Moved the cloning to settings, needs a nicer icon

This commit is contained in:
Zeapo 2014-07-26 20:57:33 +01:00
parent 6532252f31
commit 1c4defa4c9
5 changed files with 10 additions and 34 deletions

View file

@ -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).

View file

@ -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);
}

View file

@ -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>

View file

@ -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>

View file

@ -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>