From 1c4defa4c96537300528f119695ca8fdc5f4c625 Mon Sep 17 00:00:00 2001 From: Zeapo Date: Sat, 26 Jul 2014 20:57:33 +0100 Subject: [PATCH] Moved the cloning to settings, needs a nicer icon --- .../java/com/zeapo/pwdstore/GitClone.java | 28 +------------------ .../java/com/zeapo/pwdstore/pwdstore.java | 5 ++-- .../main/res/layout/activity_git_clone.xml | 2 +- app/src/main/res/menu/pwdstore.xml | 6 ++-- 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 @@