Minor onboarding stuff

This commit is contained in:
Grishka 2023-02-10 21:09:06 +03:00
parent 5c2f72a706
commit 64fbbb2f07
9 changed files with 87 additions and 57 deletions

View File

@ -9,7 +9,7 @@ android {
applicationId "org.joinmastodon.android"
minSdk 23
targetSdk 33
versionCode 48
versionCode 49
versionName "1.1.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
resConfigs "ar-rSA", "be-rBY", "bn-rBD", "bs-rBA", "ca-rES", "cs-rCZ", "de-rDE", "el-rGR", "es-rES", "eu-rES", "fi-rFI", "fil-rPH", "fr-rFR", "ga-rIE", "gd-rGB", "gl-rES", "hi-rIN", "hr-rHR", "hu-rHU", "hy-rAM", "in-rID", "is-rIS", "it-rIT", "iw-rIL", "ja-rJP", "kab", "ko-rKR", "nl-rNL", "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"

View File

@ -248,6 +248,6 @@ public class AccountActivationFragment extends ToolbarFragment{
Bundle args=new Bundle();
args.putString("account", accountID);
// Nav.goClearingStack(getActivity(), HomeFragment.class, args);
Nav.goClearingStack(getActivity(), OnboardingProfileSetupFragment.class, args);
Nav.goClearingStack(getActivity(), OnboardingFollowSuggestionsFragment.class, args);
}
}

View File

@ -191,6 +191,13 @@ public class OnboardingFollowSuggestionsFragment extends BaseRecyclerFragment<Pa
.setCallback(new Callback<>(){
@Override
public void onSuccess(Relationship result){
relationships.put(id, result);
for(int i=0;i<list.getChildCount();i++){
if(list.getChildViewHolder(list.getChildAt(i)) instanceof SuggestionViewHolder svh && svh.getItem().account.id.equals(id)){
svh.rebind();
break;
}
}
numRunningFollowRequests--;
progress.setProgress(progress.getMax()-accountIdsToFollow.size()-numRunningFollowRequests);
followNextAccount(accountIdsToFollow, progress);
@ -209,20 +216,7 @@ public class OnboardingFollowSuggestionsFragment extends BaseRecyclerFragment<Pa
private void proceed(){
Bundle args=new Bundle();
args.putString("account", accountID);
Nav.go(getActivity(), HomeFragment.class, args);
getActivity().getWindow().getDecorView().postDelayed(()->Nav.finish(this), 500);
}
@Override
protected boolean canGoBack(){
return true;
}
@Override
public void onToolbarNavigationClick(){
Bundle args=new Bundle();
args.putString("account", accountID);
Nav.goClearingStack(getActivity(), HomeFragment.class, args);
Nav.go(getActivity(), OnboardingProfileSetupFragment.class, args);
}
private class SuggestionsAdapter extends UsableRecyclerView.Adapter<SuggestionViewHolder> implements ImageLoaderRecyclerAdapter{

View File

@ -151,8 +151,7 @@ public class OnboardingProfileSetupFragment extends ToolbarFragment implements R
AccountSessionManager.getInstance().updateAccountInfo(accountID, result);
Bundle args=new Bundle();
args.putString("account", accountID);
Nav.go(getActivity(), OnboardingFollowSuggestionsFragment.class, args);
getActivity().getWindow().getDecorView().postDelayed(()->Nav.finish(OnboardingProfileSetupFragment.this), 500);
Nav.goClearingStack(getActivity(), HomeFragment.class, args);
}
@Override
@ -182,6 +181,11 @@ public class OnboardingProfileSetupFragment extends ToolbarFragment implements R
profileFieldsLayout.startDragging(view);
return true;
});
view.findViewById(R.id.delete).setOnClickListener(v->{
profileFieldsLayout.removeView(view);
if(addRow.getVisibility()==View.GONE)
addRow.setVisibility(View.VISIBLE);
});
return view;
}
@ -222,16 +226,4 @@ public class OnboardingProfileSetupFragment extends ToolbarFragment implements R
img.setForeground(null);
ViewImageLoader.load(img, null, new UrlImageLoaderRequest(uri, size, size));
}
@Override
protected boolean canGoBack(){
return true;
}
@Override
public void onToolbarNavigationClick(){
Bundle args=new Bundle();
args.putString("account", accountID);
Nav.goClearingStack(getActivity(), HomeFragment.class, args);
}
}

View File

@ -470,12 +470,6 @@ public class UiUtils{
TypedArray ta=button.getContext().obtainStyledAttributes(styleRes, new int[]{android.R.attr.background});
button.setBackground(ta.getDrawable(0));
ta.recycle();
ta=button.getContext().obtainStyledAttributes(styleRes, new int[]{android.R.attr.textColor});
if(relationship.blocking)
button.setTextColor(button.getResources().getColorStateList(R.color.error_600));
else
button.setTextColor(ta.getColorStateList(0));
ta.recycle();
}
public static void performAccountAction(Activity activity, Account account, String accountID, Relationship relationship, Button button, Consumer<Boolean> progressCallback, Consumer<Relationship> resultCallback){

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<selector>
<item android:state_focused="true">
<shape>
<stroke android:color="?colorM3Primary" android:width="2dp"/>
<corners android:radius="4dp"/>
</shape>
</item>
<item>
<shape>
<stroke android:color="?colorM3Outline" android:width="1dp"/>
<corners android:radius="4dp"/>
</shape>
</item>
</selector>
</item>
</layer-list>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M7,21Q6.175,21 5.588,20.413Q5,19.825 5,19V6H4V4H9V3H15V4H20V6H19V19Q19,19.825 18.413,20.413Q17.825,21 17,21ZM17,6H7V19Q7,19 7,19Q7,19 7,19H17Q17,19 17,19Q17,19 17,19ZM9,17H11V8H9ZM13,17H15V8H13ZM7,6V19Q7,19 7,19Q7,19 7,19Q7,19 7,19Q7,19 7,19Z"/>
</vector>

View File

@ -2,32 +2,43 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="56dp"
android:paddingStart="16dp"
android:paddingEnd="8dp"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingEnd="16dp"
android:clipToPadding="false"
android:background="?colorM3Background">
<ImageView
android:id="@+id/dragger_thingy"
android:layout_width="56dp"
android:layout_height="56dp"
android:layout_alignParentEnd="true"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentStart="true"
android:layout_marginEnd="8dp"
android:scaleType="center"
android:tint="?colorM3OnSurface"
android:contentDescription="@string/reorder"
android:src="@drawable/ic_drag_handle_24px"/>
<ImageButton
android:id="@+id/delete"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentEnd="true"
android:layout_marginStart="8dp"
android:scaleType="center"
android:tint="?colorM3OnSurface"
android:background="?android:actionBarItemBackground"
android:contentDescription="@string/delete"
android:src="@drawable/ic_delete_24px"/>
<EditText
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_marginTop="6dp"
android:layout_toStartOf="@id/dragger_thingy"
android:background="@null"
android:padding="0dp"
android:textAppearance="@style/m3_body_large"
android:textColor="?colorM3OnSurfaceVariant"
android:textColorHint="?colorM3OnSurfaceVariant"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_toEndOf="@id/dragger_thingy"
android:layout_toStartOf="@id/delete"
style="@style/Widget.Mastodon.M3.EditText"
android:inputType="textCapSentences"
android:hint="@string/field_content"
android:saveEnabled="false"
@ -36,14 +47,13 @@
<EditText
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="20dp"
android:layout_toStartOf="@id/dragger_thingy"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_toEndOf="@id/dragger_thingy"
android:layout_toStartOf="@id/delete"
android:layout_below="@id/content"
android:background="@null"
android:padding="0dp"
android:textAppearance="@style/m3_body_medium"
android:textColor="?colorM3OnSurfaceVariant"
android:textColorHint="?colorM3OnSurfaceVariant"
style="@style/Widget.Mastodon.M3.EditText"
android:inputType="textCapSentences"
android:hint="@string/field_label"
android:saveEnabled="false"

View File

@ -319,6 +319,18 @@
<item name="android:paddingRight">24dp</item>
</style>
<style name="Widget.Mastodon.M3.EditText" parent="android:Widget.Material.EditText">
<item name="android:background">@drawable/bg_m3_outlined_text_field_nopad</item>
<item name="android:textAppearance">@style/m3_body_large</item>
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
<item name="android:paddingTop">8dp</item>
<item name="android:paddingBottom">8dp</item>
<item name="android:minHeight">40dp</item>
<item name="android:textColorHint">?colorM3OnSurfaceVariant</item>
<item name="android:textColor">?colorM3OnSurface</item>
</style>
<style name="alert_title">
<item name="android:textColor">?android:textColorPrimary</item>
<item name="android:textSize">24dp</item>