Java 类android.app.ActivityManager.TaskDescription 实例源码

项目:SorceryIconPack    文件:BaseActivity.java   
@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();
    }

}
项目:DeviceControl    文件:BaseActivity.java   
@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);
    }
}
项目:okwallet    文件:AbstractWalletActivity.java   
@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);
}
项目:rview    文件:AndroidHelper.java   
@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);
    }
}
项目:Vafrinn    文件:DocumentMigrationHelper.java   
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);
}
项目:Jockey    文件:PresetThemeStore.java   
@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);
}
项目:Telecine    文件:TelecineActivity.java   
@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);
}
项目:PhotoPhase    文件:AndroidHelper.java   
@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);
    }
}
项目:ApkLauncher    文件:Target_Activity.java   
public void setTaskDescription(TaskDescription taskDescription) {
    mHostActivity.setTaskDescription(taskDescription);
}
项目:ApkLauncher    文件:Target_ActivityGroup.java   
public void setTaskDescription(TaskDescription taskDescription) {
    mHostActivity.setTaskDescription(taskDescription);
}
项目:ApkLauncher    文件:Target_TabActivity.java   
public void setTaskDescription(TaskDescription taskDescription) {
    mHostActivity.setTaskDescription(taskDescription);
}
项目:ApkLauncher    文件:Target_ListActivity.java   
public void setTaskDescription(TaskDescription taskDescription) {
    mHostActivity.setTaskDescription(taskDescription);
}
项目:ApkLauncher    文件:Target_FragmentActivity.java   
public void setTaskDescription(TaskDescription taskDescription) {
    mHostActivity.setTaskDescription(taskDescription);
}
项目:ApkLauncher    文件:Target_PreferenceActivity.java   
public void setTaskDescription(TaskDescription taskDescription) {
    mHostActivity.setTaskDescription(taskDescription);
}
项目:ApkLauncher    文件:Target_ActionBarActivity.java   
public void setTaskDescription(TaskDescription taskDescription) {
    mHostActivity.setTaskDescription(taskDescription);
}
项目:ApkLauncher    文件:Target_ExpandableListActivity.java   
public void setTaskDescription(TaskDescription taskDescription) {
    mHostActivity.setTaskDescription(taskDescription);
}