Exemple #1
0
  private List<String> loadTileSpecs() {
    final Resources res = mContext.getResources();
    /// M: Customize the quick settings tile order for operator. @{
    String defaultTileList = res.getString(R.string.quick_settings_tiles_default);
    IQuickSettingsPlugin quickSettingsPlugin = PluginFactory.getQuickSettingsPlugin(mContext);
    defaultTileList = quickSettingsPlugin.customizeQuickSettingsTileOrder(defaultTileList);
    /// M: Customize the quick settings tile order for operator. @{

    String tileList =
        Secure.getStringForUser(
            mContext.getContentResolver(), TILES_SETTING, mUserTracker.getCurrentUserId());
    if (tileList == null) {
      tileList = res.getString(R.string.quick_settings_tiles);
      if (DEBUG) Log.d(TAG, "Loaded tile specs from config: " + tileList);
    } else {
      if (DEBUG) Log.d(TAG, "Loaded tile specs from setting: " + tileList);
    }
    final ArrayList<String> tiles = new ArrayList<String>();
    boolean addedDefault = false;
    for (String tile : tileList.split(",")) {
      tile = tile.trim();
      if (tile.isEmpty()) continue;
      if (tile.equals("default")) {
        if (!addedDefault) {
          tiles.addAll(Arrays.asList(defaultTileList.split(",")));
          addedDefault = true;
        }
      } else {
        tiles.add(tile);
      }
    }
    return tiles;
  }
Exemple #2
0
  private QSTile<?> createTile(String tileSpec) {
    IQuickSettingsPlugin quickSettingsPlugin = PluginFactory.getQuickSettingsPlugin(mContext);
    if (tileSpec.equals("wifi")) return new WifiTile(this);
    else if (tileSpec.equals("bt")) return new BluetoothTile(this);
    else if (tileSpec.equals("inversion")) return new ColorInversionTile(this);
    /** M: Customize to replace the cell to Data usage by some operators.@{ */
    else if (tileSpec.equals("cell")) {
      boolean displayDataUsage = quickSettingsPlugin.customizeDisplayDataUsage(false);
      Log.i(TAG, "createTile, cell displayDataUsage = " + displayDataUsage);
      if (displayDataUsage) {
        return new DataUsageTile(this);
      } else {
        return new CellularTile(this);
      }
    }
    /** M: Customize to replace the cell to Data usage by some operators.@} */
    else if (tileSpec.equals("airplane")) return new AirplaneModeTile(this);
    else if (tileSpec.equals("rotation")) return new RotationLockTile(this);
    else if (tileSpec.equals("flashlight")) return new FlashlightTile(this);
    else if (tileSpec.equals("location")) return new LocationTile(this);
    // M: Remove CastTile when WFD is not support in quicksetting
    else if (tileSpec.equals("cast") && SIMHelper.isWifiDisplaySupport()) return new CastTile(this);
    else if (tileSpec.equals("hotspot")) return new HotspotTile(this);

    /// M: add HotKnot in quicksetting @{
    else if (tileSpec.equals("hotknot") && SIMHelper.isMtkHotKnotSupport())
      return new HotKnotTile(this);
    /// add HotKnot in quicksetting @}
    /// M: add AudioProfile in quicksetting @{
    else if (tileSpec.equals("audioprofile") && SIMHelper.isMtkAudioProfilesSupport())
      return new AudioProfileTile(this);
    /// add AudioProfile in quicksetting @}
    /// M: add DataConnection in quicksetting @{
    else if (tileSpec.equals("dataconnection") && !SIMHelper.isWifiOnlyDevice())
      return new DataConnectionTile(this);
    /// M: add DataConnection in quicksetting @}
    /// M: Customize the quick settings tiles for operator. @{
    else if (quickSettingsPlugin.customizeAddQSTile(false)
        && tileSpec.equals("simdataconnection")
        && !SIMHelper.isWifiOnlyDevice()) {
      return new SimDataConnectionTile(this);
    } else if (quickSettingsPlugin.customizeAddQSTile(false)
        && tileSpec.equals("dulsimsettings")
        && !SIMHelper.isWifiOnlyDevice()) {
      return new DualSimSettingsTile(this);
    }
    /// @}
    else if (tileSpec.startsWith(IntentTile.PREFIX)) return IntentTile.create(this, tileSpec);
    else throw new IllegalArgumentException("Bad tile spec: " + tileSpec);
  }