@Override protected void onResume() { super.onResume(); try { PackageManager pm = getPackageManager(); ActivityInfo activityInfo = pm.getActivityInfo( getComponentName(), PackageManager.GET_META_DATA); TaskDescription taskDescription = new TaskDescription( activityInfo.loadLabel(pm).toString(), BitmapFactory.decodeResource(getResources(), activityInfo.icon), ResourceUtil.getAttrColor(this, android.R.attr.colorPrimary) ); setTaskDescription(taskDescription); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { final AppResources res = AppResources.get(this); // WTF! IRIS506Q android version "unknown" try { getWindow().setStatusBarColor(res.getPrimaryColor()); } catch (Exception e) { Log.e("BaseActivity", "get a stone and throw it at your device vendor", e); } // color recents tab final Bitmap appIcon = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_devicecontrol); final TaskDescription description = new TaskDescription(String.valueOf(getTitle()), appIcon, res.getAccentColor()); setTaskDescription(description); } }
@Override protected void onCreate(final Bundle savedInstanceState) { application = (WalletApplication) getApplication(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) setTaskDescription(new TaskDescription(null, null, getResources().getColor(R.color.bg_action_bar))); super.onCreate(savedInstanceState); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static void configureTaskDescription(Activity activity) { if (isLollipopOrGreater()) { Bitmap icon = BitmapFactory.decodeResource( activity.getResources(), R.mipmap.ic_launcher); TaskDescription taskDesc = new TaskDescription( null, icon, ContextCompat.getColor(activity, R.color.primaryDark)); activity.setTaskDescription(taskDesc); } }
private static void addAppTask(Activity activity, int tabId, TabState tabState, String currentUrl, String title, Bitmap favicon, Bitmap bitmap) { if (tabId == ActivityDelegate.getTabIdFromIntent(activity.getIntent())) return; // Create intent and taskDescription. Intent intent = new Intent(Intent.ACTION_VIEW, DocumentTabModelSelector.createDocumentDataString(tabId, currentUrl)); intent.setClassName(activity, ChromeLauncherActivity.getDocumentClassName(false)); intent.putExtra(IntentHandler.EXTRA_PRESERVE_TASK, true); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT); ActivityManager am = (ActivityManager) activity.getSystemService(Activity.ACTIVITY_SERVICE); Bitmap thumbnail = Bitmap.createBitmap(am.getAppTaskThumbnailSize().getWidth(), am.getAppTaskThumbnailSize().getHeight(), Config.ARGB_8888); Canvas canvas = new Canvas(thumbnail); if (bitmap == null) { canvas.drawColor(Color.WHITE); } else { float scale = Math.max( (float) thumbnail.getWidth() / bitmap.getWidth(), (float) thumbnail.getHeight() / bitmap.getHeight()); canvas.scale(scale, scale); canvas.drawBitmap(bitmap, 0, 0, null); } TaskDescription taskDescription = new TaskDescription(title, favicon, activity.getResources().getColor(R.color.default_primary_color)); am.addAppTask(activity, intent, taskDescription, thumbnail); Entry entry = new Entry(tabId, tabState); DocumentTabModelImpl tabModel = (DocumentTabModelImpl) ChromeApplication .getDocumentTabModelSelector().getModel(false); tabModel.addEntryForMigration(entry); }
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void applyTaskDescription(Activity activity) { String taskName = mContext.getString(R.string.app_name); int taskColor = getPrimaryColor(); Bitmap taskIcon = getAppIcon(); TaskDescription taskDescription = new TaskDescription(taskName, taskIcon, taskColor); activity.setTaskDescription(taskDescription); }
@Override protected void onCreate(Bundle savedInstanceState) { AndroidInjection.inject(this); super.onCreate(savedInstanceState); if ("true".equals(getIntent().getStringExtra("crash"))) { throw new RuntimeException("Crash! Bang! Pow! This is only a test..."); } setContentView(R.layout.activity_main); ButterKnife.bind(this); CheatSheet.setup(launchView); setTaskDescription(new TaskDescription(appName, rasterizeTaskIcon(), primaryNormal)); videoSizePercentageAdapter = new VideoSizePercentageAdapter(this); videoSizePercentageView.setAdapter(videoSizePercentageAdapter); videoSizePercentageView.setSelection( VideoSizePercentageAdapter.getSelectedPosition(videoSizePreference.get())); showCountdownView.setChecked(showCountdownPreference.get()); hideFromRecentsView.setChecked(hideFromRecentsPreference.get()); recordingNotificationView.setChecked(recordingNotificationPreference.get()); showTouchesView.setChecked(showTouchesPreference.get()); useDemoModeView.setChecked(useDemoModePreference.get()); showDemoModeSetting = new DemoModeHelper.ShowDemoModeSetting() { @Override public void show() { useDemoModeContainerView.setVisibility(VISIBLE); } @Override public void hide() { useDemoModeView.setChecked(false); useDemoModeContainerView.setVisibility(GONE); } }; DemoModeHelper.showDemoModeSetting(this, showDemoModeSetting); }
@TargetApi(value=Build.VERSION_CODES.LOLLIPOP) public static void setupRecentBar(Activity activity) { if (isLollipopOrGreater()) { int color = ContextCompat.getColor(activity, R.color.color_primary); if (Color.alpha(color) != 255) { // Remove alpha color. TaskDescription needs an opaque color color = Color.rgb(Color.red(color), Color.green(color), Color.blue(color)); } TaskDescription taskDesc = new TaskDescription( activity.getString(R.string.app_name), null, color); activity.setTaskDescription(taskDesc); } }
public void setTaskDescription(TaskDescription taskDescription) { mHostActivity.setTaskDescription(taskDescription); }