summaryrefslogtreecommitdiffstats
path: root/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java
diff options
context:
space:
mode:
authorstom79 <tschneider.ac@gmail.com>2019-01-02 13:31:11 +0100
committerstom79 <tschneider.ac@gmail.com>2019-01-02 13:31:11 +0100
commit82384b48a596f3c3f671db9e2f30dba39d5172fd (patch)
tree9abd3b25b2f4fc77463c85d03e602f09e9172bc0 /app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java
parent2411c553ed9dff7fa937597c77f20b61a043e3eb (diff)
Fix some errors
Diffstat (limited to 'app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java')
-rw-r--r--app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java113
1 files changed, 57 insertions, 56 deletions
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java
index 8221cac32..2a749cdb8 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowAccountActivity.java
@@ -514,68 +514,69 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
while (it.hasNext()) {
Map.Entry pair = (Map.Entry)it.next();
String label = (String)pair.getKey();
- String value = (String)pair.getValue();
- boolean verified = fieldsVerified.get(label);
-
- LinearLayout field;
- TextView labelView;
- TextView valueView;
- LinearLayout verifiedView;
- switch(i){
- case 1:
- field = findViewById(R.id.field1);
- labelView = findViewById(R.id.label1);
- valueView = findViewById(R.id.value1);
- verifiedView = findViewById(R.id.value1BG);
- break;
- case 2:
- field = findViewById(R.id.field2);
- labelView = findViewById(R.id.label2);
- valueView = findViewById(R.id.value2);
- verifiedView = findViewById(R.id.value2BG);
- break;
- case 3:
- field = findViewById(R.id.field3);
- labelView = findViewById(R.id.label3);
- valueView = findViewById(R.id.value3);
- verifiedView = findViewById(R.id.value3BG);
- break;
- case 4:
- field = findViewById(R.id.field4);
- labelView = findViewById(R.id.label4);
- valueView = findViewById(R.id.value4);
- verifiedView = findViewById(R.id.value4BG);
- break;
- default:
- field = findViewById(R.id.field1);
- labelView = findViewById(R.id.label1);
- valueView = findViewById(R.id.value1);
- verifiedView = findViewById(R.id.value1BG);
- break;
- }
- if( field != null && labelView != null && valueView != null) {
- switch (theme){
- case Helper.THEME_LIGHT:
- labelView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_light_2));
- valueView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_light_4));
+ if( label != null && fieldsVerified.containsKey(label)) {
+ boolean verified = fieldsVerified.get(label);
+
+ LinearLayout field;
+ TextView labelView;
+ TextView valueView;
+ LinearLayout verifiedView;
+ switch (i) {
+ case 1:
+ field = findViewById(R.id.field1);
+ labelView = findViewById(R.id.label1);
+ valueView = findViewById(R.id.value1);
+ verifiedView = findViewById(R.id.value1BG);
+ break;
+ case 2:
+ field = findViewById(R.id.field2);
+ labelView = findViewById(R.id.label2);
+ valueView = findViewById(R.id.value2);
+ verifiedView = findViewById(R.id.value2BG);
break;
- case Helper.THEME_DARK:
- labelView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_dark_2));
- valueView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_dark_4));
+ case 3:
+ field = findViewById(R.id.field3);
+ labelView = findViewById(R.id.label3);
+ valueView = findViewById(R.id.value3);
+ verifiedView = findViewById(R.id.value3BG);
break;
- case Helper.THEME_BLACK:
- labelView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_black_2));
- valueView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_black_4));
+ case 4:
+ field = findViewById(R.id.field4);
+ labelView = findViewById(R.id.label4);
+ valueView = findViewById(R.id.value4);
+ verifiedView = findViewById(R.id.value4BG);
break;
default:
- labelView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_dark_2));
- valueView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_dark_4));
- }
- field.setVisibility(View.VISIBLE);
- if( verified) {
- verifiedView.setBackgroundResource(R.drawable.verified);
+ field = findViewById(R.id.field1);
+ labelView = findViewById(R.id.label1);
+ valueView = findViewById(R.id.value1);
+ verifiedView = findViewById(R.id.value1BG);
+ break;
}
+ if (field != null && labelView != null && valueView != null) {
+ switch (theme) {
+ case Helper.THEME_LIGHT:
+ labelView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_light_2));
+ valueView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_light_4));
+ break;
+ case Helper.THEME_DARK:
+ labelView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_dark_2));
+ valueView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_dark_4));
+ break;
+ case Helper.THEME_BLACK:
+ labelView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_black_2));
+ valueView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_black_4));
+ break;
+ default:
+ labelView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_dark_2));
+ valueView.setBackgroundColor(ContextCompat.getColor(ShowAccountActivity.this, R.color.notif_dark_4));
+ }
+ field.setVisibility(View.VISIBLE);
+ if (verified) {
+ verifiedView.setBackgroundResource(R.drawable.verified);
+ }
+ }
}
i++;
}