theme bug fix
This commit is contained in:
parent
72e5778047
commit
514bd9d08d
@ -84,7 +84,6 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
|||||||
private View root, layout_key, layout_proxy, layout_auth_en, layout_auth;
|
private View root, layout_key, layout_proxy, layout_auth_en, layout_auth;
|
||||||
private EditText proxyAddr, proxyPort, proxyUser, proxyPass, api_key1, api_key2;
|
private EditText proxyAddr, proxyPort, proxyUser, proxyPass, api_key1, api_key2;
|
||||||
private CompoundButton enableProxy, enableAuth, hqImage, enableAPI;
|
private CompoundButton enableProxy, enableAuth, hqImage, enableAPI;
|
||||||
private SeekBar listSizeSelector;
|
|
||||||
private Spinner locationSpinner;
|
private Spinner locationSpinner;
|
||||||
private TextView list_size;
|
private TextView list_size;
|
||||||
private Button[] colorButtons;
|
private Button[] colorButtons;
|
||||||
@ -104,7 +103,7 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
|||||||
CompoundButton toggleImg = findViewById(R.id.toggleImg);
|
CompoundButton toggleImg = findViewById(R.id.toggleImg);
|
||||||
CompoundButton toggleAns = findViewById(R.id.toggleAns);
|
CompoundButton toggleAns = findViewById(R.id.toggleAns);
|
||||||
Spinner fontSpinner = findViewById(R.id.spinner_font);
|
Spinner fontSpinner = findViewById(R.id.spinner_font);
|
||||||
listSizeSelector = findViewById(R.id.settings_list_seek);
|
SeekBar listSizeSelector = findViewById(R.id.settings_list_seek);
|
||||||
enableProxy = findViewById(R.id.settings_enable_proxy);
|
enableProxy = findViewById(R.id.settings_enable_proxy);
|
||||||
enableAuth = findViewById(R.id.settings_enable_auth);
|
enableAuth = findViewById(R.id.settings_enable_auth);
|
||||||
hqImage = findViewById(R.id.settings_image_hq);
|
hqImage = findViewById(R.id.settings_image_hq);
|
||||||
@ -155,7 +154,6 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
|||||||
fontSpinner.setSelection(settings.getFont());
|
fontSpinner.setSelection(settings.getFont());
|
||||||
|
|
||||||
AppStyles.setTheme(settings, root);
|
AppStyles.setTheme(settings, root);
|
||||||
AppStyles.setSeekBarColor(settings, listSizeSelector);
|
|
||||||
|
|
||||||
setButtonColors();
|
setButtonColors();
|
||||||
toggleImg.setChecked(settings.getImageLoad());
|
toggleImg.setChecked(settings.getImageLoad());
|
||||||
@ -274,15 +272,14 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
int viewId = v.getId();
|
|
||||||
// delete database
|
// delete database
|
||||||
if (viewId == R.id.delete_db) {
|
if (v.getId() == R.id.delete_db) {
|
||||||
if (!databaseDialog.isShowing()) {
|
if (!databaseDialog.isShowing()) {
|
||||||
databaseDialog.show();
|
databaseDialog.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// logout from twitter
|
// logout from twitter
|
||||||
else if (viewId == R.id.logout) {
|
else if (v.getId() == R.id.logout) {
|
||||||
if (!logoutDialog.isShowing()) {
|
if (!logoutDialog.isShowing()) {
|
||||||
logoutDialog.show();
|
logoutDialog.show();
|
||||||
}
|
}
|
||||||
@ -332,13 +329,10 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
|||||||
switch (mode) {
|
switch (mode) {
|
||||||
case BACKGROUND:
|
case BACKGROUND:
|
||||||
root.setBackgroundColor(color);
|
root.setBackgroundColor(color);
|
||||||
settings.setBackgroundColor(color);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FONTCOLOR:
|
case FONTCOLOR:
|
||||||
settings.setFontColor(color);
|
settings.setFontColor(color);
|
||||||
AppStyles.setTheme(settings, root);
|
|
||||||
AppStyles.setSeekBarColor(settings, listSizeSelector);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case POPUPCOLOR:
|
case POPUPCOLOR:
|
||||||
@ -347,14 +341,10 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
|||||||
|
|
||||||
case HIGHLIGHT:
|
case HIGHLIGHT:
|
||||||
settings.setHighlightColor(color);
|
settings.setHighlightColor(color);
|
||||||
AppStyles.setTheme(settings, root);
|
|
||||||
AppStyles.setSeekBarColor(settings, listSizeSelector);
|
|
||||||
setButtonColors();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CARDCOLOR:
|
case CARDCOLOR:
|
||||||
settings.setCardColor(color);
|
settings.setCardColor(color);
|
||||||
AppStyles.setTheme(settings, root);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ICONCOLOR:
|
case ICONCOLOR:
|
||||||
@ -362,6 +352,7 @@ public class AppSettings extends AppCompatActivity implements OnClickListener, O
|
|||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
AppStyles.setTheme(settings, root);
|
||||||
setButtonColors();
|
setButtonColors();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,9 @@ public final class AppStyles {
|
|||||||
int[] color = {settings.getIconColor()};
|
int[] color = {settings.getIconColor()};
|
||||||
sw.setTintColor(settings.getHighlightColor());
|
sw.setTintColor(settings.getHighlightColor());
|
||||||
sw.setThumbColor(new ColorStateList(SWITCH_STATES, color));
|
sw.setThumbColor(new ColorStateList(SWITCH_STATES, color));
|
||||||
|
} else if (child instanceof SeekBar) {
|
||||||
|
SeekBar seekBar = (SeekBar) child;
|
||||||
|
setSeekBarColor(settings, seekBar);
|
||||||
} else if (child instanceof TextView) {
|
} else if (child instanceof TextView) {
|
||||||
TextView tv = (TextView) child;
|
TextView tv = (TextView) child;
|
||||||
tv.setTypeface(settings.getFontFace());
|
tv.setTypeface(settings.getFontFace());
|
||||||
@ -232,17 +235,6 @@ public final class AppStyles {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* set up seek bar color
|
|
||||||
*
|
|
||||||
* @param settings global settings instance
|
|
||||||
* @param seekBar seek bar to color
|
|
||||||
*/
|
|
||||||
public static void setSeekBarColor(GlobalSettings settings, SeekBar seekBar) {
|
|
||||||
seekBar.getProgressDrawable().setColorFilter(new PorterDuffColorFilter(settings.getHighlightColor(), SRC_IN));
|
|
||||||
seekBar.getThumb().setColorFilter(new PorterDuffColorFilter(settings.getIconColor(), SRC_IN));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set tab icons
|
* set tab icons
|
||||||
*
|
*
|
||||||
@ -314,6 +306,18 @@ public final class AppStyles {
|
|||||||
toolbarBackground.setImageBitmap(result);
|
toolbarBackground.setImageBitmap(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set up seek bar color
|
||||||
|
*
|
||||||
|
* @param settings global settings instance
|
||||||
|
* @param seekBar seek bar to color
|
||||||
|
*/
|
||||||
|
private static void setSeekBarColor(GlobalSettings settings, SeekBar seekBar) {
|
||||||
|
seekBar.getProgressDrawable().setColorFilter(new PorterDuffColorFilter(settings.getHighlightColor(), SRC_IN));
|
||||||
|
seekBar.getThumb().setColorFilter(new PorterDuffColorFilter(settings.getIconColor(), SRC_IN));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* color drawable
|
* color drawable
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user