Support sending posts with local visibility
This change also adds this option into default post settings.
This commit is contained in:
parent
66edfaece3
commit
8cc1263e14
|
@ -992,6 +992,9 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
||||||
case DIRECT:
|
case DIRECT:
|
||||||
resource = R.string.description_visibility_direct;
|
resource = R.string.description_visibility_direct;
|
||||||
break;
|
break;
|
||||||
|
case LOCAL:
|
||||||
|
resource = R.string.description_visibility_local;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,6 +192,9 @@ public class StatusDetailedViewHolder extends StatusBaseViewHolder {
|
||||||
case DIRECT:
|
case DIRECT:
|
||||||
visibilityIcon = R.drawable.ic_email_24dp;
|
visibilityIcon = R.drawable.ic_email_24dp;
|
||||||
break;
|
break;
|
||||||
|
case LOCAL:
|
||||||
|
visibilityIcon = R.drawable.ic_local_24dp;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -765,6 +765,7 @@ class ComposeActivity :
|
||||||
binding.composeTootButton.setStatusVisibility(visibility)
|
binding.composeTootButton.setStatusVisibility(visibility)
|
||||||
|
|
||||||
val iconRes = when (visibility) {
|
val iconRes = when (visibility) {
|
||||||
|
Status.Visibility.LOCAL -> R.drawable.ic_local_24dp
|
||||||
Status.Visibility.PUBLIC -> R.drawable.ic_public_24dp
|
Status.Visibility.PUBLIC -> R.drawable.ic_public_24dp
|
||||||
Status.Visibility.PRIVATE -> R.drawable.ic_lock_outline_24dp
|
Status.Visibility.PRIVATE -> R.drawable.ic_lock_outline_24dp
|
||||||
Status.Visibility.DIRECT -> R.drawable.ic_email_24dp
|
Status.Visibility.DIRECT -> R.drawable.ic_email_24dp
|
||||||
|
|
|
@ -30,6 +30,8 @@ class ComposeOptionsView @JvmOverloads constructor(context: Context, attrs: Attr
|
||||||
|
|
||||||
setOnCheckedChangeListener { _, checkedId ->
|
setOnCheckedChangeListener { _, checkedId ->
|
||||||
val visibility = when (checkedId) {
|
val visibility = when (checkedId) {
|
||||||
|
R.id.localRadioButton ->
|
||||||
|
Status.Visibility.LOCAL
|
||||||
R.id.publicRadioButton ->
|
R.id.publicRadioButton ->
|
||||||
Status.Visibility.PUBLIC
|
Status.Visibility.PUBLIC
|
||||||
R.id.unlistedRadioButton ->
|
R.id.unlistedRadioButton ->
|
||||||
|
@ -47,6 +49,8 @@ class ComposeOptionsView @JvmOverloads constructor(context: Context, attrs: Attr
|
||||||
|
|
||||||
fun setStatusVisibility(visibility: Status.Visibility) {
|
fun setStatusVisibility(visibility: Status.Visibility) {
|
||||||
val selectedButton = when (visibility) {
|
val selectedButton = when (visibility) {
|
||||||
|
Status.Visibility.LOCAL ->
|
||||||
|
R.id.localRadioButton
|
||||||
Status.Visibility.PUBLIC ->
|
Status.Visibility.PUBLIC ->
|
||||||
R.id.publicRadioButton
|
R.id.publicRadioButton
|
||||||
Status.Visibility.UNLISTED ->
|
Status.Visibility.UNLISTED ->
|
||||||
|
|
|
@ -62,6 +62,11 @@ class TootButton
|
||||||
setText(R.string.action_send)
|
setText(R.string.action_send)
|
||||||
IconicsDrawable(context, GoogleMaterial.Icon.gmd_lock).apply { sizeDp = 18; colorInt = Color.WHITE }
|
IconicsDrawable(context, GoogleMaterial.Icon.gmd_lock).apply { sizeDp = 18; colorInt = Color.WHITE }
|
||||||
}
|
}
|
||||||
|
Status.Visibility.LOCAL -> {
|
||||||
|
setText(R.string.action_send)
|
||||||
|
IconicsDrawable(context, GoogleMaterial.Icon.gmd_group).apply { sizeDp = 18; colorInt = Color.WHITE }
|
||||||
|
null
|
||||||
|
}
|
||||||
else -> {
|
else -> {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
|
@ -333,6 +333,8 @@ class AccountPreferencesFragment : PreferenceFragmentCompat(), Injectable {
|
||||||
|
|
||||||
Status.Visibility.UNLISTED -> R.drawable.ic_lock_open_24dp
|
Status.Visibility.UNLISTED -> R.drawable.ic_lock_open_24dp
|
||||||
|
|
||||||
|
Status.Visibility.LOCAL -> R.drawable.ic_local_24dp
|
||||||
|
|
||||||
else -> R.drawable.ic_public_24dp
|
else -> R.drawable.ic_public_24dp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -270,7 +270,7 @@ class SearchStatusesFragment : SearchFragment<StatusViewData.Concrete>(), Status
|
||||||
menu.findItem(R.id.status_reblog_private).isVisible = !reblogged
|
menu.findItem(R.id.status_reblog_private).isVisible = !reblogged
|
||||||
menu.findItem(R.id.status_unreblog_private).isVisible = reblogged
|
menu.findItem(R.id.status_unreblog_private).isVisible = reblogged
|
||||||
}
|
}
|
||||||
Status.Visibility.UNKNOWN, Status.Visibility.DIRECT -> {
|
Status.Visibility.UNKNOWN, Status.Visibility.DIRECT, Status.Visibility.LOCAL -> {
|
||||||
} // Ignore
|
} // Ignore
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -80,7 +80,9 @@ data class Status(
|
||||||
PRIVATE(3),
|
PRIVATE(3),
|
||||||
|
|
||||||
@SerializedName("direct")
|
@SerializedName("direct")
|
||||||
DIRECT(4);
|
DIRECT(4),
|
||||||
|
@SerializedName("local")
|
||||||
|
LOCAL(5);
|
||||||
|
|
||||||
fun serverString(): String {
|
fun serverString(): String {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
|
@ -88,6 +90,7 @@ data class Status(
|
||||||
UNLISTED -> "unlisted"
|
UNLISTED -> "unlisted"
|
||||||
PRIVATE -> "private"
|
PRIVATE -> "private"
|
||||||
DIRECT -> "direct"
|
DIRECT -> "direct"
|
||||||
|
LOCAL -> "local"
|
||||||
UNKNOWN -> "unknown"
|
UNKNOWN -> "unknown"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,6 +100,7 @@ data class Status(
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun byNum(num: Int): Visibility {
|
fun byNum(num: Int): Visibility {
|
||||||
return when (num) {
|
return when (num) {
|
||||||
|
5 -> LOCAL
|
||||||
4 -> DIRECT
|
4 -> DIRECT
|
||||||
3 -> PRIVATE
|
3 -> PRIVATE
|
||||||
2 -> UNLISTED
|
2 -> UNLISTED
|
||||||
|
@ -113,6 +117,7 @@ data class Status(
|
||||||
"unlisted" -> UNLISTED
|
"unlisted" -> UNLISTED
|
||||||
"private" -> PRIVATE
|
"private" -> PRIVATE
|
||||||
"direct" -> DIRECT
|
"direct" -> DIRECT
|
||||||
|
"local" -> LOCAL
|
||||||
"unknown" -> UNKNOWN
|
"unknown" -> UNKNOWN
|
||||||
else -> UNKNOWN
|
else -> UNKNOWN
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,24 @@
|
||||||
tools:layout_width="match_parent"
|
tools:layout_width="match_parent"
|
||||||
tools:parentTag="RadioGroup">
|
tools:parentTag="RadioGroup">
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/localRadioButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:button="@drawable/ic_local_24dp"
|
||||||
|
android:paddingStart="10dp"
|
||||||
|
android:paddingEnd="0dp"
|
||||||
|
android:text="@string/visibility_local"
|
||||||
|
android:textColor="?android:textColorTertiary"
|
||||||
|
app:buttonTint="@color/compound_button_color" />
|
||||||
|
|
||||||
<RadioButton
|
<RadioButton
|
||||||
android:id="@+id/publicRadioButton"
|
android:id="@+id/publicRadioButton"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="4dp"
|
||||||
android:layout_marginBottom="4dp"
|
android:layout_marginBottom="4dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:button="@drawable/ic_public_24dp"
|
android:button="@drawable/ic_public_24dp"
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
<item>unlisted</item>
|
<item>unlisted</item>
|
||||||
<item>private</item>
|
<item>private</item>
|
||||||
<item>direct</item>
|
<item>direct</item>
|
||||||
|
<item>local</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="post_text_size_values">
|
<string-array name="post_text_size_values">
|
||||||
|
|
|
@ -4,6 +4,11 @@
|
||||||
<string name="status_replied_to_format">Reply to %s</string>
|
<string name="status_replied_to_format">Reply to %s</string>
|
||||||
<string name="pref_title_enable_big_emojis">Enable bigger custom emojis</string>
|
<string name="pref_title_enable_big_emojis">Enable bigger custom emojis</string>
|
||||||
<string name="title_bubble">Bubble</string>
|
<string name="title_bubble">Bubble</string>
|
||||||
|
<string name="post_privacy_local">Local</string>
|
||||||
|
<string name="description_visibility_local">
|
||||||
|
Local
|
||||||
|
</string>
|
||||||
|
<string name="visibility_local">Local: Do not federate this post</string>
|
||||||
|
|
||||||
<string name="admin">Admin</string>
|
<string name="admin">Admin</string>
|
||||||
<string name="moderator">Moderator</string>
|
<string name="moderator">Moderator</string>
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<item>@string/post_privacy_unlisted</item>
|
<item>@string/post_privacy_unlisted</item>
|
||||||
<item>@string/post_privacy_followers_only</item>
|
<item>@string/post_privacy_followers_only</item>
|
||||||
<item>@string/post_privacy_direct</item>
|
<item>@string/post_privacy_direct</item>
|
||||||
|
<item>@string/post_privacy_local</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="post_text_size_names">
|
<string-array name="post_text_size_names">
|
||||||
|
|
Loading…
Reference in New Issue