mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-23 01:00:04 +02:00
Some improvements with theme
This commit is contained in:
parent
db066c6ba6
commit
b566ba9fdd
6 changed files with 43 additions and 0 deletions
|
@ -511,6 +511,7 @@ public class ProfileActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
binding.accountFollow.setBackgroundTintList(ThemeHelper.getButtonActionColorStateList(ProfileActivity.this));
|
binding.accountFollow.setBackgroundTintList(ThemeHelper.getButtonActionColorStateList(ProfileActivity.this));
|
||||||
|
binding.headerEditProfile.setBackgroundTintList(ThemeHelper.getButtonActionColorStateList(ProfileActivity.this));
|
||||||
binding.accountFollow.setEnabled(true);
|
binding.accountFollow.setEnabled(true);
|
||||||
//Visibility depending of the relationship
|
//Visibility depending of the relationship
|
||||||
if (relationship != null) {
|
if (relationship != null) {
|
||||||
|
|
|
@ -1059,10 +1059,17 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
|
||||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
|
||||||
|
|
||||||
int theme_statuses_color = -1;
|
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);
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
if (sharedpreferences.getBoolean("use_custom_theme", false)) {
|
if (sharedpreferences.getBoolean("use_custom_theme", false)) {
|
||||||
theme_statuses_color = sharedpreferences.getInt("theme_statuses_color", -1);
|
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) {
|
if (getItemViewType(position) == TYPE_NORMAL) {
|
||||||
Status status = statusList.get(position);
|
Status status = statusList.get(position);
|
||||||
StatusSimpleViewHolder holder = (StatusSimpleViewHolder) viewHolder;
|
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.setVisibility(View.GONE);
|
||||||
holder.binding.spoiler.setText(null);
|
holder.binding.spoiler.setText(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (theme_statuses_color != -1) {
|
if (theme_statuses_color != -1) {
|
||||||
holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color);
|
holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color);
|
||||||
} else {
|
} else {
|
||||||
holder.binding.cardviewContainer.setBackgroundColor(ContextCompat.getColor(context, R.color.cyanea_primary_dark_reference));
|
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) {
|
} else if (getItemViewType(position) == TYPE_COMPOSE) {
|
||||||
Status statusDraft = statusList.get(position);
|
Status statusDraft = statusList.get(position);
|
||||||
|
|
||||||
|
|
|
@ -80,20 +80,40 @@ public class StatusHistoryAdapter extends RecyclerView.Adapter<RecyclerView.View
|
||||||
holder.binding.username.setText(String.format("@%s", status.account.acct));
|
holder.binding.username.setText(String.format("@%s", status.account.acct));
|
||||||
}
|
}
|
||||||
int theme_statuses_color = -1;
|
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);
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
if (sharedpreferences.getBoolean("use_custom_theme", false)) {
|
if (sharedpreferences.getBoolean("use_custom_theme", false)) {
|
||||||
theme_statuses_color = sharedpreferences.getInt("theme_statuses_color", -1);
|
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) {
|
if (theme_statuses_color != -1) {
|
||||||
holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color);
|
holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color);
|
||||||
} else {
|
} else {
|
||||||
holder.binding.cardviewContainer.setBackgroundColor(ContextCompat.getColor(context, R.color.cyanea_primary_dark_reference));
|
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) {
|
if (position == 0) {
|
||||||
holder.binding.dateModif.setText(context.getString(R.string.created_message_at, Helper.dateDiffFull(status.created_at)));
|
holder.binding.dateModif.setText(context.getString(R.string.created_message_at, Helper.dateDiffFull(status.created_at)));
|
||||||
} else {
|
} else {
|
||||||
holder.binding.dateModif.setText(context.getString(R.string.edited_message_at, Helper.dateDiffFull(status.created_at)));
|
holder.binding.dateModif.setText(context.getString(R.string.edited_message_at, Helper.dateDiffFull(status.created_at)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -375,6 +375,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/cyanea_primary_dark_reference"
|
android:background="@color/cyanea_primary_dark_reference"
|
||||||
|
app:tabIndicatorColor="@color/cyanea_accent_dark_reference"
|
||||||
app:tabGravity="fill"
|
app:tabGravity="fill"
|
||||||
app:tabMode="fixed" />
|
app:tabMode="fixed" />
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/cyanea_primary_dark_reference"
|
android:background="@color/cyanea_primary_dark_reference"
|
||||||
|
app:tabIndicatorColor="@color/cyanea_accent_dark_reference"
|
||||||
app:tabGravity="fill"
|
app:tabGravity="fill"
|
||||||
app:tabMode="scrollable" />
|
app:tabMode="scrollable" />
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/cyanea_primary_dark_reference"
|
android:background="@color/cyanea_primary_dark_reference"
|
||||||
|
app:tabIndicatorColor="@color/cyanea_accent_dark_reference"
|
||||||
app:tabGravity="fill"
|
app:tabGravity="fill"
|
||||||
app:tabMaxWidth="0dp" />
|
app:tabMaxWidth="0dp" />
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue