Loading app/src/debug/res/xml/compose_shortcuts.xml 0 → 100644 +19 −0 Original line number Diff line number Diff line <shortcuts xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <shortcut android:enabled="true" android:icon="@drawable/ic_baseline_add_comment_24" android:shortcutId="compose" android:shortcutShortLabel="@string/compose_shortcut_short_label1" tools:targetApi="n_mr1"> <intent android:action="app.fedilab.android.shorcut.compose" android:targetClass="app.fedilab.android.activities.MainActivity" android:targetPackage="fr.gouv.etalab.mastodon.debug" /> <categories android:name="android.shortcut.conversation" /> <capability-binding android:key="actions.intent.CREATE_MESSAGE" /> </shortcut> </shortcuts> No newline at end of file app/src/fdroid/res/xml/compose_shortcuts.xml 0 → 100644 +19 −0 Original line number Diff line number Diff line <shortcuts xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <shortcut android:enabled="true" android:icon="@drawable/ic_baseline_add_comment_24" android:shortcutId="compose" android:shortcutShortLabel="@string/compose_shortcut_short_label1" tools:targetApi="n_mr1"> <intent android:action="app.fedilab.android.shorcut.compose" android:targetClass="app.fedilab.android.activities.MainActivity" android:targetPackage="fr.gouv.etalab.mastodon" /> <categories android:name="android.shortcut.conversation" /> <capability-binding android:key="actions.intent.CREATE_MESSAGE" /> </shortcut> </shortcuts> No newline at end of file app/src/main/AndroidManifest.xml +20 −0 Original line number Diff line number Diff line Loading @@ -80,9 +80,14 @@ android:roundIcon="@mipmap/ic_launcher_bubbles_round" android:targetActivity=".activities.MainActivity"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <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/compose_shortcuts" /> </activity-alias> <activity-alias Loading @@ -96,6 +101,9 @@ <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/compose_shortcuts" /> </activity-alias> <activity-alias Loading @@ -109,6 +117,9 @@ <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/compose_shortcuts" /> </activity-alias> <activity-alias Loading @@ -122,6 +133,9 @@ <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/compose_shortcuts" /> </activity-alias> <activity-alias Loading @@ -135,6 +149,9 @@ <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/compose_shortcuts" /> </activity-alias> <activity-alias Loading @@ -148,6 +165,9 @@ <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/compose_shortcuts" /> </activity-alias> Loading app/src/main/java/app/fedilab/android/BaseMainActivity.java +12 −0 Original line number Diff line number Diff line Loading @@ -850,6 +850,10 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt rateThisApp(); binding.compose.setOnClickListener(v -> startActivity(new Intent(this, ComposeActivity.class))); binding.compose.setOnLongClickListener(view -> { CrossActionHelper.doCrossAction(BaseMainActivity.this, CrossActionHelper.TypeOfCrossAction.COMPOSE, null, null); return false; }); headerMenuOpen = false; PushHelper.startStreaming(BaseMainActivity.this); Loading Loading @@ -1094,6 +1098,14 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt String type = intent.getType(); Bundle extras = intent.getExtras(); String userIdIntent, instanceIntent, urlOfMessage; if (action != null && action.equalsIgnoreCase("app.fedilab.android.shorcut.compose")) { CrossActionHelper.doCrossAction(BaseMainActivity.this, CrossActionHelper.TypeOfCrossAction.COMPOSE, null, null); intent.replaceExtras(new Bundle()); intent.setAction(""); intent.setData(null); intent.setFlags(0); return; } if (extras != null && extras.containsKey(Helper.INTENT_ACTION)) { userIdIntent = extras.getString(Helper.PREF_USER_ID); //Id of the account in the intent instanceIntent = extras.getString(Helper.PREF_USER_INSTANCE); Loading app/src/main/java/app/fedilab/android/mastodon/helper/CrossActionHelper.java +10 −2 Original line number Diff line number Diff line Loading @@ -135,7 +135,9 @@ public class CrossActionHelper { private static void fetchRemote(@NonNull Context context, @NonNull TypeOfCrossAction actionType, @NonNull BaseAccount ownerAccount, app.fedilab.android.mastodon.client.entities.api.Account targetedAccount, Status targetedStatus) { SearchVM searchVM = new ViewModelProvider((ViewModelStoreOwner) context).get("crossactions", SearchVM.class); if (targetedAccount != null) { if (actionType == TypeOfCrossAction.COMPOSE) { applyAction(context, actionType, ownerAccount, null, null); } else if (targetedAccount != null) { String search; if (targetedAccount.acct.contains("@")) { //Not from same instance search = targetedAccount.acct; Loading Loading @@ -247,6 +249,11 @@ public class CrossActionHelper { intent.putExtra(Helper.ARG_ACCOUNT, ownerAccount); context.startActivity(intent); break; case COMPOSE: Intent intentCompose = new Intent(context, ComposeActivity.class); intentCompose.putExtra(Helper.ARG_ACCOUNT, ownerAccount); context.startActivity(intentCompose); break; } } Loading Loading @@ -530,7 +537,8 @@ public class CrossActionHelper { UNBOOKMARK_ACTION, REBLOG_ACTION, UNREBLOG_ACTION, REPLY_ACTION REPLY_ACTION, COMPOSE } Loading Loading
app/src/debug/res/xml/compose_shortcuts.xml 0 → 100644 +19 −0 Original line number Diff line number Diff line <shortcuts xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <shortcut android:enabled="true" android:icon="@drawable/ic_baseline_add_comment_24" android:shortcutId="compose" android:shortcutShortLabel="@string/compose_shortcut_short_label1" tools:targetApi="n_mr1"> <intent android:action="app.fedilab.android.shorcut.compose" android:targetClass="app.fedilab.android.activities.MainActivity" android:targetPackage="fr.gouv.etalab.mastodon.debug" /> <categories android:name="android.shortcut.conversation" /> <capability-binding android:key="actions.intent.CREATE_MESSAGE" /> </shortcut> </shortcuts> No newline at end of file
app/src/fdroid/res/xml/compose_shortcuts.xml 0 → 100644 +19 −0 Original line number Diff line number Diff line <shortcuts xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"> <shortcut android:enabled="true" android:icon="@drawable/ic_baseline_add_comment_24" android:shortcutId="compose" android:shortcutShortLabel="@string/compose_shortcut_short_label1" tools:targetApi="n_mr1"> <intent android:action="app.fedilab.android.shorcut.compose" android:targetClass="app.fedilab.android.activities.MainActivity" android:targetPackage="fr.gouv.etalab.mastodon" /> <categories android:name="android.shortcut.conversation" /> <capability-binding android:key="actions.intent.CREATE_MESSAGE" /> </shortcut> </shortcuts> No newline at end of file
app/src/main/AndroidManifest.xml +20 −0 Original line number Diff line number Diff line Loading @@ -80,9 +80,14 @@ android:roundIcon="@mipmap/ic_launcher_bubbles_round" android:targetActivity=".activities.MainActivity"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <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/compose_shortcuts" /> </activity-alias> <activity-alias Loading @@ -96,6 +101,9 @@ <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/compose_shortcuts" /> </activity-alias> <activity-alias Loading @@ -109,6 +117,9 @@ <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/compose_shortcuts" /> </activity-alias> <activity-alias Loading @@ -122,6 +133,9 @@ <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/compose_shortcuts" /> </activity-alias> <activity-alias Loading @@ -135,6 +149,9 @@ <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/compose_shortcuts" /> </activity-alias> <activity-alias Loading @@ -148,6 +165,9 @@ <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/compose_shortcuts" /> </activity-alias> Loading
app/src/main/java/app/fedilab/android/BaseMainActivity.java +12 −0 Original line number Diff line number Diff line Loading @@ -850,6 +850,10 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt rateThisApp(); binding.compose.setOnClickListener(v -> startActivity(new Intent(this, ComposeActivity.class))); binding.compose.setOnLongClickListener(view -> { CrossActionHelper.doCrossAction(BaseMainActivity.this, CrossActionHelper.TypeOfCrossAction.COMPOSE, null, null); return false; }); headerMenuOpen = false; PushHelper.startStreaming(BaseMainActivity.this); Loading Loading @@ -1094,6 +1098,14 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt String type = intent.getType(); Bundle extras = intent.getExtras(); String userIdIntent, instanceIntent, urlOfMessage; if (action != null && action.equalsIgnoreCase("app.fedilab.android.shorcut.compose")) { CrossActionHelper.doCrossAction(BaseMainActivity.this, CrossActionHelper.TypeOfCrossAction.COMPOSE, null, null); intent.replaceExtras(new Bundle()); intent.setAction(""); intent.setData(null); intent.setFlags(0); return; } if (extras != null && extras.containsKey(Helper.INTENT_ACTION)) { userIdIntent = extras.getString(Helper.PREF_USER_ID); //Id of the account in the intent instanceIntent = extras.getString(Helper.PREF_USER_INSTANCE); Loading
app/src/main/java/app/fedilab/android/mastodon/helper/CrossActionHelper.java +10 −2 Original line number Diff line number Diff line Loading @@ -135,7 +135,9 @@ public class CrossActionHelper { private static void fetchRemote(@NonNull Context context, @NonNull TypeOfCrossAction actionType, @NonNull BaseAccount ownerAccount, app.fedilab.android.mastodon.client.entities.api.Account targetedAccount, Status targetedStatus) { SearchVM searchVM = new ViewModelProvider((ViewModelStoreOwner) context).get("crossactions", SearchVM.class); if (targetedAccount != null) { if (actionType == TypeOfCrossAction.COMPOSE) { applyAction(context, actionType, ownerAccount, null, null); } else if (targetedAccount != null) { String search; if (targetedAccount.acct.contains("@")) { //Not from same instance search = targetedAccount.acct; Loading Loading @@ -247,6 +249,11 @@ public class CrossActionHelper { intent.putExtra(Helper.ARG_ACCOUNT, ownerAccount); context.startActivity(intent); break; case COMPOSE: Intent intentCompose = new Intent(context, ComposeActivity.class); intentCompose.putExtra(Helper.ARG_ACCOUNT, ownerAccount); context.startActivity(intentCompose); break; } } Loading Loading @@ -530,7 +537,8 @@ public class CrossActionHelper { UNBOOKMARK_ACTION, REBLOG_ACTION, UNREBLOG_ACTION, REPLY_ACTION REPLY_ACTION, COMPOSE } Loading