mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2024-11-23 11:31:33 +01:00
DroidFish: Don't change background color for the overlay view. Removed
unnecessary preference change listener.
This commit is contained in:
parent
43228ba081
commit
f4622e620a
|
@ -3,8 +3,8 @@
|
|||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/main"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/main"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/main"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
|
|
@ -90,7 +90,6 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
|
@ -428,12 +427,6 @@ public class DroidFish extends Activity
|
|||
|
||||
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
||||
settings = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
settings.registerOnSharedPreferenceChangeListener(new OnSharedPreferenceChangeListener() {
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||
handlePrefsChange();
|
||||
}
|
||||
});
|
||||
|
||||
setWakeLock(false);
|
||||
|
||||
|
@ -792,7 +785,7 @@ public class DroidFish extends Activity
|
|||
private final void initUI() {
|
||||
leftHanded = leftHandedView();
|
||||
setContentView(leftHanded ? R.layout.main_left_handed : R.layout.main);
|
||||
Util.overrideFonts(findViewById(android.R.id.content));
|
||||
overrideViewAttribs();
|
||||
|
||||
// title lines need to be regenerated every time due to layout changes (rotations)
|
||||
firstTitleLine = findViewById(R.id.first_title_line);
|
||||
|
@ -1241,7 +1234,7 @@ public class DroidFish extends Activity
|
|||
|
||||
ColorTheme.instance().readColors(settings);
|
||||
cb.setColors();
|
||||
Util.overrideFonts(findViewById(android.R.id.content));
|
||||
overrideViewAttribs();
|
||||
|
||||
gameTextListener.clear();
|
||||
setPieceNames(pgnOptions.view.pieceType);
|
||||
|
@ -1254,6 +1247,10 @@ public class DroidFish extends Activity
|
|||
secondTitleLine.setVisibility(showMaterialDiff ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void overrideViewAttribs() {
|
||||
Util.overrideViewAttribs(findViewById(R.id.main));
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the Pieces into figurine or regular (i.e. letters) display
|
||||
*/
|
||||
|
@ -2619,7 +2616,7 @@ public class DroidFish extends Activity
|
|||
gameTextListener.clear();
|
||||
ctrl.prefsChanged(false);
|
||||
dialog.dismiss();
|
||||
Util.overrideFonts(findViewById(android.R.id.content));
|
||||
overrideViewAttribs();
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
|
|
|
@ -116,7 +116,7 @@ public final class Util {
|
|||
}
|
||||
|
||||
/** Change foreground/background color in a view. */
|
||||
public static void overrideFonts(final View v) {
|
||||
public static void overrideViewAttribs(final View v) {
|
||||
if (v == null)
|
||||
return;
|
||||
final int bg = ColorTheme.instance().getColor(ColorTheme.GENERAL_BACKGROUND);
|
||||
|
@ -126,8 +126,6 @@ public final class Util {
|
|||
v instanceof ImageButton ||
|
||||
"title".equals(tag);
|
||||
if (!excludedItems) {
|
||||
if ("drawer".equals(tag))
|
||||
return;
|
||||
int c = bg;
|
||||
if ("thinking".equals(tag)) {
|
||||
float[] hsv = new float[3];
|
||||
|
@ -143,7 +141,7 @@ public final class Util {
|
|||
ViewGroup vg = (ViewGroup) v;
|
||||
for (int i = 0; i < vg.getChildCount(); i++) {
|
||||
View child = vg.getChildAt(i);
|
||||
overrideFonts(child);
|
||||
overrideViewAttribs(child);
|
||||
}
|
||||
} else if (!excludedItems && (v instanceof TextView)) {
|
||||
int fg = ColorTheme.instance().getColor(ColorTheme.FONT_FOREGROUND);
|
||||
|
|
|
@ -137,7 +137,7 @@ public class EditBoard extends Activity {
|
|||
|
||||
private final void initUI() {
|
||||
setContentView(R.layout.editboard);
|
||||
Util.overrideFonts(findViewById(android.R.id.content));
|
||||
Util.overrideViewAttribs(findViewById(android.R.id.content));
|
||||
|
||||
View firstTitleLine = findViewById(R.id.first_title_line);
|
||||
View secondTitleLine = findViewById(R.id.second_title_line);
|
||||
|
|
|
@ -209,7 +209,7 @@ public class EditOptions extends Activity {
|
|||
}
|
||||
|
||||
setContentView(view);
|
||||
Util.overrideFonts(findViewById(android.R.id.content));
|
||||
Util.overrideViewAttribs(findViewById(android.R.id.content));
|
||||
Button okButton = (Button)findViewById(R.id.eo_ok);
|
||||
Button cancelButton = (Button)findViewById(R.id.eo_cancel);
|
||||
Button resetButton = (Button)findViewById(R.id.eo_reset);
|
||||
|
|
|
@ -240,7 +240,7 @@ public class EditPGN extends ListActivity {
|
|||
progress = null;
|
||||
removeDialog(PROGRESS_DIALOG);
|
||||
setContentView(R.layout.select_game);
|
||||
Util.overrideFonts(findViewById(android.R.id.content));
|
||||
Util.overrideViewAttribs(findViewById(android.R.id.content));
|
||||
aa = new ArrayAdapter<GameInfo>(this, R.layout.select_game_list_item, gamesInFile) {
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
|
|
|
@ -215,7 +215,7 @@ public class LoadFEN extends ListActivity {
|
|||
}
|
||||
});
|
||||
|
||||
Util.overrideFonts(findViewById(android.R.id.content));
|
||||
Util.overrideViewAttribs(findViewById(android.R.id.content));
|
||||
aa = new ArrayAdapter<FenInfo>(this, R.layout.select_game_list_item, fensInFile) {
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
|
|
|
@ -243,7 +243,7 @@ public class LoadScid extends ListActivity {
|
|||
};
|
||||
setListAdapter(aa);
|
||||
ListView lv = getListView();
|
||||
Util.overrideFonts(lv);
|
||||
Util.overrideViewAttribs(lv);
|
||||
lv.setSelectionFromTop(defaultItem, 0);
|
||||
lv.setFastScrollEnabled(true);
|
||||
lv.setOnItemClickListener(new OnItemClickListener() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user