Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Guiorgy committed Apr 22, 2019
2 parents 5095625 + 31db1a2 commit b7ecb55
Show file tree
Hide file tree
Showing 28 changed files with 312 additions and 606 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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
Expand Down
20 changes: 15 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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) -> {
Expand All @@ -93,7 +93,7 @@ SmbFileChooserDialog.newDialog(context, "**.***.*.**", authenticator)
dialog.setAdapter(new ArrayAdapter<String>(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 -> {
Expand Down Expand Up @@ -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).

Expand Down
6 changes: 2 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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));
});
Expand Down
11 changes: 6 additions & 5 deletions app/src/main/res/values-v21/styles.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="FileChooserDialogStyle.Dark" parent="@android:style/Theme.Material.Dialog.Alert">
<style name="FileChooserDialogStyle_Dark" parent="@android:style/Theme.Material.Dialog.Alert">
<item name="android:buttonStyle">@android:style/Widget.Holo.Light.Button</item>
<item name="android:textColorPrimary">@android:color/white</item>
<item name="colorAccent">@android:style/TextAppearance.Holo.DialogWindowTitle</item>
<item name="android:windowTitleStyle">@style/FileChooserTitleStyle.Dark</item>
<item name="android:buttonBarButtonStyle">@style/FileChooserButtonStyle.Dark</item>
<item name="android:windowTitleStyle">@style/FileChooserTitleStyle_Dark</item>
<item name="android:buttonBarButtonStyle">@style/FileChooserButtonStyle_Dark</item>
<item name="android:backgroundDimAmount">0.8</item>
</style>

<style name="FileChooserTitleStyle.Dark" parent="FileChooserTitleStyle">
<style name="FileChooserTitleStyle_Dark" parent="FileChooserTitleStyle">
<item name="android:textAppearance">@android:style/TextAppearance.Holo.DialogWindowTitle</item>
<item name="android:textColor">@android:color/holo_blue_light</item>
</style>

<style name="FileChooserButtonStyle.Dark" parent="FileChooserButtonStyle">
<style name="FileChooserButtonStyle_Dark" parent="FileChooserButtonStyle">
<item name="android:textColor">@android:color/holo_blue_light</item>
</style>

Expand Down
40 changes: 20 additions & 20 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,58 @@
<!-- Base application theme -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here -->
<!-- <item name="fileChooserStyle">@style/FileChooserStyle.Dark</item> -->
<!-- <item name="fileChooserStyle">@style/FileChooserStyle_Dark</item> -->
</style>

<!-- Dark theme example for file chooser -->
<style name="FileChooserStyle.Dark" parent="FileChooserStyle">
<style name="FileChooserStyle_Dark" parent="FileChooserStyle">
<item name="fileChooserDialogGravity">center</item>
<item name="fileChooserDialogBackgroundDimAmount">0.8</item>
<item name="fileChooserDialogStyle">@style/FileChooserDialogStyle.Dark</item>
<item name="fileChooserListItemStyle">@style/FileChooserListItemStyle.Dark</item>
<item name="fileChooserPathViewStyle">@style/FileChooserPathViewStyle.Dark</item>
<item name="fileChooserNewFolderStyle">@style/FileChooserNewFolderStyle.Dark</item>
<item name="fileChooserDialogStyle">@style/FileChooserDialogStyle_Dark</item>
<item name="fileChooserListItemStyle">@style/FileChooserListItemStyle_Dark</item>
<item name="fileChooserPathViewStyle">@style/FileChooserPathViewStyle_Dark</item>
<item name="fileChooserNewFolderStyle">@style/FileChooserNewFolderStyle_Dark</item>
</style>

<style name="FileChooserDialogStyle.Dark" parent="@android:style/Theme.DeviceDefault">
<style name="FileChooserDialogStyle_Dark" parent="@android:style/Theme.DeviceDefault">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:textColorPrimary">@android:color/holo_blue_light</item>
<item name="colorAccent">@android:color/holo_blue_light</item>
<item name="android:windowTitleStyle">@style/FileChooserTitleStyle.Dark</item>
<item name="android:buttonBarButtonStyle">@style/FileChooserButtonStyle.Dark</item>
<item name="android:windowTitleStyle">@style/FileChooserTitleStyle_Dark</item>
<item name="android:buttonBarButtonStyle">@style/FileChooserButtonStyle_Dark</item>
<item name="android:backgroundDimAmount">0.8</item>
</style>

<style name="FileChooserTitleStyle.Dark" parent="FileChooserTitleStyle">
<style name="FileChooserTitleStyle_Dark" parent="FileChooserTitleStyle">
<item name="android:textAppearance">@android:style/TextAppearance.Holo.DialogWindowTitle</item>
</style>

<style name="FileChooserButtonStyle.Dark" parent="FileChooserButtonStyle">
<style name="FileChooserButtonStyle_Dark" parent="FileChooserButtonStyle">
<item name="android:textColor">@android:color/holo_blue_light</item>
</style>

<style name="FileChooserListItemStyle.Dark" parent="FileChooserListItemStyle">
<item name="fileChooserTextNameStyle">@style/FileChooserTextNameStyle.Dark</item>
<item name="fileChooserTextSizeStyle">@style/FileChooserTextSizeDateStyle.Dark</item>
<item name="fileChooserTextDateStyle">@style/FileChooserTextSizeDateStyle.Dark</item>
<style name="FileChooserListItemStyle_Dark" parent="FileChooserListItemStyle">
<item name="fileChooserTextNameStyle">@style/FileChooserTextNameStyle_Dark</item>
<item name="fileChooserTextSizeStyle">@style/FileChooserTextSizeDateStyle_Dark</item>
<item name="fileChooserTextDateStyle">@style/FileChooserTextSizeDateStyle_Dark</item>
<item name="android:background">@color/li_row_background_dark</item>
<item name="fileListItemSelectedTint">@color/li_row_background_tint_dark</item>
<item name="fileListItemFocusedDrawable">@drawable/listview_item_selector_dark</item>
</style>

<style name="FileChooserTextNameStyle.Dark" parent="FileChooserTextNameStyle">
<style name="FileChooserTextNameStyle_Dark" parent="FileChooserTextNameStyle">
<item name="android:textColor">@color/text_light</item>
</style>

<style name="FileChooserTextSizeDateStyle.Dark" parent="FileChooserTextSizeStyle">
<style name="FileChooserTextSizeDateStyle_Dark" parent="FileChooserTextSizeStyle">
<item name="android:textColor">@color/text_light</item>
</style>

<style name="FileChooserPathViewStyle.Dark" parent="FileChooserPathViewStyle">
<style name="FileChooserPathViewStyle_Dark" parent="FileChooserPathViewStyle">
<item name="android:background">@color/background_dark</item>
<item name="android:textColor">@color/text_light_opaque</item>
</style>

<style name="FileChooserNewFolderStyle.Dark">
<style name="FileChooserNewFolderStyle_Dark">
<item name="fileChooserNewFolderOverlayColor">@color/overlay_dark</item>
<item name="fileChooserNewFolderBackgroundColor">@color/background_dark</item>
<item name="fileChooserNewFolderWidthWeight">0.8</item>
Expand Down
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.21'
ext.kotlin_version = '1.3.30'
repositories {
google()
maven { url "https://maven.google.com" }
maven { url "https://maven.google.com" }
maven { url "https://dl.bintray.com/kotlin/kotlinx/" }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.android.tools:r8:1.3.52'

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.1.0'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.9.5'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'

// NOTE: Do not place your application dependencies here; they belong
Expand Down
26 changes: 15 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,25 @@ android.enableJetifier=true
android.useAndroidX=true

# Global variables
VERSION_NAME=1.4.1s
VERSION_CODE=104010
GROUP=com.obsez.android.lib.filechooser
VERSION_NAME=1.4.2s
VERSION_CODE=104020
GROUP=com.obsez.android.lib.smbfilechooser

POM_DESCRIPTION=Android File Chooser Library
POM_URL=https://github.com/hedzr/android-file-chooser
POM_SCM_URL=https://github.com/hedzr/android-file-chooser.git
POM_SCM_CONNECTION=scm:git@github.com:hedzr/android-file-chooser.git
POM_SCM_DEV_CONNECTION=scm:git@github.com:hedzr/android-file-chooser.git
POM_GROUP_ID=com.github.Guiorgy
POM_ARTIFACT_ID=android-smbfile-chooser
POM_INCEPTION_YEAR=2018
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=hedzr
POM_DEVELOPER_NAME=Hedzr Yeh
POM_DEVELOPER_EMAIL=hedzrz@gmail.com

#POM_DESCRIPTION=Android File Chooser Library
#POM_URL=https://github.com/hedzr/android-file-chooser
#POM_SCM_URL=https://github.com/hedzr/android-file-chooser.git
#POM_SCM_CONNECTION=scm:git@github.com:hedzr/android-file-chooser.git
#POM_SCM_DEV_CONNECTION=scm:git@github.com:hedzr/android-file-chooser.git
#POM_DEVELOPER_ID=hedzr
#POM_DEVELOPER_NAME=Hedzr Yeh
#POM_DEVELOPER_EMAIL=hedzrz@gmail.com

ANDROID_COMPILE_SDK_VERSION=28
ANDROID_BUILD_TOOLS_VERSION=28.0.3
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Feb 08 16:19:41 GET 2019
#Mon Apr 22 10:49:29 GET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
72 changes: 0 additions & 72 deletions library/_bintray.gradle

This file was deleted.

Loading

0 comments on commit b7ecb55

Please sign in to comment.