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


Java Tile.setIcon方法代码示例

本文整理汇总了Java中android.service.quicksettings.Tile.setIcon方法的典型用法代码示例。如果您正苦于以下问题:Java Tile.setIcon方法的具体用法?Java Tile.setIcon怎么用?Java Tile.setIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.service.quicksettings.Tile的用法示例。


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

示例1: updateState

import android.service.quicksettings.Tile; //导入方法依赖的package包/类
private void updateState() {
    Tile tile = getQsTile();
    if(tile != null) {
        SharedPreferences pref = U.getSharedPreferences(this);
        tile.setIcon(Icon.createWithResource(this, pref.getBoolean("app_drawer_icon", false)
                ? R.drawable.ic_system
                : R.drawable.ic_allapps));

        if(U.canDrawOverlays(this))
            tile.setState(U.isServiceRunning(this, NotificationService.class)
                    ? Tile.STATE_ACTIVE
                    : Tile.STATE_INACTIVE);
        else
            tile.setState(Tile.STATE_UNAVAILABLE);

        tile.updateTile();
    }
}
 
开发者ID:farmerbb,项目名称:Taskbar,代码行数:19,代码来源:QuickSettingsTileService.java

示例2: refreshTile

import android.service.quicksettings.Tile; //导入方法依赖的package包/类
/** <br> UI. */

    @RequiresApi(api = Build.VERSION_CODES.N)
    public static void refreshTile(Context context, Tile tile) {
        if (tile == null) {
            return;
        }
        Location location = DatabaseHelper.getInstance(context).readLocationList().get(0);
        location.weather = DatabaseHelper.getInstance(context).readWeather(location);
        if (location.weather != null) {
            boolean f = PreferenceManager.getDefaultSharedPreferences(context)
                    .getBoolean(context.getString(R.string.key_fahrenheit), false);
            tile.setIcon(
                    Icon.createWithResource(
                            context,
                            WeatherHelper.getNotificationWeatherIcon(
                                    location.weather.realTime.weatherKind,
                                    TimeManager.getInstance(context).isDayTime())));
            tile.setLabel(
                    ValueUtils.buildCurrentTemp(
                            location.weather.realTime.temp,
                            false,
                            f));
            tile.updateTile();
        }
    }
 
开发者ID:WangDaYeeeeee,项目名称:GeometricWeather,代码行数:27,代码来源:TileHelper.java

示例3: setBat

import android.service.quicksettings.Tile; //导入方法依赖的package包/类
private void setBat(Intent intent) {
        int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1);

        mIsCharging = status == BatteryManager.BATTERY_STATUS_CHARGING ||
                status == BatteryManager.BATTERY_STATUS_FULL;

//        int scale = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1);

        mBatteryPercent = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);

        Tile battery = getQsTile();

        int resId;

        if (mBatteryPercent >= 95) {
             resId = mIsCharging ? R.drawable.ic_battery_charging_full : R.drawable.ic_battery;
        } else if (mBatteryPercent >= 85) {
            resId = mIsCharging ? R.drawable.ic_battery_charging_90 : R.drawable.ic_battery_90;
        } else if (mBatteryPercent >= 70) {
            resId = mIsCharging ? R.drawable.ic_battery_charging_80 : R.drawable.ic_battery_80;
        } else if (mBatteryPercent >= 55) {
            resId = mIsCharging ? R.drawable.ic_battery_charging_60 : R.drawable.ic_battery_60;
        } else if (mBatteryPercent >= 40) {
            resId = mIsCharging ? R.drawable.ic_battery_charging_50 : R.drawable.ic_battery_50;
        } else if (mBatteryPercent >= 25) {
            resId = mIsCharging ? R.drawable.ic_battery_charging_30 : R.drawable.ic_battery_30;
        } else if (mBatteryPercent >= 15) {
            resId = mIsCharging ? R.drawable.ic_battery_charging_20 : R.drawable.ic_battery_20;
        } else {
            resId = mIsCharging ? R.drawable.ic_battery_charging_20 : R.drawable.ic_battery_alert;
        }

        battery.setIcon(Icon.createWithResource(this, resId));
        battery.setLabel(String.valueOf(mBatteryPercent).concat("%"));
        battery.updateTile();
    }
 
开发者ID:zacharee,项目名称:SystemUITuner2,代码行数:37,代码来源:BatteryTileService.java

示例4: _isRunning

import android.service.quicksettings.Tile; //导入方法依赖的package包/类
private void _isRunning(Tile tile) {
    if (isCharging()) {
        tile.setState(Tile.STATE_ACTIVE);
        tile.setIcon(mIconEyeOpen);
        tile.setLabel(getString(R.string.tile_active_charging_text));
    } else {
        tile.setState(Tile.STATE_ACTIVE);
        tile.setIcon(mIconEyeOpen);
        long timeRemaining = MAX_TIME_SEC - mTimeRunning_sec;
        final String formatTime = formatTime(timeRemaining);
        tile.setLabel(getString(R.string.tile_active_text, formatTime));
    }
}
 
开发者ID:r3bl-alliance,项目名称:stay-awake-app,代码行数:14,代码来源:MyTileService.java

示例5: updateTileUI

import android.service.quicksettings.Tile; //导入方法依赖的package包/类
/**
 * Updates the QSTile icon and label
 * @param state - State of night light. True value means night light is on, and vice versa
 */
private void updateTileUI(boolean state) {
    Tile tile = this.getQsTile();

    if (tile == null) return;

    Icon newIcon;
    int newState;

    String title;

    // Change the tile to match the service status.
    if (state) {
        newIcon = Icon.createWithResource(getApplicationContext(), ic_lightbulb_outline);
        newState = Tile.STATE_ACTIVE;
        title = getString(R.string.on);
    } else {
        newIcon = Icon.createWithResource(getApplicationContext(), ic_lightbulb_outline_disabled);
        newState = Tile.STATE_INACTIVE;

        title = getString(R.string.off);
    }

    // Change the UI of the tile.
    tile.setLabel(title);
    tile.setIcon(newIcon);
    tile.setState(newState);

    // Need to call updateTile for the tile to pick up changes.
    tile.updateTile();
}
 
开发者ID:corphish,项目名称:NightLight,代码行数:35,代码来源:QuickSettingsService.java

示例6: toggleTile

import android.service.quicksettings.Tile; //导入方法依赖的package包/类
private void toggleTile(boolean enable) {
	Tile tile = getQsTile();

	if (enable) {
		tile.setLabel(getString(R.string.ui_enable));
		tile.setState(Tile.STATE_ACTIVE);
		tile.setIcon(Icon.createWithResource(this, R.drawable.qs_locked));
		tile.updateTile();
	} else {
		tile.setLabel(getString(R.string.ui_disable));
		tile.setState(Tile.STATE_INACTIVE);
		tile.setIcon(Icon.createWithResource(this, R.drawable.qs_unlocked));
		tile.updateTile();
	}
}
 
开发者ID:collaction,项目名称:content-farm-blocker-android,代码行数:16,代码来源:ToggleTileService.java

示例7: updateView

import android.service.quicksettings.Tile; //导入方法依赖的package包/类
private void updateView(boolean displayToast, boolean init) {
    Tile tile = getQsTile();
    if (BaseMethod.isAccessibilitySettingsOn(this)) {
        boolean KeyBlocked = PreferenceManager.getDefaultSharedPreferences(this).getBoolean(Config.ENABLED_KEYBLOCK, false);
        if (init) {
            if (KeyBlocked) {
                tile.setState(Tile.STATE_ACTIVE);
                tile.setIcon(Icon.createWithResource(this, R.drawable.ic_notification_blocked));
            } else {
                tile.setState(Tile.STATE_INACTIVE);
                tile.setIcon(Icon.createWithResource(this, R.drawable.ic_notification_not_blocked));
            }
        } else {
            if (tile.getState() == Tile.STATE_ACTIVE) {
                tile.setState(Tile.STATE_INACTIVE);
                tile.setIcon(Icon.createWithResource(this, R.drawable.ic_notification_not_blocked));
            } else if (tile.getState() == Tile.STATE_INACTIVE) {
                tile.setState(Tile.STATE_ACTIVE);
                tile.setIcon(Icon.createWithResource(this, R.drawable.ic_notification_blocked));
            }
        }
    } else {
        tile.setState(Tile.STATE_INACTIVE);
        tile.setIcon(Icon.createWithResource(this, R.drawable.ic_notification_not_blocked));
        if (displayToast) {
            BaseMethod.RunAccessibilityService(this);
        }
    }
    tile.updateTile();
}
 
开发者ID:XFY9326,项目名称:KeyBlocker,代码行数:31,代码来源:QuickSettingService.java

示例8: onTileAdded

import android.service.quicksettings.Tile; //导入方法依赖的package包/类
@Override
public void onTileAdded() {
    super.onTileAdded();
    Tile tile = getQsTile();
    if (tile != null) {
        tile.setIcon(Icon.createWithResource(this, StaticUtils.isStatusServiceRunning(this) ? R.drawable.ic_check_box_enabled : R.drawable.ic_check_box_disabled));
        tile.updateTile();
    }
}
 
开发者ID:TheAndroidMaster,项目名称:Status,代码行数:10,代码来源:QuickToggleService.java

示例9: onStartListening

import android.service.quicksettings.Tile; //导入方法依赖的package包/类
@Override
public void onStartListening() {
    super.onStartListening();
    Tile tile = getQsTile();
    if (tile != null) {
        tile.setIcon(Icon.createWithResource(this, StaticUtils.isStatusServiceRunning(this) ? R.drawable.ic_check_box_enabled : R.drawable.ic_check_box_disabled));
        tile.updateTile();
    }
}
 
开发者ID:TheAndroidMaster,项目名称:Status,代码行数:10,代码来源:QuickToggleService.java

示例10: updateTile

import android.service.quicksettings.Tile; //导入方法依赖的package包/类
private void updateTile() {
    Tile tile = this.getQsTile();

    boolean isActive = this.getServiceStatus();

    String newLabel;
    Icon newIcon;
    int newState;
    if (isActive) {
        newLabel = "MyQs is active.";
        newIcon = Icon.createWithResource(getApplicationContext(),
                android.R.drawable.ic_dialog_alert);
        newState = Tile.STATE_ACTIVE;

        //open result activity
        Intent intent = new Intent(getApplicationContext(), ResultActivity.class);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        startActivity(intent);
    } else {
        newLabel = "MyQs is inactive.";
        newIcon = Icon.createWithResource(getApplicationContext(),
                R.mipmap.ic_tile_inactive);
        newState = Tile.STATE_INACTIVE;
    }

    tile.setIcon(newIcon);
    tile.setLabel(newLabel);
    tile.setState(newState);

    tile.updateTile();
}
 
开发者ID:kevalpatel2106,项目名称:android-samples,代码行数:32,代码来源:QuickSettingsService.java

示例11: updateTile

import android.service.quicksettings.Tile; //导入方法依赖的package包/类
private void updateTile() {
    final boolean keepActivities = getKeepActivities(getContentResolver());
    final Tile tile = getQsTile();
    tile.setIcon(Icon.createWithResource(getApplicationContext(), getIcon(keepActivities)));
    tile.setLabel(getString(getLabel(keepActivities)));
    tile.updateTile();
}
 
开发者ID:Stocard,项目名称:KeepActivitiesTile,代码行数:8,代码来源:ToggleKeepActivities.java

示例12: updateInactiveTile

import android.service.quicksettings.Tile; //导入方法依赖的package包/类
private void updateInactiveTile(Tile tile) {
    Icon inActiveIcon = Icon
            .createWithResource(getApplicationContext(),
                    R.drawable.ic_qs_night_mode_off);

    tile.setIcon(inActiveIcon);
    tile.setState(Tile.STATE_INACTIVE);
    tile.updateTile();
}
 
开发者ID:fython,项目名称:Blackbulb,代码行数:10,代码来源:MaskTileService.java

示例13: updateActiveTile

import android.service.quicksettings.Tile; //导入方法依赖的package包/类
private void updateActiveTile(Tile tile) {
    Icon activeIcon = Icon
            .createWithResource(getApplicationContext(),
                    R.drawable.ic_qs_night_mode_on);

    tile.setIcon(activeIcon);
    tile.setState(Tile.STATE_ACTIVE);
    tile.updateTile();
}
 
开发者ID:fython,项目名称:Blackbulb,代码行数:10,代码来源:MaskTileService.java

示例14: updateTile

import android.service.quicksettings.Tile; //导入方法依赖的package包/类
private void updateTile() {
    final boolean isDebugModeEnabled = getDebugModeState(getContentResolver());
    Log.d(DebugModeToggle.class.getSimpleName(), "Checking USB Debugging state, it's enabled = " + isDebugModeEnabled);
    final Tile tile = getQsTile();
    tile.setIcon(Icon.createWithResource(getApplicationContext(), getIcon(isDebugModeEnabled)));
    tile.updateTile();
}
 
开发者ID:mSobhy90,项目名称:DebugModeTile,代码行数:8,代码来源:DebugModeToggle.java

示例15: updateTileWithPercentage

import android.service.quicksettings.Tile; //导入方法依赖的package包/类
private void updateTileWithPercentage()
{
    Tile tile = getQsTile();

    tile.setIcon(Icon.createWithBitmap(drawCircularProgressBarWhiteOnTransparent(trafficWastedPercentage)));
    tile.setLabel(
            String.format("%1s: %2s%%", getString(R.string.quick_settings_tile_label), trafficWastedPercentage));
    tile.setState(Tile.STATE_ACTIVE); // leads to a standard 'active', white Tile

    tile.updateTile();
}
 
开发者ID:martinhellwig,项目名称:DatapassWidget,代码行数:12,代码来源:DataPassTileService.java


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