Browse Source

Merge pull request #7372 from Kuuuna98/enhancement_passcode_screen

Closed the app when press back button from App passcode screen
Tobias Kaminsky 4 năm trước cách đây
mục cha
commit
03a6d9294d

+ 7 - 3
src/main/java/com/owncloud/android/ui/activity/PassCodeActivity.java

@@ -23,6 +23,7 @@
 package com.owncloud.android.ui.activity;
 
 import android.content.Intent;
+import android.os.Build;
 import android.os.Bundle;
 import android.os.SystemClock;
 import android.text.Editable;
@@ -365,10 +366,13 @@ public class PassCodeActivity extends AppCompatActivity implements Injectable {
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event){
         if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount()== 0){
-            if (ACTION_REQUEST_WITH_RESULT.equals(getIntent().getAction()) ||
-                    ACTION_CHECK_WITH_RESULT.equals(getIntent().getAction())) {
+            if(ACTION_CHECK.equals(getIntent().getAction()) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
+                moveTaskToBack(true);
+                finishAndRemoveTask();
+            }else if (ACTION_REQUEST_WITH_RESULT.equals(getIntent().getAction()) ||
+                ACTION_CHECK_WITH_RESULT.equals(getIntent().getAction())) {
                 finish();
-            }   // else, do nothing, but report that the key was consumed to stay alive
+            }// else, do nothing, but report that the key was consumed to stay alive
             return true;
         }
         return super.onKeyDown(keyCode, event);