Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Add ability to enter a new filename #83

Merged
merged 14 commits into from
Jul 3, 2016
11 changes: 10 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ android:
- build-tools-23.0.2
- build-tools-23.0.1
- android-23
# - sys-img-armeabi-v7a-android-23
- extra-android-support
- extra-google-m2repository
- extra-android-m2repository
Expand All @@ -24,8 +25,16 @@ cache:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/

# Emulator Management: Create, Start and Wait
#before_script:
# x86 requires kvm which is not available on travis containers
# - echo no | android create avd --force -n test -t android-23 --abi armeabi-v7a
# - emulator -avd test -gpu off -no-audio -no-window &
# - android-wait-for-emulator
# - adb shell input keyevent 82 &

before_install:
- chmod +x gradlew

script:
- ./gradlew build check
- ./gradlew build check #testDebugUnitTest connectedDebugAndroidTest
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
* If you want to be able to select multiple items, include EXTRA_ALLOW_MULTIPLE
* (default false).
* <p/>
* Two non-standard extra arguments are supported as well: EXTRA_ONLY_DIRS
* (defaults to false)
* allows only directories to be selected.
* And EXTRA_START_PATH (default null), which should specify the starting path.
* Some non-standard extra arguments are supported as well:
* EXTRA_ONLY_DIRS - (default false) allows only directories to be selected.
* EXTRA_START_PATH - (default null) which should specify the starting path.
* EXTRA_ALLOW_EXISTING_FILE - (default true) if existing files are selectable in 'new file'-mode
* <p/>
* The result of the user's action is returned in onActivityResult intent,
* access it using getUri.
Expand All @@ -62,16 +62,20 @@ public abstract class AbstractFilePickerActivity<T> extends AppCompatActivity
// For compatibility
public static final String EXTRA_ALLOW_MULTIPLE =
"android.intent.extra" + ".ALLOW_MULTIPLE";
public static final String EXTRA_ALLOW_EXISTING_FILE =
"android.intent.extra" + ".ALLOW_EXISTING_FILE";
public static final String EXTRA_PATHS = "nononsense.intent.PATHS";
public static final int MODE_FILE = AbstractFilePickerFragment.MODE_FILE;
public static final int MODE_FILE_AND_DIR =
AbstractFilePickerFragment.MODE_FILE_AND_DIR;
public static final int MODE_NEW_FILE = AbstractFilePickerFragment.MODE_NEW_FILE;
public static final int MODE_DIR = AbstractFilePickerFragment.MODE_DIR;
protected static final String TAG = "filepicker_fragment";
protected String startPath = null;
protected int mode = AbstractFilePickerFragment.MODE_FILE;
protected boolean allowCreateDir = false;
protected boolean allowMultiple = false;
private boolean allowExistingFile = true;
protected boolean singleClick = false;

@Override
Expand All @@ -89,6 +93,8 @@ protected void onCreate(Bundle savedInstanceState) {
allowCreateDir);
allowMultiple =
intent.getBooleanExtra(EXTRA_ALLOW_MULTIPLE, allowMultiple);
allowExistingFile =
intent.getBooleanExtra(EXTRA_ALLOW_EXISTING_FILE, allowExistingFile);
singleClick =
intent.getBooleanExtra(EXTRA_SINGLE_CLICK, singleClick);
}
Expand All @@ -99,7 +105,8 @@ protected void onCreate(Bundle savedInstanceState) {

if (fragment == null) {
fragment =
getFragment(startPath, mode, allowMultiple, allowCreateDir, singleClick);
getFragment(startPath, mode, allowMultiple, allowCreateDir, allowExistingFile,
singleClick);
}

if (fragment != null) {
Expand All @@ -113,7 +120,8 @@ protected void onCreate(Bundle savedInstanceState) {

protected abstract AbstractFilePickerFragment<T> getFragment(
@Nullable final String startPath, final int mode, final boolean allowMultiple,
final boolean allowCreateDir, final boolean singleClick);
final boolean allowCreateDir, final boolean allowExistingFile,
final boolean singleClick);

@Override
public void onSaveInstanceState(Bundle b) {
Expand Down
Loading