Tab bar and stuff

This commit is contained in:
Grishka 2022-02-03 11:01:34 +03:00
parent a1dee1fc88
commit 20d3a62747
25 changed files with 364 additions and 22 deletions

View File

@ -1,21 +1,44 @@
package org.joinmastodon.android.fragments;
import android.app.Fragment;
import android.graphics.Outline;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.view.WindowInsets;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import org.joinmastodon.android.R;
import org.joinmastodon.android.api.session.AccountSessionManager;
import org.joinmastodon.android.model.Account;
import org.joinmastodon.android.ui.views.TabBar;
import org.parceler.Parcels;
import androidx.annotation.IdRes;
import androidx.annotation.Nullable;
import me.grishka.appkit.fragments.AppKitFragment;
import me.grishka.appkit.fragments.LoaderFragment;
import me.grishka.appkit.imageloader.ViewImageLoader;
import me.grishka.appkit.imageloader.requests.UrlImageLoaderRequest;
import me.grishka.appkit.utils.V;
import me.grishka.appkit.views.FragmentRootLinearLayout;
public class HomeFragment extends AppKitFragment{
private FragmentRootLinearLayout content;
private HomeTimelineFragment homeTimelineFragment;
private NotificationsFragment notificationsFragment;
private SearchFragment searchFragment;
private ProfileFragment profileFragment;
private TabBar tabBar;
private View tabBarWrap;
private ImageView tabBarAvatar;
@IdRes
private int currentTab=R.id.tab_home;
private String accountID;
@ -35,11 +58,42 @@ public class HomeFragment extends AppKitFragment{
fragmentContainer.setId(R.id.fragment_wrap);
content.addView(fragmentContainer, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f));
inflater.inflate(R.layout.tab_bar, content);
tabBar=content.findViewById(R.id.tabbar);
tabBar.setListener(this::onTabSelected);
tabBarWrap=content.findViewById(R.id.tabbar_wrap);
tabBarAvatar=tabBar.findViewById(R.id.tab_profile_ava);
tabBarAvatar.setOutlineProvider(new ViewOutlineProvider(){
@Override
public void getOutline(View view, Outline outline){
outline.setOval(0, 0, view.getWidth(), view.getHeight());
}
});
tabBarAvatar.setClipToOutline(true);
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);
getChildFragmentManager().beginTransaction().add(R.id.fragment_wrap, homeTimelineFragment).commit();
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);
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();
return content;
}
@ -47,11 +101,51 @@ public class HomeFragment extends AppKitFragment{
@Override
public void onHiddenChanged(boolean hidden){
super.onHiddenChanged(hidden);
homeTimelineFragment.onHiddenChanged(hidden);
fragmentForTab(currentTab).onHiddenChanged(hidden);
}
@Override
public boolean wantsLightStatusBar(){
return true;
}
@Override
public boolean wantsLightNavigationBar(){
return true;
}
@Override
public void onApplyWindowInsets(WindowInsets insets){
if(Build.VERSION.SDK_INT>=27){
int inset=insets.getSystemWindowInsetBottom();
tabBarWrap.setPadding(0, 0, 0, inset>0 ? Math.max(inset, V.dp(36)) : 0);
super.onApplyWindowInsets(insets.replaceSystemWindowInsets(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), 0));
}else{
super.onApplyWindowInsets(insets);
}
}
private Fragment fragmentForTab(@IdRes int tab){
if(tab==R.id.tab_home){
return homeTimelineFragment;
}else if(tab==R.id.tab_search){
return searchFragment;
}else if(tab==R.id.tab_notifications){
return notificationsFragment;
}else if(tab==R.id.tab_profile){
return profileFragment;
}
throw new IllegalArgumentException();
}
private void onTabSelected(@IdRes int tab){
Fragment newFragment=fragmentForTab(tab);
getChildFragmentManager().beginTransaction().hide(fragmentForTab(currentTab)).show(newFragment).commit();
if(newFragment instanceof LoaderFragment){
LoaderFragment lf=(LoaderFragment) newFragment;
if(!lf.loaded)
lf.loadData();
}
currentTab=tab;
}
}

View File

@ -1,12 +1,17 @@
package org.joinmastodon.android.fragments;
import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.Toolbar;
import com.squareup.otto.Subscribe;
@ -34,7 +39,6 @@ public class HomeTimelineFragment extends StatusListFragment{
@Override
public void onAttach(Activity activity){
super.onAttach(activity);
setTitle(R.string.app_name);
setHasOptionsMenu(true);
loadData();
}
@ -56,6 +60,7 @@ public class HomeTimelineFragment extends StatusListFragment{
super.onViewCreated(view, savedInstanceState);
fab=view.findViewById(R.id.fab);
fab.setOnClickListener(this::onFabClick);
updateToolbarLogo();
}
@Override
@ -65,20 +70,26 @@ public class HomeTimelineFragment extends StatusListFragment{
@Override
public boolean onOptionsItemSelected(MenuItem item){
Bundle args=new Bundle();
args.putString("account", accountID);
int id=item.getItemId();
if(id==R.id.new_toot){
Nav.go(getActivity(), ComposeFragment.class, args);
}else if(id==R.id.notifications){
Nav.go(getActivity(), NotificationsFragment.class, args);
}else if(id==R.id.my_profile){
args.putParcelable("profileAccount", Parcels.wrap(AccountSessionManager.getInstance().getAccount(accountID).self));
Nav.go(getActivity(), ProfileFragment.class, args);
}
// Bundle args=new Bundle();
// args.putString("account", accountID);
// int id=item.getItemId();
// if(id==R.id.new_toot){
// Nav.go(getActivity(), ComposeFragment.class, args);
// }else if(id==R.id.notifications){
// Nav.go(getActivity(), NotificationsFragment.class, args);
// }else if(id==R.id.my_profile){
// args.putParcelable("profileAccount", Parcels.wrap(AccountSessionManager.getInstance().getAccount(accountID).self));
// Nav.go(getActivity(), ProfileFragment.class, args);
// }
return true;
}
@Override
public void onConfigurationChanged(Configuration newConfig){
super.onConfigurationChanged(newConfig);
updateToolbarLogo();
}
@Subscribe
public void onStatusCreated(StatusCreatedEvent ev){
prependItems(Collections.singletonList(ev.status));
@ -89,4 +100,12 @@ public class HomeTimelineFragment extends StatusListFragment{
args.putString("account", accountID);
Nav.go(getActivity(), ComposeFragment.class, args);
}
private void updateToolbarLogo(){
ImageView logo=new ImageView(getActivity());
logo.setScaleType(ImageView.ScaleType.CENTER);
logo.setImageResource(R.drawable.logo);
Toolbar toolbar=getToolbar();
toolbar.addView(logo, new Toolbar.LayoutParams(Gravity.CENTER));
}
}

View File

@ -19,7 +19,6 @@ public class NotificationsFragment extends BaseStatusListFragment<Notification>{
public void onAttach(Activity activity){
super.onAttach(activity);
setTitle(R.string.notifications);
loadData();
}
@Override

View File

@ -19,7 +19,8 @@ public class ProfileFragment extends StatusListFragment{
super.onAttach(activity);
user=Parcels.unwrap(getArguments().getParcelable("profileAccount"));
setTitle("@"+user.acct);
loadData();
if(!getArguments().getBoolean("noAutoLoad"))
loadData();
}
@Override

View File

@ -0,0 +1,15 @@
package org.joinmastodon.android.fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import me.grishka.appkit.fragments.ToolbarFragment;
public class SearchFragment extends ToolbarFragment{
@Override
public View onCreateContentView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
return new View(getActivity());
}
}

View File

@ -0,0 +1,55 @@
package org.joinmastodon.android.ui.views;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import org.joinmastodon.android.R;
import java.util.function.IntConsumer;
import androidx.annotation.IdRes;
public class TabBar extends LinearLayout{
@IdRes
private int selectedTabID;
private IntConsumer listener;
public TabBar(Context context){
this(context, null);
}
public TabBar(Context context, AttributeSet attrs){
this(context, attrs, 0);
}
public TabBar(Context context, AttributeSet attrs, int defStyle){
super(context, attrs, defStyle);
}
@Override
public void onViewAdded(View child){
super.onViewAdded(child);
if(child.getId()!=0){
if(selectedTabID==0){
selectedTabID=child.getId();
child.setSelected(true);
}
child.setOnClickListener(this::onChildClick);
}
}
private void onChildClick(View v){
if(v.getId()==selectedTabID)
return;
findViewById(selectedTabID).setSelected(false);
v.setSelected(true);
selectedTabID=v.getId();
listener.accept(selectedTabID);
}
public void setListener(IntConsumer listener){
this.listener=listener;
}
}

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<layer-list>
<item android:gravity="center" android:width="29dp" android:height="29dp">
<shape android:shape="oval">
<stroke android:color="@color/gray_800" android:width="2dp"/>
</shape>
</item>
</layer-list>
</item>
</selector>

View File

@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="28dp" android:height="28dp" android:viewportWidth="28" android:viewportHeight="28">
<path android:pathData="M17.466 22.002c-0.244 1.697-1.703 3-3.466 3-1.764 0-3.223-1.303-3.466-3h6.932zM14 3c4.61 0 8.363 3.669 8.497 8.246v0.255h0.004v4.112l1.414 3.644c0.038 0.099 0.064 0.201 0.077 0.306l0.01 0.157c0 0.663-0.504 1.208-1.15 1.274L22.723 21H5.275c-0.159 0-0.316-0.03-0.464-0.087-0.618-0.24-0.943-0.907-0.77-1.532l0.04-0.125 1.417-3.644v-4.11C5.499 6.805 9.306 3 14 3z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector>

View File

@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="28dp" android:height="28dp" android:viewportWidth="28" android:viewportHeight="28">
<path android:pathData="M14 3c4.61 0 8.363 3.669 8.497 8.246l0.004 0.255v4.612l1.414 3.644c0.038 0.098 0.064 0.201 0.077 0.305l0.01 0.158c0 0.663-0.504 1.208-1.15 1.273l-0.13 0.007-5.22 0.001c0 1.934-1.568 3.502-3.502 3.502-1.87 0-3.397-1.465-3.496-3.31L10.498 21.5H5.275c-0.159 0-0.316-0.03-0.464-0.087-0.618-0.24-0.943-0.907-0.77-1.533l0.04-0.124 1.417-3.644v-4.61C5.499 6.805 9.306 3 14 3zm1.996 18.65L16 21.5l-4.002 0.002c0 1.105 0.897 2.002 2.002 2.002 1.055 0 1.92-0.817 1.996-1.853zM14 4.5c-3.786 0-6.87 3.005-6.997 6.76l-0.004 0.241v4.752c0 0.062-0.008 0.124-0.023 0.184l-0.028 0.088L5.596 20H22.4l-1.348-3.474c-0.022-0.058-0.037-0.118-0.045-0.18L21 16.254v-4.752C21.001 7.635 17.867 4.5 14 4.5z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!--~ Copyright (c) 2022. ~ Microsoft Corporation. All rights reserved.-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_fluent_alert_28_filled" android:state_activated="true"/>
<item android:drawable="@drawable/ic_fluent_alert_28_filled" android:state_checked="true"/>
<item android:drawable="@drawable/ic_fluent_alert_28_filled" android:state_selected="true"/>
<item android:drawable="@drawable/ic_fluent_alert_28_regular"/>
</selector>

View File

@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="28dp" android:height="28dp" android:viewportWidth="28" android:viewportHeight="28">
<path android:pathData="M12.592 3.498c0.823-0.66 1.993-0.66 2.816 0l7.75 6.217C23.69 10.142 24 10.787 24 11.47v11.28c0 1.243-1.007 2.25-2.25 2.25h-2.5C18.007 25 17 23.993 17 22.75v-6.5c0-0.414-0.336-0.75-0.75-0.75h-4.5c-0.414 0-0.75 0.336-0.75 0.75v6.5C11 23.993 9.993 25 8.75 25h-2.5C5.007 25 4 23.993 4 22.75V11.47c0-0.683 0.31-1.328 0.842-1.755l7.75-6.217z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector>

View File

@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="28dp" android:height="28dp" android:viewportWidth="28" android:viewportHeight="28">
<path android:pathData="M12.592 3.496c0.823-0.66 1.993-0.66 2.816 0l7.75 6.218C23.69 10.141 24 10.787 24 11.47v11.28c0 1.243-1.007 2.25-2.25 2.25h-3c-1.243 0-2.25-1.007-2.25-2.25v-6c0-0.413-0.336-0.75-0.75-0.75h-3.5c-0.414 0-0.75 0.336-0.75 0.75v6c0 1.243-1.007 2.25-2.25 2.25h-3C5.007 25 4 23.993 4 22.75V11.47c0-0.682 0.31-1.328 0.842-1.755l7.75-6.218zm1.877 1.17c-0.274-0.22-0.664-0.22-0.938 0l-7.75 6.218C5.603 11.027 5.5 11.242 5.5 11.47v11.28c0 0.415 0.336 0.75 0.75 0.75h3c0.414 0 0.75-0.335 0.75-0.75v-6c0-1.242 1.007-2.25 2.25-2.25h3.5c1.243 0 2.25 1.008 2.25 2.25v6c0 0.415 0.336 0.75 0.75 0.75h3c0.414 0 0.75-0.335 0.75-0.75V11.47c0-0.227-0.103-0.442-0.28-0.585l-7.75-6.218z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!--~ Copyright (c) 2022. ~ Microsoft Corporation. All rights reserved.-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_fluent_home_28_filled" android:state_activated="true"/>
<item android:drawable="@drawable/ic_fluent_home_28_filled" android:state_checked="true"/>
<item android:drawable="@drawable/ic_fluent_home_28_filled" android:state_selected="true"/>
<item android:drawable="@drawable/ic_fluent_home_28_regular"/>
</selector>

View File

@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="28dp" android:height="28dp" android:viewportWidth="28" android:viewportHeight="28">
<path android:pathData="M11.5 2c5.247 0 9.5 4.253 9.5 9.5 0 2.082-0.67 4.007-1.805 5.573l6.366 6.366c0.585 0.586 0.585 1.536 0 2.122-0.55 0.549-1.419 0.583-2.008 0.103L23.44 25.56l-6.366-6.366C15.507 20.33 13.582 21 11.5 21 6.253 21 2 16.747 2 11.5S6.253 2 11.5 2zm0 3C7.91 5 5 7.91 5 11.5S7.91 18 11.5 18s6.5-2.91 6.5-6.5S15.09 5 11.5 5z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector>

View File

@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="28dp" android:height="28dp" android:viewportWidth="28" android:viewportHeight="28">
<path android:pathData="M11.5 2.75c4.832 0 8.75 3.918 8.75 8.75 0 2.146-0.773 4.112-2.055 5.634l6.835 6.836c0.293 0.293 0.293 0.767 0 1.06-0.266 0.267-0.683 0.29-0.976 0.073L23.97 25.03l-6.836-6.835c-1.522 1.282-3.488 2.055-5.634 2.055-4.832 0-8.75-3.918-8.75-8.75s3.918-8.75 8.75-8.75zm0 1.5c-4.004 0-7.25 3.246-7.25 7.25s3.246 7.25 7.25 7.25 7.25-3.246 7.25-7.25-3.246-7.25-7.25-7.25z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!--~ Copyright (c) 2022. ~ Microsoft Corporation. All rights reserved.-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/ic_fluent_search_28_filled" android:state_activated="true"/>
<item android:drawable="@drawable/ic_fluent_search_28_filled" android:state_checked="true"/>
<item android:drawable="@drawable/ic_fluent_search_28_filled" android:state_selected="true"/>
<item android:drawable="@drawable/ic_fluent_search_28_regular"/>
</selector>

View File

@ -0,0 +1,3 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:pathData="M12.013 2.25c0.734 0.009 1.465 0.093 2.181 0.253 0.313 0.07 0.547 0.33 0.582 0.649l0.17 1.527c0.078 0.7 0.67 1.232 1.375 1.233 0.19 0 0.377-0.04 0.553-0.117l1.4-0.615c0.292-0.128 0.632-0.059 0.85 0.174 1.012 1.08 1.765 2.377 2.204 3.792 0.095 0.305-0.014 0.636-0.271 0.825l-1.242 0.916c-0.354 0.26-0.563 0.673-0.563 1.112 0 0.44 0.21 0.853 0.564 1.114l1.243 0.915c0.257 0.19 0.366 0.521 0.271 0.826-0.438 1.415-1.192 2.71-2.203 3.792-0.218 0.232-0.558 0.302-0.849 0.175l-1.406-0.617c-0.403-0.176-0.865-0.15-1.245 0.07-0.38 0.22-0.633 0.607-0.682 1.044l-0.169 1.526c-0.034 0.315-0.263 0.574-0.572 0.647-1.448 0.345-2.957 0.345-4.405 0-0.309-0.073-0.537-0.332-0.572-0.647l-0.17-1.524c-0.049-0.436-0.302-0.822-0.682-1.041-0.38-0.219-0.841-0.245-1.242-0.07l-1.407 0.617c-0.291 0.127-0.631 0.057-0.849-0.175-1.012-1.082-1.765-2.38-2.203-3.796-0.095-0.305 0.014-0.636 0.271-0.826l1.244-0.916c0.354-0.26 0.563-0.673 0.563-1.112 0-0.44-0.21-0.853-0.564-1.114L2.946 9.973c-0.258-0.19-0.367-0.521-0.272-0.826 0.439-1.415 1.192-2.711 2.205-3.792 0.217-0.233 0.557-0.302 0.849-0.174l1.4 0.615c0.403 0.177 0.866 0.15 1.248-0.073 0.38-0.22 0.634-0.609 0.683-1.045l0.17-1.526c0.035-0.319 0.27-0.58 0.582-0.65 0.718-0.159 1.45-0.243 2.202-0.252zm0 1.5c-0.454 0.005-0.907 0.044-1.355 0.117L10.55 4.844c-0.101 0.91-0.628 1.717-1.418 2.175-0.795 0.464-1.763 0.52-2.606 0.15L5.627 6.775C5.055 7.469 4.6 8.25 4.279 9.092l0.798 0.587C5.816 10.222 6.252 11.084 6.252 12c0 0.916-0.436 1.778-1.174 2.32l-0.8 0.59c0.32 0.841 0.776 1.625 1.349 2.32l0.905-0.396c0.838-0.366 1.8-0.312 2.592 0.144 0.792 0.457 1.32 1.263 1.425 2.174l0.108 0.984c0.89 0.15 1.799 0.15 2.689 0l0.108-0.984c0.101-0.91 0.63-1.72 1.422-2.178 0.794-0.458 1.758-0.512 2.597-0.145l0.905 0.397c0.572-0.695 1.027-1.478 1.347-2.318l-0.798-0.588c-0.739-0.543-1.175-1.405-1.175-2.322 0-0.916 0.436-1.778 1.174-2.32l0.797-0.588c-0.32-0.84-0.776-1.623-1.348-2.317L17.48 7.167c-0.366 0.162-0.76 0.245-1.16 0.245-1.47-0.002-2.703-1.109-2.863-2.568l-0.11-0.977c-0.445-0.073-0.893-0.112-1.333-0.117zM12 8.25c2.071 0 3.75 1.679 3.75 3.75 0 2.071-1.679 3.75-3.75 3.75-2.07 0-3.75-1.679-3.75-3.75 0-2.071 1.68-3.75 3.75-3.75zm0 1.5c-1.242 0-2.25 1.007-2.25 2.25s1.008 2.25 2.25 2.25c1.243 0 2.25-1.007 2.25-2.25S13.243 9.75 12 9.75z" android:fillColor="@color/fluent_default_icon_tint"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="110dp"
android:height="18dp"
android:viewportWidth="110"
android:viewportHeight="18">
<path
android:pathData="M18.406,9.999V17.878H15.287V10.231C15.287,8.618 14.609,7.8 13.254,7.8C11.755,7.8 11.004,8.771 11.004,10.69V14.876H7.903V10.69C7.903,8.771 7.151,7.8 5.653,7.8C4.297,7.8 3.619,8.618 3.619,10.231V17.878H0.5V9.999C0.5,8.389 0.91,7.109 1.733,6.162C2.581,5.215 3.693,4.73 5.072,4.73C6.668,4.73 7.877,5.344 8.676,6.572L9.453,7.876L10.23,6.572C11.029,5.344 12.238,4.73 13.834,4.73C15.214,4.73 16.325,5.215 17.174,6.162C17.997,7.109 18.406,8.389 18.406,9.999ZM29.152,13.916C29.795,13.235 30.105,12.378 30.105,11.345C30.105,10.311 29.795,9.454 29.152,8.798C28.532,8.118 27.745,7.79 26.791,7.79C25.838,7.79 25.051,8.118 24.431,8.798C23.811,9.454 23.501,10.311 23.501,11.345C23.501,12.378 23.811,13.235 24.431,13.916C25.051,14.571 25.838,14.899 26.791,14.899C27.745,14.899 28.532,14.571 29.152,13.916ZM30.105,5.042H33.181V17.647H30.105V16.16C29.176,17.395 27.888,18 26.219,18C24.622,18 23.263,17.37 22.118,16.084C20.998,14.798 20.426,13.21 20.426,11.345C20.426,9.504 20.998,7.916 22.118,6.63C23.263,5.345 24.622,4.689 26.219,4.689C27.888,4.689 29.176,5.294 30.105,6.529V5.042ZM43.528,11.118C44.434,11.798 44.888,12.756 44.864,13.966C44.864,15.252 44.41,16.26 43.481,16.966C42.551,17.647 41.431,18 40.072,18C37.616,18 35.947,16.992 35.065,15L37.735,13.412C38.093,14.496 38.879,15.05 40.072,15.05C41.168,15.05 41.717,14.697 41.717,13.966C41.717,13.437 41.001,12.958 39.547,12.58C38.999,12.429 38.546,12.277 38.188,12.151C37.688,11.95 37.258,11.723 36.901,11.445C36.019,10.765 35.566,9.857 35.566,8.698C35.566,7.462 35.995,6.479 36.853,5.773C37.735,5.042 38.808,4.689 40.095,4.689C42.146,4.689 43.648,5.571 44.625,7.361L42.003,8.874C41.621,8.017 40.978,7.588 40.095,7.588C39.166,7.588 38.713,7.941 38.713,8.622C38.713,9.151 39.428,9.63 40.882,10.008C42.003,10.26 42.885,10.639 43.528,11.118ZM53.304,8.168H50.61V13.412C50.61,14.042 50.848,14.42 51.301,14.597C51.635,14.723 52.303,14.748 53.304,14.697V17.647C51.23,17.899 49.728,17.698 48.846,17.017C47.964,16.361 47.534,15.151 47.534,13.412V8.168H45.46V5.042H47.534V2.496L50.61,1.513V5.042H53.304V8.168ZM63.103,13.84C63.723,13.185 64.033,12.353 64.033,11.344C64.033,10.336 63.723,9.504 63.103,8.849C62.483,8.193 61.721,7.866 60.791,7.866C59.861,7.866 59.098,8.193 58.478,8.849C57.882,9.529 57.572,10.361 57.572,11.344C57.572,12.328 57.882,13.16 58.478,13.84C59.098,14.496 59.861,14.823 60.791,14.823C61.721,14.823 62.483,14.496 63.103,13.84ZM56.308,16.084C55.093,14.798 54.497,13.235 54.497,11.344C54.497,9.479 55.093,7.916 56.308,6.63C57.524,5.345 59.026,4.689 60.791,4.689C62.555,4.689 64.057,5.345 65.273,6.63C66.489,7.916 67.109,9.504 67.109,11.344C67.109,13.21 66.489,14.798 65.273,16.084C64.057,17.37 62.579,18 60.791,18C59.002,18 57.524,17.37 56.308,16.084ZM77.385,13.916C78.005,13.235 78.314,12.378 78.314,11.345C78.314,10.311 78.005,9.454 77.385,8.798C76.765,8.118 75.978,7.79 75.024,7.79C74.071,7.79 73.284,8.118 72.64,8.798C72.021,9.454 71.71,10.311 71.71,11.345C71.71,12.378 72.021,13.235 72.64,13.916C73.284,14.571 74.094,14.899 75.024,14.899C75.978,14.899 76.765,14.571 77.385,13.916ZM78.314,0H81.39V17.647H78.314V16.16C77.409,17.395 76.121,18 74.452,18C72.855,18 71.472,17.37 70.328,16.084C69.207,14.798 68.635,13.21 68.635,11.345C68.635,9.504 69.207,7.916 70.328,6.63C71.472,5.345 72.855,4.689 74.452,4.689C76.121,4.689 77.409,5.294 78.314,6.529V0ZM92.191,13.84C92.811,13.185 93.12,12.353 93.12,11.344C93.12,10.336 92.811,9.504 92.191,8.849C91.571,8.193 90.808,7.866 89.878,7.866C88.948,7.866 88.185,8.193 87.565,8.849C86.969,9.529 86.659,10.361 86.659,11.344C86.659,12.328 86.969,13.16 87.565,13.84C88.185,14.496 88.948,14.823 89.878,14.823C90.808,14.823 91.571,14.496 92.191,13.84ZM85.396,16.084C84.18,14.798 83.584,13.235 83.584,11.344C83.584,9.479 84.18,7.916 85.396,6.63C86.612,5.345 88.114,4.689 89.878,4.689C91.642,4.689 93.144,5.345 94.36,6.63C95.576,7.916 96.196,9.504 96.196,11.344C96.196,13.21 95.576,14.798 94.36,16.084C93.144,17.37 91.666,18 89.878,18C88.09,18 86.612,17.37 85.396,16.084ZM109.5,9.908V17.647H106.424V10.311C106.424,9.479 106.21,8.849 105.781,8.37C105.375,7.941 104.803,7.714 104.064,7.714C102.324,7.714 101.442,8.748 101.442,10.84V17.647H98.366V5.042H101.442V6.454C102.181,5.269 103.349,4.689 104.994,4.689C106.305,4.689 107.378,5.143 108.213,6.076C109.071,7.009 109.5,8.269 109.5,9.908Z"
android:fillColor="#282C37"/>
</vector>

View File

@ -25,7 +25,7 @@
tools:text="123"/>
</FrameLayout>
<View
<Space
android:layout_width="0px"
android:layout_height="1px"
android:layout_weight="1"/>
@ -48,7 +48,7 @@
tools:text="123"/>
</FrameLayout>
<View
<Space
android:layout_width="0px"
android:layout_height="1px"
android:layout_weight="1"/>
@ -71,7 +71,7 @@
tools:text="123"/>
</FrameLayout>
<View
<Space
android:layout_width="0px"
android:layout_height="1px"
android:layout_weight="1"/>

View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabbar_wrap"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/actionbar_bg"
android:elevation="3dp"
android:outlineProvider="bounds"
android:clipChildren="false">
<org.joinmastodon.android.ui.views.TabBar
android:id="@+id/tabbar"
android:layout_width="match_parent"
android:layout_height="52dp"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<ImageView
android:id="@+id/tab_home"
android:layout_width="52dp"
android:layout_height="52dp"
android:scaleType="center"
android:background="?android:selectableItemBackgroundBorderless"
android:src="@drawable/ic_fluent_home_28_selector"/>
<Space
android:layout_width="0px"
android:layout_height="1px"
android:layout_weight="1"/>
<ImageView
android:id="@+id/tab_search"
android:layout_width="52dp"
android:layout_height="52dp"
android:scaleType="center"
android:background="?android:selectableItemBackgroundBorderless"
android:src="@drawable/ic_fluent_search_28_selector"/>
<Space
android:layout_width="0px"
android:layout_height="1px"
android:layout_weight="1"/>
<ImageView
android:id="@+id/tab_notifications"
android:layout_width="52dp"
android:layout_height="52dp"
android:scaleType="center"
android:background="?android:selectableItemBackgroundBorderless"
android:src="@drawable/ic_fluent_alert_28_selector"/>
<Space
android:layout_width="0px"
android:layout_height="1px"
android:layout_weight="1"/>
<FrameLayout
android:id="@+id/tab_profile"
android:layout_width="52dp"
android:layout_height="52dp"
android:foreground="@drawable/bg_tab_profile"
android:background="?android:selectableItemBackgroundBorderless">
<ImageView
android:id="@+id/tab_profile_ava"
android:layout_width="28dp"
android:layout_height="28dp"
android:layout_gravity="center"
android:scaleType="centerCrop"
android:src="@null"/>
</FrameLayout>
</org.joinmastodon.android.ui.views.TabBar>
</FrameLayout>

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/new_toot" android:title="New toot"/>
<item android:id="@+id/notifications" android:title="@string/notifications"/>
<item android:id="@+id/my_profile" android:title="My profile"/>
<item
android:id="@+id/settings"
android:icon="@drawable/ic_fluent_settings_24_regular"
android:showAsAction="always"
android:title="@string/settings" />
</menu>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="navigation_bar_bg">@color/actionbar_bg</color>
</resources>

View File

@ -21,6 +21,8 @@
<color name="secondary">#E9EDF2</color>
<color name="base">#282C37</color>
<color name="text_secondary_alpha50">#80667085</color>
<color name="actionbar_bg">#FAFBFC</color>
<color name="navigation_bar_bg">#000</color>
<color name="favorite_selected">#FF9F0A</color>
<color name="boost_selected">#79BD9A</color>

View File

@ -27,4 +27,5 @@
<string name="time_days">%dd</string>
<string name="share_toot_title">Share toot</string>
<string name="settings">Settings</string>
</resources>

View File

@ -5,7 +5,19 @@
<item name="android:enforceNavigationBarContrast">false</item>
<item name="android:enforceStatusBarContrast">false</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowLightNavigationBar">true</item>
<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:actionBarTheme">@style/Theme.Mastodon.Toolbar</item>
</style>
<style name="Theme.Mastodon.Toolbar" parent="android:ThemeOverlay.Material.ActionBar">
<item name="android:colorPrimary">@color/actionbar_bg</item>
<item name="android:textColorPrimary">@color/gray_800</item>
<item name="android:textColorSecondary">@color/gray_800</item>
</style>
<style name="m3_body_large">