summaryrefslogtreecommitdiffstats
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-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 ) {