Fix state save/restore and move colors to attrs

This commit is contained in:
Grishka 2022-02-13 16:16:20 +03:00
parent 6d0f38eca6
commit a91538582a
35 changed files with 255 additions and 109 deletions

View File

@ -52,6 +52,12 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
super(20);
}
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setRetainInstance(true);
}
@Override
protected RecyclerView.Adapter getAdapter(){
return adapter=new DisplayItemsAdapter();

View File

@ -132,11 +132,13 @@ public class ComposeFragment extends ToolbarFragment implements OnBackPressedLis
private String initialReplyMentions;
private String uuid;
private int pollDuration=24*3600;
private String pollDurationStr;
@Override
public void onAttach(Activity activity){
super.onAttach(activity);
setHasOptionsMenu(true);
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setRetainInstance(true);
accountID=getArguments().getString("account");
AccountSession session=AccountSessionManager.getInstance().getAccount(accountID);
charLimit=session.tootCharLimit;
@ -145,15 +147,21 @@ public class ComposeFragment extends ToolbarFragment implements OnBackPressedLis
self=session.self;
instanceDomain=session.domain;
customEmojis=AccountSessionManager.getInstance().getCustomEmojis(instanceDomain);
emojiKeyboard=new CustomEmojiPopupKeyboard(activity, customEmojis, instanceDomain);
emojiKeyboard.setListener(this::onCustomEmojiClick);
if(getArguments().containsKey("replyTo"))
replyTo=Parcels.unwrap(getArguments().getParcelable("replyTo"));
}
@Override
public void onAttach(Activity activity){
super.onAttach(activity);
setHasOptionsMenu(true);
}
@Override
public View onCreateContentView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
emojiKeyboard=new CustomEmojiPopupKeyboard(getActivity(), customEmojis, instanceDomain);
emojiKeyboard.setListener(this::onCustomEmojiClick);
View view=inflater.inflate(R.layout.fragment_compose, container, false);
mainEditText=view.findViewById(R.id.toot_text);
charCounter=view.findViewById(R.id.char_counter);
@ -206,12 +214,42 @@ public class ComposeFragment extends ToolbarFragment implements OnBackPressedLis
});
pollOptionsView.setDragListener(this::onSwapPollOptions);
pollDurationView=view.findViewById(R.id.poll_duration);
pollDurationView.setText(getString(R.string.compose_poll_duration, getResources().getQuantityString(R.plurals.x_days, 1, 1)));
pollDurationView.setOnClickListener(v->showPollDurationMenu());
pollOptions.clear();
if(savedInstanceState!=null && savedInstanceState.containsKey("pollOptions")){
pollBtn.setSelected(true);
mediaBtn.setEnabled(false);
pollWrap.setVisibility(View.VISIBLE);
for(String oldText:savedInstanceState.getStringArrayList("pollOptions")){
DraftPollOption opt=createDraftPollOption();
opt.edit.setText(oldText);
}
updatePollOptionHints();
pollDurationView.setText(getString(R.string.compose_poll_duration, pollDurationStr));
}else{
pollDurationView.setText(getString(R.string.compose_poll_duration, pollDurationStr=getResources().getQuantityString(R.plurals.x_days, 1, 1)));
}
// TODO save and restore media attachments (when design is ready)
return view;
}
@Override
public void onSaveInstanceState(Bundle outState){
super.onSaveInstanceState(outState);
if(!pollOptions.isEmpty()){
ArrayList<String> opts=new ArrayList<>();
for(DraftPollOption opt:pollOptions){
opts.add(opt.edit.getText().toString());
}
outState.putStringArrayList("pollOptions", opts);
outState.putInt("pollDuration", pollDuration);
outState.putString("pollDurationStr", pollDurationStr);
}
}
@Override
public void onResume(){
super.onResume();
@ -592,7 +630,7 @@ public class ComposeFragment extends ToolbarFragment implements OnBackPressedLis
case 7 -> 7*24*3600;
default -> throw new IllegalStateException("Unexpected value: "+item.getItemId());
};
pollDurationView.setText(getString(R.string.compose_poll_duration, item.getTitle()));
pollDurationView.setText(getString(R.string.compose_poll_duration, pollDurationStr=item.getTitle().toString()));
return true;
});
menu.show();

View File

@ -48,6 +48,24 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
accountID=getArguments().getString("account");
setRetainInstance(true);
Bundle args=new Bundle();
args.putString("account", accountID);
homeTimelineFragment=new HomeTimelineFragment();
homeTimelineFragment.setArguments(args);
args=new Bundle(args);
args.putBoolean("noAutoLoad", true);
searchFragment=new SearchFragment();
searchFragment.setArguments(args);
notificationsFragment=new NotificationsFragment();
notificationsFragment.setArguments(args);
args=new Bundle(args);
args.putParcelable("profileAccount", Parcels.wrap(AccountSessionManager.getInstance().getAccount(accountID).self));
args.putBoolean("noAutoLoad", true);
profileFragment=new ProfileFragment();
profileFragment.setArguments(args);
}
@Nullable
@ -76,28 +94,16 @@ public class HomeFragment extends AppKitFragment implements OnBackPressedListene
Account self=AccountSessionManager.getInstance().getAccount(accountID).self;
ViewImageLoader.load(tabBarAvatar, null, new UrlImageLoaderRequest(self.avatar, V.dp(28), V.dp(28)));
Bundle args=new Bundle();
args.putString("account", accountID);
homeTimelineFragment=new HomeTimelineFragment();
homeTimelineFragment.setArguments(args);
args=new Bundle(args);
args.putBoolean("noAutoLoad", true);
searchFragment=new SearchFragment();
searchFragment.setArguments(args);
notificationsFragment=new NotificationsFragment();
notificationsFragment.setArguments(args);
args=new Bundle(args);
args.putParcelable("profileAccount", Parcels.wrap(AccountSessionManager.getInstance().getAccount(accountID).self));
args.putBoolean("noAutoLoad", true);
profileFragment=new ProfileFragment();
profileFragment.setArguments(args);
if(savedInstanceState==null){
getChildFragmentManager().beginTransaction()
.add(R.id.fragment_wrap, homeTimelineFragment)
.add(R.id.fragment_wrap, searchFragment).hide(searchFragment)
.add(R.id.fragment_wrap, notificationsFragment).hide(notificationsFragment)
.add(R.id.fragment_wrap, profileFragment).hide(profileFragment)
.commit();
}else{
tabBar.selectTab(currentTab);
}
return content;
}

View File

@ -20,6 +20,7 @@ import org.joinmastodon.android.R;
import org.joinmastodon.android.model.AccountField;
import org.joinmastodon.android.ui.text.CustomEmojiSpan;
import org.joinmastodon.android.ui.utils.SimpleTextWatcher;
import org.joinmastodon.android.ui.utils.UiUtils;
import org.joinmastodon.android.ui.views.LinkedTextView;
import java.util.Collections;
@ -164,7 +165,7 @@ public class ProfileAboutFragment extends Fragment{
public BaseViewHolder(int layout){
super(getActivity(), layout, list);
background.getPaint().setColor(getResources().getColor(R.color.gray_50));
background.getPaint().setColor(UiUtils.getThemeColor(getActivity(), R.attr.colorBackgroundLight));
itemView.setBackground(background);
}

View File

@ -99,6 +99,7 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
private View postsBtn, followersBtn, followingBtn;
private EditText nameEdit, bioEdit;
private ProgressBar actionProgress;
private FrameLayout[] tabViews;
private Account account;
private String accountID;
@ -114,10 +115,17 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
super(R.layout.loader_fragment_overlay_toolbar);
}
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setRetainInstance(true);
accountID=getArguments().getString("account");
}
@Override
public void onAttach(Activity activity){
super.onAttach(activity);
accountID=getArguments().getString("account");
setHasOptionsMenu(true);
if(!getArguments().getBoolean("noAutoLoad", false))
loadData();
@ -159,6 +167,31 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
});
avatar.setClipToOutline(true);
FrameLayout sizeWrapper=new FrameLayout(getActivity()){
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
Toolbar toolbar=getToolbar();
pager.getLayoutParams().height=MeasureSpec.getSize(heightMeasureSpec)-getPaddingTop()-getPaddingBottom()-toolbar.getLayoutParams().height-statusBarHeight-V.dp(38);
coverGradient.setTopPadding(statusBarHeight+toolbar.getLayoutParams().height);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
};
tabViews=new FrameLayout[4];
for(int i=0;i<tabViews.length;i++){
FrameLayout tabView=new FrameLayout(getActivity());
tabView.setId(switch(i){
case 0 -> R.id.profile_posts;
case 1 -> R.id.profile_posts_with_replies;
case 2 -> R.id.profile_media;
case 3 -> R.id.profile_about;
default -> throw new IllegalStateException("Unexpected value: "+i);
});
tabView.setVisibility(View.GONE);
sizeWrapper.addView(tabView); // needed so the fragment manager will have somewhere to restore the tab fragment
tabViews[i]=tabView;
}
pager.setOffscreenPageLimit(4);
pager.setAdapter(new ProfilePagerAdapter());
pager.getLayoutParams().height=getResources().getDisplayMetrics().heightPixels;
@ -174,18 +207,9 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
scrollView.setScrollableChildSupplier(this::getScrollableRecyclerView);
FrameLayout sizeWrapper=new FrameLayout(getActivity()){
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
Toolbar toolbar=getToolbar();
pager.getLayoutParams().height=MeasureSpec.getSize(heightMeasureSpec)-getPaddingTop()-getPaddingBottom()-toolbar.getLayoutParams().height-statusBarHeight-V.dp(38);
coverGradient.setTopPadding(statusBarHeight+toolbar.getLayoutParams().height);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
};
sizeWrapper.addView(content);
tabbar.setTabTextColors(getResources().getColor(R.color.gray_500), getResources().getColor(R.color.gray_800));
tabbar.setTabTextColors(UiUtils.getThemeColor(getActivity(), android.R.attr.textColorSecondary), UiUtils.getThemeColor(getActivity(), android.R.attr.textColorPrimary));
tabbar.setTabTextSize(V.dp(16));
new TabLayoutMediator(tabbar, pager, new TabLayoutMediator.TabConfigurationStrategy(){
@Override
@ -224,6 +248,17 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
}
@Override
public void dataLoaded(){
postsFragment=AccountTimelineFragment.newInstance(accountID, account, GetAccountStatuses.Filter.DEFAULT, true);
postsWithRepliesFragment=AccountTimelineFragment.newInstance(accountID, account, GetAccountStatuses.Filter.INCLUDE_REPLIES, false);
mediaFragment=AccountTimelineFragment.newInstance(accountID, account, GetAccountStatuses.Filter.MEDIA, false);
aboutFragment=new ProfileAboutFragment();
aboutFragment.setFields(fields);
pager.getAdapter().notifyDataSetChanged();
super.dataLoaded();
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState){
super.onViewCreated(view, savedInstanceState);
@ -258,6 +293,11 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
}
}
@Override
public void onDestroyView(){
super.onDestroyView();
}
@Override
public void onConfigurationChanged(Configuration newConfig){
super.onConfigurationChanged(newConfig);
@ -739,31 +779,23 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
@NonNull
@Override
public SimpleViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType){
FrameLayout view=new FrameLayout(getActivity());
view.setId(View.generateViewId());
FrameLayout view=tabViews[viewType];
((ViewGroup)view.getParent()).removeView(view);
view.setVisibility(View.VISIBLE);
view.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
return new SimpleViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull SimpleViewHolder holder, int position){
Fragment fragment=switch(position){
case 0 -> postsFragment=AccountTimelineFragment.newInstance(accountID, account, GetAccountStatuses.Filter.DEFAULT, true);
case 1 -> postsWithRepliesFragment=AccountTimelineFragment.newInstance(accountID, account, GetAccountStatuses.Filter.INCLUDE_REPLIES, false);
case 2 -> mediaFragment=AccountTimelineFragment.newInstance(accountID, account, GetAccountStatuses.Filter.MEDIA, false);
case 3 -> {
aboutFragment=new ProfileAboutFragment();
aboutFragment.setFields(fields);
yield aboutFragment;
}
default -> throw new IllegalArgumentException();
};
getChildFragmentManager().beginTransaction().add(holder.itemView.getId(), fragment).commit();
Fragment fragment=getFragmentForPage(position);
if(!fragment.isAdded())
getChildFragmentManager().beginTransaction().add(holder.itemView.getId(), getFragmentForPage(position)).commit();
}
@Override
public int getItemCount(){
return 4;
return loaded ? 4 : 0;
}
@Override

View File

@ -22,15 +22,15 @@ public class ThreadFragment extends StatusListFragment{
private Status mainStatus;
@Override
public void onAttach(Activity activity){
super.onAttach(activity);
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
mainStatus=Parcels.unwrap(getArguments().getParcelable("status"));
Account inReplyToAccount=Parcels.unwrap(getArguments().getParcelable("inReplyToAccount"));
if(inReplyToAccount!=null)
knownAccounts.put(inReplyToAccount.id, inReplyToAccount);
setTitle(HtmlParser.parseCustomEmoji(getString(R.string.post_from_user, mainStatus.account.displayName), mainStatus.account.emojis));
data.add(mainStatus);
onAppendItems(Collections.singletonList(mainStatus));
setTitle(HtmlParser.parseCustomEmoji(getString(R.string.post_from_user, mainStatus.account.displayName), mainStatus.account.emojis));
}
@Override

View File

@ -14,6 +14,7 @@ import android.widget.TextView;
import org.joinmastodon.android.R;
import org.joinmastodon.android.model.Emoji;
import org.joinmastodon.android.model.EmojiCategory;
import org.joinmastodon.android.ui.utils.UiUtils;
import java.util.List;
import java.util.function.Consumer;
@ -91,7 +92,7 @@ public class CustomEmojiPopupKeyboard extends PopupKeyboard{
}
}
});
list.setBackgroundResource(R.color.gray_100);
list.setBackgroundColor(UiUtils.getThemeColor(activity, android.R.attr.colorBackground));
list.setSelector(null);
return list;

View File

@ -50,9 +50,9 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{
favorite=findViewById(R.id.favorite);
share=findViewById(R.id.share);
if(Build.VERSION.SDK_INT<Build.VERSION_CODES.N){
UiUtils.fixCompoundDrawableTintOnAndroid6(reply, R.color.text_secondary);
UiUtils.fixCompoundDrawableTintOnAndroid6(boost, R.color.boost_icon);
UiUtils.fixCompoundDrawableTintOnAndroid6(favorite, R.color.favorite_icon);
UiUtils.fixCompoundDrawableTintOnAndroid6(reply);
UiUtils.fixCompoundDrawableTintOnAndroid6(boost);
UiUtils.fixCompoundDrawableTintOnAndroid6(favorite);
}
findViewById(R.id.reply_btn).setOnClickListener(this::onReplyClick);
findViewById(R.id.boost_btn).setOnClickListener(this::onBoostClick);

View File

@ -54,14 +54,14 @@ public class ReblogOrReplyLineStatusDisplayItem extends StatusDisplayItem{
public Holder(Activity activity, ViewGroup parent){
super(activity, R.layout.display_item_reblog_or_reply_line, parent);
text=findViewById(R.id.text);
if(Build.VERSION.SDK_INT<Build.VERSION_CODES.N)
UiUtils.fixCompoundDrawableTintOnAndroid6(text, R.color.text_secondary);
}
@Override
public void onBind(ReblogOrReplyLineStatusDisplayItem item){
text.setText(item.text);
text.setCompoundDrawablesRelativeWithIntrinsicBounds(item.icon, 0, 0, 0);
if(Build.VERSION.SDK_INT<Build.VERSION_CODES.N)
UiUtils.fixCompoundDrawableTintOnAndroid6(text);
}
@Override

View File

@ -2,6 +2,7 @@ package org.joinmastodon.android.ui.utils;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
@ -25,6 +26,7 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import androidx.annotation.AttrRes;
import androidx.annotation.ColorRes;
import androidx.browser.customtabs.CustomTabsIntent;
import me.grishka.appkit.imageloader.ViewImageLoader;
@ -91,14 +93,13 @@ public class UiUtils{
* Android 6.0 has a bug where start and end compound drawables don't get tinted.
* This works around it by setting the tint colors directly to the drawables.
* @param textView
* @param color
*/
public static void fixCompoundDrawableTintOnAndroid6(TextView textView, @ColorRes int color){
public static void fixCompoundDrawableTintOnAndroid6(TextView textView){
Drawable[] drawables=textView.getCompoundDrawablesRelative();
for(int i=0;i<drawables.length;i++){
if(drawables[i]!=null){
Drawable tinted=drawables[i].mutate();
tinted.setTintList(textView.getContext().getColorStateList(color));
tinted.setTintList(textView.getTextColors());
drawables[i]=tinted;
}
}
@ -153,4 +154,11 @@ public class UiUtils{
}, null, new UrlImageLoaderRequest(emoji.getKey().url, emojiSize, emojiSize), null, false, true);
}
}
public static int getThemeColor(Context context, @AttrRes int attr){
TypedArray ta=context.obtainStyledAttributes(new int[]{attr});
int color=ta.getColor(0, 0xff00ff00);
ta.recycle();
return color;
}
}

View File

@ -1,6 +1,7 @@
package org.joinmastodon.android.ui.views;
import android.content.Context;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
@ -10,6 +11,7 @@ import org.joinmastodon.android.R;
import java.util.function.IntConsumer;
import androidx.annotation.IdRes;
import androidx.annotation.Nullable;
public class TabBar extends LinearLayout{
@IdRes
@ -52,4 +54,10 @@ public class TabBar extends LinearLayout{
public void setListener(IntConsumer listener){
this.listener=listener;
}
public void selectTab(int id){
findViewById(selectedTabID).setSelected(false);
selectedTabID=id;
findViewById(selectedTabID).setSelected(true);
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/boost_selected" android:state_selected="true"/>
<item android:color="@color/text_secondary" android:state_enabled="true"/>
<item android:color="@color/text_secondary_alpha50"/>
<item android:color="?android:textColorSecondary" android:state_enabled="true"/>
<item android:color="?android:textColorSecondary" android:alpha="0.3"/>
</selector>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/gray_800" android:state_enabled="true"/>
<item android:color="@color/gray_800_alpha50"/>
<item android:color="?colorButtonPrimary" android:state_enabled="true"/>
<item android:color="?colorButtonPrimary" android:alpha="0.5"/>
</selector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?colorButtonSecondary" android:state_enabled="true"/>
<item android:color="?colorButtonSecondary" android:alpha="0.5"/>
</selector>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/favorite_selected" android:state_selected="true"/>
<item android:color="@color/text_secondary"/>
<item android:color="?android:textColorSecondary"/>
</selector>

View File

@ -4,7 +4,7 @@
<ripple android:color="@color/highlight_over_dark">
<item>
<shape>
<solid android:color="@color/gray_600"/>
<solid android:color="@color/button_bg_secondary"/>
<corners android:radius="10dp"/>
<padding android:left="16dp" android:right="16dp" android:top="8dp" android:bottom="8dp"/>
</shape>

View File

@ -3,7 +3,7 @@
android:color="?android:colorControlHighlight">
<item>
<shape>
<solid android:color="@color/secondary"/>
<solid android:color="?colorSecondary"/>
<corners android:radius="16dp"/>
</shape>
</item>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/gray_100"/>
<solid android:color="?android:colorBackground"/>
<corners android:radius="10dp"/>
</shape>

View File

@ -2,7 +2,7 @@
<ripple xmlns:android="http://schemas.android.com/apk/res/android" android:color="?android:colorControlHighlight">
<item>
<shape>
<solid android:color="@color/gray_100"/>
<solid android:color="?android:colorBackground"/>
<corners android:radius="10dp"/>
</shape>
</item>

View File

@ -5,7 +5,7 @@
<item android:gravity="bottom">
<shape>
<size android:height="1dp"/>
<solid android:color="@color/primary_700"/>
<solid android:color="?android:colorAccent"/>
</shape>
</item>
</layer-list>

View File

@ -29,6 +29,7 @@
android:paddingEnd="16dp"
android:textAppearance="@style/m3_title_medium"
android:inputType="textCapSentences"
android:saveEnabled="false"
android:singleLine="true"/>
</LinearLayout>

View File

@ -19,7 +19,7 @@
android:layout_gravity="center"
android:drawableStart="@drawable/ic_fluent_chat_multiple_24_regular"
android:drawablePadding="8dp"
android:drawableTint="@color/text_secondary"
android:drawableTint="?android:textColorSecondary"
android:gravity="center_vertical"
android:textAppearance="@style/m3_label_large"
tools:text="123"/>
@ -89,7 +89,7 @@
android:layout_height="24dp"
android:layout_gravity="center"
android:src="@drawable/ic_fluent_share_24_regular"
android:tint="@color/text_secondary"
android:tint="?android:textColorSecondary"
android:gravity="center_vertical"/>
</FrameLayout>

View File

@ -34,6 +34,7 @@
android:ellipsize="end"
android:singleLine="true"
android:textAppearance="@style/m3_title_medium"
android:textAlignment="viewStart"
tools:text="Eugen" />
<org.joinmastodon.android.ui.views.HeaderSubtitleLinearLayout

View File

@ -6,4 +6,4 @@
android:paddingRight="16dp"
android:paddingBottom="8dp"
android:textAppearance="@style/m3_label_large"
android:textColor="@color/gray_800" />
android:textColor="?android:textColorPrimary" />

View File

@ -13,7 +13,7 @@
android:layout_height="wrap_content"
android:textAppearance="@style/m3_title_small"
android:drawableStart="@drawable/ic_fluent_arrow_repeat_all_20_filled"
android:drawableTint="@color/gray_500"
android:drawableTint="?android:textColorSecondary"
android:drawablePadding="6dp"
android:singleLine="true"
android:ellipsize="end"/>

View File

@ -25,7 +25,7 @@
android:layout_marginTop="16dp"
android:textAppearance="@style/m3_title_small"
android:drawableStart="@drawable/ic_fluent_arrow_reply_20_filled"
android:drawableTint="@color/gray_500"
android:drawableTint="?android:textColorSecondary"
android:drawablePadding="6dp"
android:singleLine="true"
android:ellipsize="end"/>
@ -117,7 +117,7 @@
android:layout_marginRight="16dp"
android:layout_marginBottom="8dp"
android:textAppearance="@style/m3_label_large"
android:textColor="@color/gray_800"
android:textColor="?android:textColorPrimary"
tools:text="Duration: 7 days"/>
</LinearLayout>
@ -135,7 +135,7 @@
android:layout_height="48dp"
android:orientation="horizontal"
android:gravity="center_vertical"
android:background="@color/gray_25"
android:background="?colorBackgroundLightest"
android:elevation="2dp"
android:outlineProvider="bounds"
android:paddingLeft="16dp"
@ -207,7 +207,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="@style/m3_body_large"
android:textColor="@color/gray_500"
android:textColor="?android:textColorSecondary"
tools:text="500"/>
</LinearLayout>

View File

@ -147,7 +147,7 @@
style="?android:progressBarStyleSmall"
android:elevation="10dp"
android:outlineProvider="none"
android:indeterminateTint="@color/text_button"
android:indeterminateTint="?colorButtonText"
android:visibility="gone"/>
</FrameLayout>
@ -161,6 +161,7 @@
android:layout_marginTop="16dp"
android:layout_toStartOf="@id/profile_action_btn_wrap"
android:textAppearance="@style/m3_headline_small"
android:textAlignment="viewStart"
tools:text="Eugen" />
<TextView
@ -171,7 +172,7 @@
android:layout_marginStart="16dp"
android:layout_toStartOf="@id/profile_action_btn_wrap"
android:textAppearance="@style/m3_title_medium"
android:textColor="@color/light_ui_action_button"
android:textColor="?android:textColorSecondary"
tools:text="\@Gargron"/>
<org.joinmastodon.android.ui.views.LinkedTextView
@ -227,6 +228,7 @@
app:tabMinWidth="0dp"
app:tabIndicator="@drawable/tab_indicator_inset"
app:tabIndicatorAnimationMode="elastic"
app:tabIndicatorColor="?android:textColorPrimary"
app:tabMode="scrollable"
app:tabGravity="start"/>
<androidx.viewpager2.widget.ViewPager2

View File

@ -7,7 +7,7 @@
android:ellipsize="end"
android:fontFamily="sans-serif-medium"
android:textSize="12dp"
android:textColor="@color/gray_500"
android:textColor="?android:textColorSecondary"
android:textAllCaps="true"
android:paddingTop="24dp"
android:paddingBottom="12dp"

View File

@ -4,7 +4,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/gray_50"
android:background="?colorBackgroundLight"
android:elevation="2dp"
android:outlineProvider="background"
android:padding="16dp">

View File

@ -10,7 +10,7 @@
android:layout_height="24dp"
android:layout_gravity="start|center_vertical"
android:layout_marginStart="16dp"
android:backgroundTint="@color/gray_900"
android:backgroundTint="?colorDarkIcon"
android:background="@drawable/ic_fluent_add_circle_24_regular"/>
</FrameLayout>

View File

@ -4,7 +4,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/gray_50"
android:background="?colorBackgroundLight"
android:elevation="2dp"
android:outlineProvider="background"
android:padding="16dp">

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<attr name="colorButtonPrimary" format="color"/>
<attr name="colorButtonSecondary" format="color"/>
<attr name="colorButtonText" format="color"/>
<attr name="colorSecondary" format="color"/>
<attr name="colorBackgroundLight" format="color"/>
<attr name="colorBackgroundLightest" format="color"/>
<attr name="colorDarkIcon" format="color"/>
</resources>

View File

@ -26,8 +26,6 @@
<color name="gray_800_alpha50">#80282C37</color>
<color name="light_ui_action_button">#606984</color>
<color name="text_primary">@color/gray_800</color>
<color name="text_secondary">@color/gray_500</color>
<color name="secondary">#E9EDF2</color>
<color name="base">#282C37</color>
<color name="text_secondary_alpha50">#80667085</color>

View File

@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="header" type="id"/>
<item name="profile_posts" type="id"/>
<item name="profile_posts_with_replies" type="id"/>
<item name="profile_media" type="id"/>
<item name="profile_about" type="id"/>
</resources>

View File

@ -9,14 +9,25 @@
<item name="android:windowBackground">@color/white</item>
<item name="android:statusBarColor">@color/actionbar_bg</item>
<item name="android:navigationBarColor">@color/navigation_bar_bg</item>
<item name="android:colorAccent">@color/gray_800</item>
<item name="android:colorPrimary">@color/gray_800</item>
<item name="android:colorBackground">@color/gray_100</item>
<item name="android:actionBarTheme">@style/Theme.Mastodon.Toolbar</item>
<item name="android:buttonStyle">@style/Widget.Mastodon.Button</item>
<item name="android:alertDialogTheme">@style/Theme.Mastodon.Dialog.Alert</item>
<item name="appkitBackDrawable">@drawable/ic_fluent_arrow_left_24_regular</item>
<item name="android:splitMotionEvents">false</item>
<!-- colors -->
<item name="android:colorAccent">@color/primary_700</item>
<item name="android:colorPrimary">@color/gray_800</item>
<item name="android:colorBackground">@color/gray_100</item>
<item name="android:textColorPrimary">@color/gray_800</item>
<item name="android:textColorSecondary">@color/gray_500</item>
<item name="colorButtonPrimary">@color/gray_800</item>
<item name="colorButtonSecondary">@color/gray_600</item>
<item name="colorButtonText">@color/gray_50</item>
<item name="colorSecondary">#E9EDF2</item>
<item name="colorBackgroundLight">@color/gray_50</item>
<item name="colorBackgroundLightest">@color/gray_25</item>
<item name="colorDarkIcon">@color/gray_900</item>
</style>
<style name="Theme.Mastodon.Toolbar" parent="android:ThemeOverlay.Material.ActionBar">
@ -40,7 +51,7 @@
<item name="android:textAllCaps">false</item>
<item name="android:background">@drawable/bg_button</item>
<item name="android:textAppearance">@style/m3_label_large</item>
<item name="android:textColor">@color/gray_50</item>
<item name="android:textColor">?colorButtonText</item>
<item name="android:minHeight">36dp</item>
<item name="android:minWidth">0px</item>
</style>
@ -53,8 +64,21 @@
<item name="android:windowTitleStyle">@style/alert_title</item>
<item name="android:dialogPreferredPadding">24dp</item>
<item name="android:windowBackground">@drawable/bg_alert</item>
<item name="android:colorBackground">@color/gray_100</item>
<item name="android:buttonBarButtonStyle">@style/Widget.Mastodon.ButtonBarButton</item>
<!-- colors -->
<item name="android:colorAccent">@color/primary_700</item>
<item name="android:colorPrimary">@color/gray_800</item>
<item name="android:colorBackground">@color/gray_100</item>
<item name="android:textColorPrimary">@color/gray_800</item>
<item name="android:textColorSecondary">@color/gray_500</item>
<item name="colorButtonPrimary">@color/gray_800</item>
<item name="colorButtonSecondary">@color/gray_600</item>
<item name="colorButtonText">@color/gray_50</item>
<item name="colorSecondary">#E9EDF2</item>
<item name="colorBackgroundLight">@color/gray_50</item>
<item name="colorBackgroundLightest">@color/gray_25</item>
<item name="colorDarkIcon">@color/gray_900</item>
</style>
<style name="Widget.Mastodon.ButtonBarButton" parent="android:Widget.Material.Button.Borderless">
@ -64,11 +88,11 @@
<item name="android:minWidth">0px</item>
<item name="android:background">@drawable/bg_alert_button</item>
<item name="android:textAppearance">@style/m3_label_large</item>
<item name="android:textColor">@color/text_primary</item>
<item name="android:textColor">?android:textColorPrimary</item>
</style>
<style name="alert_title">
<item name="android:textColor">@color/text_primary</item>
<item name="android:textColor">?android:textColorPrimary</item>
<item name="android:textSize">24dp</item>
<item name="android:minHeight">38dp</item>
<item name="android:gravity">bottom</item>
@ -76,43 +100,43 @@
<style name="m3_body_large">
<item name="android:textSize">16dp</item>
<item name="android:textColor">@color/text_primary</item>
<item name="android:textColor">?android:textColorPrimary</item>
</style>
<style name="m3_body_medium">
<item name="android:textSize">14dp</item>
<item name="android:textColor">@color/text_primary</item>
<item name="android:textColor">?android:textColorPrimary</item>
</style>
<style name="m3_title_medium">
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textSize">16dp</item>
<item name="android:textColor">@color/text_primary</item>
<item name="android:textColor">?android:textColorPrimary</item>
</style>
<style name="m3_title_small">
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textSize">14dp</item>
<item name="android:textColor">@color/text_secondary</item>
<item name="android:textColor">?android:textColorSecondary</item>
</style>
<style name="m3_label_medium">
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textSize">12dp</item>
<item name="android:textColor">@color/text_primary</item>
<item name="android:textColor">?android:textColorPrimary</item>
<item name="android:lineSpacingMultiplier">1.14</item>
</style>
<style name="m3_label_large">
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textColor">@color/text_secondary</item>
<item name="android:textColor">?android:textColorSecondary</item>
<item name="android:textSize">14dp</item>
</style>
<style name="m3_title_large">
<item name="android:fontFamily">sans-serif-medium</item>
<item name="android:textSize">22dp</item>
<item name="android:textColor">@color/text_primary</item>
<item name="android:textColor">?android:textColorPrimary</item>
</style>
<style name="m3_headline_small">