From 31db1a2755ca611ef393edfebd3b0b9a8791b7a6 Mon Sep 17 00:00:00 2001 From: Guiorgy Date: Mon, 22 Apr 2019 14:45:16 +0400 Subject: [PATCH] 1.4.2s \- removed refreshLayout \+ instead, added refresh button in the options menu \* bumped gradle \* bugs fixed --- .gitignore | 1 + CHANGELOG | 7 + README.md | 20 +- app/build.gradle | 6 +- .../demo/ChooseFileActivityFragment.java | 4 +- app/src/main/res/values-v21/styles.xml | 11 +- app/src/main/res/values/styles.xml | 40 ++-- build.gradle | 7 +- gradle.properties | 26 ++- gradle/wrapper/gradle-wrapper.properties | 4 +- library/_bintray.gradle | 72 ------ library/_mavenlocal.gradle | 141 ------------ library/_sonatype.gradle | 134 ----------- library/build.gradle | 27 +-- library/gradle.properties | 35 ++- library/pom.xml | 6 +- .../lib/smbfilechooser/FileChooserDialog.java | 59 ++--- .../smbfilechooser/SmbFileChooserDialog.java | 215 ++++++++++-------- .../android/lib/smbfilechooser/Versions.java | 8 - .../lib/smbfilechooser/internals/UiUtil.java | 6 +- .../lib/smbfilechooser/tool/DirAdapter.java | 3 +- .../tool/IExceptionHandler.java | 16 +- .../smbfilechooser/tool/SmbDirAdapter.java | 50 ++-- .../src/main/res/drawable/ic_refresh_24dp.xml | 5 + library/src/main/res/values-v21/styles.xml | 3 + library/src/main/res/values/attr.xml | 1 - library/src/main/res/values/strings_0.xml | 1 + library/src/main/res/values/styles.xml | 4 +- relnotes.md | 7 + 29 files changed, 313 insertions(+), 606 deletions(-) delete mode 100644 library/_bintray.gradle delete mode 100644 library/_mavenlocal.gradle delete mode 100644 library/_sonatype.gradle delete mode 100644 library/src/main/java/com/obsez/android/lib/smbfilechooser/Versions.java create mode 100644 library/src/main/res/drawable/ic_refresh_24dp.xml diff --git a/.gitignore b/.gitignore index d5000f0b..744e371f 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ app/src/main/java/com/obsez/android/lib/smbfilechooser/demo/ChooseFileActivityFr *.iml___jb_tmp___ library/src/main/java/com/obsez/android/lib/smbfilechooser/tool/MyAdapter.java___jb_tmp___ app/src/main/res/values/colors.xml___jb_tmp___ +.idea/assetWizardSettings.xml diff --git a/CHANGELOG b/CHANGELOG index 42dda4c0..bd61a4bd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,12 @@ # Changelog +## 1.4.2s - 2019-04-22 + +\- removed refreshLayout +\+ instead, added refresh button in the options menu +\* bumped gradle +\* bugs fixed + ## 1.4.1s - 2019-04-08 \+ fileListItemFocusedDrawable attribute added diff --git a/README.md b/README.md index fab8cd11..1710de92 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ SmbFileChooserDialog.newDialog(context, "**.***.*.**", authenticator) e.printStackTrace(); } // This is NOT main UI thread. you can NOT access SmbFiles on UI thread. - Handler mainHandler = new Handler(ctx.getMainLooper()); + Handler mainHandler = new Handler(context.getMainLooper()); mainHandler.post(() -> { Toast.makeText(context, msg, @@ -82,7 +82,7 @@ SmbFileChooserDialog.newDialog(context, "**.***.*.**", authenticator) ```java .displayPath(/*displays the current path in the title (title must be enabled)*/ true) .enableOptions(/*enables 'New folder' and 'Delete'*/ true) -.setOptionResources("New folder", "Delete", "Cancel", "OK") +.setOptionResources("New folder", /*only on `SmbFileChooserDialog`*/ "Refresh", "Delete", "Cancel", "OK") .setNewFolderFilter(new NewFolderFilter(/*max length of 10*/ 10, /*regex pattern that only allows a to z (lowercase)*/ "^[a-z]*$")) .enableMultiple(/*enables the ability to select multiple*/ true, /*allows selecting folders along with files*/ true) .setOnSelectedListener(/*this gets called, when user selects more than 1 file*/ (files) -> { @@ -93,7 +93,7 @@ SmbFileChooserDialog.newDialog(context, "**.***.*.**", authenticator) dialog.setAdapter(new ArrayAdapter(context, android.R.layout.simple_expandable_list_item_1, paths) , null); dialog.show(); }) -.enableDpad(/*enables Dpad controls (mainly fot Android TVs)*/ true) +.enableDpad(/*enables Dpad controls (mainly for Android TVs)*/ true) .cancelOnTouchOutside(true) .setTheme(R.style.FileChooserStyle) .setAdapterSetter(adapter -> { @@ -123,15 +123,25 @@ FileChooserDialog.setOnSelectedListener(files -> { paths.add(file.getPath()); } - new AlertDialog.Builder(ctx) + new AlertDialog.Builder(context) .setTitle(files.size() + " files selected:") - .setAdapter(new ArrayAdapter<>(ctx, + .setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_expandable_list_item_1, paths), null) .create() .show(); }); ``` - there's no _**titleFollowsDir**_ option, and _**displayPath**_ is false by default +- in _**SmbFileChooserDialog**_ use _**setExceptionHandler**_ to handle exceptions +```java +interface ExceptionHandler { + /** + * @return true to attempt to terminate. + * false to attempt to ignore exception and continue + */ + boolean handle(Throwable exception, int id); +} +``` For more information please refer to the [upstream repo](https://github.com/hedzr/android-file-chooser). diff --git a/app/build.gradle b/app/build.gradle index 2740ae4b..775cd7f2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,6 @@ android { signingConfigs { Properties properties = new Properties() properties.load(project.rootProject.file('local.properties').newDataInputStream()) - //def sdkDir = properties.getProperty('sdk.dir') - //def ndkDir = properties.getProperty('ndk.dir') def ksPath = properties.getProperty('KS_PATH') def keystorePropertiesFile = ksPath == null ? rootProject.file("../keystore.properties") : new File(ksPath) if (!keystorePropertiesFile.exists()) @@ -73,10 +71,10 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') implementation project(':library') - implementation 'androidx.appcompat:appcompat:1.1.0-alpha03' + implementation 'androidx.appcompat:appcompat:1.1.0-alpha04' implementation 'eu.agno3.jcifs:jcifs-ng:2.1.2' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3' + implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha4' implementation 'com.android.support:recyclerview-v7:28.0.0' implementation 'com.android.support:design:28.0.0' diff --git a/app/src/main/java/com/obsez/android/lib/smbfilechooser/demo/ChooseFileActivityFragment.java b/app/src/main/java/com/obsez/android/lib/smbfilechooser/demo/ChooseFileActivityFragment.java index e2ef23c1..5db774a9 100644 --- a/app/src/main/java/com/obsez/android/lib/smbfilechooser/demo/ChooseFileActivityFragment.java +++ b/app/src/main/java/com/obsez/android/lib/smbfilechooser/demo/ChooseFileActivityFragment.java @@ -117,7 +117,7 @@ public void onClick(View v) { if (enableSamba.isChecked()) { SmbFileChooserDialog smbFileChooserDialog = SmbFileChooserDialog.newDialog(ctx, _server) .setResources(R.string.title_choose_folder, R.string.title_choose, R.string.dialog_cancel) - .setOptionResources(R.string.option_create_folder, R.string.options_delete, R.string.new_folder_cancel, R.string.new_folder_ok) + .setOptionResources(R.string.option_create_folder, R.string.option_refresh, R.string.options_delete, R.string.new_folder_cancel, R.string.new_folder_ok) .disableTitle(disableTitle.isChecked()) .enableOptions(enableOptions.isChecked()) .displayPath(displayPath.isChecked()) @@ -188,7 +188,7 @@ public void onClick(View v) { if (continueFromLast.isChecked()) { _path = dir; } - Toast.makeText(ctx, (dirFile.isDirectory() ? "FOLDER: " : "FILE: ") + dir, Toast.LENGTH_SHORT).show(); + Toast.makeText(ctx, (dirFile.isDirectory() ? "FOLDER: " : "FILE: ") + dir, Toast.LENGTH_LONG).show(); _tv.setText(dir); if (dirFile.isFile()) _iv.setImageBitmap(ImageUtil.decodeFile(dirFile)); }); diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml index 13def886..42963260 100644 --- a/app/src/main/res/values-v21/styles.xml +++ b/app/src/main/res/values-v21/styles.xml @@ -1,20 +1,21 @@ - - - diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index a57dc37a..0913e4d7 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -3,58 +3,58 @@ - - - - - - - - -