|
|
|
@ -28,7 +28,6 @@ import android.content.Intent;
|
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
|
import android.graphics.Color;
|
|
|
|
|
import android.net.Uri;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
import android.widget.RemoteViews;
|
|
|
|
|
|
|
|
|
|
import androidx.preference.PreferenceManager;
|
|
|
|
@ -38,7 +37,6 @@ public class WidgetUnified extends AppWidgetProvider {
|
|
|
|
|
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
|
|
boolean pro = ActivityBilling.isPro(context);
|
|
|
|
|
for (int appWidgetId : appWidgetIds) {
|
|
|
|
|
long account = prefs.getLong("widget." + appWidgetId + ".account", -1L);
|
|
|
|
|
long folder = prefs.getLong("widget." + appWidgetId + ".folder", -1L);
|
|
|
|
@ -58,32 +56,28 @@ public class WidgetUnified extends AppWidgetProvider {
|
|
|
|
|
if (!semi)
|
|
|
|
|
views.setInt(R.id.widget, "setBackgroundColor", Color.TRANSPARENT);
|
|
|
|
|
|
|
|
|
|
views.setViewVisibility(R.id.pro, pro ? View.GONE : View.VISIBLE);
|
|
|
|
|
if (pro) {
|
|
|
|
|
String name = prefs.getString("widget." + appWidgetId + ".name", null);
|
|
|
|
|
if (name == null)
|
|
|
|
|
views.setTextViewText(R.id.title, context.getString(R.string.title_folder_unified));
|
|
|
|
|
else
|
|
|
|
|
views.setTextViewText(R.id.title, name);
|
|
|
|
|
String name = prefs.getString("widget." + appWidgetId + ".name", null);
|
|
|
|
|
if (name == null)
|
|
|
|
|
views.setTextViewText(R.id.title, context.getString(R.string.title_folder_unified));
|
|
|
|
|
else
|
|
|
|
|
views.setTextViewText(R.id.title, name);
|
|
|
|
|
|
|
|
|
|
views.setOnClickPendingIntent(R.id.title, pi);
|
|
|
|
|
views.setOnClickPendingIntent(R.id.title, pi);
|
|
|
|
|
|
|
|
|
|
Intent service = new Intent(context, WidgetUnifiedService.class);
|
|
|
|
|
service.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
|
|
|
|
|
service.setData(Uri.parse(service.toUri(Intent.URI_INTENT_SCHEME)));
|
|
|
|
|
Intent service = new Intent(context, WidgetUnifiedService.class);
|
|
|
|
|
service.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
|
|
|
|
|
service.setData(Uri.parse(service.toUri(Intent.URI_INTENT_SCHEME)));
|
|
|
|
|
|
|
|
|
|
views.setRemoteAdapter(R.id.lv, service);
|
|
|
|
|
views.setRemoteAdapter(R.id.lv, service);
|
|
|
|
|
|
|
|
|
|
Intent thread = new Intent(context, ActivityView.class);
|
|
|
|
|
thread.setAction("widget");
|
|
|
|
|
thread.putExtra("filter_archive", !EntityFolder.ARCHIVE.equals(type));
|
|
|
|
|
thread.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
|
PendingIntent piItem = PendingIntent.getActivity(
|
|
|
|
|
context, ActivityView.REQUEST_WIDGET, thread, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
Intent thread = new Intent(context, ActivityView.class);
|
|
|
|
|
thread.setAction("widget");
|
|
|
|
|
thread.putExtra("filter_archive", !EntityFolder.ARCHIVE.equals(type));
|
|
|
|
|
thread.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
|
|
|
PendingIntent piItem = PendingIntent.getActivity(
|
|
|
|
|
context, ActivityView.REQUEST_WIDGET, thread, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
|
|
|
|
|
|
|
views.setPendingIntentTemplate(R.id.lv, piItem);
|
|
|
|
|
} else
|
|
|
|
|
views.setTextViewText(R.id.pro, context.getText(R.string.title_pro_feature));
|
|
|
|
|
views.setPendingIntentTemplate(R.id.lv, piItem);
|
|
|
|
|
|
|
|
|
|
appWidgetManager.updateAppWidget(appWidgetId, views);
|
|
|
|
|
}
|
|
|
|
|