From 62d15b4fd7d7fc54a32cb95ae70236f75c888ec0 Mon Sep 17 00:00:00 2001 From: korelstar Date: Wed, 28 Feb 2018 19:23:24 +0100 Subject: [PATCH] move appwidget-code into separate package --- app/src/main/AndroidManifest.xml | 12 ++++++------ .../android/activity/SelectSingleNoteActivity.java | 1 + .../{activity => appwidget}/CreateNoteWidget.java | 3 ++- .../{activity => appwidget}/NoteListWidget.java | 10 ++++------ .../NoteListWidgetConfiguration.java | 2 +- .../appwidget}/NoteListWidgetFactory.java | 9 +++------ .../appwidget}/NoteListWidgetService.java | 8 +------- .../{activity => appwidget}/SingleNoteWidget.java | 4 ++-- .../appwidget}/SingleNoteWidgetFactory.java | 6 +++--- .../appwidget}/SingleNoteWidgetService.java | 9 +-------- .../notes/persistence/NoteSQLiteOpenHelper.java | 4 ++-- .../main/res/xml/note_list_widget_provider_info.xml | 2 +- 12 files changed, 27 insertions(+), 43 deletions(-) rename app/src/main/java/it/niedermann/owncloud/notes/android/{activity => appwidget}/CreateNoteWidget.java (92%) rename app/src/main/java/it/niedermann/owncloud/notes/android/{activity => appwidget}/NoteListWidget.java (92%) rename app/src/main/java/it/niedermann/owncloud/notes/android/{activity => appwidget}/NoteListWidgetConfiguration.java (96%) rename app/src/main/java/it/niedermann/owncloud/notes/{model => android/appwidget}/NoteListWidgetFactory.java (94%) rename app/src/main/java/it/niedermann/owncloud/notes/{persistence => android/appwidget}/NoteListWidgetService.java (65%) rename app/src/main/java/it/niedermann/owncloud/notes/android/{activity => appwidget}/SingleNoteWidget.java (96%) rename app/src/main/java/it/niedermann/owncloud/notes/{model => android/appwidget}/SingleNoteWidgetFactory.java (94%) rename app/src/main/java/it/niedermann/owncloud/notes/{persistence => android/appwidget}/SingleNoteWidgetService.java (65%) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 918f539b..75731060 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -91,7 +91,7 @@ + android:name=".android.appwidget.NoteListWidgetConfiguration"> @@ -99,7 +99,7 @@ @@ -112,7 +112,7 @@ @@ -125,7 +125,7 @@ @@ -138,11 +138,11 @@ diff --git a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/SelectSingleNoteActivity.java b/app/src/main/java/it/niedermann/owncloud/notes/android/activity/SelectSingleNoteActivity.java index baac35ba..c182dfec 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/SelectSingleNoteActivity.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/activity/SelectSingleNoteActivity.java @@ -11,6 +11,7 @@ import android.view.Menu; import android.view.View; import it.niedermann.owncloud.notes.R; +import it.niedermann.owncloud.notes.android.appwidget.SingleNoteWidget; import it.niedermann.owncloud.notes.model.DBNote; import it.niedermann.owncloud.notes.model.Item; import it.niedermann.owncloud.notes.model.ItemAdapter; diff --git a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/CreateNoteWidget.java b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/CreateNoteWidget.java similarity index 92% rename from app/src/main/java/it/niedermann/owncloud/notes/android/activity/CreateNoteWidget.java rename to app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/CreateNoteWidget.java index 894f658f..d1226047 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/CreateNoteWidget.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/CreateNoteWidget.java @@ -1,4 +1,4 @@ -package it.niedermann.owncloud.notes.android.activity; +package it.niedermann.owncloud.notes.android.appwidget; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; @@ -8,6 +8,7 @@ import android.content.Intent; import android.widget.RemoteViews; import it.niedermann.owncloud.notes.R; +import it.niedermann.owncloud.notes.android.activity.CreateNoteActivity; /** * Implementation of App Widget functionality. diff --git a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NoteListWidget.java b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/NoteListWidget.java similarity index 92% rename from app/src/main/java/it/niedermann/owncloud/notes/android/activity/NoteListWidget.java rename to app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/NoteListWidget.java index 84332bcd..3996cd11 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NoteListWidget.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/NoteListWidget.java @@ -1,4 +1,4 @@ -package it.niedermann.owncloud.notes.android.activity; +package it.niedermann.owncloud.notes.android.appwidget; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; @@ -10,11 +10,9 @@ import android.net.Uri; import android.widget.RemoteViews; import it.niedermann.owncloud.notes.R; -import it.niedermann.owncloud.notes.persistence.NoteListWidgetService; - -/** - * Created by dan0xii on 13/09/2017. - */ +import it.niedermann.owncloud.notes.android.activity.CreateNoteActivity; +import it.niedermann.owncloud.notes.android.activity.EditNoteActivity; +import it.niedermann.owncloud.notes.android.activity.NotesListViewActivity; public class NoteListWidget extends AppWidgetProvider { diff --git a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NoteListWidgetConfiguration.java b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/NoteListWidgetConfiguration.java similarity index 96% rename from app/src/main/java/it/niedermann/owncloud/notes/android/activity/NoteListWidgetConfiguration.java rename to app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/NoteListWidgetConfiguration.java index ddec0b21..87f83fe2 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/NoteListWidgetConfiguration.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/NoteListWidgetConfiguration.java @@ -1,4 +1,4 @@ -package it.niedermann.owncloud.notes.android.activity; +package it.niedermann.owncloud.notes.android.appwidget; import android.app.Activity; import android.appwidget.AppWidgetManager; diff --git a/app/src/main/java/it/niedermann/owncloud/notes/model/NoteListWidgetFactory.java b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/NoteListWidgetFactory.java similarity index 94% rename from app/src/main/java/it/niedermann/owncloud/notes/model/NoteListWidgetFactory.java rename to app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/NoteListWidgetFactory.java index 6f9531fc..aa92711d 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/model/NoteListWidgetFactory.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/NoteListWidgetFactory.java @@ -1,4 +1,4 @@ -package it.niedermann.owncloud.notes.model; +package it.niedermann.owncloud.notes.android.appwidget; import android.content.Context; import android.content.Intent; @@ -12,18 +12,15 @@ import java.util.List; import it.niedermann.owncloud.notes.R; import it.niedermann.owncloud.notes.android.activity.EditNoteActivity; +import it.niedermann.owncloud.notes.model.DBNote; import it.niedermann.owncloud.notes.persistence.NoteSQLiteOpenHelper; -/** - * Created by dan0xii on 13/09/2017. - */ - public class NoteListWidgetFactory implements RemoteViewsService.RemoteViewsFactory { private final Context mContext; private NoteSQLiteOpenHelper db; private List dbNotes; - public NoteListWidgetFactory(Context context, Intent intent) { + NoteListWidgetFactory(Context context, Intent intent) { mContext = context; } diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/NoteListWidgetService.java b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/NoteListWidgetService.java similarity index 65% rename from app/src/main/java/it/niedermann/owncloud/notes/persistence/NoteListWidgetService.java rename to app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/NoteListWidgetService.java index cb68ec6d..573ef7ea 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/NoteListWidgetService.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/NoteListWidgetService.java @@ -1,14 +1,8 @@ -package it.niedermann.owncloud.notes.persistence; +package it.niedermann.owncloud.notes.android.appwidget; import android.content.Intent; import android.widget.RemoteViewsService; -import it.niedermann.owncloud.notes.model.NoteListWidgetFactory; - -/** - * Created by dan0xii on 13/09/2017. - */ - public class NoteListWidgetService extends RemoteViewsService { @Override public RemoteViewsFactory onGetViewFactory(Intent intent) { diff --git a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/SingleNoteWidget.java b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/SingleNoteWidget.java similarity index 96% rename from app/src/main/java/it/niedermann/owncloud/notes/android/activity/SingleNoteWidget.java rename to app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/SingleNoteWidget.java index c3a7f180..197885cf 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/android/activity/SingleNoteWidget.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/SingleNoteWidget.java @@ -1,4 +1,4 @@ -package it.niedermann.owncloud.notes.android.activity; +package it.niedermann.owncloud.notes.android.appwidget; import android.app.PendingIntent; import android.appwidget.AppWidgetManager; @@ -12,7 +12,7 @@ import android.preference.PreferenceManager; import android.widget.RemoteViews; import it.niedermann.owncloud.notes.R; -import it.niedermann.owncloud.notes.persistence.SingleNoteWidgetService; +import it.niedermann.owncloud.notes.android.activity.EditNoteActivity; import static android.appwidget.AppWidgetManager.ACTION_APPWIDGET_UPDATE; diff --git a/app/src/main/java/it/niedermann/owncloud/notes/model/SingleNoteWidgetFactory.java b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/SingleNoteWidgetFactory.java similarity index 94% rename from app/src/main/java/it/niedermann/owncloud/notes/model/SingleNoteWidgetFactory.java rename to app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/SingleNoteWidgetFactory.java index 4fe146f6..fbd8353c 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/model/SingleNoteWidgetFactory.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/SingleNoteWidgetFactory.java @@ -1,4 +1,4 @@ -package it.niedermann.owncloud.notes.model; +package it.niedermann.owncloud.notes.android.appwidget; import android.appwidget.AppWidgetManager; import android.content.Context; @@ -12,7 +12,7 @@ import android.widget.RemoteViewsService; import it.niedermann.owncloud.notes.R; import it.niedermann.owncloud.notes.android.activity.EditNoteActivity; -import it.niedermann.owncloud.notes.android.activity.SingleNoteWidget; +import it.niedermann.owncloud.notes.model.DBNote; import it.niedermann.owncloud.notes.persistence.NoteSQLiteOpenHelper; public class SingleNoteWidgetFactory implements RemoteViewsService.RemoteViewsFactory { @@ -25,7 +25,7 @@ public class SingleNoteWidgetFactory implements RemoteViewsService.RemoteViewsFa private static final String TAG = SingleNoteWidget.class.getSimpleName(); - public SingleNoteWidgetFactory(Context context, Intent intent) { + SingleNoteWidgetFactory(Context context, Intent intent) { mContext = context; mAppWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID); diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/SingleNoteWidgetService.java b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/SingleNoteWidgetService.java similarity index 65% rename from app/src/main/java/it/niedermann/owncloud/notes/persistence/SingleNoteWidgetService.java rename to app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/SingleNoteWidgetService.java index 51c6bf34..e194d54d 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/SingleNoteWidgetService.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/android/appwidget/SingleNoteWidgetService.java @@ -1,15 +1,8 @@ -package it.niedermann.owncloud.notes.persistence; +package it.niedermann.owncloud.notes.android.appwidget; import android.content.Intent; import android.widget.RemoteViewsService; -import it.niedermann.owncloud.notes.model.SingleNoteWidgetFactory; - -/** - * Created by dan0xii on 06/09/17. - * - */ - public class SingleNoteWidgetService extends RemoteViewsService { @Override public RemoteViewsFactory onGetViewFactory(Intent intent) { diff --git a/app/src/main/java/it/niedermann/owncloud/notes/persistence/NoteSQLiteOpenHelper.java b/app/src/main/java/it/niedermann/owncloud/notes/persistence/NoteSQLiteOpenHelper.java index 54692e39..eb8eda7e 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/persistence/NoteSQLiteOpenHelper.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/persistence/NoteSQLiteOpenHelper.java @@ -21,8 +21,8 @@ import java.util.List; import java.util.Locale; import java.util.Map; -import it.niedermann.owncloud.notes.android.activity.NoteListWidget; -import it.niedermann.owncloud.notes.android.activity.SingleNoteWidget; +import it.niedermann.owncloud.notes.android.appwidget.NoteListWidget; +import it.niedermann.owncloud.notes.android.appwidget.SingleNoteWidget; import it.niedermann.owncloud.notes.model.CloudNote; import it.niedermann.owncloud.notes.model.DBNote; import it.niedermann.owncloud.notes.model.DBStatus; diff --git a/app/src/main/res/xml/note_list_widget_provider_info.xml b/app/src/main/res/xml/note_list_widget_provider_info.xml index 0dbfe8a9..b46b9d15 100644 --- a/app/src/main/res/xml/note_list_widget_provider_info.xml +++ b/app/src/main/res/xml/note_list_widget_provider_info.xml @@ -1,7 +1,7 @@