improve local visibility compatibility
This commit is contained in:
parent
84e5983c4c
commit
21f816860f
|
@ -937,6 +937,9 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
if(hasSpoiler){
|
if(hasSpoiler){
|
||||||
charCount+=spoilerEdit.length();
|
charCount+=spoilerEdit.length();
|
||||||
}
|
}
|
||||||
|
if (localOnly && GlobalUserPreferences.accountsInGlitchMode.contains(accountID)) {
|
||||||
|
charCount -= GLITCH_LOCAL_ONLY_SUFFIX.length();
|
||||||
|
}
|
||||||
charCounter.setText(String.valueOf(charLimit-charCount));
|
charCounter.setText(String.valueOf(charLimit-charCount));
|
||||||
trimmedCharCount=text.toString().trim().length();
|
trimmedCharCount=text.toString().trim().length();
|
||||||
updatePublishButtonState();
|
updatePublishButtonState();
|
||||||
|
@ -1854,7 +1857,10 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
Menu m=visibilityPopup.getMenu();
|
Menu m=visibilityPopup.getMenu();
|
||||||
MenuItem localOnlyItem = visibilityPopup.getMenu().findItem(R.id.local_only);
|
MenuItem localOnlyItem = visibilityPopup.getMenu().findItem(R.id.local_only);
|
||||||
boolean prefsSaysSupported = GlobalUserPreferences.accountsWithLocalOnlySupport.contains(accountID);
|
boolean prefsSaysSupported = GlobalUserPreferences.accountsWithLocalOnlySupport.contains(accountID);
|
||||||
if (localOnly || prefsSaysSupported) {
|
if (instance.pleroma != null) {
|
||||||
|
m.findItem(R.id.vis_local).setVisible(true);
|
||||||
|
} else if (localOnly || prefsSaysSupported) {
|
||||||
|
localOnlyItem.setVisible(true);
|
||||||
localOnlyItem.setChecked(localOnly);
|
localOnlyItem.setChecked(localOnly);
|
||||||
Status status = editingStatus != null ? editingStatus : replyTo;
|
Status status = editingStatus != null ? editingStatus : replyTo;
|
||||||
if (!prefsSaysSupported) {
|
if (!prefsSaysSupported) {
|
||||||
|
@ -1864,8 +1870,6 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
}
|
}
|
||||||
GlobalUserPreferences.save();
|
GlobalUserPreferences.save();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
localOnlyItem.setVisible(false);
|
|
||||||
}
|
}
|
||||||
UiUtils.enablePopupMenuIcons(getActivity(), visibilityPopup);
|
UiUtils.enablePopupMenuIcons(getActivity(), visibilityPopup);
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) m.setGroupDividerEnabled(true);
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) m.setGroupDividerEnabled(true);
|
||||||
|
@ -1881,6 +1885,8 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
|
||||||
statusVisibility=StatusPrivacy.PRIVATE;
|
statusVisibility=StatusPrivacy.PRIVATE;
|
||||||
}else if(id==R.id.vis_private){
|
}else if(id==R.id.vis_private){
|
||||||
statusVisibility=StatusPrivacy.DIRECT;
|
statusVisibility=StatusPrivacy.DIRECT;
|
||||||
|
}else if(id==R.id.vis_local){
|
||||||
|
statusVisibility=StatusPrivacy.LOCAL;
|
||||||
}
|
}
|
||||||
if (id == R.id.local_only) {
|
if (id == R.id.local_only) {
|
||||||
localOnly = !item.isChecked();
|
localOnly = !item.isChecked();
|
||||||
|
|
|
@ -914,7 +914,8 @@ public class UiUtils{
|
||||||
|
|
||||||
public static boolean setExtraTextInfo(Context ctx, TextView extraText, StatusPrivacy visibility, boolean localOnly) {
|
public static boolean setExtraTextInfo(Context ctx, TextView extraText, StatusPrivacy visibility, boolean localOnly) {
|
||||||
List<String> extraParts = new ArrayList<>();
|
List<String> extraParts = new ArrayList<>();
|
||||||
if (localOnly) extraParts.add(ctx.getString(R.string.sk_inline_local_only));
|
if (localOnly || (visibility != null && visibility.equals(StatusPrivacy.LOCAL)))
|
||||||
|
extraParts.add(ctx.getString(R.string.sk_inline_local_only));
|
||||||
if (visibility != null && visibility.equals(StatusPrivacy.DIRECT))
|
if (visibility != null && visibility.equals(StatusPrivacy.DIRECT))
|
||||||
extraParts.add(ctx.getString(R.string.sk_inline_direct));
|
extraParts.add(ctx.getString(R.string.sk_inline_direct));
|
||||||
if (!extraParts.isEmpty()) {
|
if (!extraParts.isEmpty()) {
|
||||||
|
|
|
@ -3,10 +3,15 @@
|
||||||
<group android:id="@+id/local_only_group" android:checkableBehavior="all">
|
<group android:id="@+id/local_only_group" android:checkableBehavior="all">
|
||||||
<item
|
<item
|
||||||
android:id="@+id/local_only"
|
android:id="@+id/local_only"
|
||||||
|
android:visible="false"
|
||||||
android:icon="@drawable/ic_fluent_eye_24_regular"
|
android:icon="@drawable/ic_fluent_eye_24_regular"
|
||||||
android:title="@string/sk_local_only" />
|
android:title="@string/sk_local_only" />
|
||||||
</group>
|
</group>
|
||||||
<group android:id="@+id/visibility_group" android:checkableBehavior="single">
|
<group android:id="@+id/visibility_group" android:checkableBehavior="single">
|
||||||
|
<item android:id="@+id/vis_local"
|
||||||
|
android:visible="false"
|
||||||
|
android:icon="@drawable/ic_fluent_eye_24_regular"
|
||||||
|
android:title="@string/sk_local_only"/>
|
||||||
<item android:id="@+id/vis_public"
|
<item android:id="@+id/vis_public"
|
||||||
android:icon="@drawable/ic_fluent_earth_24_regular"
|
android:icon="@drawable/ic_fluent_earth_24_regular"
|
||||||
android:title="@string/visibility_public"/>
|
android:title="@string/visibility_public"/>
|
||||||
|
|
Loading…
Reference in New Issue