Implement static shortcuts
Этот коммит содержится в:
@@ -18,20 +18,29 @@
|
||||
android:theme="@style/AppTheme"
|
||||
android:name=".MainApplication">
|
||||
|
||||
<activity android:name=".MainActivity" android:launchMode="singleTask" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:launchMode="singleTask" />
|
||||
|
||||
<activity-alias android:name=".Launcher" android:targetActivity=".MainActivity">
|
||||
<activity-alias
|
||||
android:name=".Launcher"
|
||||
android:targetActivity=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="android.app.shortcuts"
|
||||
android:resource="@xml/shortcuts" />
|
||||
</activity-alias>
|
||||
|
||||
<activity android:name=".StatusActivity"/>
|
||||
|
||||
<activity android:name=".AboutActivity"/>
|
||||
|
||||
<activity android:name=".ShortcutActivity">
|
||||
<activity
|
||||
android:name=".ShortcutActivity"
|
||||
android:label="@string/menu_shortcuts">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<action android:name="android.intent.action.CREATE_SHORTCUT" />
|
||||
|
||||
@@ -87,7 +87,7 @@ public class ShortcutActivity extends AppCompatActivity {
|
||||
}
|
||||
|
||||
private void setShortcutResult(String label, @DrawableRes int iconResId, String action) {
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN, null, this, ShortcutActivity.class);
|
||||
Intent intent = new Intent(Intent.ACTION_DEFAULT, null, this, ShortcutActivity.class);
|
||||
intent.putExtra(EXTRA_ACTION, action);
|
||||
|
||||
ShortcutInfoCompat shortcut = new ShortcutInfoCompat.Builder(this, action)
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
<resources>
|
||||
<string name="app_name">Traccar Client</string>
|
||||
<string name="app_logo">Traccar</string>
|
||||
<string name="shortcut_start">Traccar - Start</string>
|
||||
<string name="shortcut_stop">Traccar - Stop</string>
|
||||
<string name="shortcut_sos">Traccar - SOS</string>
|
||||
<string name="shortcut_start">Start service</string>
|
||||
<string name="shortcut_stop">Stop service</string>
|
||||
<string name="shortcut_sos">Send SOS</string>
|
||||
<string name="channel_default">Primary Channel</string>
|
||||
<string name="settings_id_title">Device identifier</string>
|
||||
<string name="settings_url_title">Server URL</string>
|
||||
@@ -35,8 +35,8 @@
|
||||
<string name="about_description">Real time GPS tracker for Android devices. Compatible with Traccar Server and other tracking systems.</string>
|
||||
<string name="about_license">This application is free and open source, source code is licensed under Apache License Version 2.0 and available on GitHub.</string>
|
||||
<string name="about_web">For more information visit\nwww.traccar.org/client</string>
|
||||
<string name="status_service_create">Service created</string>
|
||||
<string name="status_service_destroy">Service destroyed</string>
|
||||
<string name="status_service_create">Service started</string>
|
||||
<string name="status_service_destroy">Service stopped</string>
|
||||
<string name="status_send_success">Send successfully</string>
|
||||
<string name="status_send_fail">Send failed</string>
|
||||
<string name="status_location_update">Location update</string>
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shortcuts
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:targetApi="n_mr1">
|
||||
|
||||
<shortcut
|
||||
android:shortcutId="start"
|
||||
android:enabled="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:shortcutShortLabel="@string/shortcut_start">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:targetPackage="org.traccar.client"
|
||||
android:targetClass="org.traccar.client.ShortcutActivity">
|
||||
<extra
|
||||
android:name="action"
|
||||
android:value="start" />
|
||||
</intent>
|
||||
</shortcut>
|
||||
|
||||
<shortcut
|
||||
android:shortcutId="stop"
|
||||
android:enabled="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:shortcutShortLabel="@string/shortcut_stop">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:targetPackage="org.traccar.client"
|
||||
android:targetClass="org.traccar.client.ShortcutActivity">
|
||||
<extra
|
||||
android:name="action"
|
||||
android:value="stop" />
|
||||
</intent>
|
||||
</shortcut>
|
||||
|
||||
<shortcut
|
||||
android:shortcutId="sos"
|
||||
android:enabled="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:shortcutShortLabel="@string/shortcut_sos">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:targetPackage="org.traccar.client"
|
||||
android:targetClass="org.traccar.client.ShortcutActivity">
|
||||
<extra
|
||||
android:name="action"
|
||||
android:value="sos" />
|
||||
</intent>
|
||||
</shortcut>
|
||||
|
||||
</shortcuts>
|
||||
Ссылка в новой задаче
Block a user