1
0
Fork 0
mirror of https://github.com/rfc2822/GfxTablet synced 2025-10-03 09:39:16 +02:00

Dark background preference

This commit is contained in:
FatihBAKIR 2014-12-05 23:19:53 +00:00
parent ff865c297b
commit c9ff478ce9
8 changed files with 41 additions and 4 deletions

View file

@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-17
target=Google Inc.:Google APIs:14

View file

@ -10,6 +10,7 @@
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@color/Dark"
android:orientation="vertical" >
</LinearLayout>

View file

@ -0,0 +1,5 @@
<resources>
<color name="Dark"> #2E2E2E</color>
</resources>

View file

@ -9,5 +9,6 @@
<string name="menu_about">About / Help</string>
<string name="fullscreen_preference_summary">Title bar will only be hidden when hardware menu button is present</string>
<string name="stylus_preference_summary">Ignores touch events from fingers</string>
<string name="dark_theme_preference">Use Dark Background</string>
</resources>

View file

@ -0,0 +1,7 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<CheckBoxPreference
android:key="darkcanvas_preference"
android:title="@string/dark_theme_preference" />
</PreferenceScreen>

View file

@ -5,5 +5,7 @@
android:title="Networking" />
<header android:fragment="at.bitfire.gfxtablet.SettingsActivity$DrawingPrefsFragment"
android:title="Drawing" />
<header android:fragment="at.bitfire.gfxtablet.SettingsActivity$LayoutPrefsFragment"
android:title="Layout" />
</preference-headers>

View file

@ -24,12 +24,14 @@ public class CanvasView extends View implements OnSharedPreferenceChangeListener
// disable until networking has been configured
setEnabled(false);
setBackgroundColor(0xFFD0D0D0);
setBackgroundColor(0xFFD0D0D0); //0x2A2A2A
settings = PreferenceManager.getDefaultSharedPreferences(context);
settings.registerOnSharedPreferenceChangeListener(this);
reconfigureAcceptedInputDevices();
this.reconfigureLayout();
this.netClient = netClient;
new ConfigureNetworkingTask().execute();
}
@ -39,7 +41,17 @@ public class CanvasView extends View implements OnSharedPreferenceChangeListener
if (key.equals(SettingsActivity.KEY_PREF_HOST))
new ConfigureNetworkingTask().execute();
else if (key.equals(SettingsActivity.KEY_PREF_STYLUS_ONLY))
reconfigureAcceptedInputDevices();
this.reconfigureAcceptedInputDevices();
else if (key.equals(SettingsActivity.KEY_PREF_DARKCANVAS))
this.reconfigureLayout();
}
void reconfigureLayout()
{
if (settings.getBoolean(SettingsActivity.KEY_PREF_DARKCANVAS, false))
setBackgroundColor(0x2E2E2E);
else
setBackgroundColor(0xFFD0D0D0);
}
void reconfigureAcceptedInputDevices() {

View file

@ -18,7 +18,8 @@ public class SettingsActivity extends PreferenceActivity implements OnSharedPref
public static final String
KEY_PREF_HOST = "host_preference",
KEY_PREF_STYLUS_ONLY = "stylus_only_preference",
KEY_PREF_FULLSCREEN = "fullscreen_preference";
KEY_PREF_FULLSCREEN = "fullscreen_preference",
KEY_PREF_DARKCANVAS = "darkcanvas_preference";
@Override
@ -64,4 +65,12 @@ public class SettingsActivity extends PreferenceActivity implements OnSharedPref
addPreferencesFromResource(R.xml.drawing_preferences);
}
}
public static class LayoutPrefsFragment extends PreferenceFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.layout_preferences);
}
}
}