- 🚫 Removed "Create note widget" in favor of quick settings tile (in your notification area) and shortcuts (press long on the app icon)

Signed-off-by: Stefan Niedermann <info@niedermann.it>
This commit is contained in:
Stefan Niedermann 2021-10-19 08:04:12 +02:00
parent 225e4b747a
commit 22aa08acce
5 changed files with 1 additions and 88 deletions

View file

@ -139,20 +139,6 @@
</intent-filter> </intent-filter>
</activity> </activity>
<receiver
android:name=".widget.createnote.CreateNoteWidget"
android:label="@string/widget_create_note"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/create_note_widget_provider" />
</receiver>
<receiver <receiver
android:name=".widget.singlenote.SingleNoteWidget" android:name=".widget.singlenote.SingleNoteWidget"
android:label="@string/widget_single_note_title" android:label="@string/widget_single_note_title"

View file

@ -1,52 +0,0 @@
package it.niedermann.owncloud.notes.widget.createnote;
import static it.niedermann.owncloud.notes.shared.util.WidgetUtil.pendingIntentFlagCompat;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.widget.RemoteViews;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.edit.EditNoteActivity;
/**
* Implementation of App Widget functionality.
*/
public class CreateNoteWidget extends AppWidgetProvider {
private static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
int appWidgetId) {
// Construct the RemoteViews object
final var views = new RemoteViews(context.getPackageName(), R.layout.widget_create_note);
final var intent = new Intent(context, EditNoteActivity.class);
views.setOnClickPendingIntent(R.id.widget_create_note, PendingIntent.getActivity(context, 0, intent, pendingIntentFlagCompat(PendingIntent.FLAG_UPDATE_CURRENT)));
// Instruct the widget manager to update the widget
appWidgetManager.updateAppWidget(appWidgetId, views);
}
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
// There may be multiple widgets active, so update all of them
for (final int appWidgetId : appWidgetIds) {
updateAppWidget(context, appWidgetManager, appWidgetId);
}
}
@Override
public void onEnabled(Context context) {
// Enter relevant functionality for when the first widget is created
}
@Override
public void onDisabled(Context context) {
// Enter relevant functionality for when the last widget is disabled
}
}

View file

@ -1,9 +0,0 @@
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget_create_note"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/widget_margin"
android:clickable="true"
android:contentDescription="@string/widget_create_note"
android:focusable="true"
android:src="@drawable/ic_widget_create" />

View file

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:initialKeyguardLayout="@layout/widget_create_note"
android:initialLayout="@layout/widget_create_note"
android:minWidth="40dp"
android:minHeight="40dp"
android:previewImage="@drawable/ic_widget_create"
android:resizeMode="none"
android:text="@string/widget_create_note"
android:updatePeriodMillis="86400000"
android:widgetCategory="home_screen"
tools:targetApi="jelly_bean_mr1" />

View file

@ -0,0 +1 @@
- 🚫 Removed "Create note widget" in favor of quick settings tile (in your notification area) and shortcuts (press long on the app icon)