From 915b0603d071ed88afe9542676685985c027337c Mon Sep 17 00:00:00 2001 From: Grishka Date: Thu, 30 Mar 2023 19:14:12 +0300 Subject: [PATCH 1/4] Reblog -> boost --- mastodon/build.gradle | 4 ++-- mastodon/src/main/res/values/strings.xml | 24 ++++++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/mastodon/build.gradle b/mastodon/build.gradle index 8ddbe867b..cd340876a 100644 --- a/mastodon/build.gradle +++ b/mastodon/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.joinmastodon.android" minSdk 23 targetSdk 33 - versionCode 50 - versionName "1.2.0" + versionCode 51 + versionName "1.3.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" resConfigs "ar-rSA", "be-rBY", "bn-rBD", "bs-rBA", "ca-rES", "cs-rCZ", "da-rDK", "de-rDE", "el-rGR", "es-rES", "eu-rES", "fa-rIR", "fi-rFI", "fil-rPH", "fr-rFR", "ga-rIE", "gd-rGB", "gl-rES", "hi-rIN", "hr-rHR", "hu-rHU", "hy-rAM", "ig-rNG", "in-rID", "is-rIS", "it-rIT", "iw-rIL", "ja-rJP", "kab", "ko-rKR", "my-rMM", "nl-rNL", "no-rNO", "oc-rFR", "pl-rPL", "pt-rBR", "pt-rPT", "ro-rRO", "ru-rRU", "si-rLK", "sl-rSI", "sv-rSE", "th-rTH", "tr-rTR", "uk-rUA", "vi-rVN", "zh-rCN", "zh-rTW" } diff --git a/mastodon/src/main/res/values/strings.xml b/mastodon/src/main/res/values/strings.xml index b42489896..051cdaabf 100644 --- a/mastodon/src/main/res/values/strings.xml +++ b/mastodon/src/main/res/values/strings.xml @@ -12,14 +12,14 @@ OK Preparing for authentication… Finishing authentication… - %s reblogged + %s boosted In reply to %s Notifications followed you sent you a follow request favorited your post - reblogged your post + boosted your post poll ended %ds @@ -172,7 +172,7 @@ While we review this, you can take action against %s. Unfollow %s Unfollow - You won\'t see their posts or reblogs in your home feed. They won\'t know they\'ve been muted. + You won\'t see their posts or boosts in your home feed. They won\'t know they\'ve been muted. They will no longer be able to follow or see your posts, but they can see if they\'ve been blocked. Don\'t want to see this? When you see something you don\'t like on Mastodon, you can remove the person from your experience. @@ -229,7 +229,7 @@ Skip New followers Favorites - Reblogs + Boosts Mentions Polls Choose account @@ -256,7 +256,7 @@ no one Favorites my post Follows me - Reblogs my post + Boosts my post Mentions me The boring zone Account settings @@ -277,7 +277,7 @@ Hide content New post Reply - Reblog + Boost Favorite Share Media without description @@ -293,8 +293,8 @@ You\'re now following %s Requested to follow %s Open in browser - Hide reblogs from %s - Show reblogs from %s + Hide boosts from %s + Show boosts from %s Why do you want to join? This will help us review your application. Clear @@ -338,12 +338,12 @@ %,d favorites - %,d reblog - %,d reblogs + %,d boost + %,d boosts %1$s via %2$s now - Reblogs + Boosts Favorites Edit history Last edit %s @@ -405,7 +405,7 @@ What is Mastodon? Imagine you have an email address that ends with @example.com.\n\nYou can still send and receive emails from anyone, even if their email ends in @gmail.com or @icloud.com or @example.com. Mastodon is like that. - Your handle might be @gothgirl654@example.social, but you can still follow, reblog, and chat with @fallout5ever@example.online. + Your handle might be @gothgirl654@example.social, but you can still follow, boost, and chat with @fallout5ever@example.online. How do I pick a server? Different people choose different servers for any number of reasons. art.example is a great place for artists, while glasgow.example might be a good pick for Scots.\n\nYou can’t go wrong with any of our recommend servers, so regardless of which one you pick (or if you enter your own in the server search bar), you’ll never miss a beat anywhere. We\'ll pick a server based on your language if you continue without making a selection. From 4f8d8f0c8d295dd9b35841e8a404c66ba4115929 Mon Sep 17 00:00:00 2001 From: Grishka Date: Fri, 7 Apr 2023 22:40:00 +0300 Subject: [PATCH 2/4] Welcome fragment redesign again # Conflicts: # mastodon/src/main/res/values/strings.xml # mastodon/src/main/res/values/styles.xml --- .../android/fragments/SplashFragment.java | 101 +++++++++---- .../src/main/res/drawable/bg_bottom_sheet.xml | 10 +- .../res/drawable/bg_bottom_sheet_handle.xml | 6 +- .../res/drawable/bg_button_m3_outlined.xml | 25 +++ .../src/main/res/drawable/splash_logo.xml | 27 ++++ .../src/main/res/layout/fragment_splash.xml | 142 ++++++++++++------ .../main/res/layout/intro_bottom_sheet.xml | 50 ++++++ mastodon/src/main/res/values/strings.xml | 19 +++ mastodon/src/main/res/values/styles.xml | 7 + 9 files changed, 303 insertions(+), 84 deletions(-) create mode 100644 mastodon/src/main/res/drawable/bg_button_m3_outlined.xml create mode 100644 mastodon/src/main/res/drawable/splash_logo.xml create mode 100644 mastodon/src/main/res/layout/intro_bottom_sheet.xml diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/SplashFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/SplashFragment.java index b11047400..5359eea81 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/SplashFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/SplashFragment.java @@ -2,6 +2,7 @@ package org.joinmastodon.android.fragments; import android.graphics.Canvas; import android.graphics.Paint; +import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.text.SpannableString; @@ -11,33 +12,46 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.WindowInsets; +import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; +import org.joinmastodon.android.MastodonApp; import org.joinmastodon.android.R; +import org.joinmastodon.android.api.requests.instance.GetInstance; import org.joinmastodon.android.fragments.onboarding.InstanceCatalogSignupFragment; import org.joinmastodon.android.fragments.onboarding.InstanceChooserLoginFragment; +import org.joinmastodon.android.fragments.onboarding.InstanceRulesFragment; +import org.joinmastodon.android.model.Instance; +import org.joinmastodon.android.ui.InterpolatingMotionEffect; +import org.joinmastodon.android.ui.utils.UiUtils; import org.joinmastodon.android.ui.views.SizeListenerFrameLayout; +import org.parceler.Parcels; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.recyclerview.widget.RecyclerView; import androidx.viewpager2.widget.ViewPager2; import me.grishka.appkit.Nav; +import me.grishka.appkit.api.Callback; +import me.grishka.appkit.api.ErrorResponse; import me.grishka.appkit.fragments.AppKitFragment; import me.grishka.appkit.utils.V; +import me.grishka.appkit.views.BottomSheet; public class SplashFragment extends AppKitFragment{ + private static final String DEFAULT_SERVER="mastodon.social"; + private SizeListenerFrameLayout contentView; private View artContainer, blueFill, greenFill; - private ViewPager2 pager; - private ViewGroup pagerDots; + private InterpolatingMotionEffect motionEffect; private View artClouds, artPlaneElephant, artRightHill, artLeftHill, artCenterHill; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); + motionEffect=new InterpolatingMotionEffect(MastodonApp.context); } @Nullable @@ -46,44 +60,25 @@ public class SplashFragment extends AppKitFragment{ contentView=(SizeListenerFrameLayout) inflater.inflate(R.layout.fragment_splash, container, false); contentView.findViewById(R.id.btn_get_started).setOnClickListener(this::onButtonClick); contentView.findViewById(R.id.btn_log_in).setOnClickListener(this::onButtonClick); + Button joinDefault=contentView.findViewById(R.id.btn_join_default_server); + joinDefault.setText(getString(R.string.join_default_server, DEFAULT_SERVER)); + joinDefault.setOnClickListener(this::onJoinDefaultServerClick); + contentView.findViewById(R.id.btn_learn_more).setOnClickListener(this::onLearnMoreClick); + artClouds=contentView.findViewById(R.id.art_clouds); artPlaneElephant=contentView.findViewById(R.id.art_plane_elephant); artRightHill=contentView.findViewById(R.id.art_right_hill); artLeftHill=contentView.findViewById(R.id.art_left_hill); artCenterHill=contentView.findViewById(R.id.art_center_hill); - pager=contentView.findViewById(R.id.pager); - pagerDots=contentView.findViewById(R.id.pager_dots); - pager.setAdapter(new PagerAdapter()); - pager.setOffscreenPageLimit(3); - pager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback(){ - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels){ - for(int i=0;i=1 ? 1f : positionOffset)); - artPlaneElephant.setTranslationX(V.dp(101.55f)*parallaxProgress); - artLeftHill.setTranslationX(V.dp(-88)*parallaxProgress); - artLeftHill.setTranslationY(V.dp(24)*parallaxProgress); - artRightHill.setTranslationX(V.dp(-88)*parallaxProgress); - artRightHill.setTranslationY(V.dp(-24)*parallaxProgress); - artCenterHill.setTranslationX(V.dp(-40)*parallaxProgress); - } - }); artContainer=contentView.findViewById(R.id.art_container); blueFill=contentView.findViewById(R.id.blue_fill); greenFill=contentView.findViewById(R.id.green_fill); + motionEffect.addViewEffect(new InterpolatingMotionEffect.ViewEffect(contentView.findViewById(R.id.art_clouds), V.dp(-5), V.dp(5), V.dp(-5), V.dp(5))); + motionEffect.addViewEffect(new InterpolatingMotionEffect.ViewEffect(contentView.findViewById(R.id.art_right_hill), V.dp(-15), V.dp(25), V.dp(-10), V.dp(10))); + motionEffect.addViewEffect(new InterpolatingMotionEffect.ViewEffect(contentView.findViewById(R.id.art_left_hill), V.dp(-25), V.dp(15), V.dp(-15), V.dp(15))); + motionEffect.addViewEffect(new InterpolatingMotionEffect.ViewEffect(contentView.findViewById(R.id.art_center_hill), V.dp(-14), V.dp(14), V.dp(-5), V.dp(25))); + motionEffect.addViewEffect(new InterpolatingMotionEffect.ViewEffect(contentView.findViewById(R.id.art_plane_elephant), V.dp(-20), V.dp(12), V.dp(-20), V.dp(12))); contentView.setSizeListener(new SizeListenerFrameLayout.OnSizeChangedListener(){ @Override @@ -109,6 +104,38 @@ public class SplashFragment extends AppKitFragment{ Nav.go(getActivity(), isSignup ? InstanceCatalogSignupFragment.class : InstanceChooserLoginFragment.class, extras); } + private void onJoinDefaultServerClick(View v){ + new GetInstance() + .setCallback(new Callback<>(){ + @Override + public void onSuccess(Instance result){ + if(getActivity()==null) + return; + Bundle args=new Bundle(); + args.putParcelable("instance", Parcels.wrap(result)); + Nav.go(getActivity(), InstanceRulesFragment.class, args); + } + + @Override + public void onError(ErrorResponse error){ + if(getActivity()==null) + return; + error.showToast(getActivity()); + } + }) + .wrapProgress(getActivity(), R.string.loading_instance, true) + .execNoAuth(DEFAULT_SERVER); + } + + private void onLearnMoreClick(View v){ + View sheetView=getActivity().getLayoutInflater().inflate(R.layout.intro_bottom_sheet, null); + BottomSheet sheet=new BottomSheet(getActivity()); + sheet.setContentView(sheetView); + sheet.setNavigationBarBackground(new ColorDrawable(UiUtils.alphaBlendColors(UiUtils.getThemeColor(getActivity(), R.attr.colorM3Surface), + UiUtils.getThemeColor(getActivity(), R.attr.colorM3Primary), 0.05f)), !UiUtils.isDarkTheme()); + sheet.show(); + } + private void updateArtSize(int w, int h){ float scale=w/(float)V.dp(360); artContainer.setScaleX(scale); @@ -139,6 +166,18 @@ public class SplashFragment extends AppKitFragment{ return true; } + @Override + protected void onShown(){ + super.onShown(); + motionEffect.activate(); + } + + @Override + protected void onHidden(){ + super.onHidden(); + motionEffect.deactivate(); + } + private class PagerAdapter extends RecyclerView.Adapter{ @NonNull diff --git a/mastodon/src/main/res/drawable/bg_bottom_sheet.xml b/mastodon/src/main/res/drawable/bg_bottom_sheet.xml index e5b3d3ea3..bf1a899ef 100644 --- a/mastodon/src/main/res/drawable/bg_bottom_sheet.xml +++ b/mastodon/src/main/res/drawable/bg_bottom_sheet.xml @@ -2,8 +2,14 @@ - - + + + + + + + + \ No newline at end of file diff --git a/mastodon/src/main/res/drawable/bg_bottom_sheet_handle.xml b/mastodon/src/main/res/drawable/bg_bottom_sheet_handle.xml index 199c9cabf..28dc9cb56 100644 --- a/mastodon/src/main/res/drawable/bg_bottom_sheet_handle.xml +++ b/mastodon/src/main/res/drawable/bg_bottom_sheet_handle.xml @@ -1,8 +1,8 @@ - - - + + + diff --git a/mastodon/src/main/res/drawable/bg_button_m3_outlined.xml b/mastodon/src/main/res/drawable/bg_button_m3_outlined.xml new file mode 100644 index 000000000..80709f7e1 --- /dev/null +++ b/mastodon/src/main/res/drawable/bg_button_m3_outlined.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mastodon/src/main/res/drawable/splash_logo.xml b/mastodon/src/main/res/drawable/splash_logo.xml new file mode 100644 index 000000000..71195de3f --- /dev/null +++ b/mastodon/src/main/res/drawable/splash_logo.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + diff --git a/mastodon/src/main/res/layout/fragment_splash.xml b/mastodon/src/main/res/layout/fragment_splash.xml index 23e7cc657..497ab5f39 100644 --- a/mastodon/src/main/res/layout/fragment_splash.xml +++ b/mastodon/src/main/res/layout/fragment_splash.xml @@ -5,7 +5,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" - android:clipToPadding="false"> + android:clipToPadding="false" + android:theme="@style/Theme.Mastodon.Dark"> @@ -58,7 +60,8 @@ android:layout_width="197.2dp" android:layout_height="153.61dp" android:layout_gravity="top|left" - android:layout_marginTop="294dp" + android:layout_marginTop="252dp" + android:layout_marginLeft="-44dp" android:importantForAccessibility="no" android:src="@drawable/splash_art_layer2"/> @@ -67,7 +70,8 @@ android:layout_width="400dp" android:layout_height="346dp" android:layout_gravity="top|left" - android:layout_marginTop="294dp" + android:layout_marginTop="240dp" + android:layout_marginLeft="-20dp" android:importantForAccessibility="no" android:src="@drawable/splash_art_layer3"/> @@ -86,60 +90,102 @@ android:layout_height="match_parent" android:clipToPadding="false" android:orientation="vertical"> + + - - - - - - - - - - -