Added refresh shortcut

pull/160/head
M66B 6 years ago
parent 1e4e7f79d3
commit 06e78b3a00

@ -64,15 +64,19 @@
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:theme="@style/Theme.AppCompat.Translucent"> android:theme="@style/Theme.AppCompat.Translucent">
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts" />
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
<meta-data <intent-filter>
android:name="android.app.shortcuts" <action android:name="${applicationId}.REFRESH" />
android:resource="@xml/shortcuts" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity> </activity>
<activity <activity
@ -80,6 +84,7 @@
android:exported="true" android:exported="true"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:parentActivityName=".ActivityMain"> android:parentActivityName=".ActivityMain">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.APPLICATION_PREFERENCES" /> <action android:name="android.intent.action.APPLICATION_PREFERENCES" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
@ -89,6 +94,7 @@
<activity <activity
android:name=".ActivityWidgetUnified" android:name=".ActivityWidgetUnified"
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" /> <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter> </intent-filter>
@ -127,22 +133,23 @@
<action android:name="android.intent.action.SEND" /> <action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" /> <action android:name="android.intent.action.SEND_MULTIPLE" />
<data android:mimeType="*/*" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SENDTO" /> <action android:name="android.intent.action.SENDTO" />
<data android:scheme="mailto" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:scheme="mailto" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<data android:scheme="mailto" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="mailto" />
</intent-filter> </intent-filter>
</activity> </activity>
@ -213,6 +220,7 @@
<service <service
android:name=".ServiceExternal" android:name=".ServiceExternal"
android:foregroundServiceType="dataSync"> android:foregroundServiceType="dataSync">
<intent-filter> <intent-filter>
<action android:name="${applicationId}.ENABLE" /> <action android:name="${applicationId}.ENABLE" />
<action android:name="${applicationId}.DISABLE" /> <action android:name="${applicationId}.DISABLE" />
@ -224,6 +232,7 @@
android:icon="@drawable/baseline_sync_disabled_24" android:icon="@drawable/baseline_sync_disabled_24"
android:label="@string/app_name" android:label="@string/app_name"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"> android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter> <intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" /> <action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter> </intent-filter>
@ -234,6 +243,7 @@
android:icon="@drawable/baseline_mail_outline_24" android:icon="@drawable/baseline_mail_outline_24"
android:label="@string/tile_unseen" android:label="@string/tile_unseen"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"> android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter> <intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" /> <action android:name="android.service.quicksettings.action.QS_TILE" />
</intent-filter> </intent-filter>
@ -254,26 +264,26 @@
android:name=".Widget" android:name=".Widget"
android:label="@string/tile_unseen"> android:label="@string/tile_unseen">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data <meta-data
android:name="android.appwidget.provider" android:name="android.appwidget.provider"
android:resource="@xml/widget" /> android:resource="@xml/widget" />
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
</receiver> </receiver>
<receiver <receiver
android:name=".WidgetUnified" android:name=".WidgetUnified"
android:label="@string/title_folder_unified"> android:label="@string/title_folder_unified">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data <meta-data
android:name="android.appwidget.provider" android:name="android.appwidget.provider"
android:resource="@xml/widget_unified" /> android:resource="@xml/widget_unified" />
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
</receiver> </receiver>
<service <service
@ -281,6 +291,7 @@
android:permission="android.permission.BIND_REMOTEVIEWS" /> android:permission="android.permission.BIND_REMOTEVIEWS" />
<receiver android:name=".ReceiverAutoStart"> <receiver android:name=".ReceiverAutoStart">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter> </intent-filter>

@ -34,6 +34,8 @@ import androidx.preference.PreferenceManager;
import java.util.List; import java.util.List;
public class ActivityMain extends ActivityBase implements FragmentManager.OnBackStackChangedListener, SharedPreferences.OnSharedPreferenceChangeListener { public class ActivityMain extends ActivityBase implements FragmentManager.OnBackStackChangedListener, SharedPreferences.OnSharedPreferenceChangeListener {
private static final String ACTION_REFRESH = BuildConfig.APPLICATION_ID + ".REFRESH";
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
getSupportFragmentManager().addOnBackStackChangedListener(this); getSupportFragmentManager().addOnBackStackChangedListener(this);
@ -83,7 +85,10 @@ public class ActivityMain extends ActivityBase implements FragmentManager.OnBack
protected void onExecuted(Bundle args, Boolean hasAccounts) { protected void onExecuted(Bundle args, Boolean hasAccounts) {
if (hasAccounts) { if (hasAccounts) {
startActivity(new Intent(ActivityMain.this, ActivityView.class)); startActivity(new Intent(ActivityMain.this, ActivityView.class));
ServiceSynchronize.watchdog(ActivityMain.this); if (ACTION_REFRESH.equals(getIntent().getAction()))
ServiceSynchronize.process(ActivityMain.this, true);
else
ServiceSynchronize.watchdog(ActivityMain.this);
ServiceSend.watchdog(ActivityMain.this); ServiceSend.watchdog(ActivityMain.this);
} else } else
startActivity(new Intent(ActivityMain.this, ActivitySetup.class)); startActivity(new Intent(ActivityMain.this, ActivitySetup.class));

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

@ -21,6 +21,7 @@
<string name="tile_synchronize">Synchronize</string> <string name="tile_synchronize">Synchronize</string>
<string name="tile_unseen">New messages</string> <string name="tile_unseen">New messages</string>
<string name="shortcut_refresh">Refresh</string>
<string name="shortcut_compose">Compose</string> <string name="shortcut_compose">Compose</string>
<string name="shortcut_setup">Settings</string> <string name="shortcut_setup">Settings</string>

@ -1,4 +1,16 @@
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android"> <shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@drawable/ic_shortcut_refresh"
android:shortcutId="refresh"
android:shortcutShortLabel="@string/shortcut_refresh">
<intent
android:action="eu.faircode.email.REFRESH"
android:targetClass="eu.faircode.email.ActivityMain"
android:targetPackage="eu.faircode.email" />
<categories android:name="android.shortcut.conversation" />
</shortcut>
<shortcut <shortcut
android:enabled="true" android:enabled="true"
android:icon="@drawable/ic_shortcut_edit" android:icon="@drawable/ic_shortcut_edit"
@ -12,7 +24,7 @@
</shortcut> </shortcut>
<shortcut <shortcut
android:enabled="true" android:enabled="false"
android:icon="@drawable/ic_shortcut_settings" android:icon="@drawable/ic_shortcut_settings"
android:shortcutId="setup" android:shortcutId="setup"
android:shortcutShortLabel="@string/shortcut_setup"> android:shortcutShortLabel="@string/shortcut_setup">

Loading…
Cancel
Save