Skip to content
This repository was archived by the owner on Jan 22, 2023. It is now read-only.

Commit 090e60c

Browse files
committed
enable freeform cropping to close #91
1 parent c147cb8 commit 090e60c

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ dependencies {
186186
implementation 'com.melnykov:floatingactionbutton:1.3.0'
187187
implementation 'com.astuetz:pagerslidingtabstrip:1.0.1'
188188
implementation 'com.flipboard:bottomsheet-core:1.5.0'
189-
implementation 'com.yalantis:ucrop:1.5.0'
189+
implementation 'com.github.yalantis:ucrop:2.2.2'
190190
implementation 'me.leolin:ShortcutBadger:1.1.14@aar'
191191
implementation 'com.github.ajalt.reprint:core:2.9.2@aar'
192192
implementation 'com.github.ajalt.reprint:reprint_spass:2.9.2@aar'

app/src/main/java/com/klinker/android/twitter_l/activities/DirectMessageConversation.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ private void startUcrop(Uri sourceUri) {
526526
options.setActiveWidgetColor(settings.themeColors.accentColor);
527527
options.setCompressionFormat(Bitmap.CompressFormat.JPEG);
528528
options.setCompressionQuality(100);
529+
options.setFreeStyleCropEnabled(true);
529530

530531
File destination = File.createTempFile("ucrop", "jpg", getCacheDir());
531532
UCrop.of(sourceUri, Uri.fromFile(destination))

app/src/main/java/com/klinker/android/twitter_l/activities/compose/Compose.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,7 @@ private void startUcrop(Uri sourceUri) {
918918
options.setActiveWidgetColor(settings.themeColors.accentColor);
919919
options.setCompressionFormat(Bitmap.CompressFormat.JPEG);
920920
options.setCompressionQuality(100);
921+
options.setFreeStyleCropEnabled(true);
921922

922923
File destination = File.createTempFile("ucrop", "jpg", getCacheDir());
923924
UCrop.of(sourceUri, Uri.fromFile(destination))

app/src/main/java/com/klinker/android/twitter_l/activities/media_viewer/image/ImageFragment.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class ImageFragment : Fragment() {
110110
} catch (e: Exception) { }
111111

112112

113-
return url ?: ""
113+
return url?.replace("http://", "https://") ?: ""
114114
}
115115
}
116116

@@ -126,7 +126,7 @@ class ImageFragment : Fragment() {
126126

127127

128128
fun downloadImage() {
129-
TimeoutThread({
129+
TimeoutThread {
130130
Looper.prepare()
131131
val url = getLink(arguments)
132132

@@ -175,8 +175,8 @@ class ImageFragment : Fragment() {
175175

176176
var uri = IOUtils.saveImage(bitmap, name, activity)
177177
val root = Environment.getExternalStorageDirectory().toString()
178-
val myDir = File(root + "/Talon")
179-
val file = File(myDir, name + ".jpg")
178+
val myDir = File("$root/Talon")
179+
val file = File(myDir, "$name.jpg")
180180

181181
try {
182182
uri = FileProvider.getUriForFile(activity,
@@ -204,13 +204,13 @@ class ImageFragment : Fragment() {
204204
mNotificationManager.notify(randomId, builder2.build())
205205
} catch (e: Exception) {
206206
e.printStackTrace()
207-
activity.runOnUiThread({
207+
activity.runOnUiThread {
208208
try {
209209
PermissionModelUtils(activity).showStorageIssue(e)
210210
} catch (x: Exception) {
211211
e.printStackTrace()
212212
}
213-
})
213+
}
214214

215215
try {
216216
val builder2 = NotificationCompat.Builder(activity, NotificationChannelUtil.MEDIA_DOWNLOAD_CHANNEL)
@@ -225,7 +225,7 @@ class ImageFragment : Fragment() {
225225
} catch (x: IllegalStateException) {
226226
}
227227
}
228-
}).start()
228+
}.start()
229229
}
230230

231231
fun shareImage() {
@@ -240,7 +240,7 @@ class ImageFragment : Fragment() {
240240
.into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL)
241241
.get()
242242

243-
activity.runOnUiThread({
243+
activity.runOnUiThread {
244244
// create the intent
245245
val sharingIntent = Intent(android.content.Intent.ACTION_SEND)
246246
sharingIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
@@ -252,7 +252,7 @@ class ImageFragment : Fragment() {
252252

253253
// start the chooser
254254
activity.startActivity(Intent.createChooser(sharingIntent, activity.getString(R.string.menu_share) + ": "))
255-
})
255+
}
256256
} catch (e: Exception) {
257257

258258
}

app/src/main/java/com/klinker/android/twitter_l/activities/profile_viewer/ProfilePager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,6 +1725,7 @@ private void startUcrop(Uri sourceUri) {
17251725
options.setActiveWidgetColor(settings.themeColors.accentColor);
17261726
options.setCompressionFormat(Bitmap.CompressFormat.JPEG);
17271727
options.setCompressionQuality(90);
1728+
options.setFreeStyleCropEnabled(true);
17281729

17291730
File destination = File.createTempFile("ucrop", "jpg", getCacheDir());
17301731
UCrop.of(sourceUri, Uri.fromFile(destination))

0 commit comments

Comments
 (0)