diff --git a/app/build.gradle b/app/build.gradle index b19cd603..ce7362ac 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "us.koller.cameraroll" minSdkVersion 19 targetSdkVersion 26 - versionCode 28 - versionName "v1.7.1 Beta" + versionCode 29 + versionName "v1.7.2 Beta" vectorDrawables.useSupportLibrary = true testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } diff --git a/app/release/app-release.apk b/app/release/app-release.apk index e312519f..0e18f3dd 100644 Binary files a/app/release/app-release.apk and b/app/release/app-release.apk differ diff --git a/app/src/main/java/us/koller/cameraroll/ui/ItemActivity.java b/app/src/main/java/us/koller/cameraroll/ui/ItemActivity.java index 6ee83797..e475756b 100644 --- a/app/src/main/java/us/koller/cameraroll/ui/ItemActivity.java +++ b/app/src/main/java/us/koller/cameraroll/ui/ItemActivity.java @@ -588,6 +588,9 @@ public void onReceive(Context context, Intent intent) { final Activity activity = ItemActivity.this; String newFilePath = intent.getStringExtra(Rename.NEW_FILE_PATH); + if (newFilePath == null) { + return; + } int index = newFilePath.lastIndexOf("/"); final String albumPath = newFilePath.substring(0, index); getIntent().putExtra(ALBUM_PATH, albumPath); diff --git a/app/src/main/java/us/koller/cameraroll/ui/MainActivity.java b/app/src/main/java/us/koller/cameraroll/ui/MainActivity.java index 1045d229..a4f9383e 100644 --- a/app/src/main/java/us/koller/cameraroll/ui/MainActivity.java +++ b/app/src/main/java/us/koller/cameraroll/ui/MainActivity.java @@ -13,7 +13,6 @@ import android.os.Handler; import android.provider.MediaStore; import android.support.annotation.RequiresApi; -import android.support.design.widget.BaseTransientBottomBar; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.app.ActivityOptionsCompat; @@ -32,10 +31,8 @@ import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.WindowInsets; -import android.view.accessibility.AccessibilityManager; import android.widget.Toast; -import java.lang.reflect.Field; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -625,12 +622,15 @@ private void resortAlbums() { AsyncTask.execute(new Runnable() { @Override public void run() { - SortUtil.sortAlbums(MainActivity.this, MediaProvider.getAlbums()); + //SortUtil.sortAlbums(MainActivity.this, MediaProvider.getAlbums()); + final ArrayList albums = MediaProvider.getAlbumsWithVirtualDirectories(MainActivity.this); MainActivity.this.runOnUiThread(new Runnable() { @Override public void run() { - snackbar.dismiss(); + MainActivity.this.albums = albums; + ((RecyclerViewAdapter) recyclerView.getAdapter()).setAlbums(albums); recyclerView.getAdapter().notifyDataSetChanged(); + snackbar.dismiss(); } }); } diff --git a/app/src/main/java/us/koller/cameraroll/ui/widget/FabSnackbarBehaviour.java b/app/src/main/java/us/koller/cameraroll/ui/widget/FabSnackbarBehaviour.java index 75b0a53c..6156a950 100644 --- a/app/src/main/java/us/koller/cameraroll/ui/widget/FabSnackbarBehaviour.java +++ b/app/src/main/java/us/koller/cameraroll/ui/widget/FabSnackbarBehaviour.java @@ -47,4 +47,12 @@ public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionBu } return true; } + + @Override + public void onDependentViewRemoved(CoordinatorLayout parent, FloatingActionButton fab, View dependency) { + super.onDependentViewRemoved(parent, fab, dependency); + if (Util.SNACKBAR.equals(dependency.getTag()) && fabTranslationY != -1) { + fab.animate().translationY(fabTranslationY).start(); + } + } } \ No newline at end of file diff --git a/app/src/main/java/us/koller/cameraroll/util/Util.java b/app/src/main/java/us/koller/cameraroll/util/Util.java index e6ddd94c..21442a1d 100644 --- a/app/src/main/java/us/koller/cameraroll/util/Util.java +++ b/app/src/main/java/us/koller/cameraroll/util/Util.java @@ -14,7 +14,6 @@ import android.os.Build; import android.os.PowerManager; import android.support.annotation.RequiresApi; -import android.support.design.widget.BaseTransientBottomBar; import android.support.design.widget.Snackbar; import android.support.media.ExifInterface; import android.support.v4.content.res.ResourcesCompat; @@ -22,9 +21,7 @@ import android.support.v7.content.res.AppCompatResources; import android.support.v7.widget.Toolbar; import android.util.DisplayMetrics; -import android.util.Log; import android.view.View; -import android.view.accessibility.AccessibilityManager; import android.widget.TextView; import android.widget.Toast; @@ -32,7 +29,6 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; -import java.lang.reflect.Field; import java.util.Locale; import us.koller.cameraroll.R; @@ -155,20 +151,6 @@ public static boolean areStatusBarIconsDark(final View v) { public static void showSnackbar(Snackbar snackbar) { snackbar.getView().setTag(SNACKBAR); - // fixing SnackBar animation, when AccessibilityManager is enabled - // Solution from: https://stackoverflow.com/a/43811447/8378871 - try { - Field mAccessibilityManagerField = BaseTransientBottomBar.class.getDeclaredField("mAccessibilityManager"); - mAccessibilityManagerField.setAccessible(true); - AccessibilityManager accessibilityManager = (AccessibilityManager) mAccessibilityManagerField.get(snackbar); - Field mIsEnabledField = AccessibilityManager.class.getDeclaredField("mIsEnabled"); - mIsEnabledField.setAccessible(true); - mIsEnabledField.setBoolean(accessibilityManager, false); - mAccessibilityManagerField.set(snackbar, accessibilityManager); - } catch (Exception e) { - Log.d("Snackbar", "Reflection error: " + e.toString()); - } - TextView textView = snackbar.getView() .findViewById(android.support.design.R.id.snackbar_text); textView.setTypeface(Typeface.create("sans-serif-monospace", Typeface.NORMAL));