Improvements

This commit is contained in:
Thomas 2022-11-29 11:06:37 +01:00
parent 635dc94b8d
commit 1fbce05dbd
16 changed files with 20 additions and 370 deletions

View File

@ -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"

View File

@ -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;

View File

@ -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);

View File

@ -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();

View File

@ -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) {

View File

@ -88,31 +88,9 @@ public class ConversationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
Conversation conversation = conversationList.get(position);
ConversationHolder holder = (ConversationHolder) viewHolder;
int theme_icons_color = -1;
int theme_statuses_color = -1;
int theme_text_color = -1;
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
if (sharedpreferences.getBoolean("use_custom_theme", false)) {
//Getting custom colors
theme_icons_color = sharedpreferences.getInt("theme_icons_color", -1);
theme_statuses_color = sharedpreferences.getInt("theme_statuses_color", -1);
theme_text_color = sharedpreferences.getInt("theme_text_color", -1);
}
if (theme_icons_color != -1) {
Helper.changeDrawableColor(context, R.drawable.ic_baseline_star_24, theme_icons_color);
Helper.changeDrawableColor(context, R.drawable.ic_repeat, theme_icons_color);
Helper.changeDrawableColor(context, R.drawable.ic_star_outline, theme_icons_color);
Helper.changeDrawableColor(context, R.drawable.ic_person, theme_icons_color);
}
if (theme_statuses_color != -1) {
holder.binding.container.setBackgroundColor(theme_statuses_color);
}
if (theme_text_color != -1) {
holder.binding.statusContent.setTextColor(theme_text_color);
holder.binding.spoiler.setTextColor(theme_text_color);
holder.binding.lastMessageDate.setTextColor(theme_text_color);
}
final SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
//--- Profile Pictures for participants ---
holder.binding.participantsList.removeAllViews();

View File

@ -147,22 +147,7 @@ public class NotificationAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
new WeakReference<>(holderFollow.binding.displayName)),
TextView.BufferType.SPANNABLE);
holderFollow.binding.username.setText(String.format("@%s", notification.account.acct));
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(context);
int theme_icons_color = -1;
int theme_text_color = -1;
if (sharedpreferences.getBoolean("use_custom_theme", false)) {
//Getting custom colors
theme_icons_color = sharedpreferences.getInt("theme_icons_color", -1);
theme_text_color = sharedpreferences.getInt("theme_text_color", -1);
}
if (theme_icons_color != -1) {
Helper.changeDrawableColor(context, holderFollow.binding.cacheIndicator, theme_icons_color);
}
if (theme_text_color != -1) {
holderFollow.binding.displayName.setTextColor(theme_text_color);
holderFollow.binding.username.setTextColor(theme_text_color);
holderFollow.binding.title.setTextColor(theme_text_color);
}
holderFollow.binding.rejectButton.setVisibility(View.GONE);
holderFollow.binding.acceptButton.setVisibility(View.GONE);
if (getItemViewType(position) == TYPE_FOLLOW_REQUEST) {

View File

@ -46,9 +46,7 @@ import android.os.Handler;
import android.os.Looper;
import android.text.Html;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@ -498,56 +496,12 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
int truncate_toots_size = sharedpreferences.getInt(context.getString(R.string.SET_TRUNCATE_TOOTS_SIZE), 0);
// boolean display_video_preview = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_VIDEO_PREVIEWS), true);
// boolean isModerator = sharedpreferences.getBoolean(Helper.PREF_IS_MODERATOR, false);
// boolean isAdmin = sharedpreferences.getBoolean(Helper.PREF_IS_ADMINISTRATOR, false);
int theme_icons_color = -1;
int theme_statuses_color = -1;
int theme_boost_header_color = -1;
int theme_text_color = -1;
int theme_text_header_1_line = -1;
int theme_text_header_2_line = -1;
int link_color = -1;
/* if (sharedpreferences.getBoolean("use_custom_theme", false)) {
//Getting custom colors
theme_icons_color = sharedpreferences.getInt("theme_icons_color", -1);
theme_statuses_color = sharedpreferences.getInt("theme_statuses_color", -1);
theme_boost_header_color = sharedpreferences.getInt("theme_boost_header_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);
theme_text_color = sharedpreferences.getInt("theme_text_color", -1);
link_color = sharedpreferences.getInt("theme_link_color", -1);
}*/
if (currentAccount != null && currentAccount.api == Account.API.PLEROMA) {
holder.binding.statusAddCustomEmoji.setVisibility(View.VISIBLE);
holder.binding.statusEmoji.setVisibility(View.VISIBLE);
}
if (theme_icons_color != -1) {
Helper.changeDrawableColor(context, holder.binding.actionButtonReply, theme_icons_color);
Helper.changeDrawableColor(context, holder.binding.cacheIndicator, theme_icons_color);
Helper.changeDrawableColor(context, holder.binding.statusAddCustomEmoji, theme_icons_color);
Helper.changeDrawableColor(context, holder.binding.statusEmoji, theme_icons_color);
Helper.changeDrawableColor(context, holder.binding.actionButtonMore, theme_icons_color);
Helper.changeDrawableColor(context, R.drawable.ic_baseline_star_24, theme_icons_color);
Helper.changeDrawableColor(context, R.drawable.ic_repeat, theme_icons_color);
Helper.changeDrawableColor(context, holder.binding.visibility, theme_icons_color);
Helper.changeDrawableColor(context, R.drawable.ic_star_outline, theme_icons_color);
Helper.changeDrawableColor(context, R.drawable.ic_person, theme_icons_color);
Helper.changeDrawableColor(context, R.drawable.ic_bot, theme_icons_color);
Helper.changeDrawableColor(context, R.drawable.ic_baseline_reply_16, theme_icons_color);
holder.binding.actionButtonFavorite.setInActiveImageTintColor(theme_icons_color);
holder.binding.actionButtonBookmark.setInActiveImageTintColor(theme_icons_color);
holder.binding.actionButtonBoost.setInActiveImageTintColor(theme_icons_color);
holder.binding.replyCount.setTextColor(theme_icons_color);
} else {
holder.binding.actionButtonFavorite.setInActiveImageTintColor(ThemeHelper.getAttColor(context, R.attr.colorControlNormal));
holder.binding.actionButtonBookmark.setInActiveImageTintColor(ThemeHelper.getAttColor(context, R.attr.colorControlNormal));
holder.binding.actionButtonBoost.setInActiveImageTintColor(ThemeHelper.getAttColor(context, R.attr.colorControlNormal));
}
holder.binding.actionButtonFavorite.pressOnTouch(false);
holder.binding.actionButtonBoost.pressOnTouch(false);
holder.binding.actionButtonBookmark.pressOnTouch(false);
@ -574,56 +528,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
holder.binding.statusPinned.setVisibility(View.GONE);
}
if (theme_text_header_2_line != -1) {
Pattern hashAcct;
SpannableString wordToSpan;
if (status.reblog != null) {
wordToSpan = new SpannableString("@" + status.reblog.account.acct);
hashAcct = Pattern.compile("(@" + status.reblog.account.acct + ")");
} else {
wordToSpan = new SpannableString("@" + status.account.acct);
hashAcct = Pattern.compile("(@" + status.account.acct + ")");
}
Matcher matcherAcct = hashAcct.matcher(wordToSpan);
while (matcherAcct.find()) {
int matchStart = matcherAcct.start(1);
int matchEnd = matcherAcct.end();
if (wordToSpan.length() >= matchEnd && matchStart < matchEnd && matchStart >= 0) {
wordToSpan.setSpan(new ForegroundColorSpan(theme_text_header_2_line), matchStart, matchEnd, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
}
}
Helper.changeDrawableColor(context, holder.binding.statusBoostIcon, theme_text_header_2_line);
Helper.changeDrawableColor(context, holder.binding.statusPinned, theme_text_header_2_line);
}
if (theme_statuses_color != -1) {
holder.binding.cardviewContainer.setBackgroundColor(theme_statuses_color);
holder.binding.translationLabel.setBackgroundColor(theme_statuses_color);
}
if (theme_boost_header_color != -1 && status.reblog != null) {
holder.binding.statusBoosterInfo.setBackgroundColor(theme_boost_header_color);
} else {
holder.binding.statusBoosterInfo.setBackgroundColor(0);
}
if (theme_text_color != -1) {
holder.binding.statusContent.setTextColor(theme_text_color);
holder.binding.statusContentTranslated.setTextColor(theme_text_color);
holder.binding.spoiler.setTextColor(theme_text_color);
holder.binding.dateShort.setTextColor(theme_text_color);
holder.binding.poll.pollInfo.setTextColor(theme_text_color);
holder.binding.cardDescription.setTextColor(theme_text_color);
holder.binding.time.setTextColor(theme_text_color);
holder.binding.reblogsCount.setTextColor(theme_text_color);
holder.binding.favoritesCount.setTextColor(theme_text_color);
holder.binding.favoritesCount.setTextColor(theme_text_color);
Helper.changeDrawableColor(context, holder.binding.repeatInfo, theme_text_color);
Helper.changeDrawableColor(context, holder.binding.favInfo, theme_text_color);
Helper.changeDrawableColor(context, R.drawable.ic_baseline_lock_24, theme_text_color);
}
if (link_color != -1) {
holder.binding.cardUrl.setTextColor(link_color);
}
holder.binding.toggleTruncate.setVisibility(View.GONE);
if (status.isFocused) {
@ -952,13 +856,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
statusToDeal.account.getSpanDisplayName(context,
new WeakReference<>(holder.binding.displayName)),
TextView.BufferType.SPANNABLE);
if (theme_text_header_1_line != -1) {
holder.binding.displayName.setTextColor(theme_text_header_1_line);
}
holder.binding.username.setText(String.format("@%s", statusToDeal.account.acct));
if (theme_text_header_2_line != -1) {
holder.binding.username.setTextColor(theme_text_header_2_line);
}
//final float scale = context.getResources().getDisplayMetrics().density;
final float scale = sharedpreferences.getFloat(context.getString(R.string.SET_FONT_SCALE), 1.1f);
final float scaleIcon = sharedpreferences.getFloat(context.getString(R.string.SET_FONT_SCALE_ICON), 1.1f);
@ -1130,13 +1028,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
TextView.BufferType.SPANNABLE);
holder.binding.statusBoosterInfo.setVisibility(View.VISIBLE);
if (theme_text_header_1_line != -1) {
holder.binding.statusBoosterDisplayName.setTextColor(theme_text_header_1_line);
}
holder.binding.statusBoosterUsername.setText(String.format("@%s", status.account.acct));
if (theme_text_header_2_line != -1) {
holder.binding.statusBoosterUsername.setTextColor(theme_text_header_2_line);
}
} else {
holder.binding.statusBoosterInfo.setVisibility(View.GONE);
}
@ -1513,10 +1405,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
@NonNull LayoutPollItemBinding pollItemBinding = LayoutPollItemBinding.inflate(inflater, holder.binding.poll.rated, true);
double value = ((double) (pollItem.votes_count * 100) / (double) statusToDeal.poll.voters_count);
pollItemBinding.pollItemPercent.setText(String.format("%s %%", (int) value));
if (theme_text_color != -1) {
pollItemBinding.pollItemPercent.setTextColor(theme_text_color);
pollItemBinding.pollItemText.setTextColor(theme_text_color);
}
pollItemBinding.pollItemText.setText(
pollItem.getSpanTitle(context, statusToDeal,
new WeakReference<>(pollItemBinding.pollItemText)),

View File

@ -15,14 +15,12 @@ package app.fedilab.android.ui.drawer;
* see <http://www.gnu.org/licenses>. */
import android.content.Context;
import android.content.SharedPreferences;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.RecyclerView;
import java.lang.ref.WeakReference;
@ -78,32 +76,6 @@ public class StatusHistoryAdapter extends RecyclerView.Adapter<RecyclerView.View
TextView.BufferType.SPANNABLE);
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);
}
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)));

View File

@ -1,117 +0,0 @@
package app.fedilab.android.ui.drawer;
/* Copyright 2022 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 android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.core.content.res.ResourcesCompat;
import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
import app.fedilab.android.R;
import app.fedilab.android.client.entities.app.PinnedTimeline;
import app.fedilab.android.client.entities.app.Timeline;
import app.fedilab.android.databinding.DrawerTopMenuItemBinding;
public class TopMenuAdapter extends RecyclerView.Adapter<TopMenuAdapter.TopMenuHolder> {
private final List<PinnedTimeline> pinnedTimelines;
public TopMenuClicked itemListener;
private Context _mContext;
public TopMenuAdapter(List<PinnedTimeline> pinnedTimelines) {
this.pinnedTimelines = pinnedTimelines;
}
public int getCount() {
return pinnedTimelines.size();
}
public PinnedTimeline getItem(int position) {
return pinnedTimelines.get(position);
}
@NonNull
@Override
public TopMenuHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
_mContext = parent.getContext();
DrawerTopMenuItemBinding itemBinding = DrawerTopMenuItemBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false);
return new TopMenuHolder(itemBinding);
}
@Override
public void onBindViewHolder(@NonNull TopMenuHolder holder, int position) {
PinnedTimeline pinnedTimeline = pinnedTimelines.get(position);
if (pinnedTimeline.displayed) {
String name = "";
if (pinnedTimeline.type == Timeline.TimeLineEnum.LIST) {
name = pinnedTimeline.mastodonList.title;
} else if (pinnedTimeline.type == Timeline.TimeLineEnum.TAG) {
name = pinnedTimeline.tagTimeline.name;
} else if (pinnedTimeline.type == Timeline.TimeLineEnum.REMOTE) {
name = pinnedTimeline.remoteInstance.host;
}
holder.binding.name.setText(name);
holder.binding.getRoot().setVisibility(View.VISIBLE);
} else {
holder.binding.getRoot().setVisibility(View.GONE);
}
holder.binding.getRoot().setOnClickListener(v -> itemListener.onClick(v, pinnedTimeline, position));
holder.binding.getRoot().setOnLongClickListener(v -> {
itemListener.onLongClick(holder.binding.getRoot(), pinnedTimeline, position);
return true;
});
//Manage item decoration below the text
if (pinnedTimeline.isSelected) {
holder.binding.underline.setVisibility(View.VISIBLE);
holder.binding.name.setTextColor(ResourcesCompat.getColor(_mContext.getResources(), R.color.colorAccent, _mContext.getTheme()));
} else {
holder.binding.underline.setVisibility(View.GONE);
int textColor = _mContext.getResources().getColor(android.R.color.primary_text_dark);
holder.binding.name.setTextColor(textColor);
}
}
public long getItemId(int position) {
return position;
}
@Override
public int getItemCount() {
return pinnedTimelines.size();
}
public interface TopMenuClicked {
void onClick(View v, PinnedTimeline pinnedTimeline, int position);
void onLongClick(View v, PinnedTimeline pinnedTimeline, int position);
}
static class TopMenuHolder extends RecyclerView.ViewHolder {
DrawerTopMenuItemBinding binding;
TopMenuHolder(DrawerTopMenuItemBinding itemView) {
super(itemView.getRoot());
binding = itemView;
}
}
}

View File

@ -175,7 +175,6 @@
android:layout_marginTop="20dp"
android:text="@string/close"
android:textAllCaps="false"
android:textColor="@color/white"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View File

@ -3,8 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:theme="@style/ThemeOverlay.AppCompat.Dark">
android:layout_height="@dimen/nav_header_height">
<androidx.appcompat.widget.AppCompatImageView
@ -60,10 +59,10 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:singleLine="true"
android:ellipsize="end"
android:paddingTop="@dimen/nav_header_vertical_spacing"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
tools:text="@tools:sample/full_names" />
<ImageView
android:id="@+id/owner_accounts"

View File

@ -10,7 +10,6 @@
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:padding="2dp"
android:textColor="#FFFFFF"
android:textSize="35sp"
tools:android="Burhanuddin" />
</LinearLayout>

View File

@ -55,11 +55,7 @@
<action
android:id="@+id/categories_to_theming"
app:destination="@id/FragmentThemingSettings"
app:enterAnim="@anim/enter"
app:exitAnim="@anim/exit"
app:popEnterAnim="@anim/pop_enter"
app:popExitAnim="@anim/pop_exit" />
app:destination="@id/ThemeSettingsActivity" />
<action
android:id="@+id/categories_to_language"
@ -95,10 +91,6 @@
android:name="app.fedilab.android.ui.fragment.settings.FragmentPrivacySettings"
android:label="@string/action_privacy" />
<fragment
android:id="@+id/FragmentThemingSettings"
android:name="app.fedilab.android.ui.fragment.settings.FragmentThemingSettings"
android:label="@string/theming" />
<fragment
android:id="@+id/FragmentLanguageSettings"
@ -109,4 +101,8 @@
android:id="@+id/EditProfileActivity"
android:name="app.fedilab.android.activities.EditProfileActivity" />
<activity
android:id="@+id/ThemeSettingsActivity"
android:name="app.fedilab.android.activities.ThemeSettingsActivity" />
</navigation>

View File

@ -83,4 +83,6 @@
<item name="android:windowNoTitle">true</item>
</style>
<style name="AlertDialog" parent="Theme.Material3.Dark.Dialog.Alert" />
</resources>

View File

@ -81,4 +81,6 @@
</style>
<style name="AlertDialog" parent="Theme.Material3.Light.Dialog.Alert" />
</resources>