From 407e80c9ecd763b9e0eae779be5d4ba52d9e9238 Mon Sep 17 00:00:00 2001 From: Patrick Schneider Date: Thu, 12 Jan 2023 22:40:20 +0100 Subject: [PATCH 1/2] Upgrade Gradle, AGP and SDK Version. Migration to AndroidX. MinSDK is now 23, TargetSDK is 33, CompileSDK is 33. Gradlew is now version 7.0.2. Android-Gradle-Plugin is now version 7.0.4. --- app/build.gradle | 29 +++++++---------- app/src/main/AndroidManifest.xml | 3 +- .../framework/ui/AbstractAdapter.java | 2 +- .../framework/ui/AbstractViewHolder.java | 4 ++- .../framework/utils/MessageUtils.java | 4 ++- .../ui/about/AboutActivity.java | 5 +-- .../ui/baseactivity/BaseActivity.java | 21 ++++++------ .../ui/camera/CameraActivity.java | 9 ++++-- .../ui/deletelists/DeleteListsActivity.java | 4 ++- .../ui/deletelists/DeleteListsCache.java | 10 +++--- .../DeleteListsItemViewHolder.java | 5 +-- .../listeners/DeleteListsOnClickListener.java | 4 ++- .../DeleteProductsActivity.java | 4 ++- .../deleteproducts/DeleteProductsCache.java | 10 +++--- .../listadapter/DeleteProductItemCache.java | 4 ++- .../DeleteProductsItemViewHolder.java | 4 ++- .../DeleteProductOnClickListener.java | 4 ++- .../FabScrollListenerForCreateActivities.java | 5 +-- ...llAwareFabBehaviorForDeleteActivities.java | 8 +++-- .../ui/main/ShoppingListActivityCache.java | 11 ++++--- .../ui/main/SplashActivity.java | 4 ++- .../ShowDeleteListsOnClickListener.java | 4 ++- .../ui/main/sort/SortListsDialog.java | 4 ++- .../AppCompatPreferenceActivity.java | 11 ++++--- .../ui/products/PhotoPreviewActivity.java | 4 ++- .../ui/products/ProductActivityCache.java | 21 ++++++------ .../ui/products/ProductsActivity.java | 4 ++- .../dialog/EditDeleteProductDialog.java | 5 +-- .../products/dialog/ProductDialogCache.java | 6 ++-- .../dialog/ProductDialogFragment.java | 8 +++-- .../listadapter/ProductItemCache.java | 2 +- .../listadapter/ProductsItemViewHolder.java | 13 ++++---- .../listeners/CancelSearchOnClick.java | 4 ++- .../ShowSearchFieldOnClickListener.java | 4 ++- .../ui/shoppinglist/EditDeleteListDialog.java | 7 ++-- .../ui/shoppinglist/ListDialogCache.java | 9 ++++-- .../ui/shoppinglist/ListDialogFragment.java | 19 ++++++++--- .../listadapter/ListItemCache.java | 4 ++- .../listadapter/ListsItemViewHolder.java | 8 +++-- .../reminder/ReminderReceiver.java | 6 ++-- .../reminder/ReminderSchedulingService.java | 4 +-- .../ui/statistics/StatisticsCache.java | 4 ++- .../ui/tutorial/TutorialActivity.java | 8 +++-- .../layouts/camera/layout/camera_preview.xml | 6 ++-- .../layout/delete_lists_activity.xml | 12 +++---- .../layout/delete_product_list_item.xml | 6 ++-- .../layout/delete_products_activity.xml | 12 +++---- .../res/layouts/help/layout/activity_help.xml | 10 +++--- .../res/layouts/main/layout/activity_main.xml | 6 ++-- .../res/layouts/main/layout/app_bar_main.xml | 8 ++--- .../res/layouts/main/layout/main_toolbar.xml | 8 ++--- .../products/layout/product_dialog.xml | 32 +++++++++---------- .../products/layout/product_list_item.xml | 4 +-- .../layout/product_list_item_left_hand.xml | 4 +-- .../products/layout/products_activity.xml | 12 +++---- .../settings/layout/activity_settings.xml | 11 +++---- .../res/layouts/shared/layout/toolbar.xml | 6 ++-- .../layout/shopping_list_dialog.xml | 22 ++++++------- .../layout/shopping_list_item.xml | 4 +-- .../layout/shopping_list_item_left_hand.xml | 4 +-- .../statistics/layout/statistics_activity.xml | 6 ++-- .../tutorials/layout/activity_tutorial.xml | 2 +- build.gradle | 2 +- gradle.properties | 4 ++- gradle/wrapper/gradle-wrapper.properties | 6 ++-- 65 files changed, 290 insertions(+), 210 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a40dd419..a15d493b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,18 +1,12 @@ apply plugin: 'com.android.application' -apply plugin: 'me.tatarka.retrolambda' android { - compileSdkVersion 28 - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } + compileSdkVersion 33 defaultConfig { applicationId "privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist" - minSdkVersion 17 - targetSdkVersion 26 + minSdkVersion 23 + targetSdkVersion 33 versionCode 7 versionName "1.0.9" } @@ -57,17 +51,18 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') // android - androidTestImplementation 'com.android.support:support-annotations:28.0.0' - implementation 'com.android.support:appcompat-v7:28.0.0' - implementation 'com.android.support:design:28.0.0' - implementation 'com.android.support:support-v4:28.0.0' - implementation 'com.android.support:recyclerview-v7:28.0.0' - implementation 'com.android.support:cardview-v7:28.0.0' + androidTestImplementation 'androidx.annotation:annotation:1.0.0' + implementation 'androidx.appcompat:appcompat:1.0.0' + implementation 'com.google.android.material:material:1.0.0' + implementation 'androidx.legacy:legacy-support-v4:1.0.0' + implementation 'androidx.recyclerview:recyclerview:1.0.0' + implementation 'androidx.cardview:cardview:1.0.0' + // tests testImplementation 'junit:junit:4.12' testImplementation 'org.mockito:mockito-core:2.7.6' - androidTestImplementation 'com.android.support.test:runner:1.0.2' - androidTestImplementation 'com.android.support.test:rules:1.0.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test:rules:1.1.1' testImplementation 'pl.pragmatists:JUnitParams:0.3.6' // dependency injection implementation 'com.squareup.dagger:dagger:1.2.5' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index de498bee..4134f532 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -22,7 +22,8 @@ + android:screenOrientation="portrait" + android:exported="true"> diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/framework/ui/AbstractAdapter.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/framework/ui/AbstractAdapter.java index 0dc949ef..e795b498 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/framework/ui/AbstractAdapter.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/framework/ui/AbstractAdapter.java @@ -1,7 +1,7 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.ui; import android.content.Context; -import android.support.v7.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/framework/ui/AbstractViewHolder.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/framework/ui/AbstractViewHolder.java index 7ac7d8f6..c33a40c1 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/framework/ui/AbstractViewHolder.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/framework/ui/AbstractViewHolder.java @@ -1,7 +1,9 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.ui; -import android.support.v7.widget.RecyclerView; import android.view.View; + +import androidx.recyclerview.widget.RecyclerView; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.business.AbstractItem; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.business.PFACache; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/framework/utils/MessageUtils.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/framework/utils/MessageUtils.java index 66fd455d..c458e775 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/framework/utils/MessageUtils.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/framework/utils/MessageUtils.java @@ -6,9 +6,11 @@ import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; -import android.support.v7.app.AlertDialog; import android.view.Gravity; import android.widget.Toast; + +import androidx.appcompat.app.AlertDialog; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.main.welcome.WelcomeDialog; import rx.Observable; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/about/AboutActivity.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/about/AboutActivity.java index 66e77f1d..fb78ca52 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/about/AboutActivity.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/about/AboutActivity.java @@ -1,12 +1,13 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.about; import android.os.Bundle; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AppCompatActivity; import android.text.method.LinkMovementMethod; import android.view.View; import android.widget.TextView; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.BuildConfig; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.baseactivity.BaseActivity; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/baseactivity/BaseActivity.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/baseactivity/BaseActivity.java index bdc17f2e..93376aff 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/baseactivity/BaseActivity.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/baseactivity/BaseActivity.java @@ -7,16 +7,19 @@ import android.os.Handler; import android.preference.PreferenceActivity; import android.preference.PreferenceManager; -import android.support.design.widget.NavigationView; -import android.support.design.widget.NavigationView.OnNavigationItemSelectedListener; -import android.support.v4.app.TaskStackBuilder; -import android.support.v4.view.GravityCompat; -import android.support.v4.widget.DrawerLayout; -import android.support.v7.app.ActionBarDrawerToggle; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.Toolbar; + +import androidx.appcompat.app.ActionBarDrawerToggle; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import androidx.core.app.TaskStackBuilder; +import androidx.core.view.GravityCompat; +import androidx.drawerlayout.widget.DrawerLayout; + import android.view.MenuItem; import android.view.View; + +import com.google.android.material.navigation.NavigationView; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.about.AboutActivity; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.help.HelpActivity; @@ -28,7 +31,7 @@ /** * Created by Chris on 04.07.2016. */ -public class BaseActivity extends AppCompatActivity implements OnNavigationItemSelectedListener +public class BaseActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { // delay to launch nav drawer item, to allow close animation to play diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/camera/CameraActivity.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/camera/CameraActivity.java index 347e9abb..0360d61e 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/camera/CameraActivity.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/camera/CameraActivity.java @@ -1,15 +1,19 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.camera; +import android.annotation.SuppressLint; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.hardware.Camera; import android.os.Bundle; -import android.support.design.widget.FloatingActionButton; -import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; import android.view.View; import android.widget.FrameLayout; + +import androidx.appcompat.app.AppCompatActivity; + +import com.google.android.material.floatingactionbutton.FloatingActionButton; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.AbstractInstanceFactory; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.InstanceFactory; @@ -226,6 +230,7 @@ private void setupFlashIcons() private Camera.PictureCallback mPicture = new Camera.PictureCallback() { + @SuppressLint("RestrictedApi") @Override public void onPictureTaken(byte[] data, Camera camera) { diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/DeleteListsActivity.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/DeleteListsActivity.java index 9329bf74..891e2d30 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/DeleteListsActivity.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/DeleteListsActivity.java @@ -3,7 +3,9 @@ import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; -import android.support.v7.app.AppCompatActivity; + +import androidx.appcompat.app.AppCompatActivity; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.comparators.PFAComparators; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.AbstractInstanceFactory; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/DeleteListsCache.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/DeleteListsCache.java index ad6f4597..dc6d0c8e 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/DeleteListsCache.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/DeleteListsCache.java @@ -1,9 +1,11 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.deletelists; -import android.support.design.widget.FloatingActionButton; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.google.android.material.floatingactionbutton.FloatingActionButton; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.business.PFACache; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.deletelists.listadapter.DeleteListsAdapter; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/listadapter/DeleteListsItemViewHolder.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/listadapter/DeleteListsItemViewHolder.java index 96d03d41..99424574 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/listadapter/DeleteListsItemViewHolder.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/listadapter/DeleteListsItemViewHolder.java @@ -3,8 +3,9 @@ import android.content.res.Resources; import android.graphics.Paint; import android.preference.PreferenceManager; -import android.support.v4.content.ContextCompat; -import android.support.v7.widget.CardView; + +import androidx.cardview.widget.CardView; +import androidx.core.content.ContextCompat; import android.view.View; import android.widget.TextView; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/listeners/DeleteListsOnClickListener.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/listeners/DeleteListsOnClickListener.java index 4c26f9a6..86b13e0d 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/listeners/DeleteListsOnClickListener.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deletelists/listeners/DeleteListsOnClickListener.java @@ -1,8 +1,10 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.deletelists.listeners; import android.content.Intent; -import android.support.v7.app.AppCompatActivity; import android.view.View; + +import androidx.appcompat.app.AppCompatActivity; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.AbstractInstanceFactory; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.InstanceFactory; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/DeleteProductsActivity.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/DeleteProductsActivity.java index 1762765e..2d696062 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/DeleteProductsActivity.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/DeleteProductsActivity.java @@ -1,7 +1,9 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.deleteproducts; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; + +import androidx.appcompat.app.AppCompatActivity; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.AbstractInstanceFactory; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.InstanceFactory; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/DeleteProductsCache.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/DeleteProductsCache.java index 20c2d043..247e1d60 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/DeleteProductsCache.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/DeleteProductsCache.java @@ -1,9 +1,11 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.deleteproducts; -import android.support.design.widget.FloatingActionButton; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.google.android.material.floatingactionbutton.FloatingActionButton; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.business.PFACache; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.deleteproducts.listadapter.DeleteProductsAdapter; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/listadapter/DeleteProductItemCache.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/listadapter/DeleteProductItemCache.java index 0b3ef5c4..566ae337 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/listadapter/DeleteProductItemCache.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/listadapter/DeleteProductItemCache.java @@ -1,9 +1,11 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.deleteproducts.listadapter; -import android.support.v7.widget.CardView; import android.view.View; import android.widget.CheckBox; import android.widget.TextView; + +import androidx.cardview.widget.CardView; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; /** diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/listadapter/DeleteProductsItemViewHolder.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/listadapter/DeleteProductsItemViewHolder.java index dc8ea1e4..252c1544 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/listadapter/DeleteProductsItemViewHolder.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/listadapter/DeleteProductsItemViewHolder.java @@ -3,9 +3,11 @@ import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.Paint; -import android.support.v7.widget.AppCompatCheckBox; import android.view.View; import android.widget.TextView; + +import androidx.appcompat.widget.AppCompatCheckBox; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.ui.AbstractViewHolder; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.logic.product.business.domain.ProductItem; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/listeners/DeleteProductOnClickListener.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/listeners/DeleteProductOnClickListener.java index da4e4ed9..40deb0da 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/listeners/DeleteProductOnClickListener.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/deleteproducts/listeners/DeleteProductOnClickListener.java @@ -1,8 +1,10 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.deleteproducts.listeners; import android.content.Intent; -import android.support.v7.app.AppCompatActivity; import android.view.View; + +import androidx.appcompat.app.AppCompatActivity; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.AbstractInstanceFactory; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.InstanceFactory; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/fab/FabScrollListenerForCreateActivities.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/fab/FabScrollListenerForCreateActivities.java index 16f16622..8075f4cb 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/fab/FabScrollListenerForCreateActivities.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/fab/FabScrollListenerForCreateActivities.java @@ -1,7 +1,8 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.fab; -import android.support.design.widget.FloatingActionButton; -import android.support.v7.widget.RecyclerView; +import androidx.recyclerview.widget.RecyclerView; + +import com.google.android.material.floatingactionbutton.FloatingActionButton; public class FabScrollListenerForCreateActivities extends RecyclerView.OnScrollListener { diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/fab/ScrollAwareFabBehaviorForDeleteActivities.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/fab/ScrollAwareFabBehaviorForDeleteActivities.java index d73b1f77..da29c6a6 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/fab/ScrollAwareFabBehaviorForDeleteActivities.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/fab/ScrollAwareFabBehaviorForDeleteActivities.java @@ -1,12 +1,14 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.fab; import android.content.Context; -import android.support.design.widget.CoordinatorLayout; -import android.support.design.widget.FloatingActionButton; -import android.support.v4.view.ViewCompat; + +import androidx.coordinatorlayout.widget.CoordinatorLayout; +import androidx.core.view.ViewCompat; import android.util.AttributeSet; import android.view.View; +import com.google.android.material.floatingactionbutton.FloatingActionButton; + /** * Description: This class is used by the xml. * Source: https://guides.codepath.com/android/floating-action-buttons diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/ShoppingListActivityCache.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/ShoppingListActivityCache.java index e090da5e..16e059ad 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/ShoppingListActivityCache.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/ShoppingListActivityCache.java @@ -1,10 +1,13 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.main; -import android.support.design.widget.FloatingActionButton; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; import android.widget.LinearLayout; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.google.android.material.floatingactionbutton.FloatingActionButton; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.business.PFACache; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.fab.FabScrollListenerForCreateActivities; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/SplashActivity.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/SplashActivity.java index 565fd009..b20abdf0 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/SplashActivity.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/SplashActivity.java @@ -2,7 +2,9 @@ import android.content.Intent; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; + +import androidx.appcompat.app.AppCompatActivity; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.tutorial.TutorialActivity; /** diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/listeners/ShowDeleteListsOnClickListener.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/listeners/ShowDeleteListsOnClickListener.java index a1a19022..74222672 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/listeners/ShowDeleteListsOnClickListener.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/listeners/ShowDeleteListsOnClickListener.java @@ -1,8 +1,10 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.main.listeners; import android.content.Intent; -import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; + +import androidx.appcompat.app.AppCompatActivity; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.deletelists.DeleteListsActivity; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.main.ShoppingListActivityCache; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/sort/SortListsDialog.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/sort/SortListsDialog.java index 3793162d..5aa90acf 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/sort/SortListsDialog.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/main/sort/SortListsDialog.java @@ -8,9 +8,11 @@ import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; -import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; + +import androidx.appcompat.app.AppCompatActivity; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.comparators.PFAComparators; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.AbstractInstanceFactory; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/preferences/AppCompatPreferenceActivity.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/preferences/AppCompatPreferenceActivity.java index 5ea8a055..87dd8d71 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/preferences/AppCompatPreferenceActivity.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/preferences/AppCompatPreferenceActivity.java @@ -3,15 +3,16 @@ import android.content.res.Configuration; import android.os.Bundle; import android.preference.PreferenceActivity; -import android.support.annotation.LayoutRes; -import android.support.annotation.Nullable; -import android.support.v7.app.ActionBar; -import android.support.v7.app.AppCompatDelegate; -import android.support.v7.widget.Toolbar; import android.view.MenuInflater; import android.view.View; import android.view.ViewGroup; +import androidx.annotation.LayoutRes; +import androidx.annotation.Nullable; +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatDelegate; +import androidx.appcompat.widget.Toolbar; + /** * A {@link PreferenceActivity} which implements and proxies the necessary calls * to be used with AppCompat. diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/PhotoPreviewActivity.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/PhotoPreviewActivity.java index 9319cd33..23036b2a 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/PhotoPreviewActivity.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/PhotoPreviewActivity.java @@ -4,11 +4,13 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; -import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.ProgressBar; + +import androidx.appcompat.app.AppCompatActivity; + import com.davemorrissey.labs.subscaleview.ImageSource; import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/ProductActivityCache.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/ProductActivityCache.java index 67ca48dd..17617a61 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/ProductActivityCache.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/ProductActivityCache.java @@ -2,15 +2,18 @@ import android.content.SharedPreferences; import android.preference.PreferenceManager; -import android.support.design.widget.FloatingActionButton; -import android.support.design.widget.TextInputLayout; -import android.support.v7.app.AppCompatActivity; -import android.support.v7.widget.LinearLayoutManager; -import android.support.v7.widget.RecyclerView; import android.widget.AutoCompleteTextView; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; + +import com.google.android.material.floatingactionbutton.FloatingActionButton; +import com.google.android.material.textfield.TextInputLayout; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.business.PFACache; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.fab.FabScrollListenerForCreateActivities; @@ -24,9 +27,9 @@ * Author: Grebiel Jose Ifill Brito * Created: 20.07.16 creation date */ -public class ProductActivityCache extends PFACache +public class ProductActivityCache extends PFACache { - private AppCompatActivity activity; + private A activity; private FloatingActionButton newListFab; private ProductsAdapter productsAdapter; private TextView totalAmountTextView; @@ -43,7 +46,7 @@ public class ProductActivityCache extends PFACache private ImageButton cancelSarchButton; private LinearLayout alertTextView; - public ProductActivityCache(AppCompatActivity activity, String listId, String listName, boolean statisticsEnabled) + public ProductActivityCache(A activity, String listId, String listName, boolean statisticsEnabled) { this.activity = activity; this.listId = listId; @@ -75,7 +78,7 @@ public ProductActivityCache(AppCompatActivity activity, String listId, String li recyclerView.addOnScrollListener(new FabScrollListenerForCreateActivities(newListFab)); } - public AppCompatActivity getActivity() + public A getActivity() { return activity; } diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/ProductsActivity.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/ProductsActivity.java index fea06daa..547b518b 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/ProductsActivity.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/ProductsActivity.java @@ -3,10 +3,12 @@ import android.content.Intent; import android.os.Bundle; import android.preference.PreferenceManager; -import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; + +import androidx.appcompat.app.AppCompatActivity; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.AbstractInstanceFactory; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.InstanceFactory; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/dialog/EditDeleteProductDialog.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/dialog/EditDeleteProductDialog.java index 0b9d1e00..7ec3686c 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/dialog/EditDeleteProductDialog.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/dialog/EditDeleteProductDialog.java @@ -1,9 +1,10 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.products.dialog; +import android.app.AlertDialog; import android.app.Dialog; import android.os.Bundle; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; +import androidx.fragment.app.DialogFragment; + import android.view.LayoutInflater; import android.view.View; import android.widget.Button; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/dialog/ProductDialogCache.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/dialog/ProductDialogCache.java index 8252671b..186c2823 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/dialog/ProductDialogCache.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/dialog/ProductDialogCache.java @@ -1,9 +1,11 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.products.dialog; -import android.support.design.widget.TextInputEditText; -import android.support.design.widget.TextInputLayout; import android.view.View; import android.widget.*; + +import com.google.android.material.textfield.TextInputEditText; +import com.google.android.material.textfield.TextInputLayout; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; /** diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/dialog/ProductDialogFragment.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/dialog/ProductDialogFragment.java index 763c1fd2..5dfb2866 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/dialog/ProductDialogFragment.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/dialog/ProductDialogFragment.java @@ -10,9 +10,11 @@ import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; -import android.support.annotation.NonNull; -import android.support.v4.app.DialogFragment; -import android.support.v4.content.ContextCompat; + +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; +import androidx.fragment.app.DialogFragment; + import android.text.Editable; import android.text.InputFilter; import android.text.TextWatcher; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listadapter/ProductItemCache.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listadapter/ProductItemCache.java index 32f4e0cf..fc9ca14d 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listadapter/ProductItemCache.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listadapter/ProductItemCache.java @@ -1,6 +1,6 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.products.listadapter; -import android.support.v7.widget.CardView; +import androidx.cardview.widget.CardView; import android.view.View; import android.widget.*; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listadapter/ProductsItemViewHolder.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listadapter/ProductsItemViewHolder.java index 48f5c2ba..d93218f8 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listadapter/ProductsItemViewHolder.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listadapter/ProductsItemViewHolder.java @@ -4,14 +4,16 @@ import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.Paint; -import android.support.v4.app.DialogFragment; -import android.support.v7.widget.AppCompatCheckBox; -import android.support.v7.widget.CardView; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.ImageButton; import android.widget.TextView; + +import androidx.appcompat.widget.AppCompatCheckBox; +import androidx.cardview.widget.CardView; +import androidx.fragment.app.DialogFragment; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.AbstractInstanceFactory; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.InstanceFactory; @@ -30,7 +32,7 @@ * Author: Grebiel Jose Ifill Brito * Created: 20.07.16 creation date */ -public class ProductsItemViewHolder extends AbstractViewHolder +public class ProductsItemViewHolder extends AbstractViewHolder> { private ProductItemCache productItemCache; private ProductService productService; @@ -85,8 +87,7 @@ public void onClick(View v) viewPhotoIntent.putExtra(ProductsActivity.PRODUCT_ID_KEY, item.getId()); viewPhotoIntent.putExtra(ProductsActivity.PRODUCT_NAME, item.getProductName()); viewPhotoIntent.putExtra(ProductsActivity.FROM_DIALOG, false); - ProductsActivity activity = (ProductsActivity) cache.getActivity(); - activity.startActivityForResult(viewPhotoIntent, ProductsActivity.REQUEST_PHOTO_PREVIEW_FROM_ITEM); + cache.getActivity().startActivityForResult(viewPhotoIntent, ProductsActivity.REQUEST_PHOTO_PREVIEW_FROM_ITEM); } }); diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listeners/CancelSearchOnClick.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listeners/CancelSearchOnClick.java index 88e01ec4..808b6b69 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listeners/CancelSearchOnClick.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listeners/CancelSearchOnClick.java @@ -1,8 +1,10 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.products.listeners; -import android.support.v7.app.AppCompatActivity; import android.view.View; import android.view.inputmethod.InputMethodManager; + +import androidx.appcompat.app.AppCompatActivity; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.utils.StringUtils; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.products.ProductActivityCache; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listeners/ShowSearchFieldOnClickListener.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listeners/ShowSearchFieldOnClickListener.java index 72d2a196..da0a76a7 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listeners/ShowSearchFieldOnClickListener.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/products/listeners/ShowSearchFieldOnClickListener.java @@ -1,12 +1,14 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.products.listeners; import android.app.Activity; -import android.support.design.widget.TextInputLayout; import android.view.MenuItem; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.AutoCompleteTextView; import android.widget.ImageButton; + +import com.google.android.material.textfield.TextInputLayout; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.utils.StringUtils; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/EditDeleteListDialog.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/EditDeleteListDialog.java index 6cba3b93..5cb2acb0 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/EditDeleteListDialog.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/EditDeleteListDialog.java @@ -1,11 +1,12 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.shoppinglist; +import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.DialogFragment; -import android.support.v7.app.AlertDialog; +import androidx.fragment.app.DialogFragment; + import android.view.LayoutInflater; import android.view.View; import android.widget.Button; @@ -126,7 +127,7 @@ public void onClick(View view) dismiss(); if ( !ListDialogFragment.isOpened() ) { - DialogFragment productFragment = ListDialogFragment.newEditInstance(listItem, cache); + ListDialogFragment productFragment = ListDialogFragment.newEditInstance(listItem, cache); productFragment.show(cache.getActivity().getSupportFragmentManager(), "List"); } } diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/ListDialogCache.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/ListDialogCache.java index e0608e61..c482ee06 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/ListDialogCache.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/ListDialogCache.java @@ -1,10 +1,13 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.shoppinglist; -import android.support.design.widget.TextInputEditText; -import android.support.design.widget.TextInputLayout; -import android.support.v7.widget.SwitchCompat; import android.view.View; import android.widget.*; + +import androidx.appcompat.widget.SwitchCompat; + +import com.google.android.material.textfield.TextInputEditText; +import com.google.android.material.textfield.TextInputLayout; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; /** diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/ListDialogFragment.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/ListDialogFragment.java index 2fcd7f77..c0530094 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/ListDialogFragment.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/ListDialogFragment.java @@ -1,18 +1,29 @@ package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.shoppinglist; -import android.app.*; +import android.app.Activity; +import android.app.DatePickerDialog; +import android.app.Dialog; +import android.app.TimePickerDialog; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; -import android.support.v4.app.DialogFragment; -import android.support.v7.widget.SwitchCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.WindowManager; -import android.widget.*; +import android.widget.ArrayAdapter; +import android.widget.CompoundButton; +import android.widget.DatePicker; +import android.widget.TextView; +import android.widget.TimePicker; +import android.widget.Toast; + +import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.widget.SwitchCompat; +import androidx.fragment.app.DialogFragment; + import org.joda.time.DateTime; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.context.AbstractInstanceFactory; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/listadapter/ListItemCache.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/listadapter/ListItemCache.java index d73bf9f4..e5227e37 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/listadapter/ListItemCache.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/listadapter/ListItemCache.java @@ -2,11 +2,13 @@ import android.content.SharedPreferences; import android.preference.PreferenceManager; -import android.support.v7.widget.CardView; import android.view.View; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.TextView; + +import androidx.cardview.widget.CardView; + import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.settings.SettingsKeys; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/listadapter/ListsItemViewHolder.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/listadapter/ListsItemViewHolder.java index 2be4d3ee..6760431d 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/listadapter/ListsItemViewHolder.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/listadapter/ListsItemViewHolder.java @@ -2,9 +2,11 @@ import android.content.Intent; import android.preference.PreferenceManager; -import android.support.v4.app.DialogFragment; -import android.support.v4.content.ContextCompat; -import android.support.v7.app.AppCompatActivity; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.core.content.ContextCompat; +import androidx.fragment.app.DialogFragment; + import android.view.View; import android.widget.ImageButton; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/reminder/ReminderReceiver.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/reminder/ReminderReceiver.java index 9abde0e9..ae1b051f 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/reminder/ReminderReceiver.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/reminder/ReminderReceiver.java @@ -4,7 +4,7 @@ import android.app.PendingIntent; import android.content.Context; import android.content.Intent; -import android.support.v4.content.WakefulBroadcastReceiver; +import androidx.legacy.content.WakefulBroadcastReceiver; /** * Created by Chris on 13.08.2016. @@ -25,7 +25,7 @@ public void onReceive(Context context, Intent intent) public void setAlarm(Context context, Intent i, long deltaTimeInMillis, String listId) { alarmMgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - PendingIntent pi = PendingIntent.getService(context, Integer.parseInt(listId), i, PendingIntent.FLAG_UPDATE_CURRENT); + PendingIntent pi = PendingIntent.getService(context, Integer.parseInt(listId), i, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); alarmMgr.set(AlarmManager.RTC_WAKEUP, deltaTimeInMillis, pi); } @@ -33,7 +33,7 @@ public void cancelAlarm(Context context, Intent i, String listId) { // If the alarm has been set, cancel it. alarmMgr = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); - PendingIntent pi = PendingIntent.getService(context, Integer.parseInt(listId), i, PendingIntent.FLAG_CANCEL_CURRENT); + PendingIntent pi = PendingIntent.getService(context, Integer.parseInt(listId), i, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE); pi.cancel(); alarmMgr.cancel(pi); } diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/reminder/ReminderSchedulingService.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/reminder/ReminderSchedulingService.java index 05d6aa7f..552c229e 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/reminder/ReminderSchedulingService.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/shoppinglist/reminder/ReminderSchedulingService.java @@ -7,8 +7,8 @@ import android.content.Context; import android.content.Intent; import android.preference.PreferenceManager; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.TaskStackBuilder; +import androidx.core.app.NotificationCompat; +import androidx.core.app.TaskStackBuilder; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.main.MainActivity; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.products.ProductsActivity; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/statistics/StatisticsCache.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/statistics/StatisticsCache.java index 200bc7a4..ec0ea0d3 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/statistics/StatisticsCache.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/statistics/StatisticsCache.java @@ -2,9 +2,11 @@ import android.content.SharedPreferences; import android.preference.PreferenceManager; -import android.support.v7.app.AppCompatActivity; import android.widget.Spinner; import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; + import com.github.mikephil.charting.charts.BarChart; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.R; import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.ui.settings.SettingsKeys; diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/tutorial/TutorialActivity.java b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/tutorial/TutorialActivity.java index 5b2cefb7..17272e6b 100644 --- a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/tutorial/TutorialActivity.java +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/ui/tutorial/TutorialActivity.java @@ -5,9 +5,11 @@ import android.graphics.Color; import android.os.Build; import android.os.Bundle; -import android.support.v4.view.PagerAdapter; -import android.support.v4.view.ViewPager; -import android.support.v7.app.AppCompatActivity; + +import androidx.appcompat.app.AppCompatActivity; +import androidx.viewpager.widget.PagerAdapter; +import androidx.viewpager.widget.ViewPager; + import android.text.Html; import android.view.*; import android.widget.Button; diff --git a/app/src/main/res/layouts/camera/layout/camera_preview.xml b/app/src/main/res/layouts/camera/layout/camera_preview.xml index 036140c7..af8e9902 100644 --- a/app/src/main/res/layouts/camera/layout/camera_preview.xml +++ b/app/src/main/res/layouts/camera/layout/camera_preview.xml @@ -13,7 +13,7 @@ android:layout_height="match_parent"> - - - - - - + - - - + diff --git a/app/src/main/res/layouts/deleteproducts/layout/delete_product_list_item.xml b/app/src/main/res/layouts/deleteproducts/layout/delete_product_list_item.xml index 601aeb44..9255cbff 100644 --- a/app/src/main/res/layouts/deleteproducts/layout/delete_product_list_item.xml +++ b/app/src/main/res/layouts/deleteproducts/layout/delete_product_list_item.xml @@ -1,5 +1,5 @@ - - - + diff --git a/app/src/main/res/layouts/deleteproducts/layout/delete_products_activity.xml b/app/src/main/res/layouts/deleteproducts/layout/delete_products_activity.xml index 36984c08..6c4ac414 100644 --- a/app/src/main/res/layouts/deleteproducts/layout/delete_products_activity.xml +++ b/app/src/main/res/layouts/deleteproducts/layout/delete_products_activity.xml @@ -1,24 +1,24 @@ - - - + - - - + diff --git a/app/src/main/res/layouts/help/layout/activity_help.xml b/app/src/main/res/layouts/help/layout/activity_help.xml index 8f3c56df..88fbf07c 100644 --- a/app/src/main/res/layouts/help/layout/activity_help.xml +++ b/app/src/main/res/layouts/help/layout/activity_help.xml @@ -1,5 +1,5 @@ - - - + - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layouts/main/layout/activity_main.xml b/app/src/main/res/layouts/main/layout/activity_main.xml index e6cd0701..2ef7921b 100644 --- a/app/src/main/res/layouts/main/layout/activity_main.xml +++ b/app/src/main/res/layouts/main/layout/activity_main.xml @@ -1,5 +1,5 @@ - - - + diff --git a/app/src/main/res/layouts/main/layout/app_bar_main.xml b/app/src/main/res/layouts/main/layout/app_bar_main.xml index 842f1c0c..0fc170cb 100644 --- a/app/src/main/res/layouts/main/layout/app_bar_main.xml +++ b/app/src/main/res/layouts/main/layout/app_bar_main.xml @@ -1,5 +1,5 @@ - - - - + diff --git a/app/src/main/res/layouts/main/layout/main_toolbar.xml b/app/src/main/res/layouts/main/layout/main_toolbar.xml index 5def4050..929381d3 100644 --- a/app/src/main/res/layouts/main/layout/main_toolbar.xml +++ b/app/src/main/res/layouts/main/layout/main_toolbar.xml @@ -1,17 +1,17 @@ - - - + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layouts/products/layout/product_dialog.xml b/app/src/main/res/layouts/products/layout/product_dialog.xml index 97d0c9b5..0592f516 100644 --- a/app/src/main/res/layouts/products/layout/product_dialog.xml +++ b/app/src/main/res/layouts/products/layout/product_dialog.xml @@ -30,7 +30,7 @@ android:paddingRight="@dimen/dialog_padding_horizontal" android:paddingLeft="@dimen/dialog_padding_horizontal"> - - + - - - - + + - - - + @@ -146,17 +146,17 @@ android:paddingRight="@dimen/dialog_padding_horizontal" android:paddingLeft="@dimen/dialog_padding_horizontal"> - - - + - - + - - + diff --git a/app/src/main/res/layouts/products/layout/product_list_item.xml b/app/src/main/res/layouts/products/layout/product_list_item.xml index dcbcfd24..536e532a 100644 --- a/app/src/main/res/layouts/products/layout/product_list_item.xml +++ b/app/src/main/res/layouts/products/layout/product_list_item.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layouts/products/layout/product_list_item_left_hand.xml b/app/src/main/res/layouts/products/layout/product_list_item_left_hand.xml index 0368ae7f..cc302eab 100644 --- a/app/src/main/res/layouts/products/layout/product_list_item_left_hand.xml +++ b/app/src/main/res/layouts/products/layout/product_list_item_left_hand.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layouts/products/layout/products_activity.xml b/app/src/main/res/layouts/products/layout/products_activity.xml index 1a763c5f..3cb8e50b 100644 --- a/app/src/main/res/layouts/products/layout/products_activity.xml +++ b/app/src/main/res/layouts/products/layout/products_activity.xml @@ -6,7 +6,7 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - + - - - - + - - - - - + - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layouts/shared/layout/toolbar.xml b/app/src/main/res/layouts/shared/layout/toolbar.xml index a50c1d05..d0f88498 100644 --- a/app/src/main/res/layouts/shared/layout/toolbar.xml +++ b/app/src/main/res/layouts/shared/layout/toolbar.xml @@ -1,16 +1,16 @@ - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layouts/shoppinglist/layout/shopping_list_dialog.xml b/app/src/main/res/layouts/shoppinglist/layout/shopping_list_dialog.xml index ea5bad9f..1b624b33 100644 --- a/app/src/main/res/layouts/shoppinglist/layout/shopping_list_dialog.xml +++ b/app/src/main/res/layouts/shoppinglist/layout/shopping_list_dialog.xml @@ -31,7 +31,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - - + - - + @@ -179,12 +179,12 @@ android:layout_height="wrap_content" android:orientation="horizontal"> - - + - - - - + \ No newline at end of file diff --git a/app/src/main/res/layouts/shoppinglist/layout/shopping_list_item.xml b/app/src/main/res/layouts/shoppinglist/layout/shopping_list_item.xml index 099f6a80..a82619dd 100644 --- a/app/src/main/res/layouts/shoppinglist/layout/shopping_list_item.xml +++ b/app/src/main/res/layouts/shoppinglist/layout/shopping_list_item.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layouts/shoppinglist/layout/shopping_list_item_left_hand.xml b/app/src/main/res/layouts/shoppinglist/layout/shopping_list_item_left_hand.xml index 6a85f70d..22437b3b 100644 --- a/app/src/main/res/layouts/shoppinglist/layout/shopping_list_item_left_hand.xml +++ b/app/src/main/res/layouts/shoppinglist/layout/shopping_list_item_left_hand.xml @@ -1,5 +1,5 @@ - - + diff --git a/app/src/main/res/layouts/statistics/layout/statistics_activity.xml b/app/src/main/res/layouts/statistics/layout/statistics_activity.xml index c43656a5..a136359a 100644 --- a/app/src/main/res/layouts/statistics/layout/statistics_activity.xml +++ b/app/src/main/res/layouts/statistics/layout/statistics_activity.xml @@ -1,5 +1,5 @@ - - - + diff --git a/app/src/main/res/layouts/tutorials/layout/activity_tutorial.xml b/app/src/main/res/layouts/tutorials/layout/activity_tutorial.xml index ae3c8712..92a87950 100644 --- a/app/src/main/res/layouts/tutorials/layout/activity_tutorial.xml +++ b/app/src/main/res/layouts/tutorials/layout/activity_tutorial.xml @@ -6,7 +6,7 @@ tools:showIn="@layout/activity_tutorial"> - diff --git a/build.gradle b/build.gradle index db1f3db8..6a02c77d 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.2' + classpath 'com.android.tools.build:gradle:7.0.4' classpath 'me.tatarka:gradle-retrolambda:3.2.5' // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle.properties b/gradle.properties index 1d3591c8..915f0e66 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,6 @@ # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true \ No newline at end of file +# org.gradle.parallel=true +android.enableJetifier=true +android.useAndroidX=true \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ac700ccc..7064403d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sun Mar 17 16:50:47 CET 2019 +#Thu Jan 12 20:25:41 CET 2023 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip +zipStoreBase=GRADLE_USER_HOME From cb28ba8553839afa6accd8863cafd6df562e757c Mon Sep 17 00:00:00 2001 From: Patrick Schneider Date: Fri, 13 Jan 2023 12:35:30 +0100 Subject: [PATCH 2/2] Implement Backup Integration. Add Kotlin and update Gradlew + AGP. --- .gitmodules | 3 + app/build.gradle | 17 ++- app/src/main/AndroidManifest.xml | 52 +++++--- .../PFAShoppingListApplication.kt | 22 ++++ .../backup/BackupCreator.kt | 54 ++++++++ .../backup/BackupRestorer.kt | 122 ++++++++++++++++++ .../backup/PFABackupService.kt | 5 + build.gradle | 5 +- gradle/wrapper/gradle-wrapper.properties | 4 +- libs/privacy-friendly-backup-api | 1 + settings.gradle | 2 + 11 files changed, 265 insertions(+), 22 deletions(-) create mode 100644 .gitmodules create mode 100644 app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/PFAShoppingListApplication.kt create mode 100644 app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/backup/BackupCreator.kt create mode 100644 app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/backup/BackupRestorer.kt create mode 100644 app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/backup/PFABackupService.kt create mode 160000 libs/privacy-friendly-backup-api diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..5fb4a5c0 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libs/privacy-friendly-backup-api"] + path = libs/privacy-friendly-backup-api + url = https://github.com/SecUSo/privacy-friendly-backup-api.git diff --git a/app/build.gradle b/app/build.gradle index a15d493b..68c288ec 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' android { compileSdkVersion 33 @@ -47,7 +48,6 @@ android { } } } - dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') // android @@ -66,9 +66,9 @@ dependencies { testImplementation 'pl.pragmatists:JUnitParams:0.3.6' // dependency injection implementation 'com.squareup.dagger:dagger:1.2.5' - annotationProcessor 'com.squareup.dagger:dagger-compiler:1.2.5' compileOnly 'com.squareup.dagger:dagger-compiler:1.2.5' + // persistence implementation 'com.j256.ormlite:ormlite-android:5.0' // reactive x @@ -80,4 +80,17 @@ dependencies { implementation 'com.github.PhilJay:MPAndroidChart:v3.0.0-beta1' // image zoom implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.5.0' + + implementation 'androidx.sqlite:sqlite:2.3.0' + implementation 'androidx.sqlite:sqlite-ktx:2.3.0' + + // Backup API + implementation project(':backup-api') + def work_version = '2.7.1' + implementation "androidx.work:work-runtime:$work_version" + implementation "androidx.work:work-runtime-ktx:$work_version" + androidTestImplementation "androidx.work:work-testing:$work_version" + + implementation 'androidx.core:core-ktx:1.7.20' } + diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4134f532..c86f5c80 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,5 +1,7 @@ - + @@ -13,11 +15,12 @@ android:xlargeScreens="true"/> + android:name=".PFAShoppingListApplication" + android:allowBackup="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:supportsRtl="true" + android:theme="@style/AppTheme"> - - - - - - - - + + + + + + + + + + + + + + diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/PFAShoppingListApplication.kt b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/PFAShoppingListApplication.kt new file mode 100644 index 00000000..b1abfa5e --- /dev/null +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/PFAShoppingListApplication.kt @@ -0,0 +1,22 @@ +package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist + + +import android.app.Application +import android.util.Log +import androidx.work.Configuration +import org.secuso.privacyfriendlybackup.api.pfa.BackupManager +import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.backup.BackupCreator +import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.backup.BackupRestorer + +class PFAShoppingListApplication : Application(), Configuration.Provider { + + override fun onCreate() { + super.onCreate() + BackupManager.backupCreator = BackupCreator() + BackupManager.backupRestorer = BackupRestorer() + } + + override fun getWorkManagerConfiguration(): Configuration { + return Configuration.Builder().setMinimumLoggingLevel(Log.INFO).build() + } +} \ No newline at end of file diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/backup/BackupCreator.kt b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/backup/BackupCreator.kt new file mode 100644 index 00000000..1c3813e7 --- /dev/null +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/backup/BackupCreator.kt @@ -0,0 +1,54 @@ +package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.backup + +import android.content.Context +import android.preference.PreferenceManager +import android.util.JsonWriter +import android.util.Log +import org.secuso.privacyfriendlybackup.api.backup.DatabaseUtil.getSupportSQLiteOpenHelper +import org.secuso.privacyfriendlybackup.api.backup.DatabaseUtil.writeDatabase +import org.secuso.privacyfriendlybackup.api.backup.PreferenceUtil.writePreferences +import org.secuso.privacyfriendlybackup.api.pfa.IBackupCreator +import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.persistence.DB +import java.io.OutputStream +import java.io.OutputStreamWriter + +class BackupCreator : IBackupCreator { + override fun writeBackup(context: Context, outputStream: OutputStream): Boolean { + Log.d(TAG, "createBackup() started") + val outputStreamWriter = OutputStreamWriter(outputStream, Charsets.UTF_8) + val writer = JsonWriter(outputStreamWriter) + writer.setIndent("") + + try { + writer.beginObject() + + Log.d(TAG, "Writing database") + writer.name("database") + + val database = getSupportSQLiteOpenHelper(context, DB.APP.dbName).readableDatabase + + writeDatabase(writer, database) + database.close() + + Log.d(TAG, "Writing preferences") + writer.name("preferences") + + val pref = PreferenceManager.getDefaultSharedPreferences(context.applicationContext) + writePreferences(writer, pref) + + writer.endObject() + writer.close() + } catch (e: Exception) { + Log.e(TAG, "Error occurred", e) + e.printStackTrace() + return false + } + + Log.d(TAG, "Backup created successfully") + return true + } + + companion object { + const val TAG = "PFABackupCreator" + } +} \ No newline at end of file diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/backup/BackupRestorer.kt b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/backup/BackupRestorer.kt new file mode 100644 index 00000000..8838c51b --- /dev/null +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/backup/BackupRestorer.kt @@ -0,0 +1,122 @@ +package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.backup + +import android.content.Context +import android.content.SharedPreferences +import android.preference.PreferenceManager +import android.util.JsonReader +import android.util.Log +import org.secuso.privacyfriendlybackup.api.backup.DatabaseUtil +import org.secuso.privacyfriendlybackup.api.backup.FileUtil +import org.secuso.privacyfriendlybackup.api.pfa.IBackupRestorer +import privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.framework.persistence.DB +import java.io.IOException +import java.io.InputStream +import java.io.InputStreamReader +import kotlin.system.exitProcess + + +class BackupRestorer : IBackupRestorer { + @Throws(IOException::class) + private fun readDatabase(reader: JsonReader, context: Context) { + reader.beginObject() + val n1: String = reader.nextName() + if (n1 != "version") { + throw RuntimeException("Unknown value $n1") + } + val version: Int = reader.nextInt() + val n2: String = reader.nextName() + if (n2 != "content") { + throw RuntimeException("Unknown value $n2") + } + + Log.d(TAG, "Restoring database...") + val restoreDatabaseName = "restoreDatabase" + + // delete if file already exists + val restoreDatabaseFile = context.getDatabasePath(restoreDatabaseName) + if (restoreDatabaseFile.exists()) { + DatabaseUtil.deleteRoomDatabase(context, restoreDatabaseName) + } + + // create new restore database + val db = DatabaseUtil.getSupportSQLiteOpenHelper(context, restoreDatabaseName, version).writableDatabase + + db.beginTransaction() + db.version = version + + Log.d(TAG, "Copying database contents...") + DatabaseUtil.readDatabaseContent(reader, db) + db.setTransactionSuccessful() + db.endTransaction() + db.close() + + reader.endObject() + + // copy file to correct location + val actualDatabaseFile = context.getDatabasePath(DB.APP.dbName) + + DatabaseUtil.deleteRoomDatabase(context, DB.APP.dbName) + + FileUtil.copyFile(restoreDatabaseFile, actualDatabaseFile) + Log.d(TAG, "Database Restored") + + // delete restore database + DatabaseUtil.deleteRoomDatabase(context, restoreDatabaseName) + } + + @Throws(IOException::class) + private fun readPreferences(reader: JsonReader, preferences: SharedPreferences.Editor) { + reader.beginObject() + while (reader.hasNext()) { + val name: String = reader.nextName() + when (name) { + "workoutMode", + "privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.pref.sort_asc_dec_key" -> preferences.putBoolean(name, reader.nextBoolean()) + "privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.pref.sort_by_key" -> preferences.putString(name, reader.nextString()) + else -> throw RuntimeException("Unknown preference $name") + } + } + reader.endObject() + } + + private fun readPreferenceSet(reader: JsonReader): Set { + val preferenceSet = mutableSetOf() + + reader.beginArray() + while (reader.hasNext()) { + preferenceSet.add(reader.nextString()); + } + reader.endArray() + return preferenceSet + } + + override fun restoreBackup(context: Context, restoreData: InputStream): Boolean { + return try { + val isReader = InputStreamReader(restoreData) + val reader = JsonReader(isReader) + val preferences = PreferenceManager.getDefaultSharedPreferences(context).edit() + + // START + reader.beginObject() + while (reader.hasNext()) { + val type: String = reader.nextName() + when (type) { + "database" -> readDatabase(reader, context) + "preferences" -> readPreferences(reader, preferences) + else -> throw RuntimeException("Can not parse type $type") + } + } + reader.endObject() + preferences.commit() + + exitProcess(0) + } catch (e: Exception) { + e.printStackTrace() + false + } + } + + companion object { + const val TAG = "PFABackupRestorer" + } +} \ No newline at end of file diff --git a/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/backup/PFABackupService.kt b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/backup/PFABackupService.kt new file mode 100644 index 00000000..dda45986 --- /dev/null +++ b/app/src/main/java/privacyfriendlyshoppinglist/secuso/org/privacyfriendlyshoppinglist/backup/PFABackupService.kt @@ -0,0 +1,5 @@ +package privacyfriendlyshoppinglist.secuso.org.privacyfriendlyshoppinglist.backup + +import org.secuso.privacyfriendlybackup.api.pfa.PFAAuthService + +class PFABackupService : PFAAuthService() \ No newline at end of file diff --git a/build.gradle b/build.gradle index 6a02c77d..46b473a2 100644 --- a/build.gradle +++ b/build.gradle @@ -6,9 +6,12 @@ buildscript { mavenCentral() google() } + + ext.kotlin_version = "1.7.20" dependencies { - classpath 'com.android.tools.build:gradle:7.0.4' + classpath 'com.android.tools.build:gradle:7.3.1' classpath 'me.tatarka:gradle-retrolambda:3.2.5' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7064403d..8cfe1e47 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Jan 12 20:25:41 CET 2023 +#Fri Jan 13 12:17:28 CET 2023 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/libs/privacy-friendly-backup-api b/libs/privacy-friendly-backup-api new file mode 160000 index 00000000..d267b0d5 --- /dev/null +++ b/libs/privacy-friendly-backup-api @@ -0,0 +1 @@ +Subproject commit d267b0d5e899fe12f41a6b7aac2081b8d4ea71af diff --git a/settings.gradle b/settings.gradle index e7b4def4..72641405 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,3 @@ include ':app' +include ':backup-api' +project(':backup-api').projectDir = new File('libs/privacy-friendly-backup-api/BackupAPI') \ No newline at end of file