Example usage for android.service.quicksettings Tile setState

List of usage examples for android.service.quicksettings Tile setState

Introduction

In this page you can find the example usage for android.service.quicksettings Tile setState.

Prototype

public void setState(int state) 

Source Link

Document

Sets the current state for the tile.

Usage

From source file:net.hyx.app.volumenotification.factory.NotificationFactory.java

@TargetApi(Build.VERSION_CODES.N)
public void updateTile(Tile tile, int id) {
    VolumeControl item = model.parseItem(model.getItemById(id));
    if (item != null && tile != null) {
        tile.setIcon(Icon.createWithResource(context, model.getIconDrawable(item.icon)));
        tile.setLabel(item.label);// w  w  w. ja  va2 s . c o m
        tile.setState(Tile.STATE_ACTIVE);
        tile.updateTile();
    }
}

From source file:net.hyx.app.volumenotification.NotificationFactory.java

@TargetApi(Build.VERSION_CODES.N)
void updateTile(Tile tile, int position) {
    //tile.setIcon(Icon.createWithResource(context, settings.getDrawable(context, R.array.pref_buttons_icons_entries, settings.getButtonIcon(position))));
    //tile.setLabel(settings.getButtonLabel(position));
    if (settings.getButtonChecked(position)) {
        tile.setState(Tile.STATE_ACTIVE);
    } else {//from w  w w.  j  a v  a2s  .com
        tile.setState(Tile.STATE_INACTIVE);
    }
    tile.updateTile();
}