本文整理汇总了Java中android.app.ActivityManager.TaskDescription方法的典型用法代码示例。如果您正苦于以下问题:Java ActivityManager.TaskDescription方法的具体用法?Java ActivityManager.TaskDescription怎么用?Java ActivityManager.TaskDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.ActivityManager
的用法示例。
在下文中一共展示了ActivityManager.TaskDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.app.ActivityManager; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
themeString = Colorful.getThemeString();
setTheme(Colorful.getThemeDelegate().getStyleResBase());
getTheme().applyStyle(Colorful.getThemeDelegate().getStyleResPrimary(), true);
getTheme().applyStyle(Colorful.getThemeDelegate().getStyleResAccent(), true);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (Colorful.getThemeDelegate().isTranslucent()) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
ActivityManager.TaskDescription tDesc = new ActivityManager.TaskDescription(null, null,
getResources().getColor(Colorful.getThemeDelegate().getPrimaryColor().getColorRes()));
setTaskDescription(tDesc);
}
}
示例2: onCreate
import android.app.ActivityManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mMainPresenter = new MainPresenterImpl(this);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
mMainPresenter.initializeViews();
if (savedInstanceState != null) {
mMainPresenter.restoreState(savedInstanceState);
}
Intent i = new Intent(getBaseContext(), ScrapperService.class);
startService(i);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ActivityManager.TaskDescription td = new ActivityManager.TaskDescription(null, null, ContextCompat.getColor(this, R.color.colorAccent));
setTaskDescription(td);
}
}
示例3: changeRecentAppsIcon
import android.app.ActivityManager; //导入方法依赖的package包/类
public void changeRecentAppsIcon() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Bitmap iconWhite = BitmapFactory.decodeResource(activity.getResources(), R.drawable.ic_appbar);
TypedValue typedValue = new TypedValue();
Resources.Theme theme = activity.getTheme();
theme.resolveAttribute(R.attr.colorPrimary, typedValue, true);
int color = typedValue.data;
ActivityManager.TaskDescription description = new ActivityManager.TaskDescription(
activity.getResources().getString(R.string.app_name),
iconWhite,
color
);
activity.setTaskDescription(description);
iconWhite.recycle();
}
}
示例4: getTaskDescription
import android.app.ActivityManager; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public ActivityManager.TaskDescription getTaskDescription(ActivityManager.TaskDescription oldTaskDescription) {
if (oldTaskDescription == null) {
return null;
}
String labelPrefix = "[" + VUserManager.get().getUserName() + "] ";
String oldLabel = oldTaskDescription.getLabel() != null ? oldTaskDescription.getLabel() : "";
if (!oldLabel.startsWith(labelPrefix)) {
// Is it really necessary?
return new ActivityManager.TaskDescription(labelPrefix + oldTaskDescription.getLabel(), oldTaskDescription.getIcon(), oldTaskDescription.getPrimaryColor());
} else {
return oldTaskDescription;
}
}
示例5: onCreate
import android.app.ActivityManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//最近列表显示的缩略图的label,icon,top bar color
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ActivityManager.TaskDescription taskDesc = new ActivityManager.TaskDescription(
getTitle().toString(),
BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher_round));
setTaskDescription(taskDesc);
}
setContentView(initContentView());
initStatusBar();
initToolbar();
init();
initView();
initData();
}
示例6: applyTaskDescription
import android.app.ActivityManager; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void applyTaskDescription(@NonNull Activity activity, @Nullable String key) {
int color = 0;
Bitmap icon = null;
if (activity instanceof ATETaskDescriptionCustomizer) {
final ATETaskDescriptionCustomizer customizer = (ATETaskDescriptionCustomizer) activity;
color = customizer.getTaskDescriptionColor();
icon = customizer.getTaskDescriptionIcon();
if (color == ATE.USE_DEFAULT)
color = Config.primaryColor(activity, key);
} else {
color = Config.primaryColor(activity, key);
}
// Task description requires fully opaque color
color = ATEUtil.stripAlpha(color);
// Default is app's launcher icon
if (icon == null)
icon = ((BitmapDrawable) activity.getApplicationInfo().loadIcon(activity.getPackageManager())).getBitmap();
// Sets color of entry in the system recents page
ActivityManager.TaskDescription td = new ActivityManager.TaskDescription(
(String) activity.getTitle(), icon, color);
activity.setTaskDescription(td);
}
示例7: initStatusBar
import android.app.ActivityManager; //导入方法依赖的package包/类
protected void initStatusBar(){
if (Build.VERSION.SDK_INT >= 21) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(ThemeUtils.getColorById(this, R.color.theme_color_primary));
ActivityManager.TaskDescription description = new ActivityManager.TaskDescription(null, null, ThemeUtils.getThemeAttrColor(this, android.R.attr.colorPrimary));
setTaskDescription(description);
}
}
示例8: onPostCreate
import android.app.ActivityManager; //导入方法依赖的package包/类
@Override
public void onPostCreate(Bundle savedInstanceState, PersistableBundle persistentState) {
super.onPostCreate(savedInstanceState);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(ThemeUtils.getColorById(this, R.color.theme_color_primary_dark));
ActivityManager.TaskDescription description = new ActivityManager.TaskDescription(null, null,
ThemeUtils.getThemeAttrColor(this, android.R.attr.colorPrimary));
setTaskDescription(description);
}
}
示例9: onPostCreate
import android.app.ActivityManager; //导入方法依赖的package包/类
@Override
public void onPostCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
super.onPostCreate(savedInstanceState, persistentState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(ThemeUtils.getColorById(this, R.color.theme_color_primary_dark));
ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription
(null, null, ThemeUtils.getThemeAttrColor(this, android.R.attr.colorPrimary));
setTaskDescription(taskDescription);
}
}
示例10: setTaskDescription
import android.app.ActivityManager; //导入方法依赖的package包/类
protected void setTaskDescription(Bitmap bm, String label, int color){
// Color the app topbar label and icon in the overview screen
//http://www.bignerdranch.com/blog/polishing-your-Android-overview-screen-entry/
// Placed in the post create so it would be called after the action bar is initialized and we have a title.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ActivityManager.TaskDescription td = new ActivityManager.TaskDescription(label, bm, color);
setTaskDescription(td);
}
}
示例11: applyTaskDescription
import android.app.ActivityManager; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private static void applyTaskDescription(@NonNull Activity activity, @Nullable String key, int color) {
// Sets color of entry in the system recents page
try {
ActivityManager.TaskDescription td = new ActivityManager.TaskDescription(
(String) activity.getTitle(),
((BitmapDrawable) activity.getApplicationInfo().loadIcon(activity.getPackageManager())).getBitmap(),
color);
activity.setTaskDescription(td);
} catch (Exception ignored) {
}
}
示例12: onCreate
import android.app.ActivityManager; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
themeString=Colorful.getThemeString();
setTheme(Colorful.getThemeDelegate().getStyle());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (Colorful.getThemeDelegate().isTranslucent()) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
ActivityManager.TaskDescription tDesc = new ActivityManager.TaskDescription(null, null, getResources().getColor(Colorful.getThemeDelegate().getPrimaryColor().getColorRes()));
setTaskDescription(tDesc);
}
}
示例13: onCreate
import android.app.ActivityManager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mBinding = DataBindingUtil.setContentView(this, R.layout.activity_editor);
setSupportActionBar(mBinding.toolbar);
String fileName = "untitled.json";
Bundle bundle = getIntent().getExtras();
if (bundle != null && bundle.getString(FILENAME) != null) {
fileName = bundle.getString(FILENAME);
}
mViewModel = new DocumentViewModel(this, fileName);
mViewModel.loadDocument();
mBinding.setViewModel(mViewModel);
// Do some necessary non-data binding view work
// TaskDescription constructor requires us to specify an overview title bar color, so we
// grab primary color to match the original color
int primaryColor = getColor(R.color.colorPrimary);
ActivityManager.TaskDescription td = new ActivityManager.TaskDescription(
mViewModel.getPrettyFileName(), null, primaryColor
);
// Set our overview task description with custom name matching the current doc file name
setTaskDescription(td);
mLayerTypePopup = new PopupMenu(this, mBinding.addLayerBtn);
mLayerTypePopup.getMenuInflater().inflate(
R.menu.menu_layer_types, mLayerTypePopup.getMenu());
mLayerTypePopup.setOnMenuItemClickListener(mViewModel.getOnMenuItemClickListener());
registerForContextMenu(mBinding.documentView);
registerForContextMenu(mBinding.layerList);
}
示例14: call
import android.app.ActivityManager; //导入方法依赖的package包/类
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
ActivityManager.TaskDescription td = (ActivityManager.TaskDescription) args[1];
String label = td.getLabel();
Bitmap icon = td.getIcon();
// If the activity label/icon isn't specified, the application's label/icon is shown instead
// Android usually does that for us, but in this case we want info about the contained app, not VIrtualApp itself
if (label == null || icon == null) {
Application app = VClientImpl.get().getCurrentApplication();
if (app != null) {
try {
if (label == null) {
label = app.getApplicationInfo().loadLabel(app.getPackageManager()).toString();
}
if (icon == null) {
Drawable drawable = app.getApplicationInfo().loadIcon(app.getPackageManager());
if (drawable != null) {
icon = DrawableUtils.drawableToBitMap(drawable);
}
}
td = new ActivityManager.TaskDescription(label, icon, td.getPrimaryColor());
} catch (Throwable e) {
e.printStackTrace();
}
}
}
TaskDescriptionDelegate descriptionDelegate = VirtualCore.get().getTaskDescriptionDelegate();
if (descriptionDelegate != null) {
td = descriptionDelegate.getTaskDescription(td);
}
args[1] = td;
return method.invoke(who, args);
}
示例15: onResume
import android.app.ActivityManager; //导入方法依赖的package包/类
@Override
public void onResume() {
super.onResume();
//Coloring the "recent apps" tab header; doing it onResume, as an insurance
if (Build.VERSION.SDK_INT >= 23) {
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher);
ActivityManager.TaskDescription taskDesc = null;
taskDesc = new ActivityManager.TaskDescription(getString(R.string.app_name), bm, getColor(R.color.colorPrimary));
MainActivity.this.setTaskDescription(taskDesc);
}
get_location();
}