diff --git a/.gitignore b/.gitignore index fb2fe88..ba90761 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /.idea/ /app/StyleMe /app/src/main/res/values/secrets.xml +/gradle.properties diff --git a/app/build.gradle b/app/build.gradle index a1b3672..f9bfba0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,13 +1,12 @@ apply plugin: 'com.android.application' apply plugin: "com.neenbedankt.android-apt" - android { signingConfigs { signing { - keyAlias 'styleme' - keyPassword 'koshkosh1' + keyAlias ANDROID_KEY_ALIAS + keyPassword ANDROID_STORE_PASSWORD storeFile file('StyleMe') - storePassword 'koshkosh1' + storePassword ANDROID_STORE_PASSWORD } } compileSdkVersion 25 @@ -89,7 +88,6 @@ dependencies { compile 'org.adw.library:discrete-seekbar:1.0.1' compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1' compile 'pub.devrel:easypermissions:0.2.1' - compile 'com.github.iammert:MaterialIntroView:1.5.2' apt 'frankiesardo:icepick-processor:3.1.0' apt 'com.jakewharton:butterknife-compiler:8.4.0' } diff --git a/app/src/main/java/com/fastaccess/helper/ViewHelper.java b/app/src/main/java/com/fastaccess/helper/ViewHelper.java index a552452..ddf89d1 100644 --- a/app/src/main/java/com/fastaccess/helper/ViewHelper.java +++ b/app/src/main/java/com/fastaccess/helper/ViewHelper.java @@ -1,7 +1,6 @@ package com.fastaccess.helper; import android.annotation.SuppressLint; -import android.app.Activity; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Configuration; @@ -17,7 +16,6 @@ import android.graphics.drawable.shapes.RoundRectShape; import android.support.annotation.IdRes; import android.support.annotation.NonNull; -import android.support.annotation.Nullable; import android.support.annotation.StringRes; import android.support.design.widget.NavigationView; import android.support.v4.content.ContextCompat; @@ -35,11 +33,6 @@ import java.util.Arrays; -import co.mobiwise.materialintro.animation.MaterialIntroListener; -import co.mobiwise.materialintro.shape.Focus; -import co.mobiwise.materialintro.shape.FocusGravity; -import co.mobiwise.materialintro.view.MaterialIntroView; - /** * Created by kosh20111 on 10/7/2015 10:42 PM @@ -158,45 +151,6 @@ public static void showTooltip(@NonNull final View view, @StringRes int titleRes showTooltip(view, titleResId, tag, Gravity.BOTTOM); } - public static void showMaterialIntroView(@NonNull Context context, @NonNull View view, @StringRes int resId, - boolean showAnimation, @Nullable MaterialIntroListener listener) { - Activity activity = ActivityHelper.getActivity(context); - if (activity == null) { - activity = ActivityHelper.getActivity(view.getContext()); - if (activity == null) { - showTooltip(view, resId, String.valueOf(resId)); - return; - } - } - new MaterialIntroView.Builder(activity) - .enableDotAnimation(showAnimation) - .enableIcon(true) - .setFocusGravity(FocusGravity.CENTER) - .setFocusType(Focus.MINIMUM) - .setDelayMillis(1500) - .enableFadeAnimation(true) - .setInfoText(activity.getResources().getString(resId)) - .performClick(true) - .setTarget(view) - .setListener(listener) - .setUsageId(view.getId() != 0 ? String.valueOf(view.getId()) : String.valueOf(resId)) - .show(); - } - - public static void showMaterialIntroView(@NonNull Context context, @NonNull View view, @StringRes int resId, - @Nullable MaterialIntroListener listener) { - showMaterialIntroView(context, view, resId, false, listener); - - } - - public static void showMaterialIntroView(@NonNull Context context, @NonNull View view, @StringRes int resId, boolean showAnimation) { - showMaterialIntroView(context, view, resId, showAnimation, null); - } - - public static void showMaterialIntroView(@NonNull Context context, @NonNull View view, @StringRes int resId) { - showMaterialIntroView(context, view, resId, null); - } - public static Rect getLayoutPosition(@NonNull View view) { Rect myViewRect = new Rect(); view.getGlobalVisibleRect(myViewRect); diff --git a/app/src/main/java/com/fastaccess/ui/adapter/DeviceAppsAdapter.java b/app/src/main/java/com/fastaccess/ui/adapter/DeviceAppsAdapter.java index b922c48..62ef9e5 100644 --- a/app/src/main/java/com/fastaccess/ui/adapter/DeviceAppsAdapter.java +++ b/app/src/main/java/com/fastaccess/ui/adapter/DeviceAppsAdapter.java @@ -42,6 +42,31 @@ public DeviceAppsAdapter(@NonNull List data, @Nullable DeviceAppsView } } + @Override public Filter getFilter() { + return new Filter() { + @Override protected FilterResults performFiltering(CharSequence charSequence) { + final FilterResults oReturn = new FilterResults(); + final List results = new ArrayList<>(); + if (!InputHelper.isEmpty(charSequence)) { + if (!getData().isEmpty()) { + for (AppsModel appInfo : getData()) { + if (appInfo.getAppName().toLowerCase().contains(charSequence.toString())) { + results.add(appInfo); + } + } + } + oReturn.values = results; + oReturn.count = results.size(); + } + return oReturn; + } + + @SuppressWarnings("unchecked") @Override protected void publishResults(CharSequence constraint, FilterResults results) { + insertItems((List) results.values); + } + }; + } + public void select(String packageName, int position, boolean select) { if (select) selection.put(packageName, getItem(position)); else selection.remove(packageName); @@ -69,29 +94,4 @@ public List getSelections() { return new ArrayList<>(selection.values()); } - @Override public Filter getFilter() { - return new Filter() { - @Override protected FilterResults performFiltering(CharSequence charSequence) { - final FilterResults oReturn = new FilterResults(); - final List results = new ArrayList<>(); - if (!InputHelper.isEmpty(charSequence)) { - if (!getData().isEmpty()) { - for (AppsModel appInfo : getData()) { - if (appInfo.getAppName().toLowerCase().contains(charSequence.toString())) { - results.add(appInfo); - } - } - } - oReturn.values = results; - oReturn.count = results.size(); - } - return oReturn; - } - - @SuppressWarnings("unchecked") @Override protected void publishResults(CharSequence constraint, FilterResults results) { - insertItems((List) results.values); - } - }; - } - } diff --git a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/DeviceAppsViewHolder.java b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/DeviceAppsViewHolder.java index 0e011c6..acae30f 100644 --- a/app/src/main/java/com/fastaccess/ui/adapter/viewholder/DeviceAppsViewHolder.java +++ b/app/src/main/java/com/fastaccess/ui/adapter/viewholder/DeviceAppsViewHolder.java @@ -24,8 +24,8 @@ public class DeviceAppsViewHolder extends BaseViewHolder implements ItemTouchHelperViewHolder { @BindView(R.id.appIcon) ImageView appIcon; @BindView(R.id.cardView) CardView cardView; - @ColorInt private int selectedColor; - @ColorInt private int normalColor; + @ColorInt private final int selectedColor; + @ColorInt private final int normalColor; private boolean selected; public DeviceAppsViewHolder(@NonNull View itemView, @Nullable BaseRecyclerAdapter adapter) { diff --git a/app/src/main/java/com/fastaccess/ui/base/BaseBottomSheetDialog.java b/app/src/main/java/com/fastaccess/ui/base/BaseBottomSheetDialog.java index 456a338..4519ea2 100644 --- a/app/src/main/java/com/fastaccess/ui/base/BaseBottomSheetDialog.java +++ b/app/src/main/java/com/fastaccess/ui/base/BaseBottomSheetDialog.java @@ -26,6 +26,21 @@ public abstract class BaseBottomSheetDialog extends BottomSheetDialogFragment { protected BottomSheetBehavior bottomSheetBehavior; + private BottomSheetBehavior.BottomSheetCallback bottomSheetCallback = new BottomSheetBehavior.BottomSheetCallback() { + @Override public void onStateChanged(@NonNull View bottomSheet, int newState) { + if (newState == BottomSheetBehavior.STATE_HIDDEN) { + isAlreadyHidden = true; + onHidden(); + } + } + + @Override public void onSlide(@NonNull View bottomSheet, float slideOffset) { + if (slideOffset == -1.0) { + isAlreadyHidden = true; + onDismissedByScrolling(); + } + } + }; protected boolean isAlreadyHidden; @Nullable private Unbinder unbinder; @@ -52,22 +67,8 @@ public abstract class BaseBottomSheetDialog extends BottomSheetDialogFragment { View parent = ((View) contentView.getParent()); bottomSheetBehavior = BottomSheetBehavior.from(parent); if (bottomSheetBehavior != null) { + bottomSheetBehavior.setBottomSheetCallback(bottomSheetCallback); bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED); - bottomSheetBehavior.setBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() { - @Override public void onStateChanged(@NonNull View bottomSheet, int newState) { - if (newState == BottomSheetBehavior.STATE_HIDDEN) { - isAlreadyHidden = true; - onHidden(); - } - } - - @Override public void onSlide(@NonNull View bottomSheet, float slideOffset) { - if (slideOffset == -1.0) { - isAlreadyHidden = true; - onDismissedByScrolling(); - } - } - }); } unbinder = ButterKnife.bind(this, contentView); onViewCreated(contentView); @@ -80,15 +81,18 @@ public abstract class BaseBottomSheetDialog extends BottomSheetDialogFragment { @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Dialog dialog = super.onCreateDialog(savedInstanceState); - if (ViewHelper.isTablet(getContext())) { - dialog.setOnShowListener(new DialogInterface.OnShowListener() { - @Override public void onShow(DialogInterface dialogINterface) { - if (dialog.getWindow() != null) dialog.getWindow().setLayout( - ViewGroup.LayoutParams.WRAP_CONTENT, - ViewGroup.LayoutParams.MATCH_PARENT); + dialog.setOnShowListener(new DialogInterface.OnShowListener() { + @Override public void onShow(DialogInterface dialogINterface) { + if (ViewHelper.isTablet(getContext())) { + if (dialog.getWindow() != null) { + dialog.getWindow().setLayout( + ViewGroup.LayoutParams.WRAP_CONTENT, + ViewGroup.LayoutParams.MATCH_PARENT); + } } - }); - } + onDialogIsVisible(); + } + }); dialog.setOnKeyListener(new DialogInterface.OnKeyListener() { @Override public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { @@ -116,8 +120,10 @@ public abstract class BaseBottomSheetDialog extends BottomSheetDialogFragment { protected void onHidden() { dismiss(); - } + }//helper method to notify dialogs + + protected void onDismissedByScrolling() {}//helper method to notify dialogs - protected void onDismissedByScrolling() {} + protected void onDialogIsVisible() {}//helper method to notify dialogs } \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/MainPresenter.java b/app/src/main/java/com/fastaccess/ui/modules/main/MainPresenter.java index 45834f1..7a31c5e 100644 --- a/app/src/main/java/com/fastaccess/ui/modules/main/MainPresenter.java +++ b/app/src/main/java/com/fastaccess/ui/modules/main/MainPresenter.java @@ -43,12 +43,12 @@ public class MainPresenter extends BasePresenter implements MainMvp.Presenter { - public static MainPresenter with(MainMvp.View view) { - return new MainPresenter(view); + private MainPresenter(@NonNull MainMvp.View view) { + super(view); } - protected MainPresenter(@NonNull MainMvp.View view) { - super(view); + public static MainPresenter with(MainMvp.View view) { + return new MainPresenter(view); } @Override public void onActivityStarted(@Nullable Bundle savedInstance, @@ -181,11 +181,11 @@ protected MainPresenter(@NonNull MainMvp.View view) { .appendQueryParameter("link", Uri.parse(deepLinkBuilder.toString()).toString()) .appendQueryParameter("apn", packageName); ShareCompat.IntentBuilder.from(mainView) - .setType("message/rfc822") + .setType("message/*") .setSubject(mainView.getString(R.string.sharing_backup)) .setChooserTitle(mainView.getString(R.string.share_my_backup)) .setHtmlText("" + mainView.getString(R.string.click_here_html) + - "
~" + mainView.getString(R.string.app_name) + "").startChooser(); + "
~" + mainView.getString(R.string.app_name) + "").startChooser(); } @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/MainView.java b/app/src/main/java/com/fastaccess/ui/modules/main/MainView.java index 405e4d3..4195c3d 100644 --- a/app/src/main/java/com/fastaccess/ui/modules/main/MainView.java +++ b/app/src/main/java/com/fastaccess/ui/modules/main/MainView.java @@ -60,6 +60,7 @@ public class MainView extends BaseActivity implemen @BindView(R.id.drawerLayout) DrawerLayout drawerLayout; @BindView(R.id.bottomNavigation) BottomNavigation bottomNavigation; @BindView(R.id.fab) FloatingActionButton fab; + private MainPresenter presenter; private BadgeProvider badgeProvider; private GoogleApiClient mGoogleApiClient; diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml index ee91b2d..862bf83 100644 --- a/app/src/main/res/values-v21/styles.xml +++ b/app/src/main/res/values-v21/styles.xml @@ -7,6 +7,6 @@ ?colorPrimary true @color/transparent - truem> + true \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 00da3a3..5eb17f7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -33,7 +33,7 @@ Required Apps Delete - Click here to change color + Click here to change the folder color Select Apps Add All Remove All @@ -119,4 +119,5 @@ Hello there!, I\'m sharing my FA backup with you. Restore functionality is not available Click here to restore my FA backup. + diff --git a/build.gradle b/build.gradle index 15ea4dd..db6c0c0 100644 --- a/build.gradle +++ b/build.gradle @@ -22,3 +22,4 @@ allprojects { task clean(type: Delete) { delete rootProject.buildDir } + diff --git a/gradle.properties b/gradle.properties index aac7c9b..6ad8a18 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,17 +1,3 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx1536m - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true +ANDROID_STORE_PASSWORD=koshkosh1 +ANDROID_KEY_PASSWORD=koshkosh1 +ANDROID_KEY_ALIAS=styleme \ No newline at end of file