Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Commit

Permalink
Merge commit '7a977ab47241fd115f339f7ee2ad6a62e6213079'
Browse files Browse the repository at this point in the history
  • Loading branch information
weiznich committed Sep 1, 2015
2 parents da18668 + 7a977ab commit da8ebf3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
29 changes: 10 additions & 19 deletions widget/build.gradle
@@ -1,4 +1,3 @@
apply plugin: 'com.android.library'
/*******************************************************************************
* Mirakel is an Android App for managing your ToDo-Lists
*
Expand All @@ -18,22 +17,10 @@ apply plugin: 'com.android.library'
* along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/

//apply plugin: 'hugo'

android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
lintOptions{
enable 'RtlHardcoded','RtlCompat', 'RtlEnabled'
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
Expand All @@ -47,10 +34,14 @@ android {
}
}
dependencies {
compile project(':model')
compile project(':helper')
compile project(':colorpickerpreference')
compile project(':settings')
compile project(':material-elements')
debugCompile project(path: ':helper',configuration: 'debug')
releaseCompile project(path: ':helper',configuration: 'release')
debugCompile project(path: ':model',configuration: 'debug')
releaseCompile project(path: ':model',configuration: 'release')
debugCompile project(path: ':colorpickerpreference',configuration: 'debug')
releaseCompile project(path: ':colorpickerpreference',configuration: 'release')
debugCompile project(path: ':settings',configuration: 'debug')
releaseCompile project(path: ':settings',configuration: 'release')
debugCompile project(path: ':material-elements',configuration: 'debug')
releaseCompile project(path: ':material-elements',configuration: 'release')
}

10 changes: 10 additions & 0 deletions widget/src/de/azapps/mirakel/helper/WidgetHelper.java
Expand Up @@ -28,6 +28,7 @@
import android.support.annotation.NonNull;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.util.SparseIntArray;
import android.widget.RemoteViews;

import com.google.common.base.Optional;
Expand Down Expand Up @@ -197,4 +198,13 @@ public static boolean gethasGradient(final Context context,
final int widgetId) {
return getBoolean(context, widgetId, "widgetUseGradient", true);
}

public static void updateListIDs(final Context context, final SparseIntArray listMapping,
final int[] appWidgetIds) {
for (final int widgetId : appWidgetIds) {
final int listId = getSettings(context).getInt(
getKey(widgetId, "list_id"), 0);
setList(context, widgetId, listMapping.get(listId, listId));
}
}
}
12 changes: 12 additions & 0 deletions widget/src/de/azapps/mirakel/widget/MainWidgetProvider.java
Expand Up @@ -34,8 +34,10 @@
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.SparseIntArray;
import android.widget.RemoteViews;

import com.google.common.base.Optional;
Expand All @@ -54,11 +56,21 @@ public class MainWidgetProvider extends AppWidgetProvider {
EXTRA_WIDGET_ID = "de.azapps.mirakel.EXTRA_WIDGET_ID";

public static final int NORMAL_WIDGET = 0;
@Nullable
private static SparseIntArray listMapping = null;

public static void update(final SparseIntArray idMapping) {
listMapping = idMapping;
}

@Override
@SuppressLint("NewApi")
public void onUpdate(final Context context,
final AppWidgetManager appWidgetManager, final int[] appWidgetIds) {
if (listMapping != null) {
WidgetHelper.updateListIDs(context, listMapping, appWidgetIds);
listMapping = null;
}
for (final int widgetId : appWidgetIds) {
Log.v(TAG, "update Widget: " + widgetId);
final boolean isDark = WidgetHelper.isDark(context, widgetId);
Expand Down

0 comments on commit da8ebf3

Please sign in to comment.