fixed quote retweet positive button
This commit is contained in:
parent
c66371f710
commit
4ef27bfd58
|
@ -85,7 +85,7 @@ public interface AccountExtras extends Parcelable {
|
||||||
public boolean checkSize(long size, boolean async) {
|
public boolean checkSize(long size, boolean async) {
|
||||||
final long limit = async ? getMaxSizeAsync() : getMaxSizeSync();
|
final long limit = async ? getMaxSizeAsync() : getMaxSizeSync();
|
||||||
if (limit <= 0 || size <= 0) return true;
|
if (limit <= 0 || size <= 0) return true;
|
||||||
return size < limit;
|
return size <= limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ public interface AccountExtras extends Parcelable {
|
||||||
public boolean checkSize(long size, boolean async) {
|
public boolean checkSize(long size, boolean async) {
|
||||||
final long limit = async ? getMaxSizeAsync() : getMaxSizeSync();
|
final long limit = async ? getMaxSizeAsync() : getMaxSizeSync();
|
||||||
if (limit <= 0 || size <= 0) return true;
|
if (limit <= 0 || size <= 0) return true;
|
||||||
return size < limit;
|
return size <= limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("RedundantIfStatement")
|
@SuppressWarnings("RedundantIfStatement")
|
||||||
|
|
|
@ -165,17 +165,20 @@ class RetweetQuoteDialogFragment : AbsStatusDialogFragment() {
|
||||||
if (this !is AlertDialog) return
|
if (this !is AlertDialog) return
|
||||||
val positiveButton = getButton(AlertDialog.BUTTON_POSITIVE) ?: return
|
val positiveButton = getButton(AlertDialog.BUTTON_POSITIVE) ?: return
|
||||||
|
|
||||||
if (status.is_my_retweet) {
|
if (canQuoteRetweet(account)) {
|
||||||
positiveButton.setText(R.string.action_cancel_retweet)
|
if (!editComment.empty) {
|
||||||
positiveButton.isEnabled = true
|
|
||||||
} else if (canQuoteRetweet(account)) {
|
|
||||||
if (editComment.empty) {
|
|
||||||
positiveButton.setText(R.string.action_retweet)
|
|
||||||
positiveButton.isEnabled = status.can_retweet
|
|
||||||
} else {
|
|
||||||
positiveButton.setText(R.string.action_comment)
|
positiveButton.setText(R.string.action_comment)
|
||||||
positiveButton.isEnabled = true
|
positiveButton.isEnabled = true
|
||||||
|
} else if (status.is_my_retweet) {
|
||||||
|
positiveButton.setText(R.string.action_cancel_retweet)
|
||||||
|
positiveButton.isEnabled = true
|
||||||
|
} else {
|
||||||
|
positiveButton.setText(R.string.action_retweet)
|
||||||
|
positiveButton.isEnabled = status.can_retweet
|
||||||
}
|
}
|
||||||
|
} else if (status.is_my_retweet) {
|
||||||
|
positiveButton.setText(R.string.action_cancel_retweet)
|
||||||
|
positiveButton.isEnabled = true
|
||||||
} else {
|
} else {
|
||||||
positiveButton.setText(R.string.action_retweet)
|
positiveButton.setText(R.string.action_retweet)
|
||||||
positiveButton.isEnabled = status.can_retweet
|
positiveButton.isEnabled = status.can_retweet
|
||||||
|
|
|
@ -915,8 +915,8 @@ class UpdateStatusTask(
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imageLimit == null || imageLimit.checkGeomentry(o.outWidth, o.outHeight)
|
if (imageLimit == null || (imageLimit.checkGeomentry(o.outWidth, o.outHeight)
|
||||||
|| imageLimit.checkSize(imageSize, chucked)) return null
|
&& imageLimit.checkSize(imageSize, chucked))) return null
|
||||||
o.inSampleSize = o.calculateInSampleSize(imageLimit.maxWidth, imageLimit.maxHeight)
|
o.inSampleSize = o.calculateInSampleSize(imageLimit.maxWidth, imageLimit.maxHeight)
|
||||||
o.inJustDecodeBounds = false
|
o.inJustDecodeBounds = false
|
||||||
// Do actual image decoding
|
// Do actual image decoding
|
||||||
|
@ -966,6 +966,16 @@ class UpdateStatusTask(
|
||||||
videoLimit: AccountExtras.VideoLimit?,
|
videoLimit: AccountExtras.VideoLimit?,
|
||||||
chucked: Boolean
|
chucked: Boolean
|
||||||
): MediaStreamData? {
|
): MediaStreamData? {
|
||||||
|
|
||||||
|
// No limit, upload original
|
||||||
|
if (videoLimit == null) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!videoLimit.isSupported) {
|
||||||
|
throw IOException(context.getString(R.string.error_message_video_upload_not_supported))
|
||||||
|
}
|
||||||
|
|
||||||
var mediaType = defaultType
|
var mediaType = defaultType
|
||||||
val geometry = Point()
|
val geometry = Point()
|
||||||
var duration = -1L
|
var duration = -1L
|
||||||
|
@ -991,22 +1001,20 @@ class UpdateStatusTask(
|
||||||
retriever.releaseSafe()
|
retriever.releaseSafe()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (videoLimit != null) {
|
if (geometry.x > 0 && geometry.y > 0 && videoLimit.checkGeometry(geometry.x, geometry.y)
|
||||||
if (geometry.x > 0 && geometry.y > 0 && videoLimit.checkGeometry(geometry.x, geometry.y)
|
&& framerate > 0 && videoLimit.checkFrameRate(framerate)
|
||||||
&& framerate > 0 && videoLimit.checkFrameRate(framerate)
|
&& size > 0 && videoLimit.checkSize(size, chucked)) {
|
||||||
&& size > 0 && videoLimit.checkSize(size, chucked)) {
|
// Size valid, upload directly
|
||||||
// Size valid, upload directly
|
DebugLog.d(LOGTAG, "Upload video directly")
|
||||||
DebugLog.d(LOGTAG, "Upload video directly")
|
return null
|
||||||
return null
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!videoLimit.checkMinDuration(duration, chucked)) {
|
if (!videoLimit.checkMinDuration(duration, chucked)) {
|
||||||
throw UploadException(context.getString(R.string.message_video_too_short))
|
throw UploadException(context.getString(R.string.message_video_too_short))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!videoLimit.checkMaxDuration(duration, chucked)) {
|
if (!videoLimit.checkMaxDuration(duration, chucked)) {
|
||||||
throw UploadException(context.getString(R.string.message_video_too_long))
|
throw UploadException(context.getString(R.string.message_video_too_long))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||||
|
|
|
@ -1321,4 +1321,5 @@
|
||||||
<string name="users_blocked">Blocked these users.</string>
|
<string name="users_blocked">Blocked these users.</string>
|
||||||
<string name="users_lists_with_name"><xliff:g id="name">%s</xliff:g>\'s lists</string>
|
<string name="users_lists_with_name"><xliff:g id="name">%s</xliff:g>\'s lists</string>
|
||||||
<string name="users_statuses">User\'s tweets</string>
|
<string name="users_statuses">User\'s tweets</string>
|
||||||
|
<string name="error_message_video_upload_not_supported">Video upload not supported</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue