Commit 508f3c62 authored by Thomas's avatar Thomas
Browse files

comment #702 - Add post local only (Glitch)

parent 64e50bd8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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;
+3 −0
Original line number Diff line number Diff line
@@ -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,
+23 −0
Original line number Diff line number Diff line
@@ -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);
            }
+7 −0
Original line number Diff line number Diff line
@@ -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));
+10 −0
Original line number Diff line number Diff line
<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>
Loading