mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-08 14:52:13 -04:00
Zoom level option color should be grayed when disabled #556
This commit is contained in:
parent
cfe6258618
commit
367e0d642b
@ -19,6 +19,7 @@ package org.kiwix.kiwixmobile.settings;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.preference.DialogPreference;
|
import android.preference.DialogPreference;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -26,6 +27,9 @@ import android.widget.SeekBar;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import org.kiwix.kiwixmobile.R;
|
import org.kiwix.kiwixmobile.R;
|
||||||
|
|
||||||
|
import static org.kiwix.kiwixmobile.utils.Constants.PREF_NIGHTMODE;
|
||||||
|
import static org.kiwix.kiwixmobile.utils.Constants.PREF_ZOOM_ENABLED;
|
||||||
|
|
||||||
public class SliderPreference extends DialogPreference {
|
public class SliderPreference extends DialogPreference {
|
||||||
|
|
||||||
protected final static int SEEKBAR_MAX = 500;
|
protected final static int SEEKBAR_MAX = 500;
|
||||||
@ -159,4 +163,29 @@ public class SliderPreference extends DialogPreference {
|
|||||||
}
|
}
|
||||||
super.onDialogClosed(positiveResult);
|
super.onDialogClosed(positiveResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBindView(View view) {
|
||||||
|
super.onBindView(view);
|
||||||
|
setGrayState(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setGrayState(View view) {
|
||||||
|
boolean enabled = getPreferenceManager().getSharedPreferences().getBoolean(PREF_ZOOM_ENABLED, false);
|
||||||
|
boolean Nightmode = getPreferenceManager().getSharedPreferences().getBoolean(PREF_NIGHTMODE, false);
|
||||||
|
TextView titleView = view.findViewById(android.R.id.title);
|
||||||
|
TextView summaryTV = view.findViewById(android.R.id.summary);
|
||||||
|
if (!enabled) {
|
||||||
|
titleView.setTextColor(Color.GRAY);
|
||||||
|
summaryTV.setTextColor(Color.GRAY);
|
||||||
|
} else {
|
||||||
|
if (Nightmode) {
|
||||||
|
titleView.setTextColor(Color.WHITE);
|
||||||
|
summaryTV.setTextColor(Color.WHITE);
|
||||||
|
} else {
|
||||||
|
titleView.setTextColor(Color.BLACK);
|
||||||
|
summaryTV.setTextColor(Color.BLACK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user