comment #702 - Add post local only (Glitch)
This commit is contained in:
parent
64e50bd8b5
commit
508f3c6253
|
@ -102,6 +102,8 @@ public class Status implements Serializable, Cloneable {
|
|||
public List<Filter.FilterResult> filtered;
|
||||
@SerializedName("pleroma")
|
||||
public Pleroma pleroma;
|
||||
@SerializedName("local_only")
|
||||
public boolean local_only = false;
|
||||
@SerializedName("cached")
|
||||
public boolean cached = false;
|
||||
public Attachment art_attachment;
|
||||
|
|
|
@ -218,6 +218,9 @@ public class ComposeWorker extends Worker {
|
|||
return;
|
||||
}
|
||||
String language = sharedPreferences.getString(context.getString(R.string.SET_COMPOSE_LANGUAGE) + dataPost.userId + dataPost.instance, null);
|
||||
if (statuses.get(i).local_only) {
|
||||
statuses.get(i).text += " \uD83D\uDC41";
|
||||
}
|
||||
if (dataPost.scheduledDate == null) {
|
||||
if (dataPost.statusEditId == null) {
|
||||
statusCall = mastodonStatusesService.createStatus(null, dataPost.token, statuses.get(i).text, attachmentIds, poll_options, poll_expire_in,
|
||||
|
|
|
@ -1279,6 +1279,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
|||
holder.binding.buttonEmojiOne.setVisibility(View.VISIBLE);
|
||||
if (extraFeatures) {
|
||||
holder.binding.buttonTextFormat.setVisibility(View.VISIBLE);
|
||||
holder.binding.buttonLocalOnly.setVisibility(View.VISIBLE);
|
||||
holder.binding.buttonTextFormat.setOnClickListener(v -> {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context, Helper.dialogStyle());
|
||||
builder.setTitle(context.getString(R.string.post_format));
|
||||
|
@ -1304,6 +1305,28 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
|||
builder.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||
builder.create().show();
|
||||
});
|
||||
holder.binding.buttonLocalOnly.setOnClickListener(v -> {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context, Helper.dialogStyle());
|
||||
builder.setTitle(context.getString(R.string.local_only));
|
||||
Resources res = context.getResources();
|
||||
boolean[] valArr = new boolean[]{false, true};
|
||||
String[] labelArr = res.getStringArray(R.array.set_local_only);
|
||||
|
||||
int selection = 0;
|
||||
boolean localOnly = sharedpreferences.getBoolean(context.getString(R.string.SET_LOCAL_ONLY) + account.user_id + account.instance, false);
|
||||
if (statusDraft.local_only || localOnly) {
|
||||
selection = 1;
|
||||
}
|
||||
builder.setSingleChoiceItems(labelArr, selection, null);
|
||||
builder.setPositiveButton(R.string.validate, (dialog, which) -> {
|
||||
int selectedPosition = ((AlertDialog) dialog).getListView().getCheckedItemPosition();
|
||||
statusDraft.local_only = valArr[selectedPosition];
|
||||
notifyItemChanged(holder.getLayoutPosition());
|
||||
dialog.dismiss();
|
||||
});
|
||||
builder.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
|
||||
builder.create().show();
|
||||
});
|
||||
} else {
|
||||
holder.binding.buttonTextFormat.setVisibility(View.GONE);
|
||||
}
|
||||
|
|
|
@ -1053,6 +1053,13 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
|
|||
ressource = R.drawable.ic_baseline_mail_24;
|
||||
break;
|
||||
}
|
||||
|
||||
if (statusToDeal.local_only) {
|
||||
holder.binding.localOnly.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.binding.localOnly.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (status.isFocused) {
|
||||
holder.binding.statusInfo.setVisibility(View.VISIBLE);
|
||||
holder.binding.reblogsCount.setText(String.valueOf(status.reblogs_count));
|
||||
|
|
|
@ -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="@android:color/white"
|
||||
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" />
|
||||
</vector>
|
|
@ -159,6 +159,14 @@
|
|||
android:singleLine="true"
|
||||
tools:text="@tools:sample/full_names" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/local_only"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:contentDescription="@string/local_only"
|
||||
android:src="@drawable/ic_baseline_local_only_24" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/visibility_small"
|
||||
android:layout_width="20dp"
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
android:focusable="true"
|
||||
android:gravity="top|start"
|
||||
android:inputType="textMultiLine|textCapSentences"
|
||||
android:minLines="6"
|
||||
android:minLines="8"
|
||||
app:layout_constraintEnd_toStartOf="@id/button_emoji"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/content_spoiler" />
|
||||
|
@ -103,6 +103,17 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/button_emoji_one"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/button_local_only"
|
||||
style="@style/Fedilab.SmallIconButton"
|
||||
android:layout_marginEnd="6dp"
|
||||
android:contentDescription="@string/local_only"
|
||||
android:visibility="gone"
|
||||
app:icon="@drawable/ic_baseline_remove_red_eye_24"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/button_text_format"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:id="@+id/sensitive_media"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -770,6 +770,12 @@
|
|||
<item>text/x.misskeymarkdown</item>
|
||||
</string-array>
|
||||
|
||||
|
||||
<string-array name="set_local_only">
|
||||
<item>No</item>
|
||||
<item>Yes</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="set_load_media_type_value">
|
||||
<item>Always</item>
|
||||
<item>Wifi only</item>
|
||||
|
@ -1435,6 +1441,7 @@
|
|||
|
||||
<string name="SET_DISPLAY_TRANSLATE" translatable="false">SET_DISPLAY_TRANSLATE</string>
|
||||
<string name="SET_POST_FORMAT" translatable="false">SET_POST_FORMAT</string>
|
||||
<string name="SET_LOCAL_ONLY" translatable="false">SET_LOCAL_ONLY</string>
|
||||
|
||||
<string name="SET_TRANSLATOR" translatable="false">SET_TRANSLATOR</string>
|
||||
<string name="SET_TRANSLATOR_VERSION" translatable="false">SET_TRANSLATOR_VERSION</string>
|
||||
|
@ -2186,4 +2193,5 @@
|
|||
<string name="self">Self</string>
|
||||
<string name="set_remote_profile_title">Remote profiles</string>
|
||||
<string name="set_remote_profile">The app will display publicly profiles to get all messages. Interactions will need an extra step to federate messages.</string>
|
||||
<string name="local_only">Local only</string>
|
||||
</resources>
|
Loading…
Reference in New Issue