From 747b331437e3f5a8fee1b694bedee45d09dcf9f9 Mon Sep 17 00:00:00 2001 From: Shubham Goyal Date: Thu, 5 Oct 2023 14:26:00 -0500 Subject: [PATCH 1/2] Explicitly enable back navigation for connect since we are turning off breadcrumb bar --- .../commcare/activities/connect/ConnectActivity.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/org/commcare/activities/connect/ConnectActivity.java b/app/src/org/commcare/activities/connect/ConnectActivity.java index 4017899172..be04a74563 100644 --- a/app/src/org/commcare/activities/connect/ConnectActivity.java +++ b/app/src/org/commcare/activities/connect/ConnectActivity.java @@ -6,6 +6,7 @@ import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.contract.ActivityResultContracts; +import androidx.appcompat.app.ActionBar; import androidx.fragment.app.Fragment; import androidx.navigation.fragment.NavHostFragment; @@ -35,6 +36,17 @@ protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.screen_connect); setTitle(getString(R.string.connect_title)); + showBackButton(); + } + + private void showBackButton() { + ActionBar actionBar = getSupportActionBar(); + if (actionBar != null) { + if(isBackEnabled()){ + actionBar.setDisplayShowHomeEnabled(true); + actionBar.setDisplayHomeAsUpEnabled(true); + } + } } @Override From 0c8719d0e8b7ab7f51f34051d27f2b3c1107be87 Mon Sep 17 00:00:00 2001 From: Shubham Goyal Date: Thu, 5 Oct 2023 15:08:00 -0500 Subject: [PATCH 2/2] Adds back button to home screen for connect launches --- app/src/org/commcare/activities/DispatchActivity.java | 2 ++ app/src/org/commcare/activities/HomeScreenBaseActivity.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/app/src/org/commcare/activities/DispatchActivity.java b/app/src/org/commcare/activities/DispatchActivity.java index 0853ff3b10..4d503a4e27 100644 --- a/app/src/org/commcare/activities/DispatchActivity.java +++ b/app/src/org/commcare/activities/DispatchActivity.java @@ -320,6 +320,8 @@ private void launchHomeScreen() { i = new Intent(this, StandardHomeActivity.class); } i.putExtra(START_FROM_LOGIN, startFromLogin); + i.putExtra(CommCareLauncher.EXTRA_FROM_CONNECT, + getIntent().getBooleanExtra(CommCareLauncher.EXTRA_FROM_CONNECT, false)); i.putExtra(LoginActivity.LOGIN_MODE, lastLoginMode); i.putExtra(LoginActivity.MANUAL_SWITCH_TO_PW_MODE, userManuallyEnteredPasswordMode); startFromLogin = false; diff --git a/app/src/org/commcare/activities/HomeScreenBaseActivity.java b/app/src/org/commcare/activities/HomeScreenBaseActivity.java index 97637a5f54..2a1f2e2d26 100644 --- a/app/src/org/commcare/activities/HomeScreenBaseActivity.java +++ b/app/src/org/commcare/activities/HomeScreenBaseActivity.java @@ -40,6 +40,7 @@ import org.commcare.appupdate.AppUpdateControllerFactory; import org.commcare.appupdate.AppUpdateState; import org.commcare.appupdate.FlexibleAppUpdateController; +import org.commcare.commcaresupportlibrary.CommCareLauncher; import org.commcare.core.process.CommCareInstanceInitializer; import org.commcare.dalvik.BuildConfig; import org.commcare.dalvik.R; @@ -1464,6 +1465,9 @@ private void handleDeveloperModeClicks() { @Override public boolean isBackEnabled() { + if (getIntent().getBooleanExtra(CommCareLauncher.EXTRA_FROM_CONNECT, false)) { + return true; + } return false; }