Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an empty GravatarUCropActivity to avoid Manifest merger fails #398

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions demo-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ dependencies {
implementation(libs.coil.compose)
implementation(libs.androidx.activity)
implementation(libs.androidx.constraintlayout)
implementation(libs.ucrop)
implementation(project(":gravatar"))
implementation(project(":gravatar-ui"))
implementation(project(":gravatar-quickeditor"))
Expand Down
6 changes: 6 additions & 0 deletions demo-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
<!-- android:scheme="${DEMO_OAUTH_REDIRECT_URI_SCHEME}" />-->
<!-- </intent-filter>-->
</activity>

<!-- Lib activities -->
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:theme="@style/Theme.AppCompat" />

<provider
android:name=".DemoFileProvider"
android:authorities="${applicationId}.fileprovider"
Expand Down
2 changes: 1 addition & 1 deletion gravatar-quickeditor/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<!-- Lib activities-->
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:name=".ui.cropperlauncher.GravatarUCropActivity"
android:theme="@style/Theme.AppCompat.NoActionBar" />
</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ import com.gravatar.quickeditor.ui.components.EmailLabel
import com.gravatar.quickeditor.ui.components.ErrorSection
import com.gravatar.quickeditor.ui.components.FailedAvatarUploadAlertDialog
import com.gravatar.quickeditor.ui.components.ProfileCard
import com.gravatar.quickeditor.ui.copperlauncher.CropperLauncher
import com.gravatar.quickeditor.ui.copperlauncher.UCropCropperLauncher
import com.gravatar.quickeditor.ui.cropperlauncher.CropperLauncher
import com.gravatar.quickeditor.ui.cropperlauncher.UCropCropperLauncher
import com.gravatar.quickeditor.ui.editor.AvatarPickerContentLayout
import com.gravatar.quickeditor.ui.editor.GravatarQuickEditorParams
import com.gravatar.quickeditor.ui.editor.bottomsheet.DEFAULT_PAGE_HEIGHT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gravatar.quickeditor.ui.copperlauncher
package com.gravatar.quickeditor.ui.cropperlauncher

import android.content.Context
import android.content.Intent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gravatar.quickeditor.ui.copperlauncher
package com.gravatar.quickeditor.ui.cropperlauncher

import android.content.Context
import android.content.Intent
Expand All @@ -24,7 +24,21 @@ internal class UCropCropperLauncher : CropperLauncher {
setCircleDimmedLayer(true)
}
launcher.launch(
UCrop.of(image, Uri.fromFile(tempFile)).withAspectRatio(1f, 1f).withOptions(options).getIntent(context),
UCrop.of(image, Uri.fromFile(tempFile))
.withAspectRatio(1f, 1f)
.withOptions(options)
.getGravatarIntent(context),
)
}
}

private fun UCrop.getGravatarIntent(context: Context): Intent {
return getIntent(context).apply {
setClass(context, GravatarUCropActivity::class.java)
}
}

/**
* Empty Activity to not cause conflicts with UCropActivity when third-party apps depend on it already
*/
internal class GravatarUCropActivity : UCropActivity()