Commit 1fbce05d authored by Thomas's avatar Thomas
Browse files

Improvements

parent 635dc94b
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -293,15 +293,15 @@
            android:name=".activities.InstanceActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/action_about_instance"
            android:theme="@style/Theme.Material3.Dark.Dialog.Alert" />
            android:theme="@style/AlertDialog" />
        <activity
            android:name=".activities.InstanceProfileActivity"
            android:excludeFromRecents="true"
            android:theme="@style/Theme.Material3.Dark.Dialog.Alert" />
            android:theme="@style/AlertDialog" />
        <activity
            android:name=".activities.ProxyActivity"
            android:excludeFromRecents="true"
            android:theme="@style/Theme.Material3.Dark.Dialog.Alert" />
            android:theme="@style/AlertDialog" />
        <activity
            android:name=".activities.HashTagActivity"
            android:configChanges="keyboardHidden|orientation|screenSize" />
@@ -316,7 +316,7 @@
        <activity
            android:name=".activities.InstanceHealthActivity"
            android:excludeFromRecents="true"
            android:theme="@style/Theme.Material3.Dark.Dialog.Alert" />
            android:theme="@style/AlertDialog" />

        <activity
            android:name=".activities.ReportActivity"
+0 −2
Original line number Diff line number Diff line
@@ -139,7 +139,6 @@ import app.fedilab.android.helper.Helper;
import app.fedilab.android.helper.MastodonHelper;
import app.fedilab.android.helper.PinnedTimelineHelper;
import app.fedilab.android.helper.PushHelper;
import app.fedilab.android.helper.ThemeHelper;
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonConversation;
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonTimeline;
import app.fedilab.android.ui.fragment.timeline.FragmentNotificationContainer;
@@ -302,7 +301,6 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
        } else {
            BaseMainActivity.currentToken = sharedpreferences.getString(Helper.PREF_USER_TOKEN, null);
        }
        ThemeHelper.initiliazeColors(BaseMainActivity.this);

        mamageNewIntent(getIntent());
        filterFetched = false;
+0 −11
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@ package app.fedilab.android.helper;


import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.helper.ThemeHelper.linkColor;
import static app.fedilab.android.ui.drawer.StatusAdapter.sendAction;

import android.content.ClipData;
@@ -446,12 +445,6 @@ public class SpannableHelper {

                    }

                    @Override
                    public void updateDrawState(@NonNull TextPaint ds) {
                        super.updateDrawState(ds);
                        ds.setUnderlineText(false);
                        ds.setColor(linkColor);
                    }
                }, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
            }
        }
@@ -674,7 +667,6 @@ public class SpannableHelper {
                        public void updateDrawState(@NonNull TextPaint ds) {
                            super.updateDrawState(ds);
                            ds.setUnderlineText(false);
                            ds.setColor(linkColor);
                        }
                    }, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
                }
@@ -708,7 +700,6 @@ public class SpannableHelper {
                    public void updateDrawState(@NonNull TextPaint ds) {
                        super.updateDrawState(ds);
                        ds.setUnderlineText(false);
                        ds.setColor(linkColor);
                    }
                }, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
            }
@@ -745,7 +736,6 @@ public class SpannableHelper {
                    public void updateDrawState(@NonNull TextPaint ds) {
                        super.updateDrawState(ds);
                        ds.setUnderlineText(false);
                        ds.setColor(linkColor);
                    }
                }, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
            }
@@ -893,7 +883,6 @@ public class SpannableHelper {
                        public void updateDrawState(@NonNull TextPaint ds) {
                            super.updateDrawState(ds);
                            ds.setUnderlineText(false);
                            ds.setColor(linkColor);
                        }

                    }, matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
+0 −14
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@ import app.fedilab.android.R;

public class ThemeHelper {

    public static int linkColor;

    @ColorInt
    public static int getAttColor(Context context, @AttrRes int attColor) {
@@ -60,19 +59,6 @@ public class ThemeHelper {
        return typedValue.data;
    }

    public static void initiliazeColors(Activity activity) {
        TypedValue typedValue = new TypedValue();
        Resources.Theme theme = activity.getTheme();
        theme.resolveAttribute(R.attr.colorPrimary, typedValue, true);
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
        linkColor = -1;
        if (prefs.getBoolean("use_custom_theme", false)) {
            linkColor = prefs.getInt("theme_link_color", -1);
        }
        if (linkColor == -1) {
            linkColor = typedValue.data;
        }
    }

    public static int fetchAccentColor(Context context) {
        TypedValue typedValue = new TypedValue();
+1 −27
Original line number Diff line number Diff line
@@ -1099,17 +1099,8 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {

        int theme_statuses_color = -1;
        int theme_text_color = -1;
        int theme_text_header_1_line = -1;
        int theme_text_header_2_line = -1;

        SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
        if (sharedpreferences.getBoolean("use_custom_theme", false)) {
            theme_statuses_color = sharedpreferences.getInt("theme_statuses_color", -1);
            theme_text_color = sharedpreferences.getInt("theme_text_color", -1);
            theme_text_header_1_line = sharedpreferences.getInt("theme_text_header_1_line", -1);
            theme_text_header_2_line = sharedpreferences.getInt("theme_text_header_2_line", -1);
        }

        if (getItemViewType(position) == TYPE_NORMAL) {
            Status status = statusList.get(position);
@@ -1138,20 +1129,6 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
                holder.binding.spoiler.setText(null);
            }

            if (theme_statuses_color != -1) {
                holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color);
            }
            if (theme_text_header_2_line != -1) {
                holder.binding.username.setTextColor(theme_text_header_2_line);
            }
            if (theme_text_header_1_line != -1) {
                holder.binding.displayName.setTextColor(theme_text_header_1_line);
            }
            if (theme_text_color != -1) {
                holder.binding.statusContent.setTextColor(theme_text_color);
                holder.binding.spoiler.setTextColor(theme_text_color);
            }

        } else if (getItemViewType(position) == TYPE_COMPOSE) {
            Status statusDraft = statusList.get(position);

@@ -1178,9 +1155,6 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder

            int newInputTypeSpoiler = holder.binding.contentSpoiler.getInputType() & (holder.binding.contentSpoiler.getInputType() ^ InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE);
            holder.binding.contentSpoiler.setInputType(newInputTypeSpoiler);
            if (theme_statuses_color != -1) {
                holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color);
            }
            holder.binding.buttonAttach.setOnClickListener(v -> {
                if (instanceInfo.configuration.media_attachments.supported_mime_types != null) {
                    if (instanceInfo.getMimeTypeAudio().size() == 0) {
Loading