fix: fix compilation problems
This commit is contained in:
parent
e1a262ec5f
commit
b0353920a3
|
@ -1,5 +1,7 @@
|
||||||
package org.joinmastodon.android;
|
package org.joinmastodon.android;
|
||||||
|
|
||||||
|
import static org.joinmastodon.android.GlobalUserPreferences.PrefixRepliesMode.ALWAYS;
|
||||||
|
import static org.joinmastodon.android.GlobalUserPreferences.PrefixRepliesMode.TO_OTHERS;
|
||||||
import static org.joinmastodon.android.GlobalUserPreferences.getPrefs;
|
import static org.joinmastodon.android.GlobalUserPreferences.getPrefs;
|
||||||
|
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
|
|
|
@ -122,12 +122,37 @@ public class BehaviourFragment extends SettingsBaseFragment{
|
||||||
GlobalUserPreferences.save();
|
GlobalUserPreferences.save();
|
||||||
needAppRestart=true;
|
needAppRestart=true;
|
||||||
}));
|
}));
|
||||||
items.add(new SwitchItem(R.string.sk_settings_prefix_reply_cw_with_re, R.drawable.ic_fluent_arrow_reply_24_regular, GlobalUserPreferences.prefixRepliesWithRe, i->{
|
items.add(new SettingsBaseFragment.ButtonItem(R.string.sk_settings_prefix_reply_cw_with_re, R.drawable.ic_fluent_arrow_reply_24_regular, b->{
|
||||||
GlobalUserPreferences.prefixRepliesWithRe=i.checked;
|
PopupMenu popupMenu=new PopupMenu(getActivity(), b, Gravity.CENTER_HORIZONTAL);
|
||||||
|
popupMenu.inflate(R.menu.settings_prefix_reply_mode);
|
||||||
|
popupMenu.setOnMenuItemClickListener(i -> onPrefixRepliesClick(i, b));
|
||||||
|
b.setOnTouchListener(popupMenu.getDragToOpenListener());
|
||||||
|
b.setOnClickListener(v->popupMenu.show());
|
||||||
|
b.setText(switch(GlobalUserPreferences.prefixReplies){
|
||||||
|
case TO_OTHERS -> R.string.sk_settings_prefix_replies_to_others;
|
||||||
|
case ALWAYS -> R.string.sk_settings_prefix_replies_always;
|
||||||
|
default -> R.string.sk_settings_prefix_replies_never;
|
||||||
|
});
|
||||||
GlobalUserPreferences.save();
|
GlobalUserPreferences.save();
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean onPrefixRepliesClick(MenuItem item, Button btn) {
|
||||||
|
int id = item.getItemId();
|
||||||
|
GlobalUserPreferences.PrefixRepliesMode mode = GlobalUserPreferences.PrefixRepliesMode.NEVER;
|
||||||
|
if (id == R.id.prefix_replies_always) mode = GlobalUserPreferences.PrefixRepliesMode.ALWAYS;
|
||||||
|
else if (id == R.id.prefix_replies_to_others) mode = GlobalUserPreferences.PrefixRepliesMode.TO_OTHERS;
|
||||||
|
GlobalUserPreferences.prefixReplies = mode;
|
||||||
|
|
||||||
|
btn.setText(switch(GlobalUserPreferences.prefixReplies){
|
||||||
|
case TO_OTHERS -> R.string.sk_settings_prefix_replies_to_others;
|
||||||
|
case ALWAYS -> R.string.sk_settings_prefix_replies_always;
|
||||||
|
default -> R.string.sk_settings_prefix_replies_never;
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean onAutoRevealSpoilerClick(MenuItem item, Button btn) {
|
private boolean onAutoRevealSpoilerClick(MenuItem item, Button btn) {
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue