Fixed crash.

parent 4087da9f
......@@ -7,13 +7,12 @@ android {
applicationId "com.systemallica.gallery"
minSdkVersion 21
targetSdkVersion 27
versionCode 6
versionName "1.0.5"
versionCode 11
versionName "1.0.11"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
minifyEnabled false
}
}
}
......
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in d:\Profiles\areveronmolina\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
......@@ -292,7 +292,14 @@ public class FolderActivity extends AppCompatActivity {
}
// The only image of the folder was deleted
else if(resultCode == 2) {
Snackbar.make(findViewById(R.id.main), getString(R.string.no_images), Snackbar.LENGTH_LONG)
int position = data.getIntExtra("file", 0);
list_of_paths.remove(list_of_paths.get(position));
list_of_files.remove(list_of_files.get(position));
gridAdapter.notifyDataSetChanged();
// Reload
startRefresh();
// Show message
Snackbar.make(findViewById(R.id.folder), getString(R.string.no_images), Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
// Folder emptied
setResult(1);
......@@ -310,13 +317,13 @@ public class FolderActivity extends AppCompatActivity {
list_of_files.remove(list_of_files.get(position));
gridAdapter.notifyDataSetChanged();
// Reload
loadImages(folder, columns);
startRefresh();
setResult(2);
}
// Simple UI refresh
else if(resultCode == 5) {
// Reload
loadImages(folder, columns);
startRefresh();
setResult(2);
}
}else if (requestCode == 2){
......@@ -327,7 +334,7 @@ public class FolderActivity extends AppCompatActivity {
list_of_files.remove(list_of_files.get(position));
gridAdapter.notifyDataSetChanged();
// Reload
loadImages(folder, columns);
startRefresh();
// Set result
setResult(2);
}
......
......@@ -33,7 +33,7 @@ import static android.content.pm.PackageManager.PERMISSION_GRANTED;
public class MainActivity extends AppCompatActivity {
final int MY_PERMISSIONS_REQUEST_BOTH= 114;
final int MY_PERMISSIONS_REQUEST_BOTH = 114;
int columns = 2;
int folder_position;
ArrayList<FolderItem> list_of_folders = new ArrayList<>();
......
......@@ -2,6 +2,7 @@
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/folder"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.systemallica.gallery.FolderActivity">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment