diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/GitClone.java | 28 | ||||
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/pwdstore.java | 5 | ||||
-rw-r--r-- | app/src/main/res/layout/activity_git_clone.xml | 2 | ||||
-rw-r--r-- | app/src/main/res/menu/pwdstore.xml | 6 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 3 |
5 files changed, 10 insertions, 34 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/GitClone.java b/app/src/main/java/com/zeapo/pwdstore/GitClone.java index c7b67812..6f57a9f7 100644 --- a/app/src/main/java/com/zeapo/pwdstore/GitClone.java +++ b/app/src/main/java/com/zeapo/pwdstore/GitClone.java @@ -2,15 +2,11 @@ package com.zeapo.pwdstore; import android.app.Activity; import android.app.AlertDialog; -import android.app.Dialog; -import android.app.DialogFragment; -import android.app.ListActivity; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.os.AsyncTask; import android.os.Bundle; -import android.os.Message; import android.text.InputType; import android.view.Menu; import android.view.MenuItem; @@ -22,46 +18,24 @@ import android.widget.EditText; import android.widget.LinearLayout; import android.widget.Spinner; import android.widget.TextView; -import android.widget.Toast; import com.jcraft.jsch.JSch; import com.jcraft.jsch.JSchException; import com.jcraft.jsch.Session; -import com.jcraft.jsch.UserInfo; -import com.zeapo.pwdstore.R; import org.eclipse.jgit.api.CloneCommand; import org.eclipse.jgit.api.Git; import org.apache.commons.io.FileUtils; import org.eclipse.jgit.api.errors.InvalidRemoteException; -import org.eclipse.jgit.diff.Edit; -import org.eclipse.jgit.errors.NoRemoteRepositoryException; -import org.eclipse.jgit.errors.UnsupportedCredentialItem; -import org.eclipse.jgit.lib.TextProgressMonitor; -import org.eclipse.jgit.transport.CredentialItem; -import org.eclipse.jgit.transport.CredentialsProvider; -import org.eclipse.jgit.transport.CredentialsProviderUserInfo; import org.eclipse.jgit.transport.JschConfigSessionFactory; import org.eclipse.jgit.transport.OpenSshConfig; import org.eclipse.jgit.transport.SshSessionFactory; -import org.eclipse.jgit.transport.URIish; import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider; import org.eclipse.jgit.util.FS; -import org.eclipse.jgit.util.StringUtils; import java.io.File; import java.io.IOException; -import java.security.GeneralSecurityException; -import java.util.ArrayList; -import java.util.Hashtable; -import java.util.List; -import java.util.Properties; - -import javax.net.ssl.HttpsURLConnection; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; public class GitClone extends Activity { @@ -231,7 +205,7 @@ public class GitClone extends Activity { // now cheat a little and prepend the real protocol // jGit does not accept a ssh:// but requires https:// - if (!protocol.equals("ssh://")) hostname = new String(protocol + hostname); + if (!protocol.equals("ssh://")) hostname = protocol + hostname; if (localDir.exists()) { new AlertDialog.Builder(this). diff --git a/app/src/main/java/com/zeapo/pwdstore/pwdstore.java b/app/src/main/java/com/zeapo/pwdstore/pwdstore.java index 5bf9ca3c..54e1605b 100644 --- a/app/src/main/java/com/zeapo/pwdstore/pwdstore.java +++ b/app/src/main/java/com/zeapo/pwdstore/pwdstore.java @@ -37,13 +37,14 @@ public class pwdstore extends Activity { // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); - if (id == R.id.action_settings) { + if (id == R.id.clone_setting) { + getClone(); return true; } return super.onOptionsItemSelected(item); } - public void getClone(View view){ + public void getClone(){ Intent intent = new Intent(this, GitClone.class); startActivity(intent); } diff --git a/app/src/main/res/layout/activity_git_clone.xml b/app/src/main/res/layout/activity_git_clone.xml index 6587524b..8c0a3336 100644 --- a/app/src/main/res/layout/activity_git_clone.xml +++ b/app/src/main/res/layout/activity_git_clone.xml @@ -35,7 +35,7 @@ <Button android:id="@+id/clone_button" android:text="Clone!" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" android:onClick="cloneRepository"/> </LinearLayout> diff --git a/app/src/main/res/menu/pwdstore.xml b/app/src/main/res/menu/pwdstore.xml index 97d4df5b..749cabdd 100644 --- a/app/src/main/res/menu/pwdstore.xml +++ b/app/src/main/res/menu/pwdstore.xml @@ -2,8 +2,8 @@ xmlns:tools="http://schemas.android.com/tools" tools:context=".pwdstore" > <item android:id="@+id/clone_setting" - android:title="@string/clone_setting" + android:title="@string/clone_settings" android:orderInCategory="100" - android:showAsAction="ifRoom" - android:onClick="getClone"/> + android:showAsAction="ifRoom|withText" + android:icon="@android:drawable/stat_sys_download"/> </menu> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7b9de7d3..50acf7e6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,7 +3,8 @@ <string name="app_name">PwdStore</string> <string name="clone">Clone!</string> - <string name="clone_setting">Clone</string> + <string name="clone_settings">Clone</string> + <string name="action_settings">Settings</string> <string name="hello_world">Hello world!</string> <string name="dialog_delete_title">Directory already exist</string> |