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


Java CMStatusBarManager类代码示例

本文整理汇总了Java中cyanogenmod.app.CMStatusBarManager的典型用法代码示例。如果您正苦于以下问题:Java CMStatusBarManager类的具体用法?Java CMStatusBarManager怎么用?Java CMStatusBarManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CMStatusBarManager类属于cyanogenmod.app包,在下文中一共展示了CMStatusBarManager类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createStatusBarTiles

import cyanogenmod.app.CMStatusBarManager; //导入依赖的package包/类
/**
 * Create a tiles on the status bar through CyanogenMod SDK -- Fung Jichun
 * You can learn more from: https://cyngn.com/developer-blog/introducing-the-cyanogen-platform-sdk
 * @param context Context
 * @param nowStatus Now
 */
public static void createStatusBarTiles(Context context, boolean nowStatus) {
    try {
        Intent intent = new Intent();
        intent.setAction(Constants.ACTION_UPDATE_STATUS);
        intent.putExtra(Constants.Extra.ACTION,
                nowStatus ? Constants.Action.STOP : Constants.Action.START);

        CustomTile customTile = new CustomTile.Builder(context)
                .shouldCollapsePanel(false)
                .setLabel(nowStatus ? R.string.notification_action_turn_off : R.string.app_name)
                .setIcon(nowStatus ?
                        R.drawable.ic_qs_night_mode_on : R.drawable.ic_qs_night_mode_off)
                .setOnClickIntent(PendingIntent.getBroadcast(
                        context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT))
                .build();

        CMStatusBarManager.getInstance(context).publishTile(CM_TILE_CODE, customTile);
    } catch (Exception e) {
        Log.d("Utility", "Failed to create CM status bar tile. Ignore it.");
    }
}
 
开发者ID:fython,项目名称:Blackbulb,代码行数:28,代码来源:Utility.java

示例2: publishProfileTile

import cyanogenmod.app.CMStatusBarManager; //导入依赖的package包/类
public static void publishProfileTile(List<ProfileDB.ProfileItem> profiles, Context context) {
    if (!Utils.hasCMSDK()) return;
    if (profiles == null || profiles.size() < 1 || !Utils.getBoolean("profiletile", true, context)) {
        CMStatusBarManager.getInstance(context).removeTile(0);
        return;
    }

    Intent intent = new Intent();
    intent.setAction(ACTION_TOGGLE_STATE);

    ArrayList<CustomTile.ExpandedGridItem> expandedGridItems = new ArrayList<>();
    for (ProfileDB.ProfileItem item : profiles) {
        CustomTile.ExpandedGridItem expandedGridItem = new CustomTile.ExpandedGridItem();
        expandedGridItem.setExpandedGridItemTitle(item.getName());
        expandedGridItem.setExpandedGridItemDrawable(R.drawable.ic_launcher_preview);

        intent.putExtra(NAME, item.getName());
        intent.putExtra(COMMANDS, item.getCommands().toArray(new String[item.getCommands().size()]));
        PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent,
                PendingIntent.FLAG_UPDATE_CURRENT);

        expandedGridItem.setExpandedGridItemOnClickIntent(pendingIntent);
        expandedGridItems.add(expandedGridItem);
    }

    CustomTile.GridExpandedStyle gridExpandedStyle = new CustomTile.GridExpandedStyle();
    gridExpandedStyle.setGridItems(expandedGridItems);

    CustomTile mCustomTile = new CustomTile.Builder(context)
            .setExpandedStyle(gridExpandedStyle)
            .setLabel(R.string.profile)
            .setIcon(R.drawable.ic_launcher_preview)
            .build();
    try {
        CMStatusBarManager.getInstance(context).publishTile(0, mCustomTile);
    } catch (Exception e) {
        Utils.saveBoolean("profiletile", false, context);
        Utils.toast(e.getMessage(), context, Toast.LENGTH_LONG);
    }
}
 
开发者ID:exynos5420,项目名称:deathly_adiutor_free,代码行数:41,代码来源:ProfileTileReceiver.java

示例3: onReceive

import cyanogenmod.app.CMStatusBarManager; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {

    String event, data;

    if (intent.getExtras() != null && (event = intent.getStringExtra(Constant.EVENT_EXTRA)) != null) {
        data = intent.getStringExtra(Constant.DATA_EXTRA);
        thread.send(event, data);
        return;
    }

    ArrayList<CustomTile.ExpandedListItem> list = new ArrayList<>();

    int i = 0;

    for (Command command : Datastore.getInstance().getCommands()) {
        CustomTile.ExpandedListItem item = new CustomTile.ExpandedListItem();
        item.setExpandedListItemTitle(command.getEvent());
        item.setExpandedListItemSummary(command.getData());
        item.setExpandedListItemDrawable(command.getIcon());
        item.setExpandedListItemOnClickIntent(createIntent(context, i++, command));
        list.add(item);
    }

    CustomTile.ListExpandedStyle style = new CustomTile.ListExpandedStyle();
    style.setListItems(list);

    // build tile
    CustomTile customTile = new CustomTile.Builder(context)
            .setExpandedStyle(style)
            .shouldCollapsePanel(true)
            .setOnSettingsClickIntent(new Intent(context, MainActivity.class))
            .setLabel("Remote Tile")
            .setIcon(R.drawable.ic_desktop_windows_white_24dp)
            .build();

    CMStatusBarManager.getInstance(context).publishTile(0, customTile);

}
 
开发者ID:fcannizzaro,项目名称:remote-tile,代码行数:40,代码来源:TileReceiver.java

示例4: publishCMCustomTile

import cyanogenmod.app.CMStatusBarManager; //导入依赖的package包/类
public static void publishCMCustomTile(Context context) {
    try {
        Intent intent = new Intent();
        intent.setAction(Constants.ACTION_SCREEN_OFF);

        //intent.putExtra(MainActivity.STATE, States.STATE_OFF);

        PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0,
                intent, PendingIntent.FLAG_UPDATE_CURRENT);

        Intent long_i = new Intent(context, Main.class);
        PendingIntent longPendingIntent = PendingIntent.getBroadcast(context, 1,
                long_i, PendingIntent.FLAG_UPDATE_CURRENT);

        CustomTile customTile = new CustomTile.Builder(context)
                .setOnClickIntent(pendingIntent)
                .setContentDescription(context.getString(R.string.text_how_to_use))
                .setLabel(context.getString(R.string.app_name))
                .shouldCollapsePanel(true)
                .setOnLongClickIntent(longPendingIntent)
                .setIcon(R.drawable.ic_tile_screen_off)
                .build();

        CMStatusBarManager.getInstance(context)
                .publishTile(1, customTile);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:tommasoberlose,项目名称:screen-off,代码行数:30,代码来源:Utils.java

示例5: publishProfileTile

import cyanogenmod.app.CMStatusBarManager; //导入依赖的package包/类
public static void publishProfileTile(List<Profiles.ProfileItem> profiles, Context context) {
    if (!Utils.hasCMSDK()) return;
    if (profiles == null || profiles.size() < 1 || !Prefs.getBoolean("profiletile", true, context)) {
        try {
            CMStatusBarManager.getInstance(context).removeTile(0);
        } catch (RuntimeException ignored) {
        }
        return;
    }

    Intent intent = new Intent();
    intent.setAction(ACTION_TOGGLE_STATE);

    ArrayList<CustomTile.ExpandedListItem> expandedListItems = new ArrayList<>();
    for (int i = 0; i < profiles.size(); i++) {
        CustomTile.ExpandedListItem expandedListItem = new CustomTile.ExpandedListItem();
        expandedListItem.setExpandedListItemTitle(profiles.get(i).getName());
        expandedListItem.setExpandedListItemDrawable(R.drawable.ic_launcher_preview);

        List<String> commands = new ArrayList<>();
        for (Profiles.ProfileItem.CommandItem commandItem : profiles.get(i).getCommands()) {
            commands.add(commandItem.getCommand());
        }
        intent.putExtra(NAME, profiles.get(i).getName());
        intent.putExtra(COMMANDS, commands.toArray(new String[commands.size()]));
        PendingIntent pendingIntent = PendingIntent.getBroadcast(context, i, intent, 0);

        expandedListItem.setExpandedListItemOnClickIntent(pendingIntent);
        expandedListItems.add(expandedListItem);
    }

    CustomTile.ListExpandedStyle listExpandedStyle = new CustomTile.ListExpandedStyle();
    listExpandedStyle.setListItems(expandedListItems);

    CustomTile mCustomTile = new CustomTile.Builder(context)
            .setExpandedStyle(listExpandedStyle)
            .setLabel(R.string.profile)
            .setIcon(R.drawable.ic_launcher_preview)
            .build();
    try {
        CMStatusBarManager.getInstance(context).publishTile(0, mCustomTile);
    } catch (Exception e) {
        Prefs.saveBoolean("profiletile", false, context);
    }
}
 
开发者ID:morogoku,项目名称:MTweaks-KernelAdiutorMOD,代码行数:46,代码来源:Tile.java


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