mirror of
https://github.com/rfc2822/GfxTablet
synced 2025-10-03 09:39:16 +02:00
Dark background preference
This commit is contained in:
parent
ff865c297b
commit
c9ff478ce9
8 changed files with 41 additions and 4 deletions
|
@ -11,4 +11,4 @@
|
||||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||||
|
|
||||||
# Project target.
|
# Project target.
|
||||||
target=android-17
|
target=Google Inc.:Google APIs:14
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
|
android:background="@color/Dark"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
5
app-android/res/values/colors.xml
Normal file
5
app-android/res/values/colors.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<color name="Dark"> #2E2E2E</color>
|
||||||
|
|
||||||
|
</resources>
|
|
@ -9,5 +9,6 @@
|
||||||
<string name="menu_about">About / Help</string>
|
<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="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="stylus_preference_summary">Ignores touch events from fingers</string>
|
||||||
|
<string name="dark_theme_preference">Use Dark Background</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
7
app-android/res/xml/layout_preferences.xml
Normal file
7
app-android/res/xml/layout_preferences.xml
Normal 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>
|
|
@ -5,5 +5,7 @@
|
||||||
android:title="Networking" />
|
android:title="Networking" />
|
||||||
<header android:fragment="at.bitfire.gfxtablet.SettingsActivity$DrawingPrefsFragment"
|
<header android:fragment="at.bitfire.gfxtablet.SettingsActivity$DrawingPrefsFragment"
|
||||||
android:title="Drawing" />
|
android:title="Drawing" />
|
||||||
|
<header android:fragment="at.bitfire.gfxtablet.SettingsActivity$LayoutPrefsFragment"
|
||||||
|
android:title="Layout" />
|
||||||
|
|
||||||
</preference-headers>
|
</preference-headers>
|
||||||
|
|
|
@ -24,12 +24,14 @@ public class CanvasView extends View implements OnSharedPreferenceChangeListener
|
||||||
|
|
||||||
// disable until networking has been configured
|
// disable until networking has been configured
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
setBackgroundColor(0xFFD0D0D0);
|
setBackgroundColor(0xFFD0D0D0); //0x2A2A2A
|
||||||
|
|
||||||
settings = PreferenceManager.getDefaultSharedPreferences(context);
|
settings = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
settings.registerOnSharedPreferenceChangeListener(this);
|
settings.registerOnSharedPreferenceChangeListener(this);
|
||||||
|
|
||||||
reconfigureAcceptedInputDevices();
|
reconfigureAcceptedInputDevices();
|
||||||
|
|
||||||
|
this.reconfigureLayout();
|
||||||
this.netClient = netClient;
|
this.netClient = netClient;
|
||||||
new ConfigureNetworkingTask().execute();
|
new ConfigureNetworkingTask().execute();
|
||||||
}
|
}
|
||||||
|
@ -39,7 +41,17 @@ public class CanvasView extends View implements OnSharedPreferenceChangeListener
|
||||||
if (key.equals(SettingsActivity.KEY_PREF_HOST))
|
if (key.equals(SettingsActivity.KEY_PREF_HOST))
|
||||||
new ConfigureNetworkingTask().execute();
|
new ConfigureNetworkingTask().execute();
|
||||||
else if (key.equals(SettingsActivity.KEY_PREF_STYLUS_ONLY))
|
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() {
|
void reconfigureAcceptedInputDevices() {
|
||||||
|
|
|
@ -18,7 +18,8 @@ public class SettingsActivity extends PreferenceActivity implements OnSharedPref
|
||||||
public static final String
|
public static final String
|
||||||
KEY_PREF_HOST = "host_preference",
|
KEY_PREF_HOST = "host_preference",
|
||||||
KEY_PREF_STYLUS_ONLY = "stylus_only_preference",
|
KEY_PREF_STYLUS_ONLY = "stylus_only_preference",
|
||||||
KEY_PREF_FULLSCREEN = "fullscreen_preference";
|
KEY_PREF_FULLSCREEN = "fullscreen_preference",
|
||||||
|
KEY_PREF_DARKCANVAS = "darkcanvas_preference";
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -64,4 +65,12 @@ public class SettingsActivity extends PreferenceActivity implements OnSharedPref
|
||||||
addPreferencesFromResource(R.xml.drawing_preferences);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue