use of com.android.internal.widget.ResolverDrawerLayout in project android_frameworks_base by ResurrectionRemix.
the class ResolverActivity method onCreate.
protected void onCreate(Bundle savedInstanceState, Intent intent, CharSequence title, int defaultTitleRes, Intent[] initialIntents, List<ResolveInfo> rList, boolean alwaysUseOption) {
setTheme(R.style.Theme_DeviceDefault_Resolver);
super.onCreate(savedInstanceState);
// Determine whether we should show that intent is forwarded
// from managed profile to owner or other way around.
setProfileSwitchMessageId(intent.getContentUserHint());
try {
mLaunchedFromUid = ActivityManagerNative.getDefault().getLaunchedFromUid(getActivityToken());
} catch (RemoteException e) {
mLaunchedFromUid = -1;
}
if (mLaunchedFromUid < 0 || UserHandle.isIsolated(mLaunchedFromUid)) {
// Gulp!
finish();
return;
}
mPm = getPackageManager();
mPackageMonitor.register(this, getMainLooper(), false);
mRegistered = true;
final ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
mIconDpi = am.getLauncherLargeIconDensity();
// Add our initial intent as the first item, regardless of what else has already been added.
mIntents.add(0, new Intent(intent));
final String referrerPackage = getReferrerPackageName();
mResolverComparator = new ResolverComparator(this, getTargetIntent(), referrerPackage);
if (configureContentView(mIntents, initialIntents, rList, alwaysUseOption)) {
return;
}
final ResolverDrawerLayout rdl = (ResolverDrawerLayout) findViewById(R.id.contentPanel);
if (rdl != null) {
rdl.setOnDismissedListener(new ResolverDrawerLayout.OnDismissedListener() {
@Override
public void onDismissed() {
finish();
}
});
if (isVoiceInteraction()) {
rdl.setCollapsed(false);
}
mResolverDrawerLayout = rdl;
}
if (title == null) {
title = getTitleForAction(intent.getAction(), defaultTitleRes);
}
if (!TextUtils.isEmpty(title)) {
final TextView titleView = (TextView) findViewById(R.id.title);
if (titleView != null) {
titleView.setText(title);
}
setTitle(title);
// Try to initialize the title icon if we have a view for it and a title to match
final ImageView titleIcon = (ImageView) findViewById(R.id.title_icon);
if (titleIcon != null) {
ApplicationInfo ai = null;
try {
if (!TextUtils.isEmpty(referrerPackage)) {
ai = mPm.getApplicationInfo(referrerPackage, 0);
}
} catch (NameNotFoundException e) {
Log.e(TAG, "Could not find referrer package " + referrerPackage);
}
if (ai != null) {
titleIcon.setImageDrawable(ai.loadIcon(mPm));
}
}
}
final ImageView iconView = (ImageView) findViewById(R.id.icon);
final DisplayResolveInfo iconInfo = mAdapter.getFilteredItem();
if (iconView != null && iconInfo != null) {
new LoadIconIntoViewTask(iconInfo, iconView).execute();
}
if (alwaysUseOption || mAdapter.hasFilteredItem()) {
final ViewGroup buttonLayout = (ViewGroup) findViewById(R.id.button_bar);
if (buttonLayout != null) {
buttonLayout.setVisibility(View.VISIBLE);
mAlwaysButton = (Button) buttonLayout.findViewById(R.id.button_always);
mOnceButton = (Button) buttonLayout.findViewById(R.id.button_once);
} else {
mAlwaysUseOption = false;
}
}
if (mAdapter.hasFilteredItem()) {
setAlwaysButtonEnabled(true, mAdapter.getFilteredPosition(), false);
mOnceButton.setEnabled(true);
}
mProfileView = findViewById(R.id.profile_button);
if (mProfileView != null) {
mProfileView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final DisplayResolveInfo dri = mAdapter.getOtherProfile();
if (dri == null) {
return;
}
// Do not show the profile switch message anymore.
mProfileSwitchMessageId = -1;
onTargetSelected(dri, false);
finish();
}
});
bindProfileView();
}
if (isVoiceInteraction()) {
onSetupVoiceInteraction();
}
final Set<String> categories = intent.getCategories();
MetricsLogger.action(this, mAdapter.hasFilteredItem() ? MetricsProto.MetricsEvent.ACTION_SHOW_APP_DISAMBIG_APP_FEATURED : MetricsProto.MetricsEvent.ACTION_SHOW_APP_DISAMBIG_NONE_FEATURED, intent.getAction() + ":" + intent.getType() + ":" + (categories != null ? Arrays.toString(categories.toArray()) : ""));
}
use of com.android.internal.widget.ResolverDrawerLayout in project android_frameworks_base by AOSPA.
the class ResolverActivity method onCreate.
protected void onCreate(Bundle savedInstanceState, Intent intent, CharSequence title, int defaultTitleRes, Intent[] initialIntents, List<ResolveInfo> rList, boolean alwaysUseOption) {
setTheme(R.style.Theme_DeviceDefault_Resolver);
super.onCreate(savedInstanceState);
// Determine whether we should show that intent is forwarded
// from managed profile to owner or other way around.
setProfileSwitchMessageId(intent.getContentUserHint());
try {
mLaunchedFromUid = ActivityManagerNative.getDefault().getLaunchedFromUid(getActivityToken());
} catch (RemoteException e) {
mLaunchedFromUid = -1;
}
if (mLaunchedFromUid < 0 || UserHandle.isIsolated(mLaunchedFromUid)) {
// Gulp!
finish();
return;
}
mPm = getPackageManager();
mPackageMonitor.register(this, getMainLooper(), false);
mRegistered = true;
final ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
mIconDpi = am.getLauncherLargeIconDensity();
// Add our initial intent as the first item, regardless of what else has already been added.
mIntents.add(0, new Intent(intent));
final String referrerPackage = getReferrerPackageName();
mResolverComparator = new ResolverComparator(this, getTargetIntent(), referrerPackage);
if (configureContentView(mIntents, initialIntents, rList, alwaysUseOption)) {
return;
}
final ResolverDrawerLayout rdl = (ResolverDrawerLayout) findViewById(R.id.contentPanel);
if (rdl != null) {
rdl.setOnDismissedListener(new ResolverDrawerLayout.OnDismissedListener() {
@Override
public void onDismissed() {
finish();
}
});
if (isVoiceInteraction()) {
rdl.setCollapsed(false);
}
mResolverDrawerLayout = rdl;
}
if (title == null) {
title = getTitleForAction(intent.getAction(), defaultTitleRes);
}
if (!TextUtils.isEmpty(title)) {
final TextView titleView = (TextView) findViewById(R.id.title);
if (titleView != null) {
titleView.setText(title);
}
setTitle(title);
// Try to initialize the title icon if we have a view for it and a title to match
final ImageView titleIcon = (ImageView) findViewById(R.id.title_icon);
if (titleIcon != null) {
ApplicationInfo ai = null;
try {
if (!TextUtils.isEmpty(referrerPackage)) {
ai = mPm.getApplicationInfo(referrerPackage, 0);
}
} catch (NameNotFoundException e) {
Log.e(TAG, "Could not find referrer package " + referrerPackage);
}
if (ai != null) {
titleIcon.setImageDrawable(ai.loadIcon(mPm));
}
}
}
final ImageView iconView = (ImageView) findViewById(R.id.icon);
final DisplayResolveInfo iconInfo = mAdapter.getFilteredItem();
if (iconView != null && iconInfo != null) {
new LoadIconIntoViewTask(iconInfo, iconView).execute();
}
if (alwaysUseOption || mAdapter.hasFilteredItem()) {
final ViewGroup buttonLayout = (ViewGroup) findViewById(R.id.button_bar);
if (buttonLayout != null) {
buttonLayout.setVisibility(View.VISIBLE);
mAlwaysButton = (Button) buttonLayout.findViewById(R.id.button_always);
mOnceButton = (Button) buttonLayout.findViewById(R.id.button_once);
} else {
mAlwaysUseOption = false;
}
}
if (mAdapter.hasFilteredItem()) {
setAlwaysButtonEnabled(true, mAdapter.getFilteredPosition(), false);
mOnceButton.setEnabled(true);
}
mProfileView = findViewById(R.id.profile_button);
if (mProfileView != null) {
mProfileView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final DisplayResolveInfo dri = mAdapter.getOtherProfile();
if (dri == null) {
return;
}
// Do not show the profile switch message anymore.
mProfileSwitchMessageId = -1;
onTargetSelected(dri, false);
finish();
}
});
bindProfileView();
}
if (isVoiceInteraction()) {
onSetupVoiceInteraction();
}
final Set<String> categories = intent.getCategories();
MetricsLogger.action(this, mAdapter.hasFilteredItem() ? MetricsProto.MetricsEvent.ACTION_SHOW_APP_DISAMBIG_APP_FEATURED : MetricsProto.MetricsEvent.ACTION_SHOW_APP_DISAMBIG_NONE_FEATURED, intent.getAction() + ":" + intent.getType() + ":" + (categories != null ? Arrays.toString(categories.toArray()) : ""));
}
use of com.android.internal.widget.ResolverDrawerLayout in project platform_frameworks_base by android.
the class ResolverActivity method onCreate.
protected void onCreate(Bundle savedInstanceState, Intent intent, CharSequence title, int defaultTitleRes, Intent[] initialIntents, List<ResolveInfo> rList, boolean alwaysUseOption) {
setTheme(R.style.Theme_DeviceDefault_Resolver);
super.onCreate(savedInstanceState);
// Determine whether we should show that intent is forwarded
// from managed profile to owner or other way around.
setProfileSwitchMessageId(intent.getContentUserHint());
try {
mLaunchedFromUid = ActivityManagerNative.getDefault().getLaunchedFromUid(getActivityToken());
} catch (RemoteException e) {
mLaunchedFromUid = -1;
}
if (mLaunchedFromUid < 0 || UserHandle.isIsolated(mLaunchedFromUid)) {
// Gulp!
finish();
return;
}
mPm = getPackageManager();
mPackageMonitor.register(this, getMainLooper(), false);
mRegistered = true;
final ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
mIconDpi = am.getLauncherLargeIconDensity();
// Add our initial intent as the first item, regardless of what else has already been added.
mIntents.add(0, new Intent(intent));
final String referrerPackage = getReferrerPackageName();
mResolverComparator = new ResolverComparator(this, getTargetIntent(), referrerPackage);
if (configureContentView(mIntents, initialIntents, rList, alwaysUseOption)) {
return;
}
final ResolverDrawerLayout rdl = (ResolverDrawerLayout) findViewById(R.id.contentPanel);
if (rdl != null) {
rdl.setOnDismissedListener(new ResolverDrawerLayout.OnDismissedListener() {
@Override
public void onDismissed() {
finish();
}
});
if (isVoiceInteraction()) {
rdl.setCollapsed(false);
}
mResolverDrawerLayout = rdl;
}
if (title == null) {
title = getTitleForAction(intent.getAction(), defaultTitleRes);
}
if (!TextUtils.isEmpty(title)) {
final TextView titleView = (TextView) findViewById(R.id.title);
if (titleView != null) {
titleView.setText(title);
}
setTitle(title);
// Try to initialize the title icon if we have a view for it and a title to match
final ImageView titleIcon = (ImageView) findViewById(R.id.title_icon);
if (titleIcon != null) {
ApplicationInfo ai = null;
try {
if (!TextUtils.isEmpty(referrerPackage)) {
ai = mPm.getApplicationInfo(referrerPackage, 0);
}
} catch (NameNotFoundException e) {
Log.e(TAG, "Could not find referrer package " + referrerPackage);
}
if (ai != null) {
titleIcon.setImageDrawable(ai.loadIcon(mPm));
}
}
}
final ImageView iconView = (ImageView) findViewById(R.id.icon);
final DisplayResolveInfo iconInfo = mAdapter.getFilteredItem();
if (iconView != null && iconInfo != null) {
new LoadIconIntoViewTask(iconInfo, iconView).execute();
}
if (alwaysUseOption || mAdapter.hasFilteredItem()) {
final ViewGroup buttonLayout = (ViewGroup) findViewById(R.id.button_bar);
if (buttonLayout != null) {
buttonLayout.setVisibility(View.VISIBLE);
mAlwaysButton = (Button) buttonLayout.findViewById(R.id.button_always);
mOnceButton = (Button) buttonLayout.findViewById(R.id.button_once);
} else {
mAlwaysUseOption = false;
}
}
if (mAdapter.hasFilteredItem()) {
setAlwaysButtonEnabled(true, mAdapter.getFilteredPosition(), false);
mOnceButton.setEnabled(true);
}
mProfileView = findViewById(R.id.profile_button);
if (mProfileView != null) {
mProfileView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final DisplayResolveInfo dri = mAdapter.getOtherProfile();
if (dri == null) {
return;
}
// Do not show the profile switch message anymore.
mProfileSwitchMessageId = -1;
onTargetSelected(dri, false);
finish();
}
});
bindProfileView();
}
if (isVoiceInteraction()) {
onSetupVoiceInteraction();
}
final Set<String> categories = intent.getCategories();
MetricsLogger.action(this, mAdapter.hasFilteredItem() ? MetricsProto.MetricsEvent.ACTION_SHOW_APP_DISAMBIG_APP_FEATURED : MetricsProto.MetricsEvent.ACTION_SHOW_APP_DISAMBIG_NONE_FEATURED, intent.getAction() + ":" + intent.getType() + ":" + (categories != null ? Arrays.toString(categories.toArray()) : ""));
}
use of com.android.internal.widget.ResolverDrawerLayout in project android_frameworks_base by DirtyUnicorns.
the class ResolverActivity method onCreate.
protected void onCreate(Bundle savedInstanceState, Intent intent, CharSequence title, int defaultTitleRes, Intent[] initialIntents, List<ResolveInfo> rList, boolean alwaysUseOption) {
setTheme(R.style.Theme_DeviceDefault_Resolver);
super.onCreate(savedInstanceState);
// Determine whether we should show that intent is forwarded
// from managed profile to owner or other way around.
setProfileSwitchMessageId(intent.getContentUserHint());
try {
mLaunchedFromUid = ActivityManagerNative.getDefault().getLaunchedFromUid(getActivityToken());
} catch (RemoteException e) {
mLaunchedFromUid = -1;
}
if (mLaunchedFromUid < 0 || UserHandle.isIsolated(mLaunchedFromUid)) {
// Gulp!
finish();
return;
}
mPm = getPackageManager();
mPackageMonitor.register(this, getMainLooper(), false);
mRegistered = true;
final ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
mIconDpi = am.getLauncherLargeIconDensity();
// Add our initial intent as the first item, regardless of what else has already been added.
mIntents.add(0, new Intent(intent));
final String referrerPackage = getReferrerPackageName();
mResolverComparator = new ResolverComparator(this, getTargetIntent(), referrerPackage);
if (configureContentView(mIntents, initialIntents, rList, alwaysUseOption)) {
return;
}
final ResolverDrawerLayout rdl = (ResolverDrawerLayout) findViewById(R.id.contentPanel);
if (rdl != null) {
rdl.setOnDismissedListener(new ResolverDrawerLayout.OnDismissedListener() {
@Override
public void onDismissed() {
finish();
}
});
if (isVoiceInteraction()) {
rdl.setCollapsed(false);
}
mResolverDrawerLayout = rdl;
}
if (title == null) {
title = getTitleForAction(intent.getAction(), defaultTitleRes);
}
if (!TextUtils.isEmpty(title)) {
final TextView titleView = (TextView) findViewById(R.id.title);
if (titleView != null) {
titleView.setText(title);
}
setTitle(title);
// Try to initialize the title icon if we have a view for it and a title to match
final ImageView titleIcon = (ImageView) findViewById(R.id.title_icon);
if (titleIcon != null) {
ApplicationInfo ai = null;
try {
if (!TextUtils.isEmpty(referrerPackage)) {
ai = mPm.getApplicationInfo(referrerPackage, 0);
}
} catch (NameNotFoundException e) {
Log.e(TAG, "Could not find referrer package " + referrerPackage);
}
if (ai != null) {
titleIcon.setImageDrawable(ai.loadIcon(mPm));
}
}
}
final ImageView iconView = (ImageView) findViewById(R.id.icon);
final DisplayResolveInfo iconInfo = mAdapter.getFilteredItem();
if (iconView != null && iconInfo != null) {
new LoadIconIntoViewTask(iconInfo, iconView).execute();
}
if (alwaysUseOption || mAdapter.hasFilteredItem()) {
final ViewGroup buttonLayout = (ViewGroup) findViewById(R.id.button_bar);
if (buttonLayout != null) {
buttonLayout.setVisibility(View.VISIBLE);
mAlwaysButton = (Button) buttonLayout.findViewById(R.id.button_always);
mOnceButton = (Button) buttonLayout.findViewById(R.id.button_once);
} else {
mAlwaysUseOption = false;
}
}
if (mAdapter.hasFilteredItem()) {
setAlwaysButtonEnabled(true, mAdapter.getFilteredPosition(), false);
mOnceButton.setEnabled(true);
}
mProfileView = findViewById(R.id.profile_button);
if (mProfileView != null) {
mProfileView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final DisplayResolveInfo dri = mAdapter.getOtherProfile();
if (dri == null) {
return;
}
// Do not show the profile switch message anymore.
mProfileSwitchMessageId = -1;
onTargetSelected(dri, false);
finish();
}
});
bindProfileView();
}
if (isVoiceInteraction()) {
onSetupVoiceInteraction();
}
final Set<String> categories = intent.getCategories();
MetricsLogger.action(this, mAdapter.hasFilteredItem() ? MetricsProto.MetricsEvent.ACTION_SHOW_APP_DISAMBIG_APP_FEATURED : MetricsProto.MetricsEvent.ACTION_SHOW_APP_DISAMBIG_NONE_FEATURED, intent.getAction() + ":" + intent.getType() + ":" + (categories != null ? Arrays.toString(categories.toArray()) : ""));
}
use of com.android.internal.widget.ResolverDrawerLayout in project android_frameworks_base by crdroidandroid.
the class ResolverActivity method onCreate.
protected void onCreate(Bundle savedInstanceState, Intent intent, CharSequence title, int defaultTitleRes, Intent[] initialIntents, List<ResolveInfo> rList, boolean alwaysUseOption) {
setTheme(R.style.Theme_DeviceDefault_Resolver);
super.onCreate(savedInstanceState);
// Determine whether we should show that intent is forwarded
// from managed profile to owner or other way around.
setProfileSwitchMessageId(intent.getContentUserHint());
try {
mLaunchedFromUid = ActivityManagerNative.getDefault().getLaunchedFromUid(getActivityToken());
} catch (RemoteException e) {
mLaunchedFromUid = -1;
}
if (mLaunchedFromUid < 0 || UserHandle.isIsolated(mLaunchedFromUid)) {
// Gulp!
finish();
return;
}
mPm = getPackageManager();
mPackageMonitor.register(this, getMainLooper(), false);
mRegistered = true;
final ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
mIconDpi = am.getLauncherLargeIconDensity();
// Add our initial intent as the first item, regardless of what else has already been added.
mIntents.add(0, new Intent(intent));
final String referrerPackage = getReferrerPackageName();
mResolverComparator = new ResolverComparator(this, getTargetIntent(), referrerPackage);
if (configureContentView(mIntents, initialIntents, rList, alwaysUseOption)) {
return;
}
final ResolverDrawerLayout rdl = (ResolverDrawerLayout) findViewById(R.id.contentPanel);
if (rdl != null) {
rdl.setOnDismissedListener(new ResolverDrawerLayout.OnDismissedListener() {
@Override
public void onDismissed() {
finish();
}
});
if (isVoiceInteraction()) {
rdl.setCollapsed(false);
}
mResolverDrawerLayout = rdl;
}
if (title == null) {
title = getTitleForAction(intent.getAction(), defaultTitleRes);
}
if (!TextUtils.isEmpty(title)) {
final TextView titleView = (TextView) findViewById(R.id.title);
if (titleView != null) {
titleView.setText(title);
}
setTitle(title);
// Try to initialize the title icon if we have a view for it and a title to match
final ImageView titleIcon = (ImageView) findViewById(R.id.title_icon);
if (titleIcon != null) {
ApplicationInfo ai = null;
try {
if (!TextUtils.isEmpty(referrerPackage)) {
ai = mPm.getApplicationInfo(referrerPackage, 0);
}
} catch (NameNotFoundException e) {
Log.e(TAG, "Could not find referrer package " + referrerPackage);
}
if (ai != null) {
titleIcon.setImageDrawable(ai.loadIcon(mPm));
}
}
}
final ImageView iconView = (ImageView) findViewById(R.id.icon);
final DisplayResolveInfo iconInfo = mAdapter.getFilteredItem();
if (iconView != null && iconInfo != null) {
new LoadIconIntoViewTask(iconInfo, iconView).execute();
}
if (alwaysUseOption || mAdapter.hasFilteredItem()) {
final ViewGroup buttonLayout = (ViewGroup) findViewById(R.id.button_bar);
if (buttonLayout != null) {
buttonLayout.setVisibility(View.VISIBLE);
mAlwaysButton = (Button) buttonLayout.findViewById(R.id.button_always);
mOnceButton = (Button) buttonLayout.findViewById(R.id.button_once);
} else {
mAlwaysUseOption = false;
}
}
if (mAdapter.hasFilteredItem()) {
mFilteredItemContainer = (ViewGroup) findViewById(R.id.filtered_item_container);
mFilteredItemContainer.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
DisplayResolveInfo filteredItem = mAdapter.getFilteredItem();
if (filteredItem == null) {
return false;
}
showTargetDetails(filteredItem.getResolveInfo());
return true;
}
});
setAlwaysButtonEnabled(true, mAdapter.getFilteredPosition(), false);
mOnceButton.setEnabled(true);
}
mProfileView = findViewById(R.id.profile_button);
if (mProfileView != null) {
mProfileView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final DisplayResolveInfo dri = mAdapter.getOtherProfile();
if (dri == null) {
return;
}
// Do not show the profile switch message anymore.
mProfileSwitchMessageId = -1;
onTargetSelected(dri, false);
finish();
}
});
bindProfileView();
}
if (isVoiceInteraction()) {
onSetupVoiceInteraction();
}
final Set<String> categories = intent.getCategories();
MetricsLogger.action(this, mAdapter.hasFilteredItem() ? MetricsProto.MetricsEvent.ACTION_SHOW_APP_DISAMBIG_APP_FEATURED : MetricsProto.MetricsEvent.ACTION_SHOW_APP_DISAMBIG_NONE_FEATURED, intent.getAction() + ":" + intent.getType() + ":" + (categories != null ? Arrays.toString(categories.toArray()) : ""));
}
Aggregations