Skip to content

Commit

Permalink
vince: test dirac: add qs tile
Browse files Browse the repository at this point in the history
  • Loading branch information
waiser86 committed Apr 4, 2019
1 parent 7a396ab commit 281ab8b
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 1 deletion.
10 changes: 9 additions & 1 deletion parts/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

<service
android:name=".dirac.DiracTileService"
android:icon="@drawable/dirac_qs_tile_icon"
android:label="@string/dirac_qs_tile_title"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter>
</service>
</application>
</manifest>
9 changes: 9 additions & 0 deletions parts/res/drawable/dirac_qs_tile_icon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M12,3l0.01,10.55c-0.59,-0.34 -1.27,-0.55 -2,-0.55C7.79,13 6,14.79 6,17s1.79,4 4.01,4S14,19.21 14,17L14,7h4L18,3h-6zM10.01,19c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2z"/>
</vector>
2 changes: 2 additions & 0 deletions parts/res/values-ru-rRU/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@
<string name="dirac_preset_country">Кантри</string>
<string name="dirac_preset_dance">Танцевальная</string>
<string name="dirac_preset_metal">Металл</string>
<!-- QS tile title -->
<string name="dirac_qs_tile_title">Mi звук</string>
</resources>
2 changes: 2 additions & 0 deletions parts/res/values-uk-rUA/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@
<string name="dirac_preset_country">Кантрі</string>
<string name="dirac_preset_dance">Танцювальна</string>
<string name="dirac_preset_metal">Метал</string>
<!-- QS tile title -->
<string name="dirac_qs_tile_title">Mi звук</string>
</resources>
2 changes: 2 additions & 0 deletions parts/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,6 @@
<string name="dirac_preset_country">Country</string>
<string name="dirac_preset_dance">Dance</string>
<string name="dirac_preset_metal">Metal</string>
<!-- QS tile title -->
<string name="dirac_qs_tile_title">Mi sound</string>
</resources>
42 changes: 42 additions & 0 deletions parts/src/org/lineageos/settings/dirac/DiracTileService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.lineageos.settings.dirac;

import android.service.quicksettings.Tile;
import android.service.quicksettings.TileService;

public class DiracTileService extends TileService {

private DiracUtils mDiracUtils;

@Override
public void onStartListening() {

mDiracUtils = new DiracUtils(getApplicationContext());

boolean enhancerEnabled = mDiracUtils.isDiracEnabled();

Tile tile = getQsTile();
if (enhancerEnabled) {
tile.setState(Tile.STATE_ACTIVE);
} else {
tile.setState(Tile.STATE_INACTIVE);
}

tile.updateTile();

super.onStartListening();
}

@Override
public void onClick() {
Tile tile = getQsTile();
if (mDiracUtils.isDiracEnabled()) {
mDiracUtils.setEnabled(false);
tile.setState(Tile.STATE_INACTIVE);
} else {
mDiracUtils.setEnabled(true);
tile.setState(Tile.STATE_ACTIVE);
}
tile.updateTile();
super.onClick();
}
}

0 comments on commit 281ab8b

Please sign in to comment.