android.service.quicksettings.Tile.updateTile()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中android.service.quicksettings.Tile.updateTile()方法的一些代码示例,展示了Tile.updateTile()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tile.updateTile()方法的具体详情如下:
包路径:android.service.quicksettings.Tile
类名称:Tile
方法名:updateTile

Tile.updateTile介绍

暂无

代码示例

代码示例来源:origin: robolectric/robolectric

@Test
 public void updateTile() throws Exception {
  // this test passes if updateTile() throws no Exception.
  tile.updateTile();
  shadowTile.updateTile();
 }
}

代码示例来源:origin: commonsguy/cw-omnibus

private void updateTile() {
 Tile tile=getQsTile();
 if (tile!=null) {
  boolean isEnabled=getPrefs().getBoolean(MonitorApp.PREF_ENABLED, false);
  int state=isEnabled ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE;
  tile.setIcon(Icon.createWithResource(this,
   R.drawable.ic_new_releases_24dp));
  tile.setLabel(getString(R.string.app_name));
  tile.setState(state);
  tile.updateTile();
 }
}

代码示例来源:origin: ukanth/afwall

public void cbFunc(RootCommand state) {
    Api.setEnabled(context, state.exitCode != 0, true);
    tile.setState(Tile.STATE_INACTIVE);// e() method form java, used in Kotlin as a property
    tile.setLabel(getString(R.string.inactive));
    tile.setIcon(Icon.createWithResource(context, R.drawable.notification_error));
    tile.updateTile();
  }
}));

代码示例来源:origin: ukanth/afwall

public void cbFunc(RootCommand state) {
    // setEnabled always sends us a STATUS_CHANGED_MSG intent to update the icon
    Api.setEnabled(context, state.exitCode == 0, true);
    tile.setState(Tile.STATE_ACTIVE);
    tile.setLabel(getString(R.string.active));
    tile.setIcon(Icon.createWithResource(context, R.drawable.notification));
    tile.updateTile();
  }
}));

代码示例来源:origin: iTXTech/Daedalus

private void updateTile() {
    boolean activate = DaedalusVpnService.isActivated();
    Tile tile = getQsTile();
    tile.setLabel(getString(R.string.quick_toggle));
    tile.setContentDescription(getString(R.string.app_name));
    tile.setState(activate ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
    tile.updateTile();
  }
}

代码示例来源:origin: iTXTech/Daedalus

@Override
public void onClick() {
  Tile tile = getQsTile();
  tile.setLabel(getString(R.string.quick_toggle));
  tile.setContentDescription(getString(R.string.app_name));
  tile.setState(Daedalus.switchService() ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
  tile.updateTile();
}

代码示例来源:origin: ukanth/afwall

@Override
public void onStartListening() {
  super.onStartListening();
  boolean status = Api.isEnabled(this);
  Tile tile = getQsTile(); // this is getQsTile() method form java, used in Kotlin as a property
  if (tile != null) {
    if (!status) {
      tile.setLabel(getString(R.string.inactive));
      tile.setIcon(Icon.createWithResource(this, R.drawable.notification_error));
      tile.setState(Tile.STATE_INACTIVE);
    } else {
      tile.setLabel(getString(R.string.active));
      tile.setIcon(Icon.createWithResource(this, R.drawable.notification));
      tile.setState(Tile.STATE_ACTIVE);
    }
    tile.updateTile();
  }
}

代码示例来源:origin: abrenoch/hyperion-android-grabber

@Override
  public void onReceive(Context context, Intent intent) {
    Tile tile = getQsTile();
    boolean running = intent.getBooleanExtra(HyperionScreenService.BROADCAST_TAG, false);
    String error = intent.getStringExtra(HyperionScreenService.BROADCAST_ERROR);
    tile.setState(running ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
    tile.updateTile();
    if (error != null) {
      Toast.makeText(getBaseContext(), error, Toast.LENGTH_LONG).show();
    }
  }
};

代码示例来源:origin: haruue/WADB

private void showStateUnavailable() {
  Tile tile = getQsTile();
  tile.setState(Tile.STATE_UNAVAILABLE);
  tile.updateTile();
}

代码示例来源:origin: by-syk/NetUpDown

private void updateTitle(String title) {
    if (title == null) {
      return;
    }
    Tile tile = getQsTile();
    if (tile != null) {
      tile.setLabel(title);
      tile.updateTile();
    }
  }
}

代码示例来源:origin: r3bl-org/stay-awake-app

private void updateTile() {
  Tile tile = getQsTile();
  boolean isRunning = (mExecutor != null && !mExecutor.isShutdown());
  if (tile != null) {
    if (isRunning) {
      _isRunning(tile);
    } else {
      _isNotRunning(tile);
    }
  }
  tile.updateTile();
}

代码示例来源:origin: AzimoLabs/Language-Switcher-Tile

public void enable() {
  getQsTile().setState(Tile.STATE_ACTIVE);
  if (prefs.getLastLanguage() != null) {
    getQsTile().setLabel(prefs.getLastLanguage().toUpperCase());
  } else {
    getQsTile().setLabel(Locale.getDefault().getLanguage().toUpperCase());
  }
  getQsTile().updateTile();
}

代码示例来源:origin: fython/Blackbulb

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();
}

代码示例来源:origin: fython/Blackbulb

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();
}

代码示例来源:origin: fennifith/Status

@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();
  }
}

代码示例来源:origin: fennifith/Status

@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();
  }
}

代码示例来源:origin: by-syk/NetUpDown

private void switchState(boolean isActive) {
  Tile tile = getQsTile();
  if (tile != null) {
    tile.setLabel(getString(R.string.tile_run));
    if (isActive) {
      tile.setState(Tile.STATE_ACTIVE);
    } else {
      tile.setState(Tile.STATE_INACTIVE);
    }
    tile.updateTile();
  }
}

代码示例来源:origin: Omico/CurrentActivity

@Override
public void onStartListening() {
  super.onStartListening();
  tile = getQsTile();
  icon = Icon.createWithResource(getApplicationContext(), R.mipmap.ic_launcher);
  if (ServiceUtils.isRunning(getApplicationContext(), FloatViewService.class.getName())) {
    setEnableTile();
  } else {
    setDisableTile();
  }
  tile.updateTile();
}

代码示例来源:origin: haruue/WADB

private void showStateOn(String ip, int port) {
  Tile tile = getQsTile();
  tile.setState(Tile.STATE_ACTIVE);
  tile.setIcon(Icon.createWithResource(getApplication(), R.drawable.ic_qs_network_adb_on));
  tile.setLabel(ip + ":" + port);
  tile.updateTile();
}

代码示例来源:origin: 109021017/android-TopActivity

private void updateTile() {
  if (WatchingAccessibilityService.getInstance() == null) {
    getQsTile().setState(Tile.STATE_INACTIVE);
  } else {
    getQsTile().setState(SPHelper.isShowWindow(this) ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
  }
  getQsTile().updateTile();
}

相关文章