mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-15 06:22:49 +00:00
Add quick setting tiles
This commit is contained in:
parent
1f69bf558e
commit
6a1e6db486
5 changed files with 108 additions and 0 deletions
|
@ -94,6 +94,32 @@
|
|||
|
||||
<service android:name=".services.NotificationService" />
|
||||
|
||||
<service
|
||||
android:name=".services.LaunchAppTileService"
|
||||
android:label="@string/tile_open_vault"
|
||||
android:icon="@drawable/ic_aegis_quicksettings"
|
||||
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.service.quicksettings.action.QS_TILE" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.service.quicksettings.ACTIVE_TILE"
|
||||
android:value="true" />
|
||||
</service>
|
||||
|
||||
<service
|
||||
android:name=".services.LaunchScannerTileService"
|
||||
android:label="@string/tile_open_scanner"
|
||||
android:icon="@drawable/ic_aegis_quicksettings"
|
||||
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.service.quicksettings.action.QS_TILE" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.service.quicksettings.ACTIVE_TILE"
|
||||
android:value="true" />
|
||||
</service>
|
||||
|
||||
<receiver android:name=".receivers.VaultLockReceiver" android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="${applicationId}.LOCK_VAULT" />
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package com.beemdevelopment.aegis.services;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.service.quicksettings.Tile;
|
||||
import android.service.quicksettings.TileService;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.beemdevelopment.aegis.ui.MainActivity;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
public class LaunchAppTileService extends TileService {
|
||||
|
||||
@Override
|
||||
public void onStartListening() {
|
||||
super.onStartListening();
|
||||
Tile tile = getQsTile();
|
||||
tile.setState(Tile.STATE_INACTIVE);
|
||||
tile.updateTile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick() {
|
||||
super.onClick();
|
||||
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
intent.setAction(Intent.ACTION_MAIN);
|
||||
|
||||
startActivityAndCollapse(intent);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.beemdevelopment.aegis.services;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.service.quicksettings.Tile;
|
||||
import android.service.quicksettings.TileService;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.beemdevelopment.aegis.ui.MainActivity;
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
public class LaunchScannerTileService extends TileService {
|
||||
|
||||
@Override
|
||||
public void onStartListening() {
|
||||
super.onStartListening();
|
||||
Tile tile = getQsTile();
|
||||
tile.setState(Tile.STATE_INACTIVE);
|
||||
tile.updateTile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick() {
|
||||
super.onClick();
|
||||
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
intent.putExtra("action", "scan");
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
intent.setAction(Intent.ACTION_MAIN);
|
||||
|
||||
startActivityAndCollapse(intent);
|
||||
}
|
||||
}
|
12
app/src/main/res/drawable/ic_aegis_quicksettings.xml
Normal file
12
app/src/main/res/drawable/ic_aegis_quicksettings.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="36.967148dp"
|
||||
android:height="32.84542dp"
|
||||
android:viewportWidth="36.967148"
|
||||
android:viewportHeight="32.84542">
|
||||
<path
|
||||
android:pathData="m18.4319,9.1137c0.7652,0 1.5304,0.3807 1.9632,1.1419l12.1955,21.4475c0.4015,0.7063 1.1511,1.1423 1.9636,1.1423h0.151c1.7335,0 2.8208,-1.8722 1.9618,-3.3779L20.5038,1.1391c-0.4329,-0.7592 -1.1973,-1.1391 -1.9614,-1.1391 -0.762,0 -1.524,0.3775 -1.9583,1.1331l-16.2803,28.3284c-0.8654,1.5057 0.2215,3.3839 1.9579,3.3839 0.8107,0 1.5593,-0.4346 1.9614,-1.1388l12.2474,-21.4542c0.4336,-0.7592 1.1973,-1.1388 1.9614,-1.1388m-0.3658,8.877c-0.7733,0 -1.5462,0.3838 -1.9847,1.1522 -0.4004,0.701 -0.4008,1.561 -0.0021,2.2624l5.848,10.2845c0.406,0.7144 1.1642,1.1557 1.9861,1.1557h0.0243c1.7544,0 2.8543,-1.8948 1.9844,-3.4184l-5.8716,-10.2842c-0.4385,-0.768 -1.2114,-1.1522 -1.9844,-1.1522m-5.3714,9.4072c-0.7733,0 -1.5462,0.3838 -1.9847,1.1518l-0.0113,0.0205c-0.4004,0.701 -0.4011,1.5611 -0.0021,2.2627l0.4875,0.8569c0.406,0.7144 1.1645,1.1557 1.9861,1.1557h0.0254c1.754,0 2.854,-1.8948 1.9844,-3.4181l-0.5006,-0.8773c-0.4385,-0.7684 -1.2118,-1.1522 -1.9847,-1.1522"
|
||||
android:strokeWidth="0.0352778"
|
||||
android:fillColor="#ffffff"
|
||||
android:strokeColor="#ffffff"
|
||||
android:fillType="nonZero"/>
|
||||
</vector>
|
|
@ -324,6 +324,9 @@
|
|||
<string name="unable_to_generate_qrcode">Unable to generate QR code</string>
|
||||
<string name="select_picture">Select picture</string>
|
||||
<string name="select_icon">Select icon</string>
|
||||
<string name="tile_open_vault">Open vault</string>
|
||||
<string name="tile_open_scanner">Open scanner</string>
|
||||
|
||||
<string name="toggle_checkboxes">Toggle checkboxes</string>
|
||||
<string name="search">Search</string>
|
||||
<string name="channel_name_lock_status">Lock status</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue