diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 25f3cbc98..b0198deac 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -39,7 +39,8 @@ - + { diff --git a/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt b/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt index a8a60a2f1..552deb613 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/BaseGitActivity.kt @@ -64,6 +64,15 @@ abstract class BaseGitActivity : AppCompatActivity() { } } + override fun onDestroy() { + // Do not leak the service connection + if (identityBuilder != null) { + identityBuilder!!.close() + identityBuilder = null + } + super.onDestroy() + } + /** * Update the [hostname] field with the values that build it up. This function returns a boolean * indicating whether or not the values are valid or not, and only adds the `origin` remote when diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.kt b/app/src/main/java/com/zeapo/pwdstore/git/GitOperationActivity.kt similarity index 90% rename from app/src/main/java/com/zeapo/pwdstore/git/GitActivity.kt rename to app/src/main/java/com/zeapo/pwdstore/git/GitOperationActivity.kt index 4da6d1f9d..99c3e21e2 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/GitActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/git/GitOperationActivity.kt @@ -14,18 +14,12 @@ import com.zeapo.pwdstore.UserPreference import com.zeapo.pwdstore.git.config.SshApiSessionFactory import com.zeapo.pwdstore.utils.PasswordRepository -open class GitActivity : BaseGitActivity() { +open class GitOperationActivity : BaseGitActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - val operationCode = intent.extras!!.getInt("Operation") - - supportActionBar!!.setDisplayHomeAsUpEnabled(true) - - when (operationCode) { + when (intent.extras?.getInt(REQUEST_ARG_OP)) { REQUEST_PULL -> syncRepository(REQUEST_PULL) - REQUEST_PUSH -> syncRepository(REQUEST_PUSH) - REQUEST_SYNC -> syncRepository(REQUEST_SYNC) } } @@ -34,15 +28,6 @@ open class GitActivity : BaseGitActivity() { super.onResume() } - override fun onDestroy() { - // Do not leak the service connection - if (identityBuilder != null) { - identityBuilder!!.close() - identityBuilder = null - } - super.onDestroy() - } - override fun onCreateOptionsMenu(menu: Menu): Boolean { // Inflate the menu; this adds items to the action bar if it is present. menuInflater.inflate(R.menu.git_clone, menu) @@ -91,7 +76,6 @@ open class GitActivity : BaseGitActivity() { } override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { - // In addition to the pre-operation-launch series of intents for OpenKeychain auth // that will pass through here and back to launchGitOperation, there is one // synchronous operation that happens /after/ the operation has been launched in the diff --git a/app/src/main/res/layout/activity_git_clone.xml b/app/src/main/res/layout/activity_git_clone.xml index 202046b64..27d480b46 100644 --- a/app/src/main/res/layout/activity_git_clone.xml +++ b/app/src/main/res/layout/activity_git_clone.xml @@ -4,7 +4,7 @@ android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:padding="@dimen/activity_horizontal_margin" - tools:context="com.zeapo.pwdstore.git.GitActivity" + tools:context="com.zeapo.pwdstore.git.GitOperationActivity" android:background="?android:attr/windowBackground"> diff --git a/app/src/main/res/menu/git_clone.xml b/app/src/main/res/menu/git_clone.xml index 092a8b2bd..d170cca80 100644 --- a/app/src/main/res/menu/git_clone.xml +++ b/app/src/main/res/menu/git_clone.xml @@ -1,7 +1,7 @@ + tools:context="com.zeapo.pwdstore.git.GitServerConfigActivity" > @color/primary_color + +