Fixes and improvements
This commit is contained in:
parent
b52ab37aed
commit
654f7850de
|
@ -0,0 +1,19 @@
|
|||
<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>
|
|
@ -0,0 +1,19 @@
|
|||
<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>
|
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -530,7 +537,8 @@ public class CrossActionHelper {
|
|||
UNBOOKMARK_ACTION,
|
||||
REBLOG_ACTION,
|
||||
UNREBLOG_ACTION,
|
||||
REPLY_ACTION
|
||||
REPLY_ACTION,
|
||||
COMPOSE
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -306,11 +306,20 @@ public class NotificationsWorker extends Worker {
|
|||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
Intent myIntent = new Intent(getApplicationContext(), PeertubeMainActivity.class);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(
|
||||
getApplicationContext(),
|
||||
0,
|
||||
myIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
PendingIntent pendingIntent;
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
|
||||
pendingIntent = PendingIntent.getActivity(
|
||||
getApplicationContext(),
|
||||
0,
|
||||
myIntent,
|
||||
PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
} else {
|
||||
pendingIntent = PendingIntent.getActivity(
|
||||
getApplicationContext(),
|
||||
0,
|
||||
myIntent,
|
||||
PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
}
|
||||
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(getApplicationContext(), FETCH_NOTIFICATION_CHANNEL_ID)
|
||||
.setContentTitle(title)
|
||||
.setTicker(title)
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="?attr/colorControlNormal"
|
||||
android:pathData="M21.99,4c0,-1.1 -0.89,-2 -1.99,-2H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h14l4,4 -0.01,-18zM17,11h-4v4h-2v-4H7V9h4V5h2v4h4v2z" />
|
||||
</vector>
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="compose_shortcut_short_label1">Compose</string>
|
||||
</resources>
|
|
@ -0,0 +1,19 @@
|
|||
<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="app.fedilab.android" />
|
||||
|
||||
<categories android:name="android.shortcut.conversation" />
|
||||
<capability-binding android:key="actions.intent.CREATE_MESSAGE" />
|
||||
</shortcut>
|
||||
|
||||
|
||||
</shortcuts>
|
|
@ -1,5 +1,7 @@
|
|||
Changed:
|
||||
- Peertube support
|
||||
- Compose shortcut
|
||||
- Long press compose button to write with another account
|
||||
|
||||
Changed:
|
||||
- Cross actions with two accounts display a dialog
|
||||
|
|
Loading…
Reference in New Issue