diff options
author | Harsh Shandilya <msfjarvis@gmail.com> | 2019-05-31 13:15:47 +0530 |
---|---|---|
committer | Harsh Shandilya <msfjarvis@gmail.com> | 2019-05-31 13:15:47 +0530 |
commit | f05c0b37ca0df5cab4906d5484572d0288c479ed (patch) | |
tree | 96f09922fa93f21d3e7e78295fa2aea670c73ac2 /app | |
parent | 168c3d42aa25bb1cf479f9d6e6b60c5d102669fe (diff) |
GitActivity: Cleanup obvious code smells
Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java b/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java index eb9b48ab..bb2e678f 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java +++ b/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.java @@ -28,8 +28,6 @@ import com.zeapo.pwdstore.git.config.SshApiSessionFactory; import com.zeapo.pwdstore.utils.PasswordRepository; import org.apache.commons.io.FileUtils; -import org.eclipse.jgit.api.Git; -import org.eclipse.jgit.api.RebaseCommand; import org.eclipse.jgit.lib.Constants; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.Ref; @@ -350,7 +348,7 @@ public class GitActivity extends AppCompatActivity { EditText server_user = findViewById(R.id.server_user); String uri = server_uri.getText().toString(); - Pattern pattern = Pattern.compile("(.+)@([\\w\\d\\.]+):([\\d]+)*(.*)"); + Pattern pattern = Pattern.compile("(.+)@([\\w\\d.]+):([\\d]+)*(.*)"); Matcher matcher = pattern.matcher(uri); if (matcher.find()) { int count = matcher.groupCount(); @@ -402,17 +400,15 @@ public class GitActivity extends AppCompatActivity { // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); - switch (id) { - case R.id.user_pref: - try { - Intent intent = new Intent(this, UserPreference.class); - startActivity(intent); - } catch (Exception e) { - System.out.println("Exception caught :("); - e.printStackTrace(); - } - return true; - + if (id == R.id.user_pref) { + try { + Intent intent = new Intent(this, UserPreference.class); + startActivity(intent); + } catch (Exception e) { + System.out.println("Exception caught :("); + e.printStackTrace(); + } + return true; } return super.onOptionsItemSelected(item); } @@ -660,6 +656,7 @@ public class GitActivity extends AppCompatActivity { switch (operation) { case REQUEST_CLONE: + case GitOperation.GET_SSH_KEY_FROM_CLONE: op = new CloneOperation(localDir, activity).setCommand(hostname); break; @@ -679,10 +676,6 @@ public class GitActivity extends AppCompatActivity { op = new BreakOutOfDetached(localDir, activity).setCommands(); break; - case GitOperation.GET_SSH_KEY_FROM_CLONE: - op = new CloneOperation(localDir, activity).setCommand(hostname); - break; - case SshApiSessionFactory.POST_SIGNATURE: return; |