當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。