Add the ability to timed-mute from profiles

This commit is contained in:
Thomas 2022-11-20 15:55:30 +01:00
parent 3f8f15256d
commit fa760ba959
3 changed files with 16 additions and 0 deletions

View File

@ -646,6 +646,7 @@ public class ProfileActivity extends BaseActivity {
menu.findItem(R.id.action_block).setVisible(false); menu.findItem(R.id.action_block).setVisible(false);
menu.findItem(R.id.action_report).setVisible(false); menu.findItem(R.id.action_report).setVisible(false);
menu.findItem(R.id.action_mute).setVisible(false); menu.findItem(R.id.action_mute).setVisible(false);
menu.findItem(R.id.action_timed_mute).setVisible(false);
menu.findItem(R.id.action_mention).setVisible(false); menu.findItem(R.id.action_mention).setVisible(false);
menu.findItem(R.id.action_follow_instance).setVisible(false); menu.findItem(R.id.action_follow_instance).setVisible(false);
menu.findItem(R.id.action_block_instance).setVisible(false); menu.findItem(R.id.action_block_instance).setVisible(false);
@ -656,6 +657,7 @@ public class ProfileActivity extends BaseActivity {
} else { } else {
menu.findItem(R.id.action_block).setVisible(true); menu.findItem(R.id.action_block).setVisible(true);
menu.findItem(R.id.action_mute).setVisible(true); menu.findItem(R.id.action_mute).setVisible(true);
menu.findItem(R.id.action_timed_mute).setVisible(true);
menu.findItem(R.id.action_mention).setVisible(true); menu.findItem(R.id.action_mention).setVisible(true);
} }
//Update menu title depending of relationship //Update menu title depending of relationship
@ -933,6 +935,12 @@ public class ProfileActivity extends BaseActivity {
doActionAccount = action.NOTHING; doActionAccount = action.NOTHING;
} }
} else if (itemId == R.id.action_timed_mute) {
MastodonHelper.scheduleBoost(ProfileActivity.this, MastodonHelper.ScheduleType.TIMED_MUTED, null, account, rs -> {
this.relationship = rs;
updateAccount();
});
return true;
} else if (itemId == R.id.action_report) { } else if (itemId == R.id.action_report) {
builderInner = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle()); builderInner = new AlertDialog.Builder(ProfileActivity.this, Helper.dialogStyle());
builderInner.setTitle(R.string.report_account); builderInner.setTitle(R.string.report_account);

View File

@ -358,6 +358,9 @@ public class MastodonHelper {
dialogBuilder.setView(binding.getRoot()); dialogBuilder.setView(binding.getRoot());
final AlertDialog alertDialogBoost = dialogBuilder.create(); final AlertDialog alertDialogBoost = dialogBuilder.create();
binding.timePicker.setIs24HourView(true); binding.timePicker.setIs24HourView(true);
binding.dateTimeNext.setBackgroundTintList(ThemeHelper.getButtonActionColorStateList(context));
binding.dateTimePrevious.setBackgroundTintList(ThemeHelper.getButtonActionColorStateList(context));
binding.dateTimeSet.setBackgroundTintList(ThemeHelper.getButtonActionColorStateList(context));
//Buttons management //Buttons management
binding.dateTimeCancel.setOnClickListener(v -> alertDialogBoost.dismiss()); binding.dateTimeCancel.setOnClickListener(v -> alertDialogBoost.dismiss());
binding.dateTimeNext.setOnClickListener(v -> { binding.dateTimeNext.setOnClickListener(v -> {

View File

@ -21,6 +21,11 @@
android:icon="@drawable/ic_baseline_volume_mute_24" android:icon="@drawable/ic_baseline_volume_mute_24"
android:title="@string/more_action_1" android:title="@string/more_action_1"
app:showAsAction="never" /> app:showAsAction="never" />
<item
android:id="@+id/action_timed_mute"
android:icon="@drawable/ic_baseline_volume_mute_24"
android:title="@string/more_action_8"
app:showAsAction="never" />
<item <item
android:id="@+id/action_block" android:id="@+id/action_block"
android:icon="@drawable/ic_baseline_block_24" android:icon="@drawable/ic_baseline_block_24"