GitActivity: Cleanup obvious code smells

Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
This commit is contained in:
Harsh Shandilya 2019-05-31 13:15:47 +05:30
parent 168c3d42aa
commit f05c0b37ca
No known key found for this signature in database
GPG key ID: C2E74282C2133D62

View file

@ -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,8 +400,7 @@ 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:
if (id == R.id.user_pref) {
try {
Intent intent = new Intent(this, UserPreference.class);
startActivity(intent);
@ -412,7 +409,6 @@ public class GitActivity extends AppCompatActivity {
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;