Commit 5b8d5895 authored by Thomas's avatar Thomas
Browse files

Merge branch 'Fix_523' into develop

parents 05904587 8ddb02dd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -202,7 +202,7 @@ public class CheckHomeCacheActivity extends BaseBarActivity {
                    IndexAxisValueFormatter formatter = new IndexAxisValueFormatter() {
                        @Override
                        public String getFormattedValue(float value) {
                            if (value < xVals.size()) {
                            if (value >= 0 && value < xVals.size()) {
                                return xVals.get((int) value);
                            } else
                                return "";
@@ -363,7 +363,7 @@ public class CheckHomeCacheActivity extends BaseBarActivity {
                    IndexAxisValueFormatter formatter = new IndexAxisValueFormatter() {
                        @Override
                        public String getFormattedValue(float value) {
                            if (value < xVals2.size()) {
                            if (value >= 0 && value < xVals2.size()) {
                                return xVals2.get((int) value);
                            } else
                                return "";
+17 −3
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ package app.fedilab.android.mastodon.client.endpoints;
 * see <http://www.gnu.org/licenses>. */

import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;

import app.fedilab.android.mastodon.client.entities.api.Account;
@@ -25,14 +26,17 @@ import app.fedilab.android.mastodon.client.entities.api.Poll;
import app.fedilab.android.mastodon.client.entities.api.ScheduledStatus;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.api.StatusSource;
import app.fedilab.android.mastodon.client.entities.api.params.StatusParams;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
@@ -74,6 +78,16 @@ public interface MastodonStatusesService {
            @Header("Authorization") String token,
            @Path("id") String id);


    @Headers({"Accept: application/json"})
    @PUT("statuses/{id}")
    Call<Status> updateStatus(
            @Header("Idempotency-Key") String idempotency_Key,
            @Header("Authorization") String token,
            @Path("id") String id,
            @Body StatusParams statusParams
    );

    //Post a status
    @FormUrlEncoded
    @PUT("statuses/{id}")
@@ -92,9 +106,9 @@ public interface MastodonStatusesService {
            @Field("spoiler_text") String spoiler_text,
            @Field("visibility") String visibility,
            @Field("language") String language,
            @Field("media_attributes[][id]") List<String> media_id,
            @Field("media_attributes[][description]") List<String> media_description,
            @Field("media_attributes[][focus]") List<String> focus
            @Field("media_attributes[]") LinkedHashMap<String, String> media_id,
            @Field("media_attributes[]") LinkedHashMap<String, String> media_description,
            @Field("media_attributes[]") LinkedHashMap<String, String> focus
    );

    //Post a scheduled status
+65 −0
Original line number Diff line number Diff line
package app.fedilab.android.mastodon.client.entities.api.params;
/* Copyright 2025 Thomas Schneider
 *
 * This file is a part of Fedilab
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation; either version 3 of the
 * License, or (at your option) any later version.
 *
 * Fedilab is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
 * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 * Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with Fedilab; if not,
 * see <http://www.gnu.org/licenses>. */


import com.google.gson.annotations.SerializedName;

import java.io.Serializable;
import java.util.List;

public class StatusParams implements Serializable {
    @SerializedName("id")
    public String id;
    @SerializedName("status")
    public String status;
    @SerializedName("media_ids")
    public List<String> media_ids;
    @SerializedName("poll")
    public PollParams pollParams;
    @SerializedName("in_reply_to_id")
    public String in_reply_to_id;
    @SerializedName("sensitive")
    public Boolean sensitive;
    @SerializedName("spoiler_text")
    public String spoiler_text;
    @SerializedName("visibility")
    public String visibility;
    @SerializedName("language")
    public String language;
    @SerializedName("media_attributes")
    public List<MediaParams> media_attributes;

    public static class PollParams implements Serializable{
        @SerializedName("options")
        public List<String> poll_options;
        @SerializedName("expires_in")
        public Integer poll_expire_in;
        @SerializedName("multiple")
        public Boolean poll_multiple;
        @SerializedName("hide_totals")
        public Boolean poll_hide_totals;

    }

    public static class MediaParams implements Serializable {
        @SerializedName("id")
        public String id;
        @SerializedName("description")
        public String description;
        @SerializedName("focus")
        public String focus;
    }
}
+3 −1
Original line number Diff line number Diff line
@@ -106,8 +106,10 @@ public class CustomEmoji extends ReplacementSpan {
                            if (drawableCallBack != null) {
                                drawableCallBack.invalidateDrawable(drawable);
                            }
                            if(view != null) {
                                view.invalidate();
                            }
                        }

                        @Override
                        public void scheduleDrawable(@NonNull Drawable drawable, @NonNull Runnable runnable, long l) {
+8 −1
Original line number Diff line number Diff line
@@ -72,8 +72,15 @@ public class TranslateHelper {
            String translatorVersion = sharedpreferences.getString(context.getString(R.string.SET_TRANSLATOR_VERSION), "PRO");
            params.setPro(translatorVersion.equals("PRO"));
            String apikey = sharedpreferences.getString(context.getString(R.string.SET_TRANSLATOR_API_KEY), null);
            if (apikey != null) {
            if (apikey != null && !apikey.trim().isEmpty()) {
                myTransL.setDeeplAPIKey(apikey.trim());
            } else { //Issue with API key (empty or null)
                SharedPreferences.Editor editor = sharedpreferences.edit();
                editor.putString(context.getString(R.string.SET_TRANSLATOR), "FEDILAB");
                editor.commit();
                et = MyTransL.translatorEngine.LIBRETRANSLATE;
                myTransL.setTranslator(et);
                myTransL.setLibretranslateDomain("translate.fedilab.app");
            }
        }

Loading