Merge "Only show 2-pane deep link when homepage is available" into tm-dev
This commit is contained in:
@@ -24,6 +24,7 @@ import static com.android.settings.applications.appinfo.AppButtonsPreferenceCont
|
|||||||
|
|
||||||
import android.app.ActionBar;
|
import android.app.ActionBar;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -253,8 +254,7 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
getMetaData();
|
getMetaData();
|
||||||
final Intent intent = getIntent();
|
final Intent intent = getIntent();
|
||||||
|
|
||||||
if (shouldShowTwoPaneDeepLink(intent)) {
|
if (shouldShowTwoPaneDeepLink(intent) && tryStartTwoPaneDeepLink(intent)) {
|
||||||
launchHomepageForTwoPaneDeepLink(intent);
|
|
||||||
finishAndRemoveTask();
|
finishAndRemoveTask();
|
||||||
super.onCreate(savedState);
|
super.onCreate(savedState);
|
||||||
return;
|
return;
|
||||||
@@ -412,7 +412,7 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
return trampolineIntent;
|
return trampolineIntent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void launchHomepageForTwoPaneDeepLink(Intent intent) {
|
private boolean tryStartTwoPaneDeepLink(Intent intent) {
|
||||||
final Intent trampolineIntent;
|
final Intent trampolineIntent;
|
||||||
if (intent.getBooleanExtra(EXTRA_IS_FROM_SLICE, false)) {
|
if (intent.getBooleanExtra(EXTRA_IS_FROM_SLICE, false)) {
|
||||||
// Get menu key for slice deep link case.
|
// Get menu key for slice deep link case.
|
||||||
@@ -426,7 +426,14 @@ public class SettingsActivity extends SettingsBaseActivity
|
|||||||
} else {
|
} else {
|
||||||
trampolineIntent = getTrampolineIntent(intent, mHighlightMenuKey);
|
trampolineIntent = getTrampolineIntent(intent, mHighlightMenuKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
startActivity(trampolineIntent);
|
startActivity(trampolineIntent);
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
Log.e(LOG_TAG, "Deep link homepage is not available to show 2-pane UI");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldShowTwoPaneDeepLink(Intent intent) {
|
private boolean shouldShowTwoPaneDeepLink(Intent intent) {
|
||||||
|
Reference in New Issue
Block a user