summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2010-12-27 20:50:17 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2010-12-27 20:50:17 (GMT)
commit669d442509c2b6d38f5a1ba9ccfed8d5d22bf21b (patch)
treefd2d52df141c87ed7012da732c3ffe8f1b6e1215 /src
parentfbdadd1b0fcd7b7d92c261626791f3c36dba05e5 (diff)
downloadSoftKeys-669d442509c2b6d38f5a1ba9ccfed8d5d22bf21b.zip
SoftKeys-669d442509c2b6d38f5a1ba9ccfed8d5d22bf21b.tar.gz
SoftKeys-669d442509c2b6d38f5a1ba9ccfed8d5d22bf21b.tar.bz2
Add theme flags to resize background the same way we resize icons so
everything is the same size
Diffstat (limited to 'src')
-rw-r--r--src/net/hoopajoo/android/SoftKeys/Generator.java19
-rw-r--r--src/net/hoopajoo/android/SoftKeys/Theme.java26
2 files changed, 44 insertions, 1 deletions
diff --git a/src/net/hoopajoo/android/SoftKeys/Generator.java b/src/net/hoopajoo/android/SoftKeys/Generator.java
index f851e3d..42bd57e 100644
--- a/src/net/hoopajoo/android/SoftKeys/Generator.java
+++ b/src/net/hoopajoo/android/SoftKeys/Generator.java
@@ -64,6 +64,10 @@ public class Generator {
);
if( d != null ) {
+ // resize?
+ if( theme.getBoolean( new String[] { prefix + "_resize_background", "resize_background" } ) ) {
+ d = resizeImage( d, iconSize, iconSize );
+ }
container.setBackgroundDrawable( d );
}
@@ -130,6 +134,14 @@ public class Generator {
);
if( d != null ) {
+ if( theme.getBoolean( new String[] {
+ prefix + "_resize_button_background_" + name,
+ prefix + "_resize_button_background",
+ "resize_button_background_" + name,
+ "resize_button_background" } ) ) {
+ d = resizeImage( d, iconSize, iconSize );
+ }
+
b.setBackgroundDrawable( d );
}
@@ -171,7 +183,12 @@ public class Generator {
Matrix matrix = new Matrix();
matrix.postScale( scaleWidth, scaleHeight);
- return new BitmapDrawable( Bitmap.createBitmap(b, 0, 0, width, height, matrix, true) );
+ BitmapDrawable ret = new BitmapDrawable( Bitmap.createBitmap(b, 0, 0, width, height, matrix, true) );
+ // copy tile mode
+ if( d instanceof BitmapDrawable ) {
+ ret.setTileModeXY( ( (BitmapDrawable)d ).getTileModeX(), ( (BitmapDrawable)d ).getTileModeY() );
+ }
+ return ret;
}
}
\ No newline at end of file
diff --git a/src/net/hoopajoo/android/SoftKeys/Theme.java b/src/net/hoopajoo/android/SoftKeys/Theme.java
index 9a886c7..310fd31 100644
--- a/src/net/hoopajoo/android/SoftKeys/Theme.java
+++ b/src/net/hoopajoo/android/SoftKeys/Theme.java
@@ -69,6 +69,32 @@ public class Theme {
return( null );
}
+ // these check theme config flags
+ public boolean getBoolean( String[] name ) {
+ return getBoolean( name, false );
+ }
+
+ public boolean getBoolean( String[] name, boolean def ) {
+ String flag = getString( name );
+ if( flag != null ) {
+ // t/true is true, everything else is false
+ if( flag.startsWith( "t" ) ) {
+ return( true );
+ }
+ return( false );
+ }
+
+ return( def );
+ }
+
+ public String getString( String[] name ) {
+ IdPack i = getId( name, "string" );
+ if( i != null ) {
+ return i.R.getString( i.id );
+ }
+ return( null );
+ }
+
// For use mostly with the notification bar, allowing custom themes to include
// new icons primarily, but since it's a layout they can do more than that
public RemoteViews getRemoteViews( String[] name ) {