mirror of
https://github.com/rfc2822/GfxTablet
synced 2025-10-03 01:29:17 +02:00
rounded corners and changed colors
This commit is contained in:
parent
fe8a9c7944
commit
721f69e176
5 changed files with 36 additions and 13 deletions
7
app-android/res/drawable-hdpi/layout_bg.xml
Normal file
7
app-android/res/drawable-hdpi/layout_bg.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#FFFFFF"/>
|
||||
<stroke android:width="1dip" android:color="#FFFFFF" />
|
||||
<corners android:radius="5dip"/>
|
||||
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
|
||||
</shape>
|
|
@ -12,6 +12,7 @@
|
|||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@drawable/layout_bg"
|
||||
android:orientation="vertical" >
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.app.Activity;
|
|||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
|
@ -21,6 +22,8 @@ public class CanvasActivity extends Activity implements OnSharedPreferenceChange
|
|||
SharedPreferences settings;
|
||||
NetworkClient netClient;
|
||||
|
||||
LinearLayout layout;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -41,19 +44,23 @@ public class CanvasActivity extends Activity implements OnSharedPreferenceChange
|
|||
}
|
||||
|
||||
setContentView(R.layout.activity_canvas);
|
||||
LinearLayout layout = (LinearLayout)findViewById(R.id.canvas_layout);
|
||||
layout = (LinearLayout)findViewById(R.id.canvas_layout);
|
||||
|
||||
new Thread(netClient = new NetworkClient(PreferenceManager.getDefaultSharedPreferences(this))).start();
|
||||
|
||||
|
||||
canvas = new CanvasView(this, netClient);
|
||||
layout.addView(canvas);
|
||||
|
||||
this.reconfigureLayout();
|
||||
this.reconfigureColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences pref, String key) {
|
||||
if (key.equals(SettingsActivity.KEY_PREF_PADDING))
|
||||
this.reconfigureLayout();
|
||||
else if (key.equals(SettingsActivity.KEY_PREF_DARKCANVAS))
|
||||
this.reconfigureColor();
|
||||
}
|
||||
|
||||
void reconfigureLayout()
|
||||
|
@ -64,6 +71,16 @@ public class CanvasActivity extends Activity implements OnSharedPreferenceChange
|
|||
l.setPadding(p, p, p, p);
|
||||
}
|
||||
|
||||
void reconfigureColor()
|
||||
{
|
||||
GradientDrawable sd = (GradientDrawable) layout.getBackground().mutate();
|
||||
if (settings.getBoolean(SettingsActivity.KEY_PREF_DARKCANVAS, false))
|
||||
sd.setColor(0xFF263248);
|
||||
else
|
||||
sd.setColor(0xFF7E8AA2);
|
||||
sd.invalidateSelf();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
netClient.getQueue().add(new NetEvent(NetEvent.Type.TYPE_DISCONNECT));
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
package at.bitfire.gfxtablet;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
import android.graphics.drawable.ShapeDrawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.MotionEvent;
|
||||
|
@ -30,7 +37,7 @@ public class CanvasView extends View implements OnSharedPreferenceChangeListener
|
|||
|
||||
reconfigureAcceptedInputDevices();
|
||||
|
||||
this.reconfigureLayout();
|
||||
//this.reconfigureLayout();
|
||||
this.netClient = netClient;
|
||||
new ConfigureNetworkingTask().execute();
|
||||
}
|
||||
|
@ -41,17 +48,8 @@ public class CanvasView extends View implements OnSharedPreferenceChangeListener
|
|||
new ConfigureNetworkingTask().execute();
|
||||
else if (key.equals(SettingsActivity.KEY_PREF_STYLUS_ONLY))
|
||||
this.reconfigureAcceptedInputDevices();
|
||||
else if (key.equals(SettingsActivity.KEY_PREF_DARKCANVAS))
|
||||
this.reconfigureLayout();
|
||||
}
|
||||
|
||||
void reconfigureLayout()
|
||||
{
|
||||
if (settings.getBoolean(SettingsActivity.KEY_PREF_DARKCANVAS, false))
|
||||
setBackgroundColor(0xFF2E2E2E);
|
||||
else
|
||||
setBackgroundColor(0xFFD0D0D0);
|
||||
}
|
||||
|
||||
void reconfigureAcceptedInputDevices() {
|
||||
acceptStylusOnly = settings.getBoolean(SettingsActivity.KEY_PREF_STYLUS_ONLY, false);
|
||||
|
|
|
@ -32,7 +32,7 @@ public class SettingsActivity extends PreferenceActivity implements OnSharedPref
|
|||
PreferenceManager.getDefaultSharedPreferences(this)
|
||||
.registerOnSharedPreferenceChangeListener(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBuildHeaders(List<Header> target) {
|
||||
loadHeadersFromResource(R.xml.preference_headers, target);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue