From 41d40c162ecee8331d55c626819dd06203f0a39c Mon Sep 17 00:00:00 2001 From: stom79 Date: Fri, 11 May 2018 11:28:05 +0200 Subject: [PATCH] Black theme - Changes main colors --- .../mastodon/activities/AboutActivity.java | 17 ++++++--- .../mastodon/activities/BaseMainActivity.java | 16 ++++++--- .../activities/EditProfileActivity.java | 17 ++++++--- .../mastodon/activities/HashTagActivity.java | 16 ++++++--- .../mastodon/activities/InstanceActivity.java | 17 ++++++--- .../mastodon/activities/ListActivity.java | 16 ++++++--- .../mastodon/activities/LoginActivity.java | 17 ++++++--- .../activities/OwnerStatusActivity.java | 16 ++++++--- .../mastodon/activities/PrivacyActivity.java | 17 ++++++--- .../activities/RemoteFollowActivity.java | 17 ++++++--- .../activities/SearchResultActivity.java | 17 ++++++--- .../activities/ShowAccountActivity.java | 16 ++++++--- .../activities/ShowConversationActivity.java | 16 ++++++--- .../mastodon/activities/TootActivity.java | 17 ++++++--- .../mastodon/activities/WebviewActivity.java | 17 ++++++--- .../activities/WebviewConnectActivity.java | 17 ++++++--- .../mastodon/client/Entities/Status.java | 6 ++-- .../mastodon/drawers/StatusListAdapter.java | 36 ++++++++++++------- .../gouv/etalab/mastodon/helper/Helper.java | 8 +++-- .../res/drawable/button_selector_black.xml | 6 ++++ app/src/main/res/values/colors.xml | 4 ++- app/src/main/res/values/styles.xml | 24 +------------ 22 files changed, 245 insertions(+), 105 deletions(-) create mode 100644 app/src/main/res/drawable/button_selector_black.xml diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java index 4a27eb076..8908c60d7 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java @@ -69,11 +69,20 @@ public class AboutActivity extends BaseActivity implements OnRetrieveRemoteAccou super.onCreate(savedInstanceState); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme); - }else { - setTheme(R.style.AppThemeDark); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack); + break; + default: + setTheme(R.style.AppThemeDark); } + if( getSupportActionBar() != null) getSupportActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.activity_about); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java index 6aed798f6..80268f2e5 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java @@ -165,10 +165,18 @@ public abstract class BaseMainActivity extends BaseActivity final int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme_NoActionBar); - }else { - setTheme(R.style.AppThemeDark_NoActionBar); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme_NoActionBar); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark_NoActionBar); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack_NoActionBar); + break; + default: + setTheme(R.style.AppThemeDark_NoActionBar); } setContentView(R.layout.activity_main); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/EditProfileActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/EditProfileActivity.java index e45f41a91..9976e3fa9 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/EditProfileActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/EditProfileActivity.java @@ -112,11 +112,20 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme); - }else { - setTheme(R.style.AppThemeDark); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack); + break; + default: + setTheme(R.style.AppThemeDark); } + setContentView(R.layout.activity_edit_profile); ActionBar actionBar = getSupportActionBar(); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/HashTagActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/HashTagActivity.java index 54bcc996a..9e5cb0a87 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/HashTagActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/HashTagActivity.java @@ -68,10 +68,18 @@ public class HashTagActivity extends BaseActivity implements OnRetrieveFeedsInte SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme_NoActionBar); - }else { - setTheme(R.style.AppThemeDark_NoActionBar); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme_NoActionBar); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark_NoActionBar); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack_NoActionBar); + break; + default: + setTheme(R.style.AppThemeDark_NoActionBar); } setContentView(R.layout.activity_hashtag); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceActivity.java index 8ef609e14..edf8b8325 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/InstanceActivity.java @@ -57,11 +57,20 @@ public class InstanceActivity extends BaseActivity implements OnRetrieveInstance super.onCreate(savedInstanceState); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme); - }else { - setTheme(R.style.AppThemeDark); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack); + break; + default: + setTheme(R.style.AppThemeDark); } + if( getSupportActionBar() != null) getSupportActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.activity_instance); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ListActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ListActivity.java index 94ac52a5b..db711000d 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ListActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ListActivity.java @@ -76,10 +76,18 @@ public class ListActivity extends BaseActivity implements OnListActionInterface super.onCreate(savedInstanceState); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme_NoActionBar); - }else { - setTheme(R.style.AppThemeDark_NoActionBar); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme_NoActionBar); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark_NoActionBar); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack_NoActionBar); + break; + default: + setTheme(R.style.AppThemeDark_NoActionBar); } setContentView(R.layout.activity_list); Toolbar toolbar = findViewById(R.id.toolbar); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/LoginActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/LoginActivity.java index d9ccaf4cb..e98ecd531 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/LoginActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/LoginActivity.java @@ -111,11 +111,20 @@ public class LoginActivity extends BaseActivity { SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if (theme == Helper.THEME_LIGHT) { - setTheme(R.style.AppTheme); - } else { - setTheme(R.style.AppThemeDark); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack); + break; + default: + setTheme(R.style.AppThemeDark); } + setContentView(R.layout.activity_login); if (theme == Helper.THEME_DARK) { diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/OwnerStatusActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/OwnerStatusActivity.java index c41c53d61..dc5e9196e 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/OwnerStatusActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/OwnerStatusActivity.java @@ -104,10 +104,18 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme_NoActionBar); - }else { - setTheme(R.style.AppThemeDark_NoActionBar); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme_NoActionBar); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark_NoActionBar); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack_NoActionBar); + break; + default: + setTheme(R.style.AppThemeDark_NoActionBar); } setContentView(R.layout.activity_ower_status); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/PrivacyActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/PrivacyActivity.java index aaffb0a84..0b9353e22 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/PrivacyActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/PrivacyActivity.java @@ -36,11 +36,20 @@ public class PrivacyActivity extends BaseActivity { super.onCreate(savedInstanceState); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme); - }else { - setTheme(R.style.AppThemeDark); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack); + break; + default: + setTheme(R.style.AppThemeDark); } + if( getSupportActionBar() != null) getSupportActionBar().setDisplayHomeAsUpEnabled(true); setContentView(R.layout.activity_privacy); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/RemoteFollowActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/RemoteFollowActivity.java index 325623f4d..553421a2d 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/RemoteFollowActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/RemoteFollowActivity.java @@ -100,11 +100,20 @@ public class RemoteFollowActivity extends BaseActivity implements OnRetrieveRemo SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme); - }else { - setTheme(R.style.AppThemeDark); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack); + break; + default: + setTheme(R.style.AppThemeDark); } + setContentView(R.layout.activity_remote_follow); rf_instance = findViewById(R.id.rf_instance); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/SearchResultActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/SearchResultActivity.java index 864428242..b023a3310 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/SearchResultActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/SearchResultActivity.java @@ -57,11 +57,20 @@ public class SearchResultActivity extends BaseActivity implements OnRetrieveSear super.onCreate(savedInstanceState); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme); - }else { - setTheme(R.style.AppThemeDark); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack); + break; + default: + setTheme(R.style.AppThemeDark); } + setContentView(R.layout.activity_search_result); loader = findViewById(R.id.loader); 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 3c04a56b3..3b80e5d67 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 @@ -140,10 +140,18 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt super.onCreate(savedInstanceState); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme_NoActionBar); - }else { - setTheme(R.style.AppThemeDark_NoActionBar); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme_NoActionBar); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark_NoActionBar); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack_NoActionBar); + break; + default: + setTheme(R.style.AppThemeDark_NoActionBar); } setContentView(R.layout.activity_show_account); setTitle(""); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowConversationActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowConversationActivity.java index f22428e82..64ac03cff 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowConversationActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/ShowConversationActivity.java @@ -90,10 +90,18 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme_NoActionBar); - }else { - setTheme(R.style.AppThemeDark_NoActionBar); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme_NoActionBar); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark_NoActionBar); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack_NoActionBar); + break; + default: + setTheme(R.style.AppThemeDark_NoActionBar); } expanded = false; diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java index 7353987de..41f804111 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java @@ -200,11 +200,20 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null); instance = sharedpreferences.getString(Helper.PREF_INSTANCE, Helper.getLiveInstance(getApplicationContext())); final int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme); - }else { - setTheme(R.style.AppThemeDark); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack); + break; + default: + setTheme(R.style.AppThemeDark); } + setContentView(R.layout.activity_toot); ActionBar actionBar = getSupportActionBar(); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewActivity.java index 38bb1b756..dda6bdb68 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewActivity.java @@ -58,11 +58,20 @@ public class WebviewActivity extends BaseActivity { super.onCreate(savedInstanceState); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme); - }else { - setTheme(R.style.AppThemeDark); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack); + break; + default: + setTheme(R.style.AppThemeDark); } + setContentView(R.layout.activity_webview); Bundle b = getIntent().getExtras(); if(b != null) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewConnectActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewConnectActivity.java index bed1aba9a..635888897 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewConnectActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/WebviewConnectActivity.java @@ -59,11 +59,20 @@ public class WebviewConnectActivity extends BaseActivity { super.onCreate(savedInstanceState); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_LIGHT){ - setTheme(R.style.AppTheme); - }else { - setTheme(R.style.AppThemeDark); + switch (theme){ + case Helper.THEME_LIGHT: + setTheme(R.style.AppTheme); + break; + case Helper.THEME_DARK: + setTheme(R.style.AppThemeDark); + break; + case Helper.THEME_BLACK: + setTheme(R.style.AppThemeBlack); + break; + default: + setTheme(R.style.AppThemeDark); } + setContentView(R.layout.activity_webview_connect); Bundle b = getIntent().getExtras(); if(b != null) diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Status.java b/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Status.java index ee1554f7f..92d4cf87a 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Status.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/client/Entities/Status.java @@ -661,7 +661,7 @@ public class Status implements Parcelable{ matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); if( matchStart >= 0 && matchEnd <= spannableString.toString().length() && matchEnd >= matchStart) - spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, theme==Helper.THEME_DARK?R.color.mastodonC2:R.color.mastodonC4)), matchStart, matchEnd, + spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, (theme==Helper.THEME_DARK||theme==Helper.THEME_BLACK)?R.color.mastodonC2:R.color.mastodonC4)), matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); } //Deals with mention to make them clickable @@ -693,7 +693,7 @@ public class Status implements Parcelable{ startPosition, endPosition, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); if( startPosition >= 0 && endPosition <= spannableString.toString().length() && endPosition >= startPosition) - spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, theme==Helper.THEME_DARK?R.color.mastodonC2:R.color.mastodonC4)), startPosition, endPosition, + spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, (theme==Helper.THEME_DARK||theme==Helper.THEME_BLACK)?R.color.mastodonC2:R.color.mastodonC4)), startPosition, endPosition, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); } } @@ -722,7 +722,7 @@ public class Status implements Parcelable{ } }, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); if( matchStart >= 0 && matchEnd <= spannableString.toString().length() && matchEnd >= matchStart) - spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, theme==Helper.THEME_DARK?R.color.mastodonC2:R.color.mastodonC4)), matchStart, matchEnd, + spannableString.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, (theme==Helper.THEME_DARK||theme==Helper.THEME_BLACK)?R.color.mastodonC2:R.color.mastodonC4)), matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE); } return spannableString; diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java index 522017102..7b85cac5a 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java @@ -117,6 +117,7 @@ import fr.gouv.etalab.mastodon.sqlite.StatusCacheDAO; import fr.gouv.etalab.mastodon.sqlite.TempMuteDAO; import static fr.gouv.etalab.mastodon.activities.MainActivity.currentLocale; +import static fr.gouv.etalab.mastodon.helper.Helper.THEME_BLACK; import static fr.gouv.etalab.mastodon.helper.Helper.THEME_DARK; import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor; import static fr.gouv.etalab.mastodon.helper.Helper.getLiveInstance; @@ -521,7 +522,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct holder.status_bookmark.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_bookmark)); else holder.status_bookmark.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_bookmark_border)); - changeDrawableColor(context, R.drawable.ic_fiber_new,R.color.mastodonC4); + if( status.isNew()) holder.new_element.setVisibility(View.VISIBLE); else @@ -562,8 +563,13 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct //Manages theme for icon colors int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); + if( theme == Helper.THEME_BLACK) + changeDrawableColor(context, R.drawable.ic_fiber_new,R.color.dark_icon); + else + changeDrawableColor(context, R.drawable.ic_fiber_new,R.color.mastodonC4); + boolean expand_cw = sharedpreferences.getBoolean(Helper.SET_EXPAND_CW, false); - if( theme == Helper.THEME_DARK){ + if( theme == Helper.THEME_DARK || theme == Helper.THEME_BLACK){ changeDrawableColor(context, R.drawable.ic_reply,R.color.dark_icon); changeDrawableColor(context, holder.status_more, R.color.dark_icon); changeDrawableColor(context, holder.status_privacy, R.color.dark_icon); @@ -716,7 +722,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct //Change the color in gray for accounts in DARK Theme only Spannable wordtoSpan = new SpannableString(name); - if( theme == THEME_DARK) { + if( theme == THEME_DARK || theme == Helper.THEME_BLACK) { Pattern hashAcct; if( status.getReblog() != null) hashAcct = Pattern.compile("\\s(@"+status.getReblog().getAccount().getAcct()+")"); @@ -899,7 +905,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct else status.setSensitive(true); - if( theme == Helper.THEME_DARK) + if( theme == Helper.THEME_DARK || theme == Helper.THEME_BLACK) changeDrawableColor(context, R.drawable.ic_photo,R.color.dark_text); else changeDrawableColor(context, R.drawable.ic_photo,R.color.mastodonC4); @@ -916,7 +922,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct else status.setSensitive(true); - if( theme == Helper.THEME_DARK) + if( theme == Helper.THEME_DARK || theme == Helper.THEME_BLACK) changeDrawableColor(context, R.drawable.ic_photo,R.color.dark_text); else changeDrawableColor(context, R.drawable.ic_photo,R.color.mastodonC4); @@ -968,7 +974,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct changeDrawableColor(context, R.drawable.ic_star,R.color.marked_icon); imgFav = ContextCompat.getDrawable(context, R.drawable.ic_star); }else { - if( theme == THEME_DARK) + if( theme == THEME_DARK || theme == THEME_BLACK) changeDrawableColor(context, R.drawable.ic_star_border,R.color.dark_icon); else changeDrawableColor(context, R.drawable.ic_star_border,R.color.black); @@ -979,7 +985,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct changeDrawableColor(context, R.drawable.ic_repeat_boost,R.color.boost_icon); imgReblog = ContextCompat.getDrawable(context, R.drawable.ic_repeat_boost); }else { - if( theme == THEME_DARK) + if( theme == THEME_DARK || theme == THEME_BLACK) changeDrawableColor(context, R.drawable.ic_repeat,R.color.dark_icon); else changeDrawableColor(context, R.drawable.ic_repeat,R.color.black); @@ -987,7 +993,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct } - if( theme == THEME_DARK) + if( theme == THEME_DARK || theme == THEME_BLACK) changeDrawableColor(context, R.drawable.ic_reply,R.color.dark_icon); else changeDrawableColor(context, R.drawable.ic_reply,R.color.black); @@ -1015,7 +1021,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct changeDrawableColor(context, R.drawable.ic_pin_drop_p,R.color.marked_icon); imgPin = ContextCompat.getDrawable(context, R.drawable.ic_pin_drop_p); }else { - if( theme == THEME_DARK) + if( theme == THEME_DARK || theme == THEME_BLACK) changeDrawableColor(context, R.drawable.ic_pin_drop,R.color.dark_icon); else changeDrawableColor(context, R.drawable.ic_pin_drop,R.color.black); @@ -1076,16 +1082,20 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct } if( theme == Helper.THEME_LIGHT){ holder.main_container.setBackgroundResource(R.color.mastodonC3__); - }else { + }else if (theme == Helper.THEME_DARK){ holder.main_container.setBackgroundResource(R.color.mastodonC1_); + }else if (theme == Helper.THEME_BLACK){ + holder.main_container.setBackgroundResource(R.color.black); } if( type == RetrieveFeedsAsyncTask.Type.CONTEXT ){ if( position == conversationPosition){ if( theme == Helper.THEME_LIGHT) holder.main_container.setBackgroundResource(R.color.mastodonC3_); - else + else if( theme == Helper.THEME_DARK) holder.main_container.setBackgroundResource(R.color.mastodonC1___); + else if( theme == Helper.THEME_BLACK) + holder.main_container.setBackgroundResource(R.color.black_2); if( status.getCard() != null){ holder.status_cardview_content.setText(status.getCard().getDescription()); @@ -1137,8 +1147,10 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct holder.status_cardview_video.setVisibility(View.GONE); if( theme == Helper.THEME_LIGHT) holder.main_container.setBackgroundResource(R.color.mastodonC3__); - else + else if( theme == Helper.THEME_DARK) holder.main_container.setBackgroundResource(R.color.mastodonC1_); + else if (theme == Helper.THEME_BLACK) + holder.main_container.setBackgroundResource(R.color.black); } } diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java index a1d8a062e..e4992e3f1 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java @@ -972,7 +972,7 @@ public class Helper { final SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); - if( theme == Helper.THEME_DARK){ + if( theme == Helper.THEME_DARK || theme == Helper.THEME_BLACK){ changeDrawableColor(activity, R.drawable.ic_person_add,R.color.dark_text); changeDrawableColor(activity, R.drawable.ic_person,R.color.dark_text); changeDrawableColor(activity, R.drawable.ic_cancel,R.color.dark_text); @@ -1865,7 +1865,11 @@ public class Helper { int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK); if (theme == Helper.THEME_DARK) { canvas.drawColor(ContextCompat.getColor(context, R.color.mastodonC1)); - }else { + + }else if( theme == Helper.THEME_BLACK){ + canvas.drawColor(ContextCompat.getColor(context, R.color.black)); + } + else { canvas.drawColor(Color.WHITE); } } diff --git a/app/src/main/res/drawable/button_selector_black.xml b/app/src/main/res/drawable/button_selector_black.xml new file mode 100644 index 000000000..236998710 --- /dev/null +++ b/app/src/main/res/drawable/button_selector_black.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index e95fe46d0..3061c1ae7 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -34,7 +34,7 @@ #B3E5FC #D7CCC8 #000 - + #222 #585c67 #454b5b @@ -49,6 +49,8 @@ #1b80c9 + #8089A4 + #404964 #313543 #353947 diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index e973d2af8..6ca8e1735 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -58,7 +58,6 @@ @color/mastodonC3 - - - - - @@ -206,20 +201,14 @@ @color/black - - - - - - @@ -297,7 +286,6 @@ @color/mastodonC1 - - - - @@ -320,7 +305,6 @@ @color/mastodonC1 - @@ -329,17 +313,11 @@ @drawable/imageview_border_dark - - - - - -