diff --git a/README.md b/README.md
index 255c65faa..3113e5f71 100644
--- a/README.md
+++ b/README.md
@@ -197,4 +197,4 @@ While *Aurora Store* was originally based on Sergei Yeriomin's [Yalp store](http
* [Raccoon](https://github.com/onyxbits/raccoon4)
* [SAI](https://github.com/Aefyr/SAI)
-[
](https://f-droid.org/packages/com.dragons.aurora/) [
](https://poeditor.com/join/project/54swaCpFXJ)
\ No newline at end of file
+[
](https://f-droid.org/packages/com.dragons.aurora/) [
](https://poeditor.com/join/project/54swaCpFXJ)
diff --git a/app/build.gradle b/app/build.gradle
index 65f898fe7..ad8f2c270 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -42,7 +42,9 @@ android {
}
buildTypes {
release {
- minifyEnabled false
+ minifyEnabled true
+ zipAlignEnabled true
+ shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
@@ -52,19 +54,7 @@ android {
sourceCompatibility 1.8
}
lintOptions {
- checkReleaseBuilds false
- abortOnError false
- }
-}
-
-configurations.all {
- resolutionStrategy.eachDependency { DependencyResolveDetails details ->
- def requested = details.requested
- if (requested.group == "androidx") {
- if (!requested.name.startsWith("multidex")) {
- details.useVersion "${targetSdk}.+"
- }
- }
+ warning 'MissingTranslation', 'GetLocales', 'VectorDrawableCompat'
}
}
@@ -72,12 +62,19 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'commons-io:commons-io:2.6'
implementation 'org.apache.maven:maven-artifact:3.6.2'
+ implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
+
//UI-Libs
implementation 'androidx.appcompat:appcompat:1.1.0'
+ implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
implementation 'androidx.preference:preference:1.1.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
- implementation 'com.google.android.material:material:1.1.0-alpha10'
implementation 'androidx.palette:palette:1.0.0'
+ implementation 'androidx.navigation:navigation-fragment:2.1.0'
+ implementation 'androidx.navigation:navigation-ui:2.1.0'
+ implementation 'com.google.android.material:material:1.1.0-alpha10'
+ implementation 'io.github.luizgrp.sectionedrecyclerviewadapter:sectionedrecyclerviewadapter:3.0.0'
+
//Utils
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'org.apache.commons:commons-text:1.8'
@@ -85,18 +82,23 @@ dependencies {
implementation 'com.google.code.gson:gson:2.8.6'
compileOnly 'org.projectlombok:lombok:1.18.10'
annotationProcessor 'org.projectlombok:lombok:1.18.10'
+
//PlayStoreApi
implementation 'com.github.whyorean:playstore-api-v2:2.4'
+
//OkHTTP3
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.2.2'
+
//RX-Java2
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.14'
implementation 'com.jakewharton.rxrelay2:rxrelay:2.1.1'
+
//ButterKnife
implementation 'com.jakewharton:butterknife:10.2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'
+
//Glide
implementation 'com.github.bumptech.glide:glide:4.10.0'
implementation "com.github.bumptech.glide:okhttp3-integration:4.10.0"
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index 95f167ef0..a69866ef8 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -51,4 +51,6 @@
# is used to reflectively look up the generated ViewBinding.
-keep class butterknife.*
-keepclasseswithmembernames class * { @butterknife.* ; }
--keepclasseswithmembernames class * { @butterknife.* ; }
\ No newline at end of file
+-keepclasseswithmembernames class * { @butterknife.* ; }
+
+-keep public class com.aurora.store.ui.preference.fragment.*
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 975db7342..99ceddeca 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -67,34 +67,12 @@
tools:targetApi="q">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -121,36 +99,61 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
-
\ No newline at end of file
diff --git a/app/src/main/java/com/aurora/store/AnonymousLoginService.java b/app/src/main/java/com/aurora/store/AnonymousLoginService.java
deleted file mode 100644
index 8163e4bf0..000000000
--- a/app/src/main/java/com/aurora/store/AnonymousLoginService.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package com.aurora.store;
-
-import android.app.Service;
-import android.content.Intent;
-import android.os.IBinder;
-
-import androidx.annotation.Nullable;
-
-import com.aurora.store.api.PlayStoreApiAuthenticator;
-import com.aurora.store.events.Event;
-import com.aurora.store.events.Events;
-import com.aurora.store.events.RxBus;
-import com.aurora.store.utility.Accountant;
-import com.aurora.store.utility.Log;
-
-import io.reactivex.Observable;
-import io.reactivex.android.schedulers.AndroidSchedulers;
-import io.reactivex.disposables.CompositeDisposable;
-import io.reactivex.schedulers.Schedulers;
-
-public class AnonymousLoginService extends Service {
-
- public static AnonymousLoginService instance = null;
-
- private CompositeDisposable disposable = new CompositeDisposable();
-
- public static boolean isServiceRunning() {
- try {
- return instance != null && instance.isRunning();
- } catch (NullPointerException e) {
- return false;
- }
- }
-
- private boolean isRunning() {
- return true;
- }
-
- @Nullable
- @Override
- public IBinder onBind(Intent intent) {
- return null;
- }
-
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
- return START_NOT_STICKY;
- }
-
- @Override
- public void onCreate() {
- super.onCreate();
- login();
- }
-
- private void login() {
- disposable.add(Observable.fromCallable(() -> PlayStoreApiAuthenticator
- .login(this))
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe((api) -> {
- if (api != null) {
- Log.i("Anonymous Login Successful");
- Accountant.setAnonymous(this, true);
- RxBus.publish(new Event(Events.LOGGED_IN));
- } else
- Log.e("Anonymous Login Failed Permanently");
- destroyService();
- }, err -> {
- Log.e(err.getMessage());
- destroyService();
- }));
- }
-
- @Override
- public void onDestroy() {
- instance = null;
- super.onDestroy();
- }
-
- private void destroyService() {
- Log.e("Anonymous login service destroyed");
- stopSelf();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/aurora/store/AppDiffCallback.java b/app/src/main/java/com/aurora/store/AppDiffCallback.java
new file mode 100644
index 000000000..857634542
--- /dev/null
+++ b/app/src/main/java/com/aurora/store/AppDiffCallback.java
@@ -0,0 +1,37 @@
+package com.aurora.store;
+
+import androidx.recyclerview.widget.DiffUtil;
+
+import com.aurora.store.model.App;
+
+import java.util.List;
+
+public class AppDiffCallback extends DiffUtil.Callback {
+ private List newList;
+ private List oldList;
+
+ public AppDiffCallback(List newList, List oldList) {
+ this.newList = newList;
+ this.oldList = oldList;
+ }
+
+ @Override
+ public int getOldListSize() {
+ return oldList != null ? oldList.size() : 0;
+ }
+
+ @Override
+ public int getNewListSize() {
+ return newList != null ? newList.size() : 0;
+ }
+
+ @Override
+ public boolean areItemsTheSame(int oldIndex, int newIndex) {
+ return true;
+ }
+
+ @Override
+ public boolean areContentsTheSame(int oldIndex, int newIndex) {
+ return oldList.get(oldIndex).equals(newList.get(newIndex));
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/aurora/store/AuroraApplication.java b/app/src/main/java/com/aurora/store/AuroraApplication.java
index e1eac1cdd..c7bd8f09d 100644
--- a/app/src/main/java/com/aurora/store/AuroraApplication.java
+++ b/app/src/main/java/com/aurora/store/AuroraApplication.java
@@ -24,11 +24,15 @@ import android.annotation.SuppressLint;
import android.app.Application;
import android.content.IntentFilter;
+import com.aurora.store.events.Event;
+import com.aurora.store.events.RxBus;
import com.aurora.store.installer.Installer;
import com.aurora.store.installer.InstallerService;
import com.aurora.store.installer.Uninstaller;
import com.aurora.store.model.App;
-import com.aurora.store.utility.Util;
+import com.aurora.store.util.Log;
+import com.aurora.store.util.Util;
+import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
import java.util.ArrayList;
import java.util.Iterator;
@@ -38,20 +42,27 @@ import io.reactivex.plugins.RxJavaPlugins;
public class AuroraApplication extends Application {
- public static boolean updating = false;
- public static List ongoingUpdateList = new ArrayList<>();
+ public static GooglePlayAPI api = null;
+
+ private static RxBus rxBus = null;
+ private static boolean bulkUpdateAlive = false;
+ private static List ongoingUpdateList = new ArrayList<>();
@SuppressLint("StaticFieldLeak")
- public static Installer installer;
+ private static Installer installer;
@SuppressLint("StaticFieldLeak")
- public static Uninstaller uninstaller;
+ private static Uninstaller uninstaller;
- public static boolean getOnGoingUpdate() {
- return updating;
+ public static RxBus getRxBus() {
+ return rxBus;
}
- public static void setOnGoingUpdate(boolean updating) {
- AuroraApplication.updating = updating;
+ public static boolean isBulkUpdateAlive() {
+ return bulkUpdateAlive;
+ }
+
+ public static void setBulkUpdateAlive(boolean updating) {
+ AuroraApplication.bulkUpdateAlive = updating;
}
public static List getOngoingUpdateList() {
@@ -69,7 +80,7 @@ public class AuroraApplication extends Application {
iterator.remove();
}
if (ongoingUpdateList.isEmpty())
- setOnGoingUpdate(false);
+ setBulkUpdateAlive(false);
}
public static Installer getInstaller() {
@@ -80,24 +91,35 @@ public class AuroraApplication extends Application {
return uninstaller;
}
+ public static void rxNotify(Event event) {
+ rxBus.getBus().accept(event);
+ }
+
@Override
public void onCreate() {
super.onCreate();
+
+ rxBus = new RxBus();
installer = new Installer(this);
uninstaller = new Uninstaller(this);
+
+ //Clear all old installation sessions.
Util.clearOldInstallationSessions(this);
+
+ //Register global install broadcast receiver.
registerReceiver(installer.getPackageInstaller().getBroadcastReceiver(),
new IntentFilter(InstallerService.ACTION_INSTALLATION_STATUS_NOTIFICATION));
- RxJavaPlugins.setErrorHandler(err -> {
- });
+
+ //Global RX-Error handler, just simply logs, I make sure all errors are handled at origin.
+ RxJavaPlugins.setErrorHandler(err -> Log.i(err.getMessage()));
}
@Override
public void onTerminate() {
- super.onTerminate();
try {
unregisterReceiver(installer.getPackageInstaller().getBroadcastReceiver());
} catch (Exception ignored) {
}
+ super.onTerminate();
}
}
diff --git a/app/src/main/java/com/aurora/store/AuroraGlide.java b/app/src/main/java/com/aurora/store/AuroraGlide.java
index a78066cbb..879ba0584 100644
--- a/app/src/main/java/com/aurora/store/AuroraGlide.java
+++ b/app/src/main/java/com/aurora/store/AuroraGlide.java
@@ -25,7 +25,7 @@ import android.graphics.Bitmap;
import androidx.annotation.NonNull;
-import com.aurora.store.utility.Util;
+import com.aurora.store.util.Util;
import com.bumptech.glide.Glide;
import com.bumptech.glide.GlideBuilder;
import com.bumptech.glide.Registry;
diff --git a/app/src/main/java/com/aurora/store/BulkUpdateService.java b/app/src/main/java/com/aurora/store/BulkUpdateService.java
new file mode 100644
index 000000000..adc38d4d5
--- /dev/null
+++ b/app/src/main/java/com/aurora/store/BulkUpdateService.java
@@ -0,0 +1,110 @@
+package com.aurora.store;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+
+import androidx.annotation.Nullable;
+
+import com.aurora.store.events.Event;
+import com.aurora.store.exception.CredentialsEmptyException;
+import com.aurora.store.exception.MalformedRequestException;
+import com.aurora.store.exception.NotPurchasedException;
+import com.aurora.store.exception.TooManyRequestsException;
+import com.aurora.store.model.App;
+import com.aurora.store.notification.QuickNotification;
+import com.aurora.store.task.LiveUpdate;
+import com.aurora.store.task.ObservableDeliveryData;
+import com.aurora.store.util.Log;
+import com.dragons.aurora.playstoreapiv2.AuthException;
+
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+
+import io.reactivex.Observable;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.disposables.CompositeDisposable;
+import io.reactivex.schedulers.Schedulers;
+
+public class BulkUpdateService extends Service {
+ public static BulkUpdateService instance = null;
+
+ private List appList = new ArrayList<>();
+ private CompositeDisposable disposable = new CompositeDisposable();
+
+ public static boolean isServiceRunning() {
+ try {
+ return instance != null && instance.isRunning();
+ } catch (NullPointerException e) {
+ return false;
+ }
+ }
+
+ private boolean isRunning() {
+ return true;
+ }
+
+
+ @Nullable
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ return START_NOT_STICKY;
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ instance = this;
+ appList = AuroraApplication.getOngoingUpdateList();
+ updateAllApps();
+ }
+
+ private void updateAllApps() {
+ AuroraApplication.setBulkUpdateAlive(true);
+ AuroraApplication.rxNotify(new Event(Event.SubType.BULK_UPDATE_NOTIFY));
+ disposable.add(Observable.fromIterable(appList)
+ .flatMap(app -> new ObservableDeliveryData(getApplicationContext()).getDeliveryData(app))
+ .subscribeOn(Schedulers.computation())
+ .observeOn(AndroidSchedulers.mainThread())
+ .doOnNext(deliveryDataBundle -> new LiveUpdate(getApplicationContext())
+ .enqueueUpdate(deliveryDataBundle.getApp(),
+ deliveryDataBundle.getAndroidAppDeliveryData()))
+ .subscribe(deliveryDataBundle -> {
+ }, err -> {
+ if (err instanceof MalformedRequestException || err instanceof NotPurchasedException) {
+ QuickNotification.show(getApplication(),
+ getString(R.string.action_updates),
+ err.getMessage(),
+ null);
+ }
+ processException(err);
+ Log.e(err.getMessage());
+ }));
+ }
+
+ private void processException(Throwable e) {
+ if (e instanceof CredentialsEmptyException) {
+ AuroraApplication.rxNotify(new Event(Event.SubType.API_ERROR));
+ } else if (e instanceof AuthException | e instanceof TooManyRequestsException) {
+ AuroraApplication.rxNotify(new Event(Event.SubType.API_FAILED));
+ } else if (e instanceof UnknownHostException) {
+ AuroraApplication.rxNotify(new Event(Event.SubType.NETWORK_UNAVAILABLE));
+ } else
+ Log.e(e.getMessage());
+ stopSelf();
+ }
+
+ @Override
+ public void onDestroy() {
+ AuroraApplication.setBulkUpdateAlive(false);
+ AuroraApplication.rxNotify(new Event(Event.SubType.BULK_UPDATE_NOTIFY));
+ instance = null;
+ super.onDestroy();
+ }
+}
diff --git a/app/src/main/java/com/aurora/store/Constants.java b/app/src/main/java/com/aurora/store/Constants.java
index 569906118..aac0b8bc1 100644
--- a/app/src/main/java/com/aurora/store/Constants.java
+++ b/app/src/main/java/com/aurora/store/Constants.java
@@ -31,6 +31,7 @@ public class Constants {
public static final String INTENT_DEVICE_NAME = "INTENT_DEVICE_NAME";
public static final String INTENT_DEVICE_INDEX = "INTENT_DEVICE_INDEX";
public static final String INTENT_FRAGMENT_POSITION = "INTENT_FRAGMENT_POSITION";
+ public static final String INTENT_PACKAGE_NAME = "INTENT_PACKAGE_NAME";
public static final String BUILD_DEVICE = "Build.DEVICE";
public static final String BUILD_MANUFACTURER = "Build.MANUFACTURER";
@@ -40,16 +41,18 @@ public class Constants {
public static final String TAG = "Aurora Store";
public static final String FILES = "Files";
+ public static final String CATEGORY_APPS = "APPLICATION";
+ public static final String CATEGORY_GAME = "GAME";
+ public static final String CATEGORY_FAMILY = "FAMILY";
+
+ public static final String TOP_APPS = "TOP_APPS";
+ public static final String TOP_GAME = "TOP_GAME";
+ public static final String TOP_FAMILY = "TOP_FAMILY";
+
public static final String RECENT_HISTORY = "RECENT_HISTORY";
- public static final String FILTER_SYSTEM_APPS = "FILTER_SYSTEM_APPS";
- public static final String FILTER_APPS_WITH_ADS = "FILTER_APPS_WITH_ADS";
- public static final String FILTER_PAID_APPS = "FILTER_PAID_APPS";
- public static final String FILTER_GSF_DEPENDENT_APPS = "FILTER_GSF_DEPENDENT_APPS";
- public static final String FILTER_CATEGORY = "FILTER_CATEGORY";
- public static final String FILTER_RATING = "FILTER_RATING";
- public static final String FILTER_DOWNLOADS = "FILTER_DOWNLOADS";
-
+ public static final String NOTIFICATION_CHANNEL_ALERT = "NOTIFICATION_CHANNEL_ALERT";
+ public static final String NOTIFICATION_CHANNEL_GENERAL = "NOTIFICATION_CHANNEL_GENERAL";
public static final String PRIVILEGED_EXTENSION_PACKAGE_NAME = "com.aurora.services";
public static final String PRIVILEGED_EXTENSION_SERVICE_INTENT = "com.aurora.services.IPrivilegedService";
@@ -57,9 +60,7 @@ public class Constants {
public static final String PREFERENCE_THEME = "PREFERENCE_THEME";
public static final String PREFERENCE_DEFAULT_TAB = "PREFERENCE_DEFAULT_TAB";
public static final String PREFERENCE_UI_CARD_STYLE = "PREFERENCE_UI_CARD_STYLE";
- public static final String PREFERENCE_UI_TRANSPARENT = "PREFERENCE_UI_TRANSPARENT";
public static final String PREFERENCE_FEATURED_SNAP = "PREFERENCE_FEATURED_SNAP";
- public static final String PREFERENCE_TAB_MODE = "PREFERENCE_TAB_MODE";
public static final String PREFERENCE_SEARCH_IME = "PREFERENCE_SEARCH_IME";
public static final String PREFERENCE_SEARCH_PACKAGE = "PREFERENCE_SEARCH_PACKAGE";
public static final String PREFERENCE_DO_NOT_SHOW_INTRO = "PREFERENCE_DO_NOT_SHOW_INTRO";
@@ -70,6 +71,7 @@ public class Constants {
public static final String PREFERENCE_DEVICE_TO_PRETEND_TO_BE_INDEX = "PREFERENCE_DEVICE_TO_PRETEND_TO_BE_INDEX";
public static final String PREFERENCE_REQUESTED_LOCATION_INDEX = "PREFERENCE_REQUESTED_LOCATION_INDEX";
public static final String PREFERENCE_BLACKLIST_APPS_LIST = "PREFERENCE_BLACKLIST_APPS_LIST";
+ public static final String PREFERENCE_FILTER_APPS = "PREFERENCE_FILTER_APPS";
public static final String PREFERENCE_FILTER_GOOGLE = "PREFERENCE_FILTER_GOOGLE";
public static final String PREFERENCE_FILTER_F_DROID = "PREFERENCE_FILTER_F_DROID";
public static final String PREFERENCE_FILTER_SEARCH = "PREFERENCE_FILTER_SEARCH";
@@ -109,11 +111,16 @@ public class Constants {
public static final String PREFERENCE_INSTALLATION_PROFILE = "PREFERENCE_INSTALLATION_PROFILE";
public static final String PREFERENCE_ACCOUNTS_PASSWORD_SWITCH = "PREFERENCE_ACCOUNTS_PASSWORD_SWITCH";
- public static final String PREFERENCE_TOP_APPS = "PREFERENCE_TOP_APPS";
- public static final String PREFERENCE_TOP_GAMES = "PREFERENCE_TOP_GAMES";
- public static final String PREFERENCE_TOP_FAMILY = "PREFERENCE_TOP_FAMILY";
public static final String PREFERENCE_INSTALLED_APPS = "PREFERENCE_INSTALLED_APPS";
public static final String PREFERENCE_CACHE_DATE = "PREFERENCE_CACHE_DATE";
public static final String PREFERENCE_SELF_UPDATE_DATE = "PREFERENCE_SELF_UPDATE_DATE";
public static final String PREFERENCE_SELF_UPDATE = "PREFERENCE_SELF_UPDATE";
+
+
+ public static final String FRAGMENT_NAME = "FRAGMENT_NAME";
+ public static final String FRAGMENT_ABOUT = "FRAGMENT_ABOUT";
+ public static final String FRAGMENT_ACCOUNTS = "FRAGMENT_ACCOUNTS";
+ public static final String FRAGMENT_BLACKLIST = "FRAGMENT_BLACKLIST";
+ public static final String FRAGMENT_FAV_LIST = "FRAGMENT_FAV_LIST";
+ public static final String FRAGMENT_SPOOF = "FRAGMENT_SPOOF";
}
diff --git a/app/src/main/java/com/aurora/store/FavouriteItemTouchHelper.java b/app/src/main/java/com/aurora/store/FavouriteItemTouchHelper.java
deleted file mode 100644
index 8fe60f4ee..000000000
--- a/app/src/main/java/com/aurora/store/FavouriteItemTouchHelper.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store;
-
-import android.graphics.Canvas;
-import android.view.View;
-
-import androidx.recyclerview.widget.ItemTouchHelper;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.aurora.store.adapter.SelectableViewHolder;
-
-import org.jetbrains.annotations.NotNull;
-
-public class FavouriteItemTouchHelper extends ItemTouchHelper.SimpleCallback {
-
- private RecyclerItemTouchHelperListener listener;
-
- public FavouriteItemTouchHelper(int dragDirs, int swipeDirs, RecyclerItemTouchHelperListener listener) {
- super(dragDirs, swipeDirs);
- this.listener = listener;
- }
-
- @Override
- public boolean onMove(@NotNull RecyclerView recyclerView, @NotNull RecyclerView.ViewHolder viewHolder, @NotNull RecyclerView.ViewHolder target) {
- return true;
- }
-
- @Override
- public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
- if (viewHolder != null) {
- final View foregroundView = ((SelectableViewHolder) viewHolder).viewForeground;
- getDefaultUIUtil().onSelected(foregroundView);
- }
- }
-
- @Override
- public void onChildDrawOver(@NotNull Canvas c, @NotNull RecyclerView recyclerView,
- RecyclerView.ViewHolder viewHolder, float dX, float dY,
- int actionState, boolean isCurrentlyActive) {
- final View foregroundView = ((SelectableViewHolder) viewHolder).viewForeground;
- getDefaultUIUtil().onDrawOver(c, recyclerView, foregroundView, dX, dY,
- actionState, isCurrentlyActive);
- }
-
- @Override
- public void clearView(@NotNull RecyclerView recyclerView, @NotNull RecyclerView.ViewHolder viewHolder) {
- final View foregroundView = ((SelectableViewHolder) viewHolder).viewForeground;
- getDefaultUIUtil().clearView(foregroundView);
- }
-
- @Override
- public void onChildDraw(@NotNull Canvas c, @NotNull RecyclerView recyclerView, @NotNull
- RecyclerView.ViewHolder viewHolder, float dX, float dY,
- int actionState, boolean isCurrentlyActive) {
- final View foregroundView = ((SelectableViewHolder) viewHolder).viewForeground;
-
- getDefaultUIUtil().onDraw(c, recyclerView, foregroundView, dX, dY,
- actionState, isCurrentlyActive);
- }
-
- @Override
- public void onSwiped(@NotNull RecyclerView.ViewHolder viewHolder, int direction) {
- listener.onSwiped(viewHolder, direction, viewHolder.getAdapterPosition());
- }
-
- @Override
- public int convertToAbsoluteDirection(int flags, int layoutDirection) {
- return super.convertToAbsoluteDirection(flags, layoutDirection);
- }
-
- public interface RecyclerItemTouchHelperListener {
- void onSwiped(RecyclerView.ViewHolder viewHolder, int direction, int position);
- }
-}
diff --git a/app/src/main/java/com/aurora/store/Filter.java b/app/src/main/java/com/aurora/store/Filter.java
deleted file mode 100644
index 4843cdbc4..000000000
--- a/app/src/main/java/com/aurora/store/Filter.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Yalp Store
- * Copyright (C) 2018 Sergey Yeriomin
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-
-import com.aurora.store.utility.PrefUtil;
-import com.aurora.store.utility.Util;
-
-public class Filter {
-
- private Context context;
-
- public Filter(Context context) {
- this.context = context;
- }
-
- public com.aurora.store.model.Filter getFilterPreferences() {
- com.aurora.store.model.Filter filter = new com.aurora.store.model.Filter();
- SharedPreferences prefs = Util.getPrefs(context);
- filter.setSystemApps(prefs.getBoolean(Constants.FILTER_SYSTEM_APPS, false));
- filter.setAppsWithAds(prefs.getBoolean(Constants.FILTER_APPS_WITH_ADS, true));
- filter.setPaidApps(prefs.getBoolean(Constants.FILTER_PAID_APPS, true));
- filter.setGsfDependentApps(prefs.getBoolean(Constants.FILTER_GSF_DEPENDENT_APPS, true));
- filter.setCategory(prefs.getString(Constants.FILTER_CATEGORY, Constants.TOP));
- filter.setRating(prefs.getFloat(Constants.FILTER_RATING, 0.0f));
- filter.setDownloads(prefs.getInt(Constants.FILTER_DOWNLOADS, 0));
- return filter;
- }
-
- public void resetFilterPreferences() {
- SharedPreferences prefs = Util.getPrefs(context);
- PrefUtil.putBoolean(context, Constants.FILTER_SYSTEM_APPS, false);
- PrefUtil.putBoolean(context, Constants.FILTER_APPS_WITH_ADS, true);
- PrefUtil.putBoolean(context, Constants.FILTER_PAID_APPS, true);
- PrefUtil.putBoolean(context, Constants.FILTER_GSF_DEPENDENT_APPS, true);
- PrefUtil.putString(context, Constants.FILTER_CATEGORY, Constants.TOP);
- PrefUtil.putFloat(context, Constants.FILTER_RATING, 0.0f);
- PrefUtil.putInteger(context, Constants.FILTER_DOWNLOADS, 0);
- }
-}
diff --git a/app/src/main/java/com/aurora/store/HistoryItemTouchHelper.java b/app/src/main/java/com/aurora/store/HistoryItemTouchHelper.java
deleted file mode 100644
index e93bc13b9..000000000
--- a/app/src/main/java/com/aurora/store/HistoryItemTouchHelper.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store;
-
-import android.graphics.Canvas;
-import android.view.View;
-
-import androidx.recyclerview.widget.ItemTouchHelper;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.aurora.store.adapter.SearchHistoryAdapter;
-
-public class HistoryItemTouchHelper extends ItemTouchHelper.SimpleCallback {
-
- private RecyclerItemTouchHelperListener listener;
-
- public HistoryItemTouchHelper(int dragDirs, int swipeDirs, RecyclerItemTouchHelperListener listener) {
- super(dragDirs, swipeDirs);
- this.listener = listener;
- }
-
- @Override
- public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
- return true;
- }
-
- @Override
- public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
- if (viewHolder != null) {
- final View foregroundView = ((SearchHistoryAdapter.ViewHolder) viewHolder).viewForeground;
- getDefaultUIUtil().onSelected(foregroundView);
- }
- }
-
- @Override
- public void onChildDrawOver(Canvas c, RecyclerView recyclerView,
- RecyclerView.ViewHolder viewHolder, float dX, float dY,
- int actionState, boolean isCurrentlyActive) {
- final View foregroundView = ((SearchHistoryAdapter.ViewHolder) viewHolder).viewForeground;
- getDefaultUIUtil().onDrawOver(c, recyclerView, foregroundView, dX, dY,
- actionState, isCurrentlyActive);
- }
-
- @Override
- public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
- final View foregroundView = ((SearchHistoryAdapter.ViewHolder) viewHolder).viewForeground;
- getDefaultUIUtil().clearView(foregroundView);
- }
-
- @Override
- public void onChildDraw(Canvas c, RecyclerView recyclerView,
- RecyclerView.ViewHolder viewHolder, float dX, float dY,
- int actionState, boolean isCurrentlyActive) {
- final View foregroundView = ((SearchHistoryAdapter.ViewHolder) viewHolder).viewForeground;
-
- getDefaultUIUtil().onDraw(c, recyclerView, foregroundView, dX, dY,
- actionState, isCurrentlyActive);
- }
-
- @Override
- public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
- listener.onSwiped(viewHolder, direction, viewHolder.getAdapterPosition());
- }
-
- @Override
- public int convertToAbsoluteDirection(int flags, int layoutDirection) {
- return super.convertToAbsoluteDirection(flags, layoutDirection);
- }
-
- public interface RecyclerItemTouchHelperListener {
- void onSwiped(RecyclerView.ViewHolder viewHolder, int direction, int position);
- }
-}
diff --git a/app/src/main/java/com/aurora/store/ListType.java b/app/src/main/java/com/aurora/store/ListType.java
deleted file mode 100644
index b94104046..000000000
--- a/app/src/main/java/com/aurora/store/ListType.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store;
-
-public enum ListType {
- INSTALLED,
- UPDATES,
- ENDLESS
-}
diff --git a/app/src/main/java/com/aurora/store/PermissionGroup.java b/app/src/main/java/com/aurora/store/PermissionGroup.java
index b1284003a..da48647d1 100644
--- a/app/src/main/java/com/aurora/store/PermissionGroup.java
+++ b/app/src/main/java/com/aurora/store/PermissionGroup.java
@@ -37,8 +37,8 @@ import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
-import com.aurora.store.utility.Util;
-import com.aurora.store.utility.ViewUtil;
+import com.aurora.store.util.Util;
+import com.aurora.store.util.ViewUtil;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import org.apache.commons.lang3.StringUtils;
@@ -101,7 +101,7 @@ public class PermissionGroup extends LinearLayout {
public void setPermissionGroupInfo(final PermissionGroupInfo permissionGroupInfo) {
this.permissionGroupInfo = permissionGroupInfo;
- ImageView imageView = (ImageView) findViewById(R.id.permission_group_icon);
+ ImageView imageView = findViewById(R.id.permission_group_icon);
imageView.setImageDrawable(getPermissionGroupIcon(permissionGroupInfo));
imageView.setColorFilter(ViewUtil.getStyledAttribute(imageView.getContext(), android.R.attr.colorAccent));
}
diff --git a/app/src/main/java/com/aurora/store/PermissionsComparator.java b/app/src/main/java/com/aurora/store/PermissionsComparator.java
deleted file mode 100644
index 3f4c6b40e..000000000
--- a/app/src/main/java/com/aurora/store/PermissionsComparator.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Yalp Store
- * Copyright (C) 2018 Sergey Yeriomin
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store;
-
-import android.content.Context;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.text.TextUtils;
-
-import com.aurora.store.model.App;
-import com.aurora.store.utility.Log;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-public class PermissionsComparator {
-
- private Context context;
-
- public PermissionsComparator(Context context) {
- this.context = context;
- }
-
- public boolean isSame(App app) {
- Log.i("Checking %s", app.getPackageName());
- Set oldPermissions = getOldPermissions(app.getPackageName());
- if (null == oldPermissions) {
- return true;
- }
- Set newPermissions = new HashSet<>(app.getPermissions());
- newPermissions.removeAll(oldPermissions);
- Log.i(newPermissions.isEmpty()
- ? app.getPackageName() + " requests no new permissions"
- : app.getPackageName() + " requests new permissions: " + TextUtils.join(", ", newPermissions));
- return newPermissions.isEmpty();
- }
-
- private Set getOldPermissions(String packageName) {
- PackageManager pm = context.getPackageManager();
- try {
- PackageInfo pi = pm.getPackageInfo(packageName, PackageManager.GET_PERMISSIONS);
- return new HashSet<>(Arrays.asList(
- null == pi.requestedPermissions
- ? new String[0]
- : pi.requestedPermissions
- ));
- } catch (PackageManager.NameNotFoundException e) {
- Log.e("Package " + packageName + " doesn't seem to be installed");
- }
- return null;
- }
-}
diff --git a/app/src/main/java/com/aurora/store/ReviewsDiffCallback.java b/app/src/main/java/com/aurora/store/ReviewsDiffCallback.java
new file mode 100644
index 000000000..554790721
--- /dev/null
+++ b/app/src/main/java/com/aurora/store/ReviewsDiffCallback.java
@@ -0,0 +1,37 @@
+package com.aurora.store;
+
+import androidx.recyclerview.widget.DiffUtil;
+
+import com.aurora.store.model.Review;
+
+import java.util.List;
+
+public class ReviewsDiffCallback extends DiffUtil.Callback {
+ private List newList;
+ private List oldList;
+
+ public ReviewsDiffCallback(List newList, List oldList) {
+ this.newList = newList;
+ this.oldList = oldList;
+ }
+
+ @Override
+ public int getOldListSize() {
+ return oldList != null ? oldList.size() : 0;
+ }
+
+ @Override
+ public int getNewListSize() {
+ return newList != null ? newList.size() : 0;
+ }
+
+ @Override
+ public boolean areItemsTheSame(int oldIndex, int newIndex) {
+ return true;
+ }
+
+ @Override
+ public boolean areContentsTheSame(int oldIndex, int newIndex) {
+ return oldList.get(oldIndex).equals(newList.get(newIndex));
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/aurora/store/SelfUpdateService.java b/app/src/main/java/com/aurora/store/SelfUpdateService.java
index 268f20dcc..d65d2da79 100644
--- a/app/src/main/java/com/aurora/store/SelfUpdateService.java
+++ b/app/src/main/java/com/aurora/store/SelfUpdateService.java
@@ -18,10 +18,10 @@ import com.aurora.store.download.RequestBuilder;
import com.aurora.store.model.App;
import com.aurora.store.model.Update;
import com.aurora.store.task.NetworkTask;
-import com.aurora.store.utility.CertUtil;
-import com.aurora.store.utility.ContextUtil;
-import com.aurora.store.utility.Log;
-import com.aurora.store.utility.PackageUtil;
+import com.aurora.store.util.CertUtil;
+import com.aurora.store.util.ContextUtil;
+import com.aurora.store.util.Log;
+import com.aurora.store.util.PackageUtil;
import com.google.gson.Gson;
import com.tonyodev.fetch2.AbstractFetchGroupListener;
import com.tonyodev.fetch2.Download;
@@ -79,6 +79,7 @@ public class SelfUpdateService extends Service {
@Override
public void onCreate() {
super.onCreate();
+ instance = this;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
startForeground(1, getNotification());
} else {
@@ -119,7 +120,7 @@ public class SelfUpdateService extends Service {
} else
downloadAndUpdate(update);
} catch (Exception e) {
- Log.e("Error checking self-update");
+ Log.d("Error checking self-update");
destroyService();
}
}));
@@ -189,7 +190,7 @@ public class SelfUpdateService extends Service {
public void onError(int groupId, @NotNull Download download, @NotNull Error error,
@org.jetbrains.annotations.Nullable Throwable throwable, @NotNull FetchGroup fetchGroup) {
if (groupId == hashCode) {
- Log.e("Error self-updating %s", app.getDisplayName());
+ Log.d("Error self-updating %s", app.getDisplayName());
destroyService();
}
}
@@ -205,7 +206,7 @@ public class SelfUpdateService extends Service {
@Override
public void onCancelled(int groupId, @NotNull Download download, @NotNull FetchGroup fetchGroup) {
if (groupId == hashCode) {
- Log.e("Self-update cancelled %s", app.getDisplayName());
+ Log.d("Self-update cancelled %s", app.getDisplayName());
destroyService();
}
}
diff --git a/app/src/main/java/com/aurora/store/SuggestionDiffCallback.java b/app/src/main/java/com/aurora/store/SuggestionDiffCallback.java
new file mode 100644
index 000000000..469f6885d
--- /dev/null
+++ b/app/src/main/java/com/aurora/store/SuggestionDiffCallback.java
@@ -0,0 +1,37 @@
+package com.aurora.store;
+
+import androidx.recyclerview.widget.DiffUtil;
+
+import com.dragons.aurora.playstoreapiv2.SearchSuggestEntry;
+
+import java.util.List;
+
+public class SuggestionDiffCallback extends DiffUtil.Callback {
+ private List newList;
+ private List oldList;
+
+ public SuggestionDiffCallback(List newList, List oldList) {
+ this.newList = newList;
+ this.oldList = oldList;
+ }
+
+ @Override
+ public int getOldListSize() {
+ return oldList != null ? oldList.size() : 0;
+ }
+
+ @Override
+ public int getNewListSize() {
+ return newList != null ? newList.size() : 0;
+ }
+
+ @Override
+ public boolean areItemsTheSame(int oldIndex, int newIndex) {
+ return true;
+ }
+
+ @Override
+ public boolean areContentsTheSame(int oldIndex, int newIndex) {
+ return oldList.get(oldIndex).equals(newList.get(newIndex));
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/aurora/store/TokenDispenserMirrors.java b/app/src/main/java/com/aurora/store/TokenDispenserMirrors.java
index 0c5520595..bcb123f97 100644
--- a/app/src/main/java/com/aurora/store/TokenDispenserMirrors.java
+++ b/app/src/main/java/com/aurora/store/TokenDispenserMirrors.java
@@ -25,8 +25,8 @@ package com.aurora.store;
import android.content.Context;
-import com.aurora.store.utility.PrefUtil;
-import com.aurora.store.utility.Util;
+import com.aurora.store.util.PrefUtil;
+import com.aurora.store.util.Util;
import java.util.ArrayList;
import java.util.List;
diff --git a/app/src/main/java/com/aurora/store/ValidateApiService.java b/app/src/main/java/com/aurora/store/ValidateApiService.java
new file mode 100644
index 000000000..a107a2daf
--- /dev/null
+++ b/app/src/main/java/com/aurora/store/ValidateApiService.java
@@ -0,0 +1,130 @@
+package com.aurora.store;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+
+import androidx.annotation.Nullable;
+
+import com.aurora.store.api.PlayStoreApiAuthenticator;
+import com.aurora.store.events.Event;
+import com.aurora.store.exception.CredentialsEmptyException;
+import com.aurora.store.exception.TooManyRequestsException;
+import com.aurora.store.util.ApiBuilderUtil;
+import com.aurora.store.util.Log;
+import com.dragons.aurora.playstoreapiv2.AuthException;
+import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
+import com.dragons.aurora.playstoreapiv2.TocResponse;
+
+import java.net.UnknownHostException;
+
+import io.reactivex.Observable;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.disposables.CompositeDisposable;
+import io.reactivex.schedulers.Schedulers;
+
+public class ValidateApiService extends Service {
+ public static ValidateApiService instance = null;
+
+ private CompositeDisposable disposable = new CompositeDisposable();
+
+
+ public static boolean isServiceRunning() {
+ try {
+ return instance != null && instance.isRunning();
+ } catch (NullPointerException e) {
+ return false;
+ }
+ }
+
+ private boolean isRunning() {
+ return true;
+ }
+
+
+ @Nullable
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ return START_NOT_STICKY;
+ }
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ instance = this;
+ buildAndTestApi();
+ }
+
+ private void buildAndTestApi() {
+ Log.d(getString(R.string.toast_api_build_api));
+ disposable.clear();
+ disposable.add(Observable.fromCallable(() -> new PlayStoreApiAuthenticator()
+ .getPlayApi(this))
+ .flatMap(api -> {
+ AuroraApplication.api = api;
+ return getTocResponse(api);
+ })
+ .subscribeOn(Schedulers.computation())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(response -> {
+ Log.d(getString(R.string.toast_api_all_ok));
+ AuroraApplication.rxNotify(new Event(Event.SubType.API_SUCCESS));
+ }, err -> {
+ Log.d(getString(R.string.toast_api_build_failed));
+ processException(err);
+ })
+ );
+ }
+
+ private void processException(Throwable e) {
+ if (e instanceof CredentialsEmptyException) {
+ AuroraApplication.rxNotify(new Event(Event.SubType.API_ERROR));
+ } else if (e instanceof AuthException | e instanceof TooManyRequestsException) {
+ AuroraApplication.rxNotify(new Event(Event.SubType.API_FAILED));
+ getNewAuthToken();
+ } else if (e instanceof UnknownHostException) {
+ AuroraApplication.rxNotify(new Event(Event.SubType.NETWORK_UNAVAILABLE));
+ } else
+ Log.e(e.getMessage());
+ stopSelf();
+ }
+
+ public void getNewAuthToken() {
+ disposable.clear();
+ disposable.add(Observable.fromCallable(() -> ApiBuilderUtil
+ .generateApiWithNewAuthToken(this))
+ .flatMap(api -> {
+ AuroraApplication.api = api;
+ return getTocResponse(api);
+ })
+ .subscribeOn(Schedulers.computation())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(response -> {
+ AuroraApplication.rxNotify(new Event(Event.SubType.API_SUCCESS));
+ }, err -> {
+ Log.e(err.getMessage());
+ AuroraApplication.rxNotify(new Event(Event.SubType.API_ERROR));
+ })
+ );
+ }
+
+ public Observable getTocResponse(GooglePlayAPI api) {
+ return Observable.create(emitter -> {
+ TocResponse tocResponse = api.toc();
+ emitter.onNext(tocResponse);
+ emitter.onComplete();
+ });
+ }
+
+
+ @Override
+ public void onDestroy() {
+ instance = null;
+ super.onDestroy();
+ }
+}
diff --git a/app/src/main/java/com/aurora/store/activity/AuroraActivity.java b/app/src/main/java/com/aurora/store/activity/AuroraActivity.java
deleted file mode 100644
index 3ecb2656a..000000000
--- a/app/src/main/java/com/aurora/store/activity/AuroraActivity.java
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store.activity;
-
-import android.Manifest;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.MenuItem;
-
-import androidx.annotation.ColorInt;
-import androidx.appcompat.app.ActionBar;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.appcompat.widget.Toolbar;
-import androidx.core.app.ActivityCompat;
-import androidx.core.content.ContextCompat;
-import androidx.core.graphics.ColorUtils;
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
-
-import com.aurora.store.BuildConfig;
-import com.aurora.store.Constants;
-import com.aurora.store.R;
-import com.aurora.store.SelfUpdateService;
-import com.aurora.store.adapter.ViewPagerAdapter;
-import com.aurora.store.fragment.AppsFragment;
-import com.aurora.store.fragment.HomeFragment;
-import com.aurora.store.fragment.SearchFragment;
-import com.aurora.store.model.Update;
-import com.aurora.store.task.NetworkTask;
-import com.aurora.store.utility.Accountant;
-import com.aurora.store.utility.CertUtil;
-import com.aurora.store.utility.Log;
-import com.aurora.store.utility.NetworkUtil;
-import com.aurora.store.utility.PrefUtil;
-import com.aurora.store.utility.TextUtil;
-import com.aurora.store.utility.ThemeUtil;
-import com.aurora.store.utility.Util;
-import com.aurora.store.utility.ViewUtil;
-import com.aurora.store.view.CustomViewPager;
-import com.google.android.material.bottomnavigation.BottomNavigationView;
-import com.google.android.material.dialog.MaterialAlertDialogBuilder;
-import com.google.gson.Gson;
-
-import java.util.Calendar;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-import io.reactivex.Observable;
-import io.reactivex.android.schedulers.AndroidSchedulers;
-import io.reactivex.disposables.CompositeDisposable;
-import io.reactivex.schedulers.Schedulers;
-
-public class AuroraActivity extends AppCompatActivity {
-
-
- public static String externalQuery;
-
- @BindView(R.id.toolbar)
- Toolbar toolbar;
- @BindView(R.id.viewpager)
- CustomViewPager viewPager;
- @BindView(R.id.bottom_navigation)
- BottomNavigationView bottomNavigationView;
-
- private ActionBar actionBar;
- private ViewPagerAdapter pagerAdapter;
- private ThemeUtil themeUtil = new ThemeUtil();
- private CompositeDisposable disposable = new CompositeDisposable();
- private int fragmentCur = 0;
- private boolean isSearchIntent = false;
-
- public BottomNavigationView getBottomNavigation() {
- return bottomNavigationView;
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- themeUtil.onCreate(this);
- setContentView(R.layout.activity_main);
- ButterKnife.bind(this);
- fragmentCur = Util.getDefaultTab(this);
- onNewIntent(getIntent());
-
- if (!PrefUtil.getBoolean(this, Constants.PREFERENCE_DO_NOT_SHOW_INTRO)) {
- PrefUtil.putBoolean(this, Constants.PREFERENCE_DO_NOT_SHOW_INTRO, true);
- startActivity(new Intent(this, IntroActivity.class));
- finish();
- } else {
- if (Accountant.isLoggedIn(this))
- init();
- else
- startActivity(new Intent(this, AccountsActivity.class));
- }
-
- if (NetworkUtil.isConnected(this)) {
- if (Util.isCacheObsolete(this))
- Util.clearCache(this);
-
- if (Util.shouldCheckUpdate(this) && !SelfUpdateService.isServiceRunning())
- checkSelfUpdate();
- }
- checkPermissions();
- }
-
- private void init() {
- setupActionbar();
- setupViewPager();
- setupBottomNavigation();
- }
-
- @Override
- protected void onNewIntent(Intent intent) {
- super.onNewIntent(intent);
- Bundle bundle = intent.getExtras();
- if (bundle != null)
- fragmentCur = bundle.getInt(Constants.INTENT_FRAGMENT_POSITION);
- else if (intent.getScheme() != null && intent.getScheme().equals("market")) {
- fragmentCur = 2;
- isSearchIntent = true;
- if (intent.getData() != null)
- externalQuery = intent.getData().getQueryParameter("q");
- } else
- fragmentCur = Util.getDefaultTab(this);
- }
-
- @Override
- public void onBackPressed() {
- Fragment fragment = pagerAdapter.getItem(viewPager.getCurrentItem());
- if (!fragment.isAdded())
- return;
- if (fragment instanceof SearchFragment || fragment instanceof HomeFragment) {
- FragmentManager fragmentManager = fragment.getChildFragmentManager();
- if (!fragmentManager.getFragments().isEmpty())
- fragmentManager.popBackStack();
- else
- super.onBackPressed();
- } else
- super.onBackPressed();
- }
-
- @Override
- public boolean onSupportNavigateUp() {
- return super.onSupportNavigateUp();
- }
-
- @Override
- public boolean onCreateOptionsMenu(final Menu menu) {
- getMenuInflater().inflate(R.menu.menu_main, menu);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(final MenuItem menuItem) {
- switch (menuItem.getItemId()) {
- case android.R.id.home:
- onBackPressed();
- return true;
- case R.id.action_download:
- startActivity(new Intent(this, DownloadsActivity.class));
- return true;
- case R.id.action_setting:
- startActivity(new Intent(this, SettingsActivity.class));
- return true;
- }
- return super.onOptionsItemSelected(menuItem);
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- themeUtil.onResume(this);
- Util.toggleSoftInput(this, false);
- if (pagerAdapter == null)
- init();
- }
-
- @Override
- protected void onUserLeaveHint() {
- super.onUserLeaveHint();
- Util.toggleSoftInput(this, false);
- }
-
- @Override
- protected void onDestroy() {
- super.onDestroy();
- disposable.clear();
- }
-
- private void setupActionbar() {
- setSupportActionBar(toolbar);
- actionBar = getSupportActionBar();
- if (actionBar != null) {
- actionBar.setDisplayShowCustomEnabled(true);
- actionBar.setElevation(0f);
- actionBar.setTitle(getString(R.string.app_name));
- }
- }
-
- private void setupViewPager() {
- pagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
- pagerAdapter.addFragment(0, new HomeFragment());
- pagerAdapter.addFragment(1, new AppsFragment());
- pagerAdapter.addFragment(2, new SearchFragment());
- viewPager.setAdapter(pagerAdapter);
- viewPager.setScroll(false);
- viewPager.setOffscreenPageLimit(2);
- viewPager.setCurrentItem(fragmentCur, true);
- }
-
- private void setupBottomNavigation() {
- @ColorInt
- int backGroundColor = ViewUtil.getStyledAttribute(this, android.R.attr.colorBackground);
- bottomNavigationView.setBackgroundColor(ColorUtils.setAlphaComponent(backGroundColor, 245));
- bottomNavigationView.setOnNavigationItemSelectedListener(menuItem -> {
- viewPager.setCurrentItem(menuItem.getOrder(), true);
- switch (menuItem.getItemId()) {
- case R.id.action_home:
- Util.toggleSoftInput(this, false);
- actionBar.setTitle(getString(R.string.title_home));
- break;
- case R.id.action_apps:
- Util.toggleSoftInput(this, false);
- actionBar.setTitle(getString(R.string.title_installed));
- break;
- case R.id.action_search:
- if (Util.isIMEEnabled(this))
- Util.toggleSoftInput(this, true);
- actionBar.setTitle(getString(R.string.title_search));
- break;
- }
- return true;
- });
-
- if (isSearchIntent)
- bottomNavigationView.setSelectedItemId(R.id.action_search);
- if (fragmentCur != 0 && !isSearchIntent)
- bottomNavigationView.setSelectedItemId(bottomNavigationView.getMenu()
- .getItem(fragmentCur).getItemId());
- }
-
- private void checkSelfUpdate() {
- disposable.add(Observable.fromCallable(() -> new NetworkTask(this)
- .get(Constants.UPDATE_URL))
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(response -> {
- try {
- Util.setSelfUpdateTime(this, Calendar.getInstance().getTimeInMillis());
- Gson gson = new Gson();
- Update update = gson.fromJson(response, Update.class);
- if (update.getVersionCode() > BuildConfig.VERSION_CODE) {
- if (CertUtil.isFDroidApp(this, BuildConfig.APPLICATION_ID)
- && TextUtil.emptyIfNull(update.getFdroidBuild()).isEmpty()) {
- Log.d("FDroid build of latest version is not published yet");
- return;
- }
-
- if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
- showAddRepoDialog(update);
- } else {
- Log.i("No new update available");
- }
- }
- } catch (Exception e) {
- Log.e("Error checking updates");
- }
- }));
- }
-
- private void checkPermissions() {
- if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
- != PackageManager.PERMISSION_GRANTED) {
- ActivityCompat.requestPermissions(this,
- new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},
- 1337);
- }
- }
-
- protected void showAddRepoDialog(Update update) {
- final String changelog = TextUtil.emptyIfNull(update.getChangelog());
- MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this)
- .setTitle(getString(R.string.dialog_title_self_update))
- .setMessage(new StringBuilder()
- .append(update.getVersionName())
- .append("\n\n")
- .append(changelog.isEmpty() ? getString(R.string.details_no_changes) : changelog)
- .append("\n\n")
- .append(getString(R.string.dialog_desc_self_update))
- .toString())
- .setPositiveButton(getString(android.R.string.yes), (dialog, which) -> {
- Intent intent = new Intent(this, SelfUpdateService.class);
- startService(intent);
- })
- .setNegativeButton(getString(android.R.string.no), (dialog, which) -> {
- dialog.dismiss();
- });
- builder.create();
- builder.show();
- }
-}
diff --git a/app/src/main/java/com/aurora/store/activity/DetailsActivity.java b/app/src/main/java/com/aurora/store/activity/DetailsActivity.java
deleted file mode 100644
index ab2993209..000000000
--- a/app/src/main/java/com/aurora/store/activity/DetailsActivity.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store.activity;
-
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.text.TextUtils;
-import android.view.Menu;
-import android.view.MenuItem;
-
-import androidx.appcompat.app.ActionBar;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.appcompat.widget.Toolbar;
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
-import androidx.fragment.app.FragmentTransaction;
-
-import com.aurora.store.R;
-import com.aurora.store.fragment.DetailsFragment;
-import com.aurora.store.manager.BlacklistManager;
-import com.aurora.store.manager.FavouriteListManager;
-import com.aurora.store.utility.Log;
-import com.aurora.store.utility.ThemeUtil;
-
-import java.util.List;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-public class DetailsActivity extends AppCompatActivity {
-
- public static final String INTENT_PACKAGE_NAME = "INTENT_PACKAGE_NAME";
-
- @BindView(R.id.toolbar)
- Toolbar toolbar;
-
- private String packageName;
- private DetailsFragment detailsFragment;
- private ThemeUtil themeUtil = new ThemeUtil();
- private FavouriteListManager favouriteListManager;
-
- static public Intent getDetailsIntent(Context context, String packageName) {
- Intent intent = new Intent(context, DetailsActivity.class);
- intent.putExtra(DetailsActivity.INTENT_PACKAGE_NAME, packageName);
- return intent;
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- themeUtil.onCreate(this);
- setContentView(R.layout.activity_details);
- ButterKnife.bind(this);
- setupActionBar();
- favouriteListManager = new FavouriteListManager(this);
- onNewIntent(getIntent());
- }
-
- @Override
- protected void onNewIntent(Intent intent) {
- super.onNewIntent(intent);
-
- packageName = getIntentPackageName(intent);
- if (TextUtils.isEmpty(packageName)) {
- Log.e("No package name provided");
- finish();
- return;
- }
- Log.i("Getting info about %s", packageName);
- grabDetails(packageName);
- }
-
- @Override
- public boolean onCreateOptionsMenu(final Menu menu) {
- getMenuInflater().inflate(R.menu.menu_app_details, menu);
- menu.findItem(R.id.action_favourite).setIcon(favouriteListManager.contains(packageName)
- ? R.drawable.ic_favourite_red
- : R.drawable.ic_favourite_remove);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(final MenuItem menuItem) {
- switch (menuItem.getItemId()) {
- case android.R.id.home:
- onBackPressed();
- return true;
- case R.id.action_favourite:
- if (favouriteListManager.contains(packageName)) {
- favouriteListManager.remove(packageName);
- menuItem.setIcon(R.drawable.ic_favourite_remove);
- } else {
- favouriteListManager.add(packageName);
- menuItem.setIcon(R.drawable.ic_favourite_red);
- }
- return true;
- case R.id.action_manual:
- startActivity(new Intent(this, ManualDownloadActivity.class));
- return true;
- case R.id.action_downloads:
- startActivity(new Intent(this, DownloadsActivity.class));
- return true;
- case R.id.action_blacklist:
- new BlacklistManager(this).add(packageName);
- return true;
- }
- return super.onOptionsItemSelected(menuItem);
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- themeUtil.onResume(this);
- }
-
- @Override
- public void onBackPressed() {
- List fragments = getSupportFragmentManager().getFragments();
- if (fragments.get(0) instanceof DetailsFragment) {
- FragmentManager fm = fragments.get(0).getChildFragmentManager();
- if (!fm.getFragments().isEmpty())
- fm.popBackStack();
- else
- super.onBackPressed();
- } else
- super.onBackPressed();
- }
-
- private void setupActionBar() {
- setSupportActionBar(toolbar);
- ActionBar mActionBar = getSupportActionBar();
- if (mActionBar != null) {
- mActionBar.setDisplayHomeAsUpEnabled(true);
- mActionBar.setDisplayShowTitleEnabled(false);
- }
- }
-
- private String getIntentPackageName(Intent intent) {
- if (intent.hasExtra(INTENT_PACKAGE_NAME)) {
- return intent.getStringExtra(INTENT_PACKAGE_NAME);
- } else if (intent.getScheme() != null
- && (intent.getScheme().equals("market")
- || intent.getScheme().equals("http")
- || intent.getScheme().equals("https"))) {
- return intent.getData().getQueryParameter("id");
- } else if (intent.getExtras() != null) {
- Bundle bundle = intent.getExtras();
- return bundle.getString(INTENT_PACKAGE_NAME);
- }
- return null;
- }
-
- public void grabDetails(String packageName) {
- detailsFragment = new DetailsFragment();
- Bundle arguments = new Bundle();
- arguments.putString("PackageName", packageName);
- detailsFragment.setArguments(arguments);
- getSupportFragmentManager()
- .beginTransaction()
- .replace(R.id.content, detailsFragment)
- .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
- .commitAllowingStateLoss();
- }
-
- public void redrawButtons() {
- if (detailsFragment != null)
- detailsFragment.drawButtons();
- }
-
-}
diff --git a/app/src/main/java/com/aurora/store/activity/IntroActivity.java b/app/src/main/java/com/aurora/store/activity/IntroActivity.java
deleted file mode 100644
index 692966f5d..000000000
--- a/app/src/main/java/com/aurora/store/activity/IntroActivity.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store.activity;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.Menu;
-import android.view.MenuItem;
-
-import androidx.appcompat.app.ActionBar;
-import androidx.appcompat.app.AppCompatActivity;
-import androidx.appcompat.widget.Toolbar;
-
-import com.aurora.store.R;
-import com.aurora.store.adapter.ViewPagerAdapter;
-import com.aurora.store.fragment.AccountsFragment;
-import com.aurora.store.fragment.intro.LoginFragment;
-import com.aurora.store.fragment.intro.PermissionFragment;
-import com.aurora.store.fragment.intro.WelcomeFragment;
-import com.aurora.store.utility.Accountant;
-import com.aurora.store.utility.ThemeUtil;
-import com.aurora.store.view.CustomViewPager;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-public class IntroActivity extends AppCompatActivity {
-
- @BindView(R.id.viewpager)
- CustomViewPager viewPager;
- @BindView(R.id.toolbar)
- Toolbar toolbar;
-
- private ActionBar actionBar;
- private ThemeUtil themeUtil = new ThemeUtil();
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- themeUtil.onCreate(this);
- setContentView(R.layout.activity_intro);
- ButterKnife.bind(this);
- setupActionbar();
- setupViewPager();
- }
-
- @Override
- public boolean onCreateOptionsMenu(final Menu menu) {
- getMenuInflater().inflate(R.menu.menu_intro, menu);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(final MenuItem menuItem) {
- switch (menuItem.getItemId()) {
- case R.id.action_setting:
- startActivity(new Intent(this, SettingsActivity.class));
- return true;
- }
- return super.onOptionsItemSelected(menuItem);
- }
-
- private void setupActionbar() {
- setSupportActionBar(toolbar);
- actionBar = getSupportActionBar();
- if (actionBar != null) {
- actionBar.setDisplayShowCustomEnabled(true);
- actionBar.setDisplayShowTitleEnabled(false);
- actionBar.setElevation(0f);
- }
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- themeUtil.onResume(this);
- if (Accountant.isLoggedIn(this)) {
- startActivity(new Intent(this, AuroraActivity.class));
- finish();
- }
- }
-
- private void setupViewPager() {
- ViewPagerAdapter viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
- viewPagerAdapter.addFragment(0, new WelcomeFragment());
- viewPagerAdapter.addFragment(1, new PermissionFragment());
- viewPagerAdapter.addFragment(2, new LoginFragment());
- viewPager.setAdapter(viewPagerAdapter);
- viewPager.setScroll(false);
- }
-
- public void moveForward() {
- viewPager.setCurrentItem(viewPager.getCurrentItem() + 1);
- }
-}
diff --git a/app/src/main/java/com/aurora/store/adapter/BlacklistAdapter.java b/app/src/main/java/com/aurora/store/adapter/BlacklistAdapter.java
deleted file mode 100644
index 34e1eb2cf..000000000
--- a/app/src/main/java/com/aurora/store/adapter/BlacklistAdapter.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store.adapter;
-
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.CheckBox;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.aurora.store.GlideApp;
-import com.aurora.store.R;
-import com.aurora.store.model.App;
-
-import org.jetbrains.annotations.NotNull;
-
-import java.util.Collections;
-import java.util.List;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-
-public class BlacklistAdapter extends SelectableAdapter {
-
- private List appList;
- private ItemClickListener itemClickListener;
-
- public BlacklistAdapter(Context context, List appList, ItemClickListener itemClickListener) {
- super(context);
- this.itemClickListener = itemClickListener;
- this.appList = appList;
- }
-
- @NotNull
- @Override
- public ViewHolder onCreateViewHolder(@NotNull ViewGroup parent, int viewType) {
- View itemLayoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_blacklist, parent, false);
- return new ViewHolder(itemLayoutView, itemClickListener);
- }
-
- @Override
- public void onBindViewHolder(@NotNull ViewHolder viewHolder, int position) {
- final App app = appList.get(position);
- viewHolder.label.setText(app.getDisplayName());
- viewHolder.packageName.setText(app.getPackageName());
- viewHolder.checkBox.setChecked(isSelected(app.getPackageName()));
- GlideApp
- .with(context)
- .load(app.getIconInfo().getUrl())
- .into(viewHolder.icon);
- }
-
- @Override
- public int getItemCount() {
- return appList.size();
- }
-
- @Override
- public void toggleSelection(int position) {
- String packageName = appList.get(position).getPackageName();
- if (mSelections.contains(packageName)) {
- mSelections.remove(packageName);
- mBlacklistManager.remove(packageName);
- } else {
- mSelections.add(packageName);
- }
- notifyItemChanged(position);
- }
-
- public int getSelectedCount() {
- return mSelections.size();
- }
-
- public interface ItemClickListener {
- void onItemClicked(int position);
- }
-
- class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
-
- @BindView(R.id.label)
- TextView label;
- @BindView(R.id.packageName)
- TextView packageName;
- @BindView(R.id.icon)
- ImageView icon;
- @BindView(R.id.check)
- CheckBox checkBox;
-
- private ItemClickListener listener;
-
- ViewHolder(View itemLayoutView, ItemClickListener listener) {
- super(itemLayoutView);
- this.listener = listener;
- ButterKnife.bind(this, itemView);
- itemLayoutView.setOnClickListener(this);
- }
-
- @Override
- public void onClick(View v) {
- if (listener != null) {
- listener.onItemClicked(getAdapterPosition());
- }
- }
- }
-}
diff --git a/app/src/main/java/com/aurora/store/adapter/CategoriesListAdapter.java b/app/src/main/java/com/aurora/store/adapter/CategoriesListAdapter.java
deleted file mode 100644
index 8ca6ca98f..000000000
--- a/app/src/main/java/com/aurora/store/adapter/CategoriesListAdapter.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store.adapter;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
-import androidx.fragment.app.FragmentTransaction;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.aurora.store.R;
-import com.aurora.store.SharedPreferencesTranslator;
-import com.aurora.store.fragment.CategoryAppsFragment;
-import com.aurora.store.utility.Util;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-public class CategoriesListAdapter extends RecyclerView.Adapter {
-
- private Context context;
- private Fragment fragment;
- private Map categories = new HashMap<>();
-
- private Integer[] categoriesImg = {
- R.drawable.ic_android_wear,
- R.drawable.ic_art_design,
- R.drawable.ic_auto_vehicles,
- R.drawable.ic_beauty,
- R.drawable.ic_books_reference,
- R.drawable.ic_business,
- R.drawable.ic_comics,
- R.drawable.ic_communication,
- R.drawable.ic_dating,
- R.drawable.ic_education,
- R.drawable.ic_entertainment,
- R.drawable.ic_events,
- R.drawable.ic_family,
- R.drawable.ic_finance,
- R.drawable.ic_food_drink,
- R.drawable.ic_games,
- R.drawable.ic_health_fitness,
- R.drawable.ic_house_home,
- R.drawable.ic_libraries_demo,
- R.drawable.ic_lifestyle,
- R.drawable.ic_maps_navigation,
- R.drawable.ic_medical,
- R.drawable.ic_music__audio,
- R.drawable.ic_news_magazines,
- R.drawable.ic_parenting,
- R.drawable.ic_personalization,
- R.drawable.ic_photography,
- R.drawable.ic_productivity,
- R.drawable.ic_shopping,
- R.drawable.ic_social,
- R.drawable.ic_sports,
- R.drawable.ic_tools,
- R.drawable.ic_travel_local,
- R.drawable.ic_video_editors,
- R.drawable.ic_weather,
- };
-
- private SharedPreferencesTranslator translator;
-
- public CategoriesListAdapter(Fragment fragment) {
- this.fragment = fragment;
- this.context = fragment.getContext();
- translator = new SharedPreferencesTranslator(Util.getPrefs(context));
- }
-
- public void addData(Map categories) {
- this.categories.clear();
- this.categories = categories;
- notifyDataSetChanged();
- }
-
- public boolean isDataEmpty() {
- return categories.isEmpty();
- }
-
- @NonNull
- @Override
- public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- View view = LayoutInflater.from(parent.getContext())
- .inflate(R.layout.item_category_list, parent, false);
- return new ViewHolder(view);
- }
-
- @Override
- public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {
- holder.topLabel.setText(translator.getString(new ArrayList<>(categories.keySet()).get(position)));
- holder.topImage.setImageDrawable(context.getResources().getDrawable(categoriesImg[position]));
- holder.itemView.setOnClickListener(v -> {
- CategoryAppsFragment categoryAppsFragment = new CategoryAppsFragment();
- Bundle arguments = new Bundle();
- arguments.putString("CategoryId", new ArrayList<>(categories.keySet()).get(position));
- arguments.putString("CategoryName", translator.getString(new ArrayList<>(categories.keySet()).get(position)));
- categoryAppsFragment.setArguments(arguments);
- FragmentManager fragmentManager = fragment.getFragmentManager();
- if (fragmentManager != null)
- fragmentManager
- .beginTransaction()
- .replace(R.id.coordinator, categoryAppsFragment)
- .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
- .addToBackStack(null)
- .commit();
- });
- }
-
- @Override
- public int getItemCount() {
- return categories.size();
- }
-
- static class ViewHolder extends RecyclerView.ViewHolder {
-
- @BindView(R.id.all_cat_img)
- ImageView topImage;
- @BindView(R.id.all_cat_name)
- TextView topLabel;
-
- ViewHolder(@NonNull View itemView) {
- super(itemView);
- ButterKnife.bind(this, itemView);
- }
- }
-}
diff --git a/app/src/main/java/com/aurora/store/adapter/DownloadsAdapter.java b/app/src/main/java/com/aurora/store/adapter/DownloadsAdapter.java
index bd2356162..7aa715e37 100644
--- a/app/src/main/java/com/aurora/store/adapter/DownloadsAdapter.java
+++ b/app/src/main/java/com/aurora/store/adapter/DownloadsAdapter.java
@@ -30,15 +30,20 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
+import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
+import com.aurora.store.Constants;
import com.aurora.store.GlideApp;
import com.aurora.store.R;
-import com.aurora.store.activity.DetailsActivity;
-import com.aurora.store.activity.DownloadsActivity;
import com.aurora.store.sheet.DownloadMenuSheet;
-import com.aurora.store.utility.PackageUtil;
-import com.aurora.store.utility.Util;
+import com.aurora.store.ui.details.DetailsActivity;
+import com.aurora.store.ui.single.activity.DownloadsActivity;
+import com.aurora.store.util.PackageUtil;
+import com.aurora.store.util.Util;
+import com.aurora.store.util.ViewUtil;
+import com.bumptech.glide.load.resource.bitmap.CenterCrop;
+import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.tonyodev.fetch2.Download;
import com.tonyodev.fetch2.Status;
@@ -105,6 +110,7 @@ public class DownloadsAdapter extends RecyclerView.Adapter {
Intent intent = new Intent(context, DetailsActivity.class);
- intent.putExtra("INTENT_PACKAGE_NAME", packageName);
- context.startActivity(intent);
+ intent.putExtra(Constants.INTENT_PACKAGE_NAME, packageName);
+ context.startActivity(intent, ViewUtil.getEmptyActivityBundle((AppCompatActivity) context));
});
viewHolder.itemView.setOnLongClickListener(v -> {
diff --git a/app/src/main/java/com/aurora/store/adapter/EndlessAppsAdapter.java b/app/src/main/java/com/aurora/store/adapter/EndlessAppsAdapter.java
deleted file mode 100644
index 4cfa4fc75..000000000
--- a/app/src/main/java/com/aurora/store/adapter/EndlessAppsAdapter.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store.adapter;
-
-import android.content.Context;
-
-import androidx.annotation.NonNull;
-
-import com.aurora.store.ListType;
-import com.aurora.store.R;
-import com.aurora.store.model.App;
-import com.aurora.store.utility.PackageUtil;
-import com.aurora.store.utility.Util;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.List;
-
-public class EndlessAppsAdapter extends InstalledAppsAdapter {
-
- public EndlessAppsAdapter(Context context) {
- super(context, ListType.ENDLESS);
- }
-
- @Override
- public void onBindViewHolder(@NonNull InstalledAppsAdapter.ViewHolder holder, int position) {
- super.onBindViewHolder(holder, position);
- }
-
- @Override
- public void getDetails(List Version, List Extra, App app) {
- Version.add(Util.addSiPrefix(app.getSize()));
- if (!app.isEarlyAccess())
- Version.add(context.getString(R.string.details_rating, (app.getRating().getAverage())));
- if (PackageUtil.isInstalled(context, app.getPackageName()))
- Version.add(context.getString(R.string.action_installed));
- Extra.add(app.getPrice());
- Extra.add(context.getString(app.containsAds() ? R.string.list_app_has_ads : R.string.list_app_no_ads));
- Extra.add(context.getString(app.getDependencies().isEmpty() ? R.string.list_app_independent_from_gsf : R.string.list_app_depends_on_gsf));
- if (!StringUtils.isEmpty(app.getUpdated()))
- Extra.add(app.getUpdated());
- }
-}
diff --git a/app/src/main/java/com/aurora/store/adapter/ExodusAdapter.java b/app/src/main/java/com/aurora/store/adapter/ExodusAdapter.java
index 3faa15477..e56c19758 100644
--- a/app/src/main/java/com/aurora/store/adapter/ExodusAdapter.java
+++ b/app/src/main/java/com/aurora/store/adapter/ExodusAdapter.java
@@ -41,36 +41,36 @@ import butterknife.ButterKnife;
public class ExodusAdapter extends RecyclerView.Adapter {
- private Context mContext;
- private List mExodusTrackers;
+ private Context context;
+ private List exodusTrackers;
- public ExodusAdapter(Context mContext, List mExodusTrackers) {
- this.mContext = mContext;
- this.mExodusTrackers = mExodusTrackers;
+ public ExodusAdapter(Context context, List exodusTrackers) {
+ this.context = context;
+ this.exodusTrackers = exodusTrackers;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_exodus, parent, false);
+ View view = LayoutInflater.from(parent.getContext())
+ .inflate(R.layout.item_exodus, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
- ExodusTracker mExodusTracker = mExodusTrackers.get(position);
+ ExodusTracker mExodusTracker = exodusTrackers.get(position);
holder.TrackerName.setText(mExodusTracker.Name);
holder.TrackerSignature.setText(mExodusTracker.Signature);
holder.TrackerDate.setText(mExodusTracker.Date);
- holder.itemView.setOnClickListener(v ->
- mContext.startActivity(new Intent(Intent.ACTION_VIEW,
- Uri.parse(mExodusTracker.URL)))
+ holder.itemView.setOnClickListener(v -> context.startActivity(new Intent(Intent.ACTION_VIEW,
+ Uri.parse(mExodusTracker.URL)))
);
}
@Override
public int getItemCount() {
- return mExodusTrackers.size();
+ return exodusTrackers.size();
}
static class ViewHolder extends RecyclerView.ViewHolder {
diff --git a/app/src/main/java/com/aurora/store/adapter/FavouriteAppsAdapter.java b/app/src/main/java/com/aurora/store/adapter/FavouriteAppsAdapter.java
deleted file mode 100644
index 24620980c..000000000
--- a/app/src/main/java/com/aurora/store/adapter/FavouriteAppsAdapter.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store.adapter;
-
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.aurora.store.R;
-import com.aurora.store.manager.FavouriteListManager;
-import com.aurora.store.model.App;
-import com.aurora.store.utility.PackageUtil;
-import com.bumptech.glide.Glide;
-import com.bumptech.glide.load.engine.DiskCacheStrategy;
-import com.bumptech.glide.load.resource.bitmap.CenterCrop;
-import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
-import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
-import com.bumptech.glide.request.RequestOptions;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class FavouriteAppsAdapter extends RecyclerView.Adapter {
-
- private List appList = new ArrayList<>();
- private List selectedList = new ArrayList<>();
- private Context context;
- private FavouriteListManager manager;
- private SelectableViewHolder.ItemClickListener itemClickListener;
-
- public FavouriteAppsAdapter(Context context, SelectableViewHolder.ItemClickListener itemClickListener, List appsToAdd) {
- this.itemClickListener = itemClickListener;
- this.context = context;
- manager = new FavouriteListManager(context);
- appList.addAll(appsToAdd);
- Collections.sort(appsToAdd, (App1, App2) ->
- App1.getDisplayName().compareToIgnoreCase(App2.getDisplayName()));
- }
-
- public void add(int position, App app) {
- appList.add(position, app);
- notifyItemInserted(position);
- }
-
- public void add(App app) {
- appList.add(app);
- }
-
- public void remove(int position) {
- manager.remove(appList.get(position).getPackageName());
- appList.remove(position);
- notifyItemRemoved(position);
- }
-
- public boolean isEmpty() {
- return appList.isEmpty();
- }
-
- @NonNull
- @Override
- public SelectableViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- LayoutInflater inflater = LayoutInflater.from(parent.getContext());
- View view = inflater.inflate(R.layout.item_favorite, parent, false);
- return new SelectableViewHolder(view, itemClickListener);
- }
-
- @Override
- public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
- SelectableViewHolder holder = (SelectableViewHolder) viewHolder;
- App app = appList.get(position);
-
- holder.AppTitle.setText(app.getDisplayName());
-
- if (PackageUtil.isInstalled(context, app)) {
- holder.AppExtra.setText(context.getText(R.string.list_installed));
- holder.AppCheckbox.setEnabled(false);
- } else {
- holder.AppExtra.setText(context.getText(R.string.list_not_installd));
- }
-
- Glide
- .with(context)
- .load(app.getIconInfo().getUrl())
- .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL))
- .transition(new DrawableTransitionOptions().crossFade())
- .transforms(new CenterCrop(), new RoundedCorners(25))
- .into(holder.AppIcon);
-
- holder.setChecked(isSelected(appList.get(position)));
- }
-
- public void toggleSelection(int position) {
- App app = appList.get(position);
- if (selectedList.contains(app)) {
- selectedList.remove(app);
- } else {
- selectedList.add(app);
- }
- notifyItemChanged(position);
- }
-
- private boolean isSelected(App app) {
- return selectedList.contains(app);
- }
-
- @Override
- public int getItemCount() {
- return appList.size();
- }
-
- public List getSelectedList() {
- return new ArrayList<>(selectedList);
- }
-}
diff --git a/app/src/main/java/com/aurora/store/adapter/FeaturedAppsAdapter.java b/app/src/main/java/com/aurora/store/adapter/FeaturedAppsAdapter.java
index a1e43a9e7..3764e8759 100644
--- a/app/src/main/java/com/aurora/store/adapter/FeaturedAppsAdapter.java
+++ b/app/src/main/java/com/aurora/store/adapter/FeaturedAppsAdapter.java
@@ -32,15 +32,18 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
-import com.aurora.store.CardType;
+import com.aurora.store.Constants;
import com.aurora.store.GlideApp;
import com.aurora.store.R;
-import com.aurora.store.activity.DetailsActivity;
+import com.aurora.store.enums.CardType;
import com.aurora.store.model.App;
-import com.aurora.store.utility.PackageUtil;
-import com.aurora.store.utility.Util;
+import com.aurora.store.ui.details.DetailsActivity;
+import com.aurora.store.util.PackageUtil;
+import com.aurora.store.util.Util;
+import com.aurora.store.util.ViewUtil;
import com.bumptech.glide.load.resource.bitmap.BitmapTransitionOptions;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
@@ -88,18 +91,19 @@ public class FeaturedAppsAdapter extends RecyclerView.Adapter {
- Intent intent = new Intent(context, DetailsActivity.class);
- intent.putExtra("INTENT_PACKAGE_NAME", app.getPackageName());
- context.startActivity(intent);
- });
-
viewHolder.txtIndicator.setVisibility(PackageUtil.isInstalled(context, app)
? View.VISIBLE
: View.GONE);
if (viewHolder.txtSize != null)
viewHolder.txtSize.setText(Util.humanReadableByteValue(app.getSize(), true));
+
+ viewHolder.itemView.setOnClickListener(v -> {
+ DetailsActivity.app = app;
+ Intent intent = new Intent(context, DetailsActivity.class);
+ intent.putExtra(Constants.INTENT_PACKAGE_NAME, app.getPackageName());
+ context.startActivity(intent, ViewUtil.getEmptyActivityBundle((AppCompatActivity) context));
+ });
}
private void drawBackground(App app, ViewHolder holder) {
diff --git a/app/src/main/java/com/aurora/store/adapter/InstalledAppsAdapter.java b/app/src/main/java/com/aurora/store/adapter/InstalledAppsAdapter.java
deleted file mode 100644
index 31caedc35..000000000
--- a/app/src/main/java/com/aurora/store/adapter/InstalledAppsAdapter.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store.adapter;
-
-import android.content.Context;
-import android.content.Intent;
-import android.text.TextUtils;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.FragmentManager;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.aurora.store.GlideApp;
-import com.aurora.store.ListType;
-import com.aurora.store.R;
-import com.aurora.store.activity.AuroraActivity;
-import com.aurora.store.activity.DetailsActivity;
-import com.aurora.store.model.App;
-import com.aurora.store.sheet.AppMenuSheet;
-import com.bumptech.glide.load.resource.bitmap.CenterCrop;
-import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
-import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-public class InstalledAppsAdapter extends RecyclerView.Adapter {
-
- public List appList = new ArrayList<>();
- public Context context;
- private ListType listType;
- private AppMenuSheet menuSheet;
-
- public InstalledAppsAdapter(Context context, ListType listType) {
- this.context = context;
- this.listType = listType;
- this.menuSheet = new AppMenuSheet();
- }
-
- public void add(int position, App app) {
- appList.add(position, app);
- notifyItemInserted(position);
- }
-
- public void add(App app) {
- appList.add(app);
- }
-
- public void remove(int position) {
- appList.remove(position);
- notifyItemRemoved(position);
- }
-
- public void remove(String packageName) {
- for (App app : appList) {
- if (app.getPackageName().equals(packageName)) {
- appList.remove(app);
- notifyDataSetChanged();
- break;
- }
- }
- }
-
- public void remove(App app) {
- appList.remove(app);
- notifyDataSetChanged();
- }
-
- public void addData(List appList) {
- this.appList.clear();
- this.appList = appList;
- final Set appSet = new LinkedHashSet<>(appList);
- appList.clear();
- appList.addAll(appSet);
- if (listType == ListType.INSTALLED || listType == ListType.UPDATES)
- Collections.sort(appList, (App1, App2) ->
- App1.getDisplayName().compareToIgnoreCase(App2.getDisplayName()));
- notifyDataSetChanged();
- }
-
- public boolean isDataEmpty() {
- return appList.isEmpty();
- }
-
- @NonNull
- @Override
- public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- LayoutInflater inflater = LayoutInflater.from(parent.getContext());
- View view = inflater.inflate(R.layout.item_installed, parent, false);
- return new ViewHolder(view);
- }
-
- @Override
- public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
- App app = appList.get(position);
- List Version = new ArrayList<>();
- List Extra = new ArrayList<>();
-
- holder.AppTitle.setText(app.getDisplayName());
- getDetails(Version, Extra, app);
- setText(holder.AppExtra, TextUtils.join(" • ", Extra));
- setText(holder.AppVersion, TextUtils.join(" • ", Version));
-
- holder.itemView.setOnClickListener(v -> {
- Intent intent = new Intent(context, DetailsActivity.class);
- intent.putExtra("INTENT_PACKAGE_NAME", app.getPackageName());
- context.startActivity(intent);
- });
-
- holder.itemView.setOnLongClickListener(v -> {
- menuSheet.setApp(app);
- menuSheet.setAdapter(this);
- menuSheet.show(getFragmentManager(), "BOTTOM_MENU_SHEET");
- return false;
- });
-
- GlideApp
- .with(context)
- .load(app.getIconInfo().getUrl())
- .transition(new DrawableTransitionOptions().crossFade())
- .transforms(new CenterCrop(), new RoundedCorners(30))
- .into(holder.AppIcon);
- }
-
- private FragmentManager getFragmentManager() {
- if (context instanceof DetailsActivity)
- return ((DetailsActivity) context).getSupportFragmentManager();
- else
- return ((AuroraActivity) context).getSupportFragmentManager();
- }
-
- public void getDetails(List Version, List Extra, App app) {
- Version.add("v" + app.getVersionName() + "." + app.getVersionCode());
- if (app.isSystem())
- Extra.add(context.getString(R.string.list_app_system));
- else
- Extra.add(context.getString(R.string.list_app_user));
- }
-
- protected void setText(TextView textView, String text) {
- if (!TextUtils.isEmpty(text)) {
- textView.setText(text);
- textView.setVisibility(View.VISIBLE);
- } else {
- textView.setVisibility(View.GONE);
- }
- }
-
- @Override
- public int getItemCount() {
- return appList.size();
- }
-
- public static class ViewHolder extends RecyclerView.ViewHolder {
- @BindView(R.id.app_icon)
- ImageView AppIcon;
- @BindView(R.id.app_title)
- TextView AppTitle;
- @BindView(R.id.app_version)
- TextView AppVersion;
- @BindView(R.id.app_extra)
- TextView AppExtra;
-
- ViewHolder(@NonNull View itemView) {
- super(itemView);
- ButterKnife.bind(this, itemView);
- }
- }
-}
diff --git a/app/src/main/java/com/aurora/store/adapter/NativeHttpClientAdapter.java b/app/src/main/java/com/aurora/store/adapter/NativeHttpClientAdapter.java
index 9f672aee5..af5314f75 100644
--- a/app/src/main/java/com/aurora/store/adapter/NativeHttpClientAdapter.java
+++ b/app/src/main/java/com/aurora/store/adapter/NativeHttpClientAdapter.java
@@ -28,7 +28,7 @@ import com.aurora.store.exception.AppNotFoundException;
import com.aurora.store.exception.MalformedRequestException;
import com.aurora.store.exception.TooManyRequestsException;
import com.aurora.store.exception.UnknownException;
-import com.aurora.store.utility.Util;
+import com.aurora.store.util.Util;
import com.dragons.aurora.playstoreapiv2.AuthException;
import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
import com.dragons.aurora.playstoreapiv2.GooglePlayException;
@@ -46,7 +46,6 @@ import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
-import java.util.zip.GZIPInputStream;
public class NativeHttpClientAdapter extends HttpClientAdapter {
@@ -81,13 +80,10 @@ public class NativeHttpClientAdapter extends HttpClientAdapter {
}
}
- static private byte[] readFully(InputStream inputStream, boolean gzipped) throws IOException {
+ static private byte[] readFully(InputStream inputStream) throws IOException {
if (null == inputStream) {
return new byte[0];
}
- if (gzipped) {
- inputStream = new GZIPInputStream(inputStream);
- }
InputStream bufferedInputStream = new BufferedInputStream(inputStream);
byte[] buffer = new byte[8192];
int bytesRead;
@@ -177,8 +173,6 @@ public class NativeHttpClientAdapter extends HttpClientAdapter {
protected byte[] request(HttpURLConnection connection, byte[] body, Map headers) throws IOException {
connection.setConnectTimeout(TIMEOUT);
connection.setReadTimeout(TIMEOUT);
- connection.setRequestProperty("Accept-Encoding", "gzip");
- connection.addRequestProperty("Cache-Control", "max-age=300");
for (String headerName : headers.keySet()) {
connection.addRequestProperty(headerName, headers.get(headerName));
}
@@ -189,18 +183,11 @@ public class NativeHttpClientAdapter extends HttpClientAdapter {
int code = 0;
- boolean isGzip;
- try {
- isGzip = null != connection.getContentEncoding() && connection.getContentEncoding().contains("gzip");
- } catch (NullPointerException e) {
- throw new AuthException(e.getMessage(), 401);
- }
-
try {
code = connection.getResponseCode();
- content = readFully(connection.getInputStream(), isGzip);
+ content = readFully(connection.getInputStream());
} catch (IOException e) {
- content = readFully(connection.getErrorStream(), isGzip);
+ content = readFully(connection.getErrorStream());
} finally {
connection.disconnect();
}
diff --git a/app/src/main/java/com/aurora/store/adapter/OkHttpClientAdapter.java b/app/src/main/java/com/aurora/store/adapter/OkHttpClientAdapter.java
index 3845060be..e8fccd705 100644
--- a/app/src/main/java/com/aurora/store/adapter/OkHttpClientAdapter.java
+++ b/app/src/main/java/com/aurora/store/adapter/OkHttpClientAdapter.java
@@ -26,7 +26,7 @@ import com.aurora.store.exception.AppNotFoundException;
import com.aurora.store.exception.MalformedRequestException;
import com.aurora.store.exception.TooManyRequestsException;
import com.aurora.store.exception.UnknownException;
-import com.aurora.store.utility.Util;
+import com.aurora.store.util.Util;
import com.dragons.aurora.playstoreapiv2.AuthException;
import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
import com.dragons.aurora.playstoreapiv2.GooglePlayException;
diff --git a/app/src/main/java/com/aurora/store/adapter/ReviewsAdapter.java b/app/src/main/java/com/aurora/store/adapter/ReviewsAdapter.java
deleted file mode 100644
index 10946bb52..000000000
--- a/app/src/main/java/com/aurora/store/adapter/ReviewsAdapter.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store.adapter;
-
-import android.content.Context;
-import android.text.format.DateFormat;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.RatingBar;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.aurora.store.GlideApp;
-import com.aurora.store.R;
-import com.aurora.store.model.Review;
-import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
-import com.google.android.material.dialog.MaterialAlertDialogBuilder;
-
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.List;
-import java.util.Locale;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-public class ReviewsAdapter extends RecyclerView.Adapter {
-
- private Context context;
- private List reviewList;
-
- public ReviewsAdapter(Context context, List reviewList) {
- this.context = context;
- this.reviewList = reviewList;
- }
-
- public void add(int position, Review review) {
- reviewList.add(position, review);
- notifyItemInserted(position);
- }
-
- public void add(Review review) {
- reviewList.add(review);
- }
-
- public void remove(int position) {
- reviewList.remove(position);
- notifyItemRemoved(position);
- }
-
- public void sort() {
- Collections.sort(reviewList, (lhs, rhs) -> lhs.getRating() > rhs.getRating() ? -1 : 1);
- }
-
-
- @NonNull
- @Override
- public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_review_list, parent, false);
- return new ViewHolder(view);
- }
-
- @Override
- public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
- Review mReview = reviewList.get(position);
- holder.Author.setText(mReview.getUserName());
- holder.Rating.setRating(mReview.getRating());
- holder.Date.setText(getDate(mReview));
- holder.Comment.setText(mReview.getComment());
-
-
- GlideApp
- .with(context)
- .load(mReview.getUserPhotoUrl())
- .placeholder(R.color.colorTransparent)
- .circleCrop()
- .transition(new DrawableTransitionOptions().crossFade())
- .into(holder.Avatar);
-
- holder.itemView.setOnClickListener(v -> {
- MaterialAlertDialogBuilder mBuilder = new MaterialAlertDialogBuilder(context)
- .setIcon(holder.Avatar.getDrawable())
- .setTitle(mReview.getUserName())
- .setMessage(mReview.getComment())
- .setCancelable(false)
- .setPositiveButton(android.R.string.ok, (dialog, which) -> {
- dialog.dismiss();
- });
- mBuilder.create();
- mBuilder.show();
- });
- }
-
- private String getDate(Review review) {
- Calendar calendar = Calendar.getInstance(Locale.getDefault());
- calendar.setTimeInMillis(review.getTimeStamp());
- return DateFormat.format("dd/MM/yyyy", calendar).toString();
- }
-
- @Override
- public int getItemCount() {
- return reviewList.size();
- }
-
- static class ViewHolder extends RecyclerView.ViewHolder {
- @BindView(R.id.avatar)
- ImageView Avatar;
- @BindView(R.id.author)
- TextView Author;
- @BindView(R.id.rating)
- RatingBar Rating;
- @BindView(R.id.date)
- TextView Date;
- @BindView(R.id.comment)
- TextView Comment;
-
- ViewHolder(@NonNull View itemView) {
- super(itemView);
- ButterKnife.bind(this, itemView);
- }
- }
-}
diff --git a/app/src/main/java/com/aurora/store/adapter/SearchHistoryAdapter.java b/app/src/main/java/com/aurora/store/adapter/SearchHistoryAdapter.java
deleted file mode 100644
index 26e4ff625..000000000
--- a/app/src/main/java/com/aurora/store/adapter/SearchHistoryAdapter.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store.adapter;
-
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.aurora.store.Constants;
-import com.aurora.store.R;
-import com.aurora.store.utility.PrefUtil;
-
-import org.apache.commons.lang3.StringUtils;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Locale;
-
-public class SearchHistoryAdapter extends RecyclerView.Adapter {
-
- private Context context;
- private ArrayList queryList;
- private ClickListener clickListener;
-
- public SearchHistoryAdapter(Context context, ArrayList queryList, ClickListener clickListener) {
- this.queryList = queryList;
- this.clickListener = clickListener;
- this.context = context;
- }
-
- public void add(int position, String mHistory) {
- queryList.add(mHistory);
- notifyItemInserted(position);
- }
-
- public void remove(int position) {
- queryList.remove(position);
- updatePrefList();
- notifyItemRemoved(position);
- }
-
- public void clear() {
- queryList.clear();
- clearPrefList();
- notifyDataSetChanged();
- }
-
- public void reload() {
- queryList = PrefUtil.getListString(context, Constants.RECENT_HISTORY);
- notifyDataSetChanged();
- }
-
- private void updatePrefList() {
- PrefUtil.putListString(context, Constants.RECENT_HISTORY, queryList);
- }
-
- private void clearPrefList() {
- PrefUtil.putListString(context, Constants.RECENT_HISTORY, new ArrayList<>());
- }
-
- @NonNull
- @Override
- public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- LayoutInflater inflater = LayoutInflater.from(parent.getContext());
- View view = inflater.inflate(R.layout.item_history, parent, false);
- return new ViewHolder(view);
- }
-
- @Override
- public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {
- String[] datedQuery = queryList.get(position).split(":");
- holder.query.setText(datedQuery[0]);
- holder.date.setText(getQueryDate(datedQuery[1]));
- holder.viewForeground.setOnClickListener(v -> clickListener.onClicked(datedQuery[0]));
- }
-
- @Override
- public int getItemCount() {
- return queryList.size();
- }
-
- private String getQueryDate(String queryDate) {
- try {
- final long timeInMilli = Long.parseLong(queryDate);
- final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MMM", Locale.getDefault());
- return simpleDateFormat.format(new Date(timeInMilli));
- } catch (NumberFormatException e) {
- return StringUtils.EMPTY;
- }
- }
-
- public interface ClickListener {
- void onClicked(String query);
- }
-
- public class ViewHolder extends RecyclerView.ViewHolder {
- public RelativeLayout viewForeground;
- RelativeLayout viewBackground;
- TextView query;
- TextView date;
-
- ViewHolder(View view) {
- super(view);
- query = view.findViewById(R.id.query);
- date = view.findViewById(R.id.queryTime);
- viewBackground = view.findViewById(R.id.view_background);
- viewForeground = view.findViewById(R.id.view_foreground);
- }
- }
-}
diff --git a/app/src/main/java/com/aurora/store/adapter/SearchSuggestionAdapter.java b/app/src/main/java/com/aurora/store/adapter/SearchSuggestionAdapter.java
new file mode 100644
index 000000000..7b4b08f5d
--- /dev/null
+++ b/app/src/main/java/com/aurora/store/adapter/SearchSuggestionAdapter.java
@@ -0,0 +1,106 @@
+/*
+ * Aurora Store
+ * Copyright (C) 2019, Rahul Kumar Patel
+ *
+ * Aurora Store is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Aurora Store is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Aurora Store. If not, see .
+ *
+ *
+ */
+
+package com.aurora.store.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.aurora.store.GlideApp;
+import com.aurora.store.R;
+import com.bumptech.glide.load.resource.bitmap.CenterCrop;
+import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
+import com.dragons.aurora.playstoreapiv2.SearchSuggestEntry;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+
+public class SearchSuggestionAdapter extends RecyclerView.Adapter {
+
+ public List appList;
+ public Context context;
+ private ClickListener clickListener;
+
+ public SearchSuggestionAdapter(Context context, ClickListener clickListener) {
+ this.context = context;
+ this.clickListener = clickListener;
+ this.appList = new ArrayList<>();
+ }
+
+ public void addData(List appList) {
+ this.appList.clear();
+ this.appList.addAll(appList);
+ notifyDataSetChanged();
+ }
+
+ @NonNull
+ @Override
+ public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ LayoutInflater inflater = LayoutInflater.from(parent.getContext());
+ View view = inflater.inflate(R.layout.item_suggestion, parent, false);
+ return new ViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
+ SearchSuggestEntry suggestEntry = appList.get(position);
+ String title = suggestEntry.getTitle();
+ String packageName = suggestEntry.getPackageNameContainer().getPackageName();
+ holder.line1.setText(title);
+ GlideApp
+ .with(context)
+ .load(suggestEntry.getImageContainer().getImageUrl())
+ .placeholder(R.drawable.ic_round_search)
+ .transforms(new CenterCrop(), new RoundedCorners(30))
+ .into(holder.img);
+ holder.itemView.setOnClickListener(v -> clickListener.onClickedSuggestion(packageName.isEmpty() ? title : packageName));
+ }
+
+ @Override
+ public int getItemCount() {
+ return appList.size();
+ }
+
+ public interface ClickListener {
+ void onClickedSuggestion(String query);
+ }
+
+ public static class ViewHolder extends RecyclerView.ViewHolder {
+ @BindView(R.id.img)
+ ImageView img;
+ @BindView(R.id.line1)
+ TextView line1;
+
+ ViewHolder(@NonNull View itemView) {
+ super(itemView);
+ ButterKnife.bind(this, itemView);
+ }
+ }
+}
diff --git a/app/src/main/java/com/aurora/store/adapter/SelectableAdapter.java b/app/src/main/java/com/aurora/store/adapter/SelectableAdapter.java
deleted file mode 100644
index ad5277ac9..000000000
--- a/app/src/main/java/com/aurora/store/adapter/SelectableAdapter.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store.adapter;
-
-import android.content.Context;
-
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.aurora.store.manager.BlacklistManager;
-
-import java.util.ArrayList;
-
-abstract class SelectableAdapter extends RecyclerView.Adapter {
-
- protected ArrayList mSelections;
- protected Context context;
- protected BlacklistManager mBlacklistManager;
-
- SelectableAdapter(Context context) {
- this.context = context;
- mBlacklistManager = new BlacklistManager(context);
- ArrayList blacklistedApps = mBlacklistManager.get();
- mSelections = new ArrayList<>();
- if (blacklistedApps != null && !blacklistedApps.isEmpty()) {
- mSelections.addAll(blacklistedApps);
- }
- }
-
- boolean isSelected(String packageName) {
- return mSelections.contains(packageName);
- }
-
- void toggleSelection(int position) {
- }
-
- public void addSelectionsToBlackList() {
- mBlacklistManager.addAll(mSelections);
- }
-
- public void removeSelectionsFromBlackList() {
- mBlacklistManager.removeAll(mSelections);
- mSelections = new ArrayList<>();
- }
-}
diff --git a/app/src/main/java/com/aurora/store/adapter/SelectableViewHolder.java b/app/src/main/java/com/aurora/store/adapter/SelectableViewHolder.java
deleted file mode 100644
index 66f452629..000000000
--- a/app/src/main/java/com/aurora/store/adapter/SelectableViewHolder.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store.adapter;
-
-import android.view.View;
-import android.widget.CheckBox;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.aurora.store.R;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-public class SelectableViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
- @BindView(R.id.view_foreground)
- public RelativeLayout viewForeground;
- @BindView(R.id.view_background)
- RelativeLayout viewBackground;
- @BindView(R.id.app_icon)
- ImageView AppIcon;
- @BindView(R.id.app_title)
- TextView AppTitle;
- @BindView(R.id.app_extra)
- TextView AppExtra;
- @BindView(R.id.app_checkbox)
- CheckBox AppCheckbox;
-
- private ItemClickListener listener;
-
- SelectableViewHolder(View view, ItemClickListener listener) {
- super(view);
- ButterKnife.bind(this, view);
- this.listener = listener;
- view.setOnClickListener(this);
- }
-
- public void setChecked(boolean value) {
- AppCheckbox.setChecked(value);
- }
-
- @Override
- public void onClick(View v) {
- if (listener != null) {
- listener.onItemClicked(getAdapterPosition());
- }
- }
-
- public interface ItemClickListener {
- void onItemClicked(int position);
- }
-}
diff --git a/app/src/main/java/com/aurora/store/adapter/SmallScreenshotsAdapter.java b/app/src/main/java/com/aurora/store/adapter/SmallScreenshotsAdapter.java
index 3523736ee..f1abf59fe 100644
--- a/app/src/main/java/com/aurora/store/adapter/SmallScreenshotsAdapter.java
+++ b/app/src/main/java/com/aurora/store/adapter/SmallScreenshotsAdapter.java
@@ -34,8 +34,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.aurora.store.GlideApp;
import com.aurora.store.R;
-import com.aurora.store.activity.FullscreenImageActivity;
-import com.aurora.store.utility.ViewUtil;
+import com.aurora.store.ui.single.activity.FullscreenImageActivity;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
diff --git a/app/src/main/java/com/aurora/store/adapter/SubCategoryAdapter.java b/app/src/main/java/com/aurora/store/adapter/SubCategoryAdapter.java
deleted file mode 100644
index 5b39ba117..000000000
--- a/app/src/main/java/com/aurora/store/adapter/SubCategoryAdapter.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store.adapter;
-
-import android.content.Context;
-import android.os.Bundle;
-
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
-import androidx.fragment.app.FragmentStatePagerAdapter;
-
-import com.aurora.store.R;
-import com.aurora.store.fragment.SubCategoryFragment;
-
-import org.jetbrains.annotations.NotNull;
-
-public class SubCategoryAdapter extends FragmentStatePagerAdapter {
-
- private Context context;
-
- public SubCategoryAdapter(Context context, FragmentManager fragmentManager) {
- super(fragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
- this.context = context;
- }
-
- @NotNull
- @Override
- public Fragment getItem(int position) {
- final Bundle bundle = new Bundle();
- final Fragment subCategoryFragment = new SubCategoryFragment();
- switch (position) {
- case 0:
- bundle.putString("SUBCATEGORY", "TOP_FREE");
- break;
- case 1:
- bundle.putString("SUBCATEGORY", "MOVERS_SHAKERS");
- break;
- default:
- bundle.putString("SUBCATEGORY", "TOP_GROSSING");
- break;
- }
- subCategoryFragment.setArguments(bundle);
- return subCategoryFragment;
- }
-
- @Override
- public int getCount() {
- return 3;
- }
-
- @Override
- public CharSequence getPageTitle(int position) {
- switch (position) {
- case 0:
- return context.getString(R.string.category_topFree);
- case 1:
- return context.getString(R.string.category_trending);
- default:
- return context.getString(R.string.category_topGrossing);
- }
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/aurora/store/adapter/TabAdapter.java b/app/src/main/java/com/aurora/store/adapter/TabAdapter.java
deleted file mode 100644
index cfa40650c..000000000
--- a/app/src/main/java/com/aurora/store/adapter/TabAdapter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.aurora.store.adapter;
-
-import androidx.annotation.Nullable;
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
-import androidx.fragment.app.FragmentPagerAdapter;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class TabAdapter extends FragmentPagerAdapter {
-
- private final List fragmentList = new ArrayList<>();
- private final List fragmentTitleList = new ArrayList<>();
-
- public TabAdapter(FragmentManager fm) {
- super(fm);
- }
-
- @Override
- public Fragment getItem(int position) {
- return fragmentList.get(position);
- }
-
- public void addFragment(Fragment fragment, String title) {
- fragmentList.add(fragment);
- fragmentTitleList.add(title);
- }
-
- @Nullable
- @Override
- public CharSequence getPageTitle(int position) {
- return fragmentTitleList.get(position);
- }
-
- @Override
- public int getCount() {
- return fragmentList.size();
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/aurora/store/adapter/TopCategoriesAdapter.java b/app/src/main/java/com/aurora/store/adapter/TopCategoriesAdapter.java
deleted file mode 100644
index c037d8fd5..000000000
--- a/app/src/main/java/com/aurora/store/adapter/TopCategoriesAdapter.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store.adapter;
-
-import android.content.Context;
-import android.content.res.ColorStateList;
-import android.graphics.Color;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import androidx.annotation.ColorInt;
-import androidx.annotation.NonNull;
-import androidx.core.graphics.ColorUtils;
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentTransaction;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.aurora.store.R;
-import com.aurora.store.SharedPreferencesTranslator;
-import com.aurora.store.fragment.CategoriesFragment;
-import com.aurora.store.fragment.CategoryAppsFragment;
-import com.aurora.store.fragment.HomeFragment;
-import com.aurora.store.utility.ColorUtil;
-import com.aurora.store.utility.Util;
-import com.aurora.store.utility.ViewUtil;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-public class TopCategoriesAdapter extends RecyclerView.Adapter {
-
- private Context context;
- private Fragment fragment;
- private String[] topCategoryIDs;
- private SharedPreferencesTranslator translator;
- private boolean isTransparent;
-
- private Integer[] categoriesImg = {
- R.drawable.ic_cat_communication,
- R.drawable.ic_cat_family,
- R.drawable.ic_cat_games,
- R.drawable.ic_cat_music,
- R.drawable.ic_cat_personalization,
- R.drawable.ic_cat_photography,
- R.drawable.ic_cat_shopping,
- R.drawable.ic_cat_social_alt,
- };
-
- public TopCategoriesAdapter(HomeFragment fragment) {
- this.fragment = fragment;
- this.context = fragment.getContext();
- this.topCategoryIDs = context.getResources().getStringArray(R.array.topCategories);
- this.isTransparent = Util.isTransparentStyle(context);
- this.translator = new SharedPreferencesTranslator(Util.getPrefs(context));
- }
-
- @NonNull
- @Override
- public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- View view = LayoutInflater.from(parent.getContext())
- .inflate(R.layout.item_category_top, parent, false);
- return new ViewHolder(view);
- }
-
- @Override
- public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {
- @ColorInt int color = ViewUtil.getSolidColors(position);
- holder.itemView.setBackgroundTintList(ColorStateList.valueOf(
- ColorUtils.setAlphaComponent(color, isTransparent ? 60 : 255)));
- holder.imgCat.setImageDrawable(context.getResources().getDrawable(categoriesImg[position]));
- holder.imgCat.setColorFilter(isTransparent ? ColorUtil.manipulateColor(color, 0.85f) : Color.WHITE);
- holder.txtCat.setText(translator.getString(topCategoryIDs[position]));
- holder.txtCat.setTextColor(isTransparent ? ColorUtil.manipulateColor(color, 0.75f) : Color.WHITE);
-
- if (topCategoryIDs[position].equals(CategoriesFragment.FAMILY)) {
- holder.itemView.setOnClickListener(v -> getSubCategoryFragment(CategoriesFragment.FAMILY));
- } else if (topCategoryIDs[position].equals(CategoriesFragment.GAME)) {
- holder.itemView.setOnClickListener(v -> getSubCategoryFragment(CategoriesFragment.GAME));
- } else
- holder.itemView.setOnClickListener(v -> getCategoryAppsFragment(position));
- }
-
- private void getSubCategoryFragment(String subCategory) {
- CategoriesFragment categoryAppsFragment = new CategoriesFragment();
- Bundle arguments = new Bundle();
- arguments.putString("CATEGORY_TYPE", subCategory);
- categoryAppsFragment.setArguments(arguments);
- fragment.getChildFragmentManager().beginTransaction()
- .replace(R.id.coordinator, categoryAppsFragment)
- .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
- .addToBackStack(null)
- .commit();
- }
-
- private void getCategoryAppsFragment(int position) {
- CategoryAppsFragment categoryAppsFragment = new CategoryAppsFragment();
- Bundle arguments = new Bundle();
- arguments.putString("CategoryId", topCategoryIDs[position]);
- arguments.putString("CategoryName", translator.getString(topCategoryIDs[position]));
- categoryAppsFragment.setArguments(arguments);
- fragment.getChildFragmentManager()
- .beginTransaction()
- .replace(R.id.coordinator, categoryAppsFragment)
- .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
- .addToBackStack(null)
- .commit();
- }
-
- @Override
- public int getItemCount() {
- return topCategoryIDs.length;
- }
-
- static class ViewHolder extends RecyclerView.ViewHolder {
-
- @BindView(R.id.cat_icon)
- ImageView imgCat;
- @BindView(R.id.cat_txt)
- TextView txtCat;
-
- ViewHolder(@NonNull View itemView) {
- super(itemView);
- ButterKnife.bind(this, itemView);
- }
- }
-}
diff --git a/app/src/main/java/com/aurora/store/adapter/UpdatableAppsAdapter.java b/app/src/main/java/com/aurora/store/adapter/UpdatableAppsAdapter.java
deleted file mode 100644
index 299605917..000000000
--- a/app/src/main/java/com/aurora/store/adapter/UpdatableAppsAdapter.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Aurora Store
- * Copyright (C) 2019, Rahul Kumar Patel
- *
- * Aurora Store is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * Aurora Store is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Aurora Store. If not, see .
- *
- *
- */
-
-package com.aurora.store.adapter;
-
-import android.content.Context;
-import android.content.Intent;
-import android.text.Html;
-import android.text.TextUtils;
-import android.text.format.Formatter;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.aurora.store.GlideApp;
-import com.aurora.store.R;
-import com.aurora.store.activity.AuroraActivity;
-import com.aurora.store.activity.DetailsActivity;
-import com.aurora.store.model.App;
-import com.aurora.store.sheet.AppMenuSheet;
-import com.aurora.store.utility.ViewUtil;
-import com.bumptech.glide.load.resource.bitmap.CenterCrop;
-import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
-import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import butterknife.BindView;
-import butterknife.ButterKnife;
-
-public class UpdatableAppsAdapter extends RecyclerView.Adapter {
-
- private List appList = new ArrayList<>();
- private Context context;
- private AppMenuSheet menuSheet;
-
- public UpdatableAppsAdapter(Context context) {
- this.context = context;
- this.menuSheet = new AppMenuSheet();
- }
-
- public List getAppList() {
- return appList;
- }
-
- public void add(int position, App app) {
- appList.add(position, app);
- notifyItemInserted(position);
- }
-
- public void add(App app) {
- appList.add(app);
- }
-
- public void remove(int position) {
- appList.remove(position);
- notifyItemRemoved(position);
- }
-
- public void remove(String packageName) {
- Iterator iterator = appList.iterator();
- while (iterator.hasNext()) {
- final App app = iterator.next();
- if (packageName.equals(app.getPackageName()) || packageName.startsWith(app.getPackageName()))
- iterator.remove();
- }
- notifyDataSetChanged();
- }
-
- public void remove(App app) {
- appList.remove(app);
- notifyDataSetChanged();
- }
-
- public void addData(List appList) {
- this.appList.clear();
- this.appList = appList;
- Collections.sort(appList, (App1, App2) ->
- App1.getDisplayName().compareToIgnoreCase(App2.getDisplayName()));
- notifyDataSetChanged();
- }
-
- public boolean isDataEmpty() {
- return appList.isEmpty();
- }
-
- @NonNull
- @Override
- public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- LayoutInflater inflater = LayoutInflater.from(parent.getContext());
- View view = inflater.inflate(R.layout.item_updatable, parent, false);
- return new ViewHolder(view);
- }
-
- @Override
- public void onBindViewHolder(@NonNull ViewHolder viewHolder, int position) {
- App app = appList.get(position);
- List Version = new ArrayList<>();
- List Extra = new ArrayList<>();
-
- viewHolder.txtTitle.setText(app.getDisplayName());
- getDetails(Version, Extra, app);
- setText(viewHolder.txtVersion, TextUtils.join(" • ", Version));
- setText(viewHolder.txtExtra, TextUtils.join(" • ", Extra));
- setText(viewHolder.txtChanges, app.getChanges().isEmpty()
- ? context.getString(R.string.details_no_changes)
- : Html.fromHtml(app.getChanges()).toString());
-
- viewHolder.itemView.setOnClickListener(v -> {
- Intent intent = new Intent(context, DetailsActivity.class);
- intent.putExtra("INTENT_PACKAGE_NAME", app.getPackageName());
- context.startActivity(intent);
- });
-
- viewHolder.itemView.setOnLongClickListener(v -> {
- menuSheet.setApp(app);
- menuSheet.setAdapter(this);
- menuSheet.show(((AuroraActivity) context).getSupportFragmentManager(),
- "BOTTOM_MENU_SHEET");
- return false;
- });
-
- GlideApp
- .with(context)
- .load(app.getIconInfo().getUrl())
- .transition(new DrawableTransitionOptions().crossFade())
- .transforms(new CenterCrop(), new RoundedCorners(25))
- .into(viewHolder.imgIcon);
-
- viewHolder.imgExpand.setOnClickListener(v -> {
- if (viewHolder.layoutChanges.getHeight() == 0) {
- ViewUtil.rotateView(v, false);
- ViewUtil.expandView(viewHolder.layoutChanges,
- viewHolder.txtChanges.getHeight()
- + viewHolder.txtChangesTitle.getHeight()
- + 120 /*Padding & Margins*/);
- } else {
- ViewUtil.rotateView(v, true);
- ViewUtil.collapseView(viewHolder.layoutChanges, 0);
- }
- });
- }
-
- private void getDetails(List Version, List Extra, App app) {
- Version.add(app.getUpdated());
- Extra.add(app.getSize() == 0 ? "N/A" : Formatter.formatShortFileSize(context, app.getSize()));
- }
-
- protected void setText(TextView textView, String text) {
- if (!TextUtils.isEmpty(text)) {
- textView.setText(text);
- textView.setVisibility(View.VISIBLE);
- } else {
- textView.setVisibility(View.GONE);
- }
- }
-
- @Override
- public int getItemCount() {
- return appList.size();
- }
-
- public class ViewHolder extends RecyclerView.ViewHolder {
- @BindView(R.id.layout_info)
- RelativeLayout layoutInfo;
- @BindView(R.id.layout_changes)
- RelativeLayout layoutChanges;
- @BindView(R.id.app_icon)
- ImageView imgIcon;
- @BindView(R.id.app_title)
- TextView txtTitle;
- @BindView(R.id.app_version)
- TextView txtVersion;
- @BindView(R.id.app_extra)
- TextView txtExtra;
- @BindView(R.id.img_expand)
- ImageView imgExpand;
- @BindView(R.id.txt_title)
- TextView txtChangesTitle;
- @BindView(R.id.txt_changes)
- TextView txtChanges;
-
- ViewHolder(@NonNull View itemView) {
- super(itemView);
- ButterKnife.bind(this, itemView);
- }
- }
-
-}
diff --git a/app/src/main/java/com/aurora/store/adapter/ViewPagerAdapter.java b/app/src/main/java/com/aurora/store/adapter/ViewPagerAdapter.java
deleted file mode 100644
index be88b5800..000000000
--- a/app/src/main/java/com/aurora/store/adapter/ViewPagerAdapter.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.aurora.store.adapter;
-
-import androidx.annotation.NonNull;
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
-import androidx.fragment.app.FragmentStatePagerAdapter;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ViewPagerAdapter extends FragmentStatePagerAdapter {
-
- private List fragmentList = new ArrayList<>();
-
- public ViewPagerAdapter(@NonNull FragmentManager fragmentManager) {
- super(fragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
- }
-
- public void addFragment(int position, Fragment fragment) {
- fragmentList.add(position, fragment);
- }
-
- @Override
- public int getCount() {
- return fragmentList.size();
- }
-
- @NonNull
- @Override
- public Fragment getItem(int position) {
- return fragmentList.get(position);
- }
-}
diff --git a/app/src/main/java/com/aurora/store/api/PlayStoreApiAuthenticator.java b/app/src/main/java/com/aurora/store/api/PlayStoreApiAuthenticator.java
index bd8b7c352..e142f2440 100644
--- a/app/src/main/java/com/aurora/store/api/PlayStoreApiAuthenticator.java
+++ b/app/src/main/java/com/aurora/store/api/PlayStoreApiAuthenticator.java
@@ -27,62 +27,33 @@ import android.content.Context;
import com.aurora.store.TokenDispenserMirrors;
import com.aurora.store.model.LoginInfo;
-import com.aurora.store.utility.ApiBuilderUtil;
+import com.aurora.store.util.ApiBuilderUtil;
import com.dragons.aurora.playstoreapiv2.GooglePlayAPI;
import java.io.IOException;
public class PlayStoreApiAuthenticator {
- private static volatile PlayStoreApiAuthenticator instance;
- private static GooglePlayAPI api;
-
- public PlayStoreApiAuthenticator() {
- if (instance != null) {
- throw new RuntimeException("Use getApi() method to get the single instance of RxBus");
- }
- }
-
- public static GooglePlayAPI getApi() {
- return api;
- }
-
- public static GooglePlayAPI getInstance(Context context) throws Exception {
- if (instance == null) {
- synchronized (PlayStoreApiAuthenticator.class) {
- if (instance == null) {
- instance = new PlayStoreApiAuthenticator();
- api = instance.getApi(context);
- }
- }
- }
- return api;
- }
-
public static boolean login(Context context, String email, String password) throws IOException {
LoginInfo loginInfo = new LoginInfo();
loginInfo.setEmail(email);
loginInfo.setAasToken(password);
- GooglePlayAPI api = ApiBuilderUtil.buildApi(context, loginInfo);
+ GooglePlayAPI api = ApiBuilderUtil.buildApi(context, loginInfo, false);
return api != null;
}
public static GooglePlayAPI login(Context context) throws IOException {
LoginInfo loginInfo = new LoginInfo();
loginInfo.setTokenDispenserUrl(TokenDispenserMirrors.get(context));
- GooglePlayAPI api = ApiBuilderUtil.buildAnonymousApi(context, loginInfo);
- return api;
+ return ApiBuilderUtil.buildApi(context, loginInfo, true);
}
- public static void destroyInstance() {
- api = null;
- instance = null;
+ public static GooglePlayAPI getApi(Context context) throws Exception {
+ return ApiBuilderUtil.buildFromPreferences(context);
}
- private synchronized GooglePlayAPI getApi(Context context) throws Exception {
- if (api == null) {
- api = ApiBuilderUtil.buildFromPreferences(context);
- }
- return api;
+ public GooglePlayAPI getPlayApi(Context context) throws Exception {
+ return ApiBuilderUtil.buildFromPreferences(context);
}
+
}
\ No newline at end of file
diff --git a/app/src/main/java/com/aurora/store/download/DownloadManager.java b/app/src/main/java/com/aurora/store/download/DownloadManager.java
index f05c0948a..1d263927d 100644
--- a/app/src/main/java/com/aurora/store/download/DownloadManager.java
+++ b/app/src/main/java/com/aurora/store/download/DownloadManager.java
@@ -23,7 +23,7 @@ package com.aurora.store.download;
import android.content.Context;
import com.aurora.store.Constants;
-import com.aurora.store.utility.Util;
+import com.aurora.store.util.Util;
import com.tonyodev.fetch2.Fetch;
import com.tonyodev.fetch2.FetchConfiguration;
import com.tonyodev.fetch2okhttp.OkHttpDownloader;
diff --git a/app/src/main/java/com/aurora/store/download/RequestBuilder.java b/app/src/main/java/com/aurora/store/download/RequestBuilder.java
index 0d1b579b9..9685daab5 100644
--- a/app/src/main/java/com/aurora/store/download/RequestBuilder.java
+++ b/app/src/main/java/com/aurora/store/download/RequestBuilder.java
@@ -23,9 +23,9 @@ package com.aurora.store.download;
import android.content.Context;
import com.aurora.store.model.App;
-import com.aurora.store.utility.PathUtil;
-import com.aurora.store.utility.TextUtil;
-import com.aurora.store.utility.Util;
+import com.aurora.store.util.PathUtil;
+import com.aurora.store.util.TextUtil;
+import com.aurora.store.util.Util;
import com.dragons.aurora.playstoreapiv2.AndroidAppDeliveryData;
import com.dragons.aurora.playstoreapiv2.AppFileMetadata;
import com.dragons.aurora.playstoreapiv2.Split;
diff --git a/app/src/main/java/com/aurora/store/CardType.java b/app/src/main/java/com/aurora/store/enums/CardType.java
similarity index 96%
rename from app/src/main/java/com/aurora/store/CardType.java
rename to app/src/main/java/com/aurora/store/enums/CardType.java
index 46a7e159c..7c812e33d 100644
--- a/app/src/main/java/com/aurora/store/CardType.java
+++ b/app/src/main/java/com/aurora/store/enums/CardType.java
@@ -18,7 +18,7 @@
*
*/
-package com.aurora.store;
+package com.aurora.store.enums;
public enum CardType {
LEGACY,
diff --git a/app/src/main/java/com/aurora/store/ErrorType.java b/app/src/main/java/com/aurora/store/enums/ErrorType.java
similarity index 89%
rename from app/src/main/java/com/aurora/store/ErrorType.java
rename to app/src/main/java/com/aurora/store/enums/ErrorType.java
index a3b00f638..112667ae8 100644
--- a/app/src/main/java/com/aurora/store/ErrorType.java
+++ b/app/src/main/java/com/aurora/store/enums/ErrorType.java
@@ -18,17 +18,14 @@
*
*/
-package com.aurora.store;
+package com.aurora.store.enums;
public enum ErrorType {
NO_NETWORK,
- NO_APPS,
- NO_UPDATES,
- NO_SEARCH,
NO_DOWNLOADS,
+ NO_API,
UNKNOWN,
SESSION_EXPIRED,
APP_NOT_FOUND,
- LOGOUT_ERR,
- IMPORT
+ LOGOUT_ERR
}
diff --git a/app/src/main/java/com/aurora/store/NotificationProvider.java b/app/src/main/java/com/aurora/store/enums/NotificationProvider.java
similarity index 96%
rename from app/src/main/java/com/aurora/store/NotificationProvider.java
rename to app/src/main/java/com/aurora/store/enums/NotificationProvider.java
index f0b0db32d..93324bad1 100644
--- a/app/src/main/java/com/aurora/store/NotificationProvider.java
+++ b/app/src/main/java/com/aurora/store/enums/NotificationProvider.java
@@ -18,7 +18,7 @@
*
*/
-package com.aurora.store;
+package com.aurora.store.enums;
public enum NotificationProvider {
NATIVE,
diff --git a/app/src/main/java/com/aurora/store/events/Event.java b/app/src/main/java/com/aurora/store/events/Event.java
index 38d9b6622..2cc24ef08 100644
--- a/app/src/main/java/com/aurora/store/events/Event.java
+++ b/app/src/main/java/com/aurora/store/events/Event.java
@@ -1,18 +1,40 @@
package com.aurora.store.events;
+import lombok.Data;
+
+
+@Data
public class Event {
- private Events event;
+ private SubType subType;
+ private String packageName;
+ private int status;
- public Event(Events event) {
- this.event = event;
+ public Event(SubType subType, String packageName, int status) {
+ this.subType = subType;
+ this.packageName = packageName;
+ this.status = status;
}
- public Events getEvent() {
- return event;
+ public Event(SubType subType, String packageName) {
+ this.subType = subType;
+ this.packageName = packageName;
}
- public void setEvent(Events event) {
- this.event = event;
+ public Event(SubType subType) {
+ this.subType = subType;
+ }
+
+ public enum SubType {
+ API_SUCCESS,
+ API_FAILED,
+ API_ERROR,
+ BLACKLIST,
+ WHITELIST,
+ INSTALLED,
+ UNINSTALLED,
+ NETWORK_UNAVAILABLE,
+ NETWORK_AVAILABLE,
+ BULK_UPDATE_NOTIFY
}
}
diff --git a/app/src/main/java/com/aurora/store/events/Events.java b/app/src/main/java/com/aurora/store/events/Events.java
deleted file mode 100644
index 272dacab5..000000000
--- a/app/src/main/java/com/aurora/store/events/Events.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.aurora.store.events;
-
-public enum Events {
- LOGGED_IN,
- LOGGED_OUT,
- TOKEN_REFRESHED,
- TOKEN_EXPIRED,
- NET_CONNECTED,
- NET_DISCONNECTED,
- PERMANENT_FAIL,
- BLACKLIST
-}
diff --git a/app/src/main/java/com/aurora/store/events/RxBus.java b/app/src/main/java/com/aurora/store/events/RxBus.java
index adb3c89f1..9420c60e0 100644
--- a/app/src/main/java/com/aurora/store/events/RxBus.java
+++ b/app/src/main/java/com/aurora/store/events/RxBus.java
@@ -3,38 +3,11 @@ package com.aurora.store.events;
import com.jakewharton.rxrelay2.PublishRelay;
import com.jakewharton.rxrelay2.Relay;
-import io.reactivex.Observable;
-
public class RxBus {
- public static volatile RxBus instance;
- private final Relay