change the package name

This commit is contained in:
tibbi
2016-02-25 22:11:03 +01:00
parent 9eefa472fc
commit b8642927a1
9 changed files with 12 additions and 12 deletions

View File

@ -0,0 +1,34 @@
package com.simplemobiletools.notes;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.widget.RemoteViews;
public class MyWidgetProvider extends AppWidgetProvider {
private static SharedPreferences prefs;
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
prefs = context.getSharedPreferences(Constants.PREFS, Context.MODE_PRIVATE);
final RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
final int defaultColor = context.getResources().getColor(R.color.dark_grey);
final int newBgColor = prefs.getInt(Constants.WIDGET_BG_COLOR, defaultColor);
final int newTextColor = prefs.getInt(Constants.WIDGET_TEXT_COLOR, Color.WHITE);
remoteViews.setInt(R.id.notes_view, "setBackgroundColor", newBgColor);
remoteViews.setInt(R.id.notes_view, "setTextColor", newTextColor);
for (int widgetId : appWidgetIds) {
updateWidget(appWidgetManager, widgetId, remoteViews);
}
super.onUpdate(context, appWidgetManager, appWidgetIds);
}
private void updateWidget(AppWidgetManager widgetManager, int widgetId, RemoteViews remoteViews) {
final String text = prefs.getString(Constants.TEXT, "");
remoteViews.setTextViewText(R.id.notes_view, text);
widgetManager.updateAppWidget(widgetId, remoteViews);
}
}