use custom instead of app name

This commit is contained in:
sk 2022-12-16 14:21:54 +01:00
parent abdce64b99
commit d63e5af8d0
9 changed files with 125 additions and 63 deletions

View File

@ -16,7 +16,7 @@ import org.joinmastodon.android.fragments.HomeFragment;
import org.joinmastodon.android.fragments.ProfileFragment;
import org.joinmastodon.android.fragments.ThreadFragment;
import org.joinmastodon.android.fragments.onboarding.AccountActivationFragment;
import org.joinmastodon.android.fragments.onboarding.MegalodonLoginFragment;
import org.joinmastodon.android.fragments.onboarding.CustomWelcomeFragment;
import org.joinmastodon.android.model.Notification;
import org.joinmastodon.android.ui.utils.UiUtils;
import org.joinmastodon.android.updater.GithubSelfUpdater;
@ -33,7 +33,7 @@ public class MainActivity extends FragmentStackActivity{
if(savedInstanceState==null){
if(AccountSessionManager.getInstance().getLoggedInAccounts().isEmpty()){
showFragmentClearingBackStack(new MegalodonLoginFragment());
showFragmentClearingBackStack(new CustomWelcomeFragment());
}else{
AccountSessionManager.getInstance().maybeUpdateLocalInfo();
AccountSession session;

View File

@ -36,11 +36,11 @@ import me.grishka.appkit.utils.SingleViewRecyclerAdapter;
import me.grishka.appkit.utils.V;
import me.grishka.appkit.views.UsableRecyclerView;
public class MegalodonLoginFragment extends InstanceCatalogFragment {
public class CustomWelcomeFragment extends InstanceCatalogFragment {
private View headerView;
public MegalodonLoginFragment() {
super(R.layout.fragment_megalodon_welcome, 1);
public CustomWelcomeFragment() {
super(R.layout.fragment_welcome_custom, 1);
}
@Override
@ -131,15 +131,16 @@ public class MegalodonLoginFragment extends InstanceCatalogFragment {
@Override
protected RecyclerView.Adapter getAdapter(){
headerView=getActivity().getLayoutInflater().inflate(R.layout.header_megalodon_welcome, list, false);
headerView=getActivity().getLayoutInflater().inflate(R.layout.header_welcome_custom, list, false);
searchEdit=headerView.findViewById(R.id.search_edit);
searchEdit.setOnEditorActionListener(this::onSearchEnterPressed);
headerView.findViewById(R.id.more).setVisibility(View.GONE);
headerView.findViewById(R.id.visibility).setVisibility(View.GONE);
((TextView) headerView.findViewById(R.id.username)).setText("@megalodon");
headerView.findViewById(R.id.separator).setVisibility(View.GONE);
headerView.findViewById(R.id.timestamp).setVisibility(View.GONE);
((TextView) headerView.findViewById(R.id.username)).setText(R.string.sk_app_username);
((TextView) headerView.findViewById(R.id.name)).setText(R.string.sk_app_name);
((TextView) headerView.findViewById(R.id.timestamp)).setText(R.string.time_now);
((ImageView) headerView.findViewById(R.id.avatar)).setImageDrawable(getActivity().getDrawable(R.mipmap.ic_launcher));
((FragmentStackActivity) getActivity()).invalidateSystemBarColors(this);
@ -203,7 +204,7 @@ public class MegalodonLoginFragment extends InstanceCatalogFragment {
private final RadioButton radioButton;
public InstanceViewHolder(){
super(getActivity(), R.layout.item_megalodon_instance, list);
super(getActivity(), R.layout.item_instance_custom, list);
// itemView.setPadding(V.dp(16), V.dp(16), V.dp(16), V.dp(16));
// TypedValue value = new TypedValue();

View File

@ -23,7 +23,7 @@ import org.joinmastodon.android.R;
import org.joinmastodon.android.api.requests.oauth.RevokeOauthToken;
import org.joinmastodon.android.api.session.AccountSession;
import org.joinmastodon.android.api.session.AccountSessionManager;
import org.joinmastodon.android.fragments.onboarding.MegalodonLoginFragment;
import org.joinmastodon.android.fragments.onboarding.CustomWelcomeFragment;
import org.joinmastodon.android.ui.utils.UiUtils;
import java.util.List;
@ -77,7 +77,7 @@ public class AccountSwitcherSheet extends BottomSheet{
holder.avatar.setImageResource(R.drawable.ic_fluent_add_circle_24_filled);
holder.avatar.setImageTintList(ColorStateList.valueOf(UiUtils.getThemeColor(activity, android.R.attr.textColorPrimary)));
adapter.addAdapter(new ClickableSingleViewRecyclerAdapter(holder.itemView, ()->{
Nav.go(activity, MegalodonLoginFragment.class, null);
Nav.go(activity, CustomWelcomeFragment.class, null);
dismiss();
}));

View File

@ -3,17 +3,20 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
android:paddingStart="16dp"
android:paddingEnd="24dp"
android:paddingTop="12dp"
android:paddingBottom="12dp">
<RadioButton
android:id="@+id/radiobtn"
android:layout_width="24dp"
android:layout_width="28dp"
android:layout_height="24dp"
android:layout_marginEnd="16dp"
android:layout_centerVertical="true"
android:layout_marginStart="-3dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:button="@drawable/ic_round_checkbox"
android:buttonTint="?android:textColorSecondary"
android:buttonTint="@color/m3_radiobutton_tint"
android:background="@null"
android:focusable="false"
android:clickable="false"/>
@ -26,61 +29,34 @@
android:importantForAccessibility="no"
android:layout_toEndOf="@id/radiobtn"
android:scaleType="centerCrop"
android:visibility="gone"
tools:src="#0f0"/>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/radiobtn"
android:layout_toEndOf="@id/image"
android:layout_alignParentTop="true"
android:layout_marginBottom="4dp"
android:textAppearance="@style/m3_title_medium"
android:textAppearance="@style/m3_body_large"
android:singleLine="true"
android:ellipsize="end"
android:gravity="center_vertical"
android:textSize="16sp"
android:minHeight="24dp"
android:textColor="?colorM3OnSurface"
tools:text="mastodon.social"/>
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/radiobtn"
android:layout_toEndOf="@id/image"
android:layout_below="@id/title"
android:layout_marginBottom="8dp"
android:textAppearance="@style/m3_body_medium"
android:textColor="?android:textColorSecondary"
android:textColor="?colorM3OnSurfaceVariant"
android:textSize="14sp"
android:lineSpacingExtra="4sp"
tools:text="General-purpose server run by the lead developer of Mastodon"/>
<TextView
android:id="@+id/user_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/radiobtn"
android:layout_below="@id/description"
android:textAppearance="@style/m3_label_medium"
android:textColor="?android:textColorSecondary"
android:drawableStart="@drawable/ic_fluent_people_community_16_regular"
android:drawableTint="?android:textColorSecondary"
android:drawablePadding="8dp"
tools:text="588.8K"/>
<TextView
android:id="@+id/lang"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/user_count"
android:layout_below="@id/description"
android:layout_marginStart="24dp"
android:textAppearance="@style/m3_label_medium"
android:textColor="?android:textColorSecondary"
android:drawableStart="@drawable/ic_fluent_local_language_16_regular"
android:drawableTint="?android:textColorSecondary"
android:drawablePadding="8dp"
tools:text="EN"/>
</RelativeLayout>

View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="16dp"
android:paddingVertical="8dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_search_field">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<RadioButton
android:id="@+id/radiobtn"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="16dp"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:button="@drawable/ic_round_checkbox"
android:buttonTint="?android:textColorSecondary"
android:background="@null"
android:focusable="false"
android:clickable="false"/>
<ImageView
android:id="@+id/image"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_marginEnd="16dp"
android:importantForAccessibility="no"
android:layout_toEndOf="@id/radiobtn"
android:scaleType="centerCrop"
android:visibility="gone"
tools:src="#0f0"/>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/radiobtn"
android:layout_alignParentTop="true"
android:layout_marginBottom="4dp"
android:textAppearance="@style/m3_title_medium"
android:singleLine="true"
android:ellipsize="end"
android:gravity="center_vertical"
android:textSize="16sp"
android:minHeight="24dp"
tools:text="mastodon.social"/>
<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/radiobtn"
android:layout_below="@id/title"
android:layout_marginBottom="8dp"
android:textAppearance="@style/m3_body_medium"
android:textColor="?android:textColorSecondary"
android:textSize="14sp"
tools:text="General-purpose server run by the lead developer of Mastodon"/>
<TextView
android:id="@+id/user_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/radiobtn"
android:layout_below="@id/description"
android:textAppearance="@style/m3_label_medium"
android:textColor="?android:textColorSecondary"
android:drawableStart="@drawable/ic_fluent_people_community_16_regular"
android:drawableTint="?android:textColorSecondary"
android:drawablePadding="8dp"
tools:text="588.8K"/>
<TextView
android:id="@+id/lang"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/user_count"
android:layout_below="@id/description"
android:layout_marginStart="24dp"
android:textAppearance="@style/m3_label_medium"
android:textColor="?android:textColorSecondary"
android:drawableStart="@drawable/ic_fluent_local_language_16_regular"
android:drawableTint="?android:textColorSecondary"
android:drawablePadding="8dp"
tools:text="EN"/>
</RelativeLayout>
</FrameLayout>
</FrameLayout>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="16dp"
android:paddingVertical="8dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_search_field">
<include layout="@layout/item_instance_catalog" />
</FrameLayout>
</FrameLayout>

View File

@ -60,4 +60,5 @@
<string name="sk_welcome_title">Welcome!</string>
<string name="sk_welcome_text">The shark salutes you! To get started, please enter your home instances domain name below.</string>
<string name="sk_example_domain">example.social</string>
<string name="sk_app_username" translatable="false">\@megalodon</string>
</resources>