Fixes some text color issues in light mode. Fixes an issue with icon colors when going back from settings in light mode.

This commit is contained in:
tom79 2017-08-21 09:02:01 +02:00
parent a0bc2b9881
commit 874f482f02
4 changed files with 46 additions and 2 deletions

View File

@ -84,6 +84,7 @@ import static fr.gouv.etalab.mastodon.helper.Helper.HOME_TIMELINE_INTENT;
import static fr.gouv.etalab.mastodon.helper.Helper.INTENT_ACTION;
import static fr.gouv.etalab.mastodon.helper.Helper.NOTIFICATION_INTENT;
import static fr.gouv.etalab.mastodon.helper.Helper.PREF_KEY_ID;
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
import static fr.gouv.etalab.mastodon.helper.Helper.changeUser;
import static fr.gouv.etalab.mastodon.helper.Helper.loadPPInActionBar;
import static fr.gouv.etalab.mastodon.helper.Helper.menuAccounts;
@ -523,7 +524,34 @@ public class MainActivity extends AppCompatActivity
final NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
unCheckAllMenuItems(navigationView);
toot.setVisibility(View.VISIBLE);
//Manages theme for icon colors
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_DARK){
changeDrawableColor(getApplicationContext(), R.drawable.ic_reply,R.color.dark_text);
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_more,R.color.dark_text);
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_globe,R.color.dark_text);
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_lock_open,R.color.dark_text);
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_lock_closed,R.color.dark_text);
changeDrawableColor(getApplicationContext(), R.drawable.ic_local_post_office,R.color.dark_text);
changeDrawableColor(getApplicationContext(), R.drawable.ic_retweet_black,R.color.dark_text);
changeDrawableColor(getApplicationContext(), R.drawable.ic_fav_black,R.color.dark_text);
changeDrawableColor(getApplicationContext(), R.drawable.ic_photo,R.color.dark_text);
changeDrawableColor(getApplicationContext(), R.drawable.ic_remove_red_eye,R.color.dark_text);
changeDrawableColor(getApplicationContext(), R.drawable.ic_translate,R.color.dark_text);
}else {
changeDrawableColor(getApplicationContext(), R.drawable.ic_reply,R.color.black);
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_more,R.color.black);
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_globe,R.color.black);
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_lock_open,R.color.black);
changeDrawableColor(getApplicationContext(), R.drawable.ic_action_lock_closed,R.color.black);
changeDrawableColor(getApplicationContext(), R.drawable.ic_local_post_office,R.color.black);
changeDrawableColor(getApplicationContext(), R.drawable.ic_retweet_black,R.color.black);
changeDrawableColor(getApplicationContext(), R.drawable.ic_fav_black,R.color.black);
changeDrawableColor(getApplicationContext(), R.drawable.ic_photo,R.color.white);
changeDrawableColor(getApplicationContext(), R.drawable.ic_remove_red_eye,R.color.white);
changeDrawableColor(getApplicationContext(), R.drawable.ic_translate,R.color.white);
}
switch (viewPager.getCurrentItem()){
case 0:
toolbarTitle.setText(R.string.home_menu);

View File

@ -15,6 +15,7 @@
package fr.gouv.etalab.mastodon.activities;
import android.app.Activity;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
@ -471,7 +472,9 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
restoreToot(restored);
}
changeColor();
if( theme == Helper.THEME_LIGHT) {
toot_it.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.white));
}
}

View File

@ -20,6 +20,7 @@ import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.SwitchCompat;
import android.view.LayoutInflater;
@ -225,6 +226,10 @@ public class SettingsNotificationsFragment extends Fragment {
editor.apply();
}
});
if( theme == Helper.THEME_LIGHT) {
settings_time_from.setTextColor(ContextCompat.getColor(context, R.color.white));
settings_time_to.setTextColor(ContextCompat.getColor(context, R.color.white));
}
return rootView;
}

View File

@ -14,6 +14,8 @@ package fr.gouv.etalab.mastodon.fragments;
* You should have received a copy of the GNU General Public License along with Mastalab; if not,
* see <http://www.gnu.org/licenses>. */
import android.app.Activity;
import android.content.SharedPreferences;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
@ -53,6 +55,7 @@ import fr.gouv.etalab.mastodon.asynctasks.UpdateCredentialAsyncTask;
import fr.gouv.etalab.mastodon.client.APIResponse;
import fr.gouv.etalab.mastodon.client.Entities.Account;
import fr.gouv.etalab.mastodon.client.Entities.Error;
import fr.gouv.etalab.mastodon.helper.Helper;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveAccountInterface;
import fr.gouv.etalab.mastodon.interfaces.OnUpdateCredentialInterface;
import mastodon.etalab.gouv.fr.mastodon.R;
@ -101,6 +104,11 @@ public class SettingsProfileFragment extends Fragment implements OnRetrieveAccou
options = new DisplayImageOptions.Builder().displayer(new SimpleBitmapDisplayer()).cacheInMemory(false)
.cacheOnDisk(true).resetViewBeforeLoading(true).build();
new RetrieveAccountInfoAsyncTask(context, SettingsProfileFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
final int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
if( theme == Helper.THEME_LIGHT) {
set_profile_save.setTextColor(ContextCompat.getColor(context, R.color.white));
}
return rootView;
}