[WIP]Lossless Transformations(Rotate feature) (#5252)

* UI setup for the crop feature almost setup

* basic setup of rotate feature done

* Added basic changes for editing feature

* Getting data back from edit activity

* Getting data back from edit activity

* Updated contentUri

* Finally the rotated image is getting uploaded

* Minor Improvements for better testing

* Fixed thumbnail preview

* Fixed loss of exif data

* Copy exif data

* Save exif data

* Added java docs

* Minor fix

* Added Javadoc

* Refactoring

* Formatting fixes

* Minor Formatting Fix

* Fix unit test

* Add test coverage

* Formatting fixes

* Formatting Fixes

---------

Co-authored-by: Priyank Shankar <priyankshankar@changejar.in>
This commit is contained in:
Priyank Shankar 2023-10-24 09:34:21 +05:30 committed by GitHub
parent 6b8954b4a9
commit 2ddb6b2e5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 570 additions and 28 deletions

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="@color/item_white_background"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M15.55,5.55L11,1v3.07C7.06,4.56 4,7.92 4,12s3.05,7.44 7,7.93v-2.02c-2.84,-0.48 -5,-2.94 -5,-5.91s2.16,-5.43 5,-5.91L11,10l4.55,-4.45zM19.93,11c-0.17,-1.39 -0.72,-2.73 -1.62,-3.89l-1.42,1.42c0.54,0.75 0.88,1.6 1.02,2.47h2.02zM13,17.9v2.02c1.39,-0.17 2.74,-0.71 3.9,-1.61l-1.44,-1.44c-0.75,0.54 -1.59,0.89 -2.46,1.03zM16.89,15.48l1.42,1.41c0.9,-1.16 1.45,-2.5 1.62,-3.89h-2.02c-0.14,0.87 -0.48,1.72 -1.02,2.48z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="@color/bottom_bar_light"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M17,3L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7l-4,-4zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM15,9L5,9L5,5h10v4z"/>
</vector>

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
tools:context=".edit.EditActivity"
android:gravity="center"
android:layout_margin="2dp"
android:orientation="vertical">
<ImageView
android:id="@+id/iv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
/>
<LinearLayout
android:elevation="2dp"
android:gravity="center"
android:orientation="horizontal"
android:layout_gravity="bottom|center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp">
<androidx.appcompat.widget.AppCompatButton
android:drawablePadding="4dp"
android:drawableStart="@drawable/baseline_rotate_right"
android:id="@+id/rotate_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:text="@string/rotate"/>
<androidx.appcompat.widget.AppCompatButton
android:onClick="getRotatedImage"
android:drawablePadding="4dp"
android:drawableStart="@drawable/baseline_save_24"
android:id="@+id/btn_save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/menu_save_categories"
android:textColor="@android:color/white" />
</LinearLayout>
</FrameLayout>

View file

@ -142,6 +142,16 @@
android:layout_marginRight="@dimen/standard_gap"
android:layout_toLeftOf="@+id/btn_next"
android:text="@string/previous" />
<Button
android:id="@+id/edit_image"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/standard_gap"
android:layout_marginBottom="24dp"
android:layout_toStartOf="@id/btn_previous"
android:contentDescription="Edit Image"
android:text="Edit Image" />
</RelativeLayout>

View file

@ -353,6 +353,7 @@
<string name="wrong">Wrong Answer</string>
<string name="quiz_screenshot_question">Is this screenshot OK to upload?</string>
<string name="share_app_title">Share App</string>
<string name="rotate">Rotate</string>
<string name="error_fetching_nearby_places">Error fetching nearby places.</string>
<string name="no_nearby_places_around">No nearby places around</string>

View file

@ -158,6 +158,9 @@
<style name="LightFlatNearbyPermissionButton" parent="LightAppTheme">
<item name="colorControlHighlight">@color/primaryColor</item>
</style>
<style name="EditActivityTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/primaryColor</item>
</style>
<style name="ProgressBar" parent="Widget.AppCompat.ProgressBar.Horizontal" />