mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 08:35:37 -04:00
Feat[cropper]: improve UI
This commit is contained in:
parent
1fd64e0a3a
commit
d8773ce8bf
@ -126,6 +126,7 @@ public class CropperView extends View {
|
|||||||
canvas.drawRect(mSelectionHighlight, mSelectionPaint);
|
canvas.drawRect(mSelectionHighlight, mSelectionPaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ClickableViewAccessibility") // the view is not clickable
|
||||||
@Override
|
@Override
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
public boolean onTouchEvent(MotionEvent event) {
|
||||||
return dispatchGenericMotionEvent(event);
|
return dispatchGenericMotionEvent(event);
|
||||||
|
@ -28,7 +28,7 @@ public class CropperUtils {
|
|||||||
public static ActivityResultLauncher<?> registerCropper(Fragment fragment, final CropperListener cropperListener) {
|
public static ActivityResultLauncher<?> registerCropper(Fragment fragment, final CropperListener cropperListener) {
|
||||||
return fragment.registerForActivityResult(new ActivityResultContracts.OpenDocument(), (result)->{
|
return fragment.registerForActivityResult(new ActivityResultContracts.OpenDocument(), (result)->{
|
||||||
Context context = fragment.getContext();
|
Context context = fragment.getContext();
|
||||||
if (context == null) return;
|
if (context == null || result == null) return;
|
||||||
openCropperDialog(context, result, cropperListener);
|
openCropperDialog(context, result, cropperListener);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<stroke android:width="@dimen/profile_editor_image_padding" android:color="#fff"/>
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
@ -1,13 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/background_app"
|
android:background="@color/background_app"
|
||||||
android:fadeScrollbars="true"
|
android:orientation="vertical"
|
||||||
android:scrollbarThumbVertical="@color/minebutton_color"
|
|
||||||
>
|
>
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:fadeScrollbars="true"
|
||||||
|
android:scrollbarThumbVertical="@color/minebutton_color">
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -16,26 +22,30 @@
|
|||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_marginTop="@dimen/padding_extra_large"
|
android:layout_marginTop="@dimen/padding_extra_large"
|
||||||
android:id="@+id/vprof_editor_profile_icon"
|
android:layout_width="@dimen/_36sdp"
|
||||||
android:layout_width="32dp"
|
android:layout_height="@dimen/_36sdp"
|
||||||
android:layout_height="32dp"
|
android:paddingVertical="@dimen/profile_editor_image_padding"
|
||||||
tools:src="@tools:sample/avatars"
|
android:paddingHorizontal="@dimen/profile_editor_image_padding"
|
||||||
|
android:background="@drawable/background_profile_icon_selector"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
<TextView
|
android:id="@+id/vprof_editor_profile_icon"
|
||||||
android:layout_width="wrap_content"
|
tools:src="@tools:sample/avatars" />
|
||||||
android:layout_height="wrap_content"
|
<ImageView
|
||||||
android:text="PROFILE ICON"
|
android:layout_width="16dp"
|
||||||
app:layout_constraintBottom_toTopOf="@id/vprof_editor_profile_icon"
|
android:layout_height="16dp"
|
||||||
app:layout_constraintStart_toStartOf="@id/vprof_editor_profile_icon"/>
|
android:src="@drawable/ic_edit_profile"
|
||||||
|
android:layout_marginStart="-5dp"
|
||||||
|
android:layout_marginTop="-5dp"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/vprof_editor_profile_icon"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/vprof_editor_profile_icon"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/vprof_editor_profile_name_sub"
|
android:id="@+id/vprof_editor_profile_name_sub"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/profiles_profile_name"
|
android:text="@string/profiles_profile_name"
|
||||||
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/vprof_editor_profile_name"
|
app:layout_constraintBottom_toTopOf="@+id/vprof_editor_profile_name"
|
||||||
app:layout_constraintStart_toStartOf="@+id/vprof_editor_profile_name" />
|
app:layout_constraintStart_toStartOf="@+id/vprof_editor_profile_name" />
|
||||||
|
|
||||||
@ -254,31 +264,30 @@
|
|||||||
app:layout_constraintEnd_toEndOf="@id/vprof_editor_profile_renderer"
|
app:layout_constraintEnd_toEndOf="@id/vprof_editor_profile_renderer"
|
||||||
app:layout_constraintTop_toTopOf="@id/vprof_editor_profile_renderer" />
|
app:layout_constraintTop_toTopOf="@id/vprof_editor_profile_renderer" />
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
</ScrollView>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:paddingHorizontal="@dimen/fragment_padding_medium"
|
||||||
|
android:layout_marginVertical="13dp"
|
||||||
|
>
|
||||||
<com.kdt.mcgui.MineButton
|
<com.kdt.mcgui.MineButton
|
||||||
android:id="@+id/vprof_editor_save_button"
|
android:id="@+id/vprof_editor_save_button"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginVertical="26dp"
|
android:layout_weight="1"
|
||||||
android:text="@string/global_save"
|
android:text="@string/global_save"
|
||||||
android:layout_marginEnd="@dimen/padding_medium"
|
android:layout_marginEnd="@dimen/padding_medium" />
|
||||||
app:layout_constraintEnd_toStartOf="@+id/vprof_editor_delete_button"
|
|
||||||
|
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/vprof_editor_profile_renderer"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<com.kdt.mcgui.MineButton
|
<com.kdt.mcgui.MineButton
|
||||||
android:id="@+id/vprof_editor_delete_button"
|
android:id="@+id/vprof_editor_delete_button"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
android:layout_marginStart="@dimen/padding_medium"
|
android:layout_marginStart="@dimen/padding_medium"
|
||||||
android:text="@string/global_delete"
|
android:text="@string/global_delete" />
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
app:layout_constraintHorizontal_bias="0.5"
|
|
||||||
app:layout_constraintStart_toEndOf="@+id/vprof_editor_save_button"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/vprof_editor_save_button"
|
|
||||||
/>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
</ScrollView>
|
|
@ -29,5 +29,6 @@
|
|||||||
|
|
||||||
<!-- Fragment padding -->
|
<!-- Fragment padding -->
|
||||||
<dimen name="fragment_padding_medium">@dimen/_10sdp</dimen>
|
<dimen name="fragment_padding_medium">@dimen/_10sdp</dimen>
|
||||||
|
<!-- Misc paddings -->
|
||||||
|
<dimen name="profile_editor_image_padding">2dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user