Skip to content

Commit

Permalink
widget background for white wallpapers
Browse files Browse the repository at this point in the history
  • Loading branch information
Xlythe committed Apr 27, 2014
1 parent fe8dde8 commit 247b232
Show file tree
Hide file tree
Showing 8 changed files with 189 additions and 167 deletions.
2 changes: 1 addition & 1 deletion Calculator.iml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="C:\Users\Will\AndroidStudioProjects\Calculator" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
Expand Down
2 changes: 1 addition & 1 deletion Calculator/Calculator-Calculator.iml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="C:\Users\Will\AndroidStudioProjects\Calculator\Calculator" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="Calculator" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="Calculator" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
Expand Down
Expand Up @@ -77,4 +77,8 @@ static void saveKey(Context context, String key, boolean value) {
public static int getVibrationStrength() {
return 10;
}

public static boolean showWidgetBackground(Context context) {
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("SHOW_WIDGET_BACKGROUND", context.getResources().getBoolean(R.bool.SHOW_WIDGET_BACKGROUND));
}
}
Expand Up @@ -210,6 +210,7 @@ private void updateAppWidget(Context context, AppWidgetManager appWidgetManager,

int displayId = android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.JELLY_BEAN_MR1 ? R.id.display_long_clickable : R.id.display;

remoteViews.setViewVisibility(R.id.background, CalculatorSettings.showWidgetBackground(context) ? View.VISIBLE : View.GONE);
remoteViews.setViewVisibility(displayId, View.VISIBLE);
remoteViews.setTextViewText(displayId, value);
remoteViews.setTextViewText(R.id.display, value);
Expand Down
7 changes: 7 additions & 0 deletions Calculator/src/main/res/drawable/widget_bg.xml
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#66000000"/>

<corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp"
android:topLeftRadius="7dp" android:topRightRadius="7dp"/>
</shape>
337 changes: 173 additions & 164 deletions Calculator/src/main/res/layout/widget.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Calculator/src/main/res/values/constants.xml
Expand Up @@ -30,4 +30,5 @@
<item type="bool" name="SHOW_DETAILS">true</item>
<item type="bool" name="FLOATING_CALCULATOR">false</item>
<item type="bool" name="VIBRATE_ON_PRESS">false</item>
<item type="bool" name="SHOW_WIDGET_BACKGROUND">false</item>
</resources>
2 changes: 1 addition & 1 deletion ThemeEngine/ThemeEngine.iml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.path="C:\Users\Will\AndroidStudioProjects\Calculator\ThemeEngine" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="Calculator" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="Calculator" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
Expand Down

0 comments on commit 247b232

Please sign in to comment.