Clean up switchToFragment call.
This will make logging where search is launched from slightly easier. Bug: 123294739 Test: manual Change-Id: I62a804cdf6b8a5fa8ae68dcf9e2b56cc8358afb7
This commit is contained in:
@@ -32,7 +32,6 @@ import android.os.Bundle;
|
|||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.transition.TransitionManager;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@@ -103,8 +102,6 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
*/
|
*/
|
||||||
public static final String EXTRA_FRAGMENT_ARG_KEY = ":settings:fragment_args_key";
|
public static final String EXTRA_FRAGMENT_ARG_KEY = ":settings:fragment_args_key";
|
||||||
|
|
||||||
public static final String BACK_STACK_PREFS = ":settings:prefs";
|
|
||||||
|
|
||||||
// extras that allow any preference activity to be launched as part of a wizard
|
// extras that allow any preference activity to be launched as part of a wizard
|
||||||
|
|
||||||
// show Back and Next buttons? takes boolean parameter
|
// show Back and Next buttons? takes boolean parameter
|
||||||
@@ -374,14 +371,13 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
setTitleFromIntent(intent);
|
setTitleFromIntent(intent);
|
||||||
|
|
||||||
Bundle initialArguments = intent.getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS);
|
Bundle initialArguments = intent.getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGUMENTS);
|
||||||
switchToFragment(initialFragmentName, initialArguments, true, false,
|
switchToFragment(initialFragmentName, initialArguments, true,
|
||||||
mInitialTitleResId, mInitialTitle, false);
|
mInitialTitleResId, mInitialTitle);
|
||||||
} else {
|
} else {
|
||||||
// Show search icon as up affordance if we are displaying the main Dashboard
|
// Show search icon as up affordance if we are displaying the main Dashboard
|
||||||
mInitialTitleResId = R.string.dashboard_title;
|
mInitialTitleResId = R.string.dashboard_title;
|
||||||
switchToFragment(TopLevelSettings.class.getName(), null /* args */, false, false,
|
switchToFragment(TopLevelSettings.class.getName(), null /* args */, false,
|
||||||
mInitialTitleResId, mInitialTitle, false);
|
mInitialTitleResId, mInitialTitle);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -567,7 +563,7 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
* Switch to a specific Fragment with taking care of validation, Title and BackStack
|
* Switch to a specific Fragment with taking care of validation, Title and BackStack
|
||||||
*/
|
*/
|
||||||
private Fragment switchToFragment(String fragmentName, Bundle args, boolean validate,
|
private Fragment switchToFragment(String fragmentName, Bundle args, boolean validate,
|
||||||
boolean addToBackStack, int titleResId, CharSequence title, boolean withTransition) {
|
int titleResId, CharSequence title) {
|
||||||
Log.d(LOG_TAG, "Switching to fragment " + fragmentName);
|
Log.d(LOG_TAG, "Switching to fragment " + fragmentName);
|
||||||
if (validate && !isValidFragment(fragmentName)) {
|
if (validate && !isValidFragment(fragmentName)) {
|
||||||
throw new IllegalArgumentException("Invalid fragment for this activity: "
|
throw new IllegalArgumentException("Invalid fragment for this activity: "
|
||||||
@@ -576,12 +572,6 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
Fragment f = Fragment.instantiate(this, fragmentName, args);
|
Fragment f = Fragment.instantiate(this, fragmentName, args);
|
||||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||||
transaction.replace(R.id.main_content, f);
|
transaction.replace(R.id.main_content, f);
|
||||||
if (withTransition) {
|
|
||||||
TransitionManager.beginDelayedTransition(mContent);
|
|
||||||
}
|
|
||||||
if (addToBackStack) {
|
|
||||||
transaction.addToBackStack(SettingsActivity.BACK_STACK_PREFS);
|
|
||||||
}
|
|
||||||
if (titleResId > 0) {
|
if (titleResId > 0) {
|
||||||
transaction.setBreadCrumbTitle(titleResId);
|
transaction.setBreadCrumbTitle(titleResId);
|
||||||
} else if (title != null) {
|
} else if (title != null) {
|
||||||
|
@@ -53,7 +53,7 @@ public class SettingsHomepageActivity extends SettingsBaseActivity {
|
|||||||
|
|
||||||
final Toolbar toolbar = findViewById(R.id.search_action_bar);
|
final Toolbar toolbar = findViewById(R.id.search_action_bar);
|
||||||
FeatureFactory.getFactory(this).getSearchFeatureProvider()
|
FeatureFactory.getFactory(this).getSearchFeatureProvider()
|
||||||
.initSearchToolbar(this, toolbar);
|
.initSearchToolbar(this /* activity */, toolbar);
|
||||||
|
|
||||||
final ImageView avatarView = findViewById(R.id.account_avatar);
|
final ImageView avatarView = findViewById(R.id.account_avatar);
|
||||||
final AvatarViewMixin avatarViewMixin = new AvatarViewMixin(this, avatarView);
|
final AvatarViewMixin avatarViewMixin = new AvatarViewMixin(this, avatarView);
|
||||||
|
Reference in New Issue
Block a user