当前位置: 首页>>代码示例>>Java>>正文


Java ActivityManager.TaskDescription方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:woxingxiao,项目名称:GracefulMovies,代码行数:18,代码来源:ColorfulActivity.java

示例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);
    }
}
 
开发者ID:riteshakya037,项目名称:Android-Scrapper,代码行数:21,代码来源:MainActivity.java

示例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();
    }
}
 
开发者ID:xtools-at,项目名称:Android-PWA-Wrapper,代码行数:19,代码来源:UIManager.java

示例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;
    }
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:17,代码来源:MyTaskDescriptionDelegate.java

示例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();
}
 
开发者ID:fendoudebb,项目名称:PlayAndroid,代码行数:18,代码来源:BaseActivity.java

示例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);
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:26,代码来源:ATE.java

示例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);
    }
}
 
开发者ID:WeDevelopTeam,项目名称:HeroVideo-master,代码行数:11,代码来源:RxBaseActivity.java

示例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);
  }
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:15,代码来源:RxBaseActivity.java

示例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);
    }
}
 
开发者ID:MUFCRyan,项目名称:BilibiliClient,代码行数:14,代码来源:RxBaseActivity.java

示例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);
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:11,代码来源:ChatSDKBaseActivity.java

示例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) {

    }
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:14,代码来源:ATEUtils.java

示例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);
    }
}
 
开发者ID:sega4revenge,项目名称:Sega,代码行数:15,代码来源:CActivity.java

示例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);
}
 
开发者ID:google,项目名称:spline,代码行数:39,代码来源:EditorActivity.java

示例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);
}
 
开发者ID:codehz,项目名称:container,代码行数:37,代码来源:SetTaskDescription.java

示例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();
}
 
开发者ID:mgks,项目名称:Android-SmartWebView,代码行数:13,代码来源:MainActivity.java


注:本文中的android.app.ActivityManager.TaskDescription方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。