Skip to content

Commit

Permalink
Merge pull request #2720 from dimagi/enableBackOnConnect
Browse files Browse the repository at this point in the history
Enable back button on connect activity
  • Loading branch information
shubham1g5 authored Oct 5, 2023
2 parents ac4f455 + 0c8719d commit 41d5b1f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/src/org/commcare/activities/DispatchActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions app/src/org/commcare/activities/HomeScreenBaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1464,6 +1465,9 @@ private void handleDeveloperModeClicks() {

@Override
public boolean isBackEnabled() {
if (getIntent().getBooleanExtra(CommCareLauncher.EXTRA_FROM_CONNECT, false)) {
return true;
}
return false;
}

Expand Down
12 changes: 12 additions & 0 deletions app/src/org/commcare/activities/connect/ConnectActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 41d5b1f

Please sign in to comment.