I've been working on an wallpaper app, which fetches some set of wallpapers (through an api of my choice), gives users features of sharing, setting as wallpaper directly (scrollable if it supports) or edit and set the picture.
This edit screen is where I face some bugs/issues.
I need the user to be able to crop/zoom/pan the image to their liking and set it as the wallpaper. Similar to how Nova wallpaper does it, where if the crop selection is reduced, the entire images zooms in accordingly to that selection. All this happens in a single imageview I believe.
But, in my case, I happen to use two imageviews, one for cropping and the other for zooming. crop library: github-dot-com/edmodo/cropper/
Once, user crops, the second imageview is populated with the bitmap of selection from cropper. This imageview is used for zooming or panning. zoom/pan library: github-dot-com/jasonpolites/gesture-imageview
Here is layout for that screen: https://i.stack.imgur.com/wnjcP.jpg
And the code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:gesture-image="http://schemas.polites.com/android"
android:id="@+id/scrollview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:id="@+id/mylayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusableInTouchMode="true"
android:orientation="vertical"
tools:context=".MainActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/Button_crop"
style="@style/RoboTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="25dp"
android:paddingRight="25dp"
android:text="@string/crop"
android:textColor="#33B5E5"
android:textSize="12sp" />
<ImageButton
android:id="@+id/Button_rotate_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/rotate_left" />
<ImageButton
android:id="@+id/Button_rotate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/rotate_right" />
<Button
android:id="@+id/Button_setother"
style="@style/RoboTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="25dp"
android:paddingRight="25dp"
android:text="@string/setother"
android:textColor="#33B5E5"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:id="@+id/checkboxlayout">
<CheckBox
android:id="@+id/scrollable"
style="@style/RoboTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#33B5E5"
android:textSize="12sp"
android:checked="false"
android:text="Scrollable" />
<Button
android:id="@+id/Button_setwallpaper"
style="@style/RoboTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="25dp"
android:paddingRight="25dp"
android:text="@string/setwallpaper"
android:textColor="#33B5E5"
android:textSize="12sp" />
</LinearLayout>
<com.edmodo.cropper.CropImageView
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:id="@+id/CropImageView"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_gravity="center"
android:adjustViewBounds="true" />
<com.polites.android.GestureImageView
android:id="@+id/croppedImageView"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:contentDescription="@string/croppedImageDesc"
gesture-image:max-scale="10.0"
gesture-image:min-scale="0.1"
gesture-image:strict="false" />
</LinearLayout>
</ScrollView>
Whereas, I would like to some assistance in getting this layout efficient. Where I'm not required to scroll in different devices or base it on something similar to Nova Launcher's "Set Wallpaper" screen like:
https://i.stack.imgur.com/WaJRO.png
Any assistance is much appreciated!
Thanks,
Arnab