Commit b566ba9f authored by Thomas's avatar Thomas
Browse files

Some improvements with theme

parent db066c6b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -511,6 +511,7 @@ public class ProfileActivity extends BaseActivity {
            }
        }
        binding.accountFollow.setBackgroundTintList(ThemeHelper.getButtonActionColorStateList(ProfileActivity.this));
        binding.headerEditProfile.setBackgroundTintList(ThemeHelper.getButtonActionColorStateList(ProfileActivity.this));
        binding.accountFollow.setEnabled(true);
        //Visibility depending of the relationship
        if (relationship != null) {
+19 −0
Original line number Diff line number Diff line
@@ -1059,10 +1059,17 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
    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);
            StatusSimpleViewHolder holder = (StatusSimpleViewHolder) viewHolder;
@@ -1089,11 +1096,23 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
                holder.binding.spoiler.setVisibility(View.GONE);
                holder.binding.spoiler.setText(null);
            }

            if (theme_statuses_color != -1) {
                holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color);
            } else {
                holder.binding.cardviewContainer.setBackgroundColor(ContextCompat.getColor(context, R.color.cyanea_primary_dark_reference));
            }
            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);

+20 −0
Original line number Diff line number Diff line
@@ -80,20 +80,40 @@ public class StatusHistoryAdapter extends RecyclerView.Adapter<RecyclerView.View
            holder.binding.username.setText(String.format("@%s", status.account.acct));
        }
        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 (theme_statuses_color != -1) {
            holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color);
        } else {
            holder.binding.cardviewContainer.setBackgroundColor(ContextCompat.getColor(context, R.color.cyanea_primary_dark_reference));
        }
        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.dateModif.setTextColor(theme_text_color);
            holder.binding.spoiler.setTextColor(theme_text_color);
        }

        if (position == 0) {
            holder.binding.dateModif.setText(context.getString(R.string.created_message_at, Helper.dateDiffFull(status.created_at)));
        } else {
            holder.binding.dateModif.setText(context.getString(R.string.edited_message_at, Helper.dateDiffFull(status.created_at)));
        }

    }

    @Override
+1 −0
Original line number Diff line number Diff line
@@ -375,6 +375,7 @@
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/cyanea_primary_dark_reference"
            app:tabIndicatorColor="@color/cyanea_accent_dark_reference"
            app:tabGravity="fill"
            app:tabMode="fixed" />
    </com.google.android.material.appbar.AppBarLayout>
+1 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/cyanea_primary_dark_reference"
            app:tabIndicatorColor="@color/cyanea_accent_dark_reference"
            app:tabGravity="fill"
            app:tabMode="scrollable" />
    </com.google.android.material.appbar.AppBarLayout>
Loading