default to reasonable external directory
This commit is contained in:
parent
b78465b744
commit
7ee5ff76ba
6 changed files with 26 additions and 8 deletions
|
@ -25,6 +25,8 @@ android {
|
||||||
|
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
exclude '.readme'
|
exclude '.readme'
|
||||||
|
exclude 'META-INF/LICENSE.txt'
|
||||||
|
exclude 'META-INF/NOTICE.txt'
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -67,7 +69,9 @@ dependencies {
|
||||||
compile 'com.jcraft:jsch:0.1.53'
|
compile 'com.jcraft:jsch:0.1.53'
|
||||||
compile 'org.apache.commons:commons-io:1.3.2'
|
compile 'org.apache.commons:commons-io:1.3.2'
|
||||||
compile 'com.jayway.android.robotium:robotium-solo:5.3.1'
|
compile 'com.jayway.android.robotium:robotium-solo:5.3.1'
|
||||||
compile 'net.rdrei.android.dirchooser:library:2.1@aar'
|
compile ('net.rdrei.android.dirchooser:library:3.0@aar') {
|
||||||
|
transitive = true;
|
||||||
|
}
|
||||||
compile group: 'com.google.guava', name: 'guava', version: '18.0'
|
compile group: 'com.google.guava', name: 'guava', version: '18.0'
|
||||||
}
|
}
|
||||||
tasks.findAll { // make all tasks whose name starts with 'assemble'...
|
tasks.findAll { // make all tasks whose name starts with 'assemble'...
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="com.zeapo.pwdstore">
|
package="com.zeapo.pwdstore">
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
|
@ -8,7 +9,8 @@
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
|
|
||||||
<application android:allowBackup="true" android:icon="@drawable/ic_launcher"
|
<application android:allowBackup="true" android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/app_name" android:theme="@style/AppTheme">
|
android:label="@string/app_name" android:theme="@style/AppTheme"
|
||||||
|
tools:replace="android:theme">
|
||||||
<activity android:name=".PasswordStore" android:label="@string/app_name"
|
<activity android:name=".PasswordStore" android:label="@string/app_name"
|
||||||
android:configChanges="orientation|screenSize">
|
android:configChanges="orientation|screenSize">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|
|
@ -495,7 +495,7 @@ public class PasswordStore extends AppCompatActivity {
|
||||||
PasswordRepository.closeRepository();
|
PasswordRepository.closeRepository();
|
||||||
|
|
||||||
new AlertDialog.Builder(this)
|
new AlertDialog.Builder(this)
|
||||||
.setTitle("Repositiory location")
|
.setTitle("Repository location")
|
||||||
.setMessage("Select where to create or clone your password repository.")
|
.setMessage("Select where to create or clone your password repository.")
|
||||||
.setPositiveButton("External", new DialogInterface.OnClickListener() {
|
.setPositiveButton("External", new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int whichButton) {
|
public void onClick(DialogInterface dialog, int whichButton) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Environment;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
|
@ -29,6 +30,7 @@ import com.zeapo.pwdstore.git.GitActivity;
|
||||||
import com.zeapo.pwdstore.utils.PasswordRepository;
|
import com.zeapo.pwdstore.utils.PasswordRepository;
|
||||||
|
|
||||||
import net.rdrei.android.dirchooser.DirectoryChooserActivity;
|
import net.rdrei.android.dirchooser.DirectoryChooserActivity;
|
||||||
|
import net.rdrei.android.dirchooser.DirectoryChooserConfig;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
@ -124,7 +126,8 @@ public class UserPreference extends AppCompatActivity {
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
new AlertDialog.Builder(callingActivity).
|
new AlertDialog.Builder(callingActivity).
|
||||||
setTitle(R.string.pref_dialog_delete_title).
|
setTitle(R.string.pref_dialog_delete_title).
|
||||||
setMessage(R.string.pref_dialog_delete_msg).
|
setMessage(getResources().getString(R.string.dialog_delete_msg)
|
||||||
|
+ " " + PasswordRepository.getWorkTree().toString()).
|
||||||
setCancelable(false).
|
setCancelable(false).
|
||||||
setPositiveButton(R.string.dialog_delete, new DialogInterface.OnClickListener() {
|
setPositiveButton(R.string.dialog_delete, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -265,8 +268,16 @@ public class UserPreference extends AppCompatActivity {
|
||||||
|
|
||||||
public void selectExternalGitRepository() {
|
public void selectExternalGitRepository() {
|
||||||
Intent intent = new Intent(this, DirectoryChooserActivity.class);
|
Intent intent = new Intent(this, DirectoryChooserActivity.class);
|
||||||
intent.putExtra(DirectoryChooserActivity.EXTRA_NEW_DIR_NAME,
|
File dir = new File(Environment.getExternalStorageDirectory() + "/PasswordStore");
|
||||||
"passwordstore");
|
if (!dir.exists()) {
|
||||||
|
dir.mkdir();
|
||||||
|
}
|
||||||
|
DirectoryChooserConfig config = DirectoryChooserConfig.builder()
|
||||||
|
.newDirectoryName("PasswordStore")
|
||||||
|
.allowNewDirectoryNameModification(true)
|
||||||
|
.initialDirectory(Environment.getExternalStorageDirectory() + "/PasswordStore")
|
||||||
|
.build();
|
||||||
|
intent.putExtra(DirectoryChooserActivity.EXTRA_CONFIG, config);
|
||||||
|
|
||||||
startActivityForResult(intent, SELECT_GIT_DIRECTORY);
|
startActivityForResult(intent, SELECT_GIT_DIRECTORY);
|
||||||
}
|
}
|
||||||
|
|
|
@ -481,7 +481,7 @@ public class GitActivity extends AppCompatActivity {
|
||||||
if (localDir.exists() && localDir.listFiles().length != 0) {
|
if (localDir.exists() && localDir.listFiles().length != 0) {
|
||||||
new AlertDialog.Builder(this).
|
new AlertDialog.Builder(this).
|
||||||
setTitle(R.string.dialog_delete_title).
|
setTitle(R.string.dialog_delete_title).
|
||||||
setMessage(R.string.dialog_delete_msg).
|
setMessage(getResources().getString(R.string.dialog_delete_msg) + " " + localDir.toString()).
|
||||||
setCancelable(false).
|
setCancelable(false).
|
||||||
setPositiveButton(R.string.dialog_delete,
|
setPositiveButton(R.string.dialog_delete,
|
||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
|
|
|
@ -17,6 +17,7 @@ allprojects {
|
||||||
repositories {
|
repositories {
|
||||||
jcenter()
|
jcenter()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
maven { url 'http://guardian.github.com/maven/repo-releases' }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue