QuickTileService: show app if no profiles exist

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2017-11-27 00:43:34 +01:00 committed by Samuel Holland
parent e421b997cd
commit d43c87a869
3 changed files with 8 additions and 4 deletions

View File

@ -17,6 +17,7 @@
android:name=".AddActivity" android:name=".AddActivity"
android:label="@string/add_activity_title" android:label="@string/add_activity_title"
android:parentActivityName=".ConfigActivity" /> android:parentActivityName=".ConfigActivity" />
<activity android:name=".ConfigActivity"> <activity android:name=".ConfigActivity">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
@ -24,9 +25,11 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
android:name=".SettingsActivity" android:name=".SettingsActivity"
android:label="@string/settings"> android:label="@string/settings"
android:parentActivityName=".ConfigActivity">
<intent-filter> <intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" /> <action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES" />
</intent-filter> </intent-filter>

View File

@ -29,6 +29,8 @@ public class QuickTileService extends TileService {
service.disable(config.getName()); service.disable(config.getName());
else else
service.enable(config.getName()); service.enable(config.getName());
} else {
startActivityAndCollapse(new Intent(this, ConfigActivity.class));
} }
} }
@ -60,8 +62,8 @@ public class QuickTileService extends TileService {
} }
} else { } else {
tile.setIcon(Icon.createWithResource(this, R.drawable.ic_tile_disabled)); tile.setIcon(Icon.createWithResource(this, R.drawable.ic_tile_disabled));
tile.setLabel(getString(R.string.loading)); tile.setLabel(getString(R.string.app_name));
tile.setState(Tile.STATE_UNAVAILABLE); tile.setState(Tile.STATE_INACTIVE);
} }
tile.updateTile(); tile.updateTile();
} }

View File

@ -23,7 +23,6 @@
<string name="hint_random">(random)</string> <string name="hint_random">(random)</string>
<string name="iface">Interface</string> <string name="iface">Interface</string>
<string name="listen_port">Listen port</string> <string name="listen_port">Listen port</string>
<string name="loading">Loading</string>
<string name="mtu">MTU</string> <string name="mtu">MTU</string>
<string name="name">Name</string> <string name="name">Name</string>
<string name="peer">Peer</string> <string name="peer">Peer</string>