fixed status quoted media opening
implementing buffer update
This commit is contained in:
parent
2bcb06aea2
commit
57ec043a8a
|
@ -36,7 +36,7 @@ subprojects {
|
|||
Kotlin : '1.1.1',
|
||||
SupportLib : '25.3.0',
|
||||
MariotakuCommons: '0.9.11',
|
||||
RestFu : '0.9.42',
|
||||
RestFu : '0.9.43',
|
||||
ObjectCursor : '0.9.16',
|
||||
PlayServices : '10.2.0',
|
||||
MapsUtils : '0.4.4',
|
||||
|
|
|
@ -65,6 +65,7 @@ public interface IntentConstants {
|
|||
String INTENT_ACTION_EXTENSION_SETTINGS = INTENT_PACKAGE_PREFIX + "EXTENSION_SETTINGS";
|
||||
|
||||
String INTENT_ACTION_UPDATE_STATUS = INTENT_PACKAGE_PREFIX + "UPDATE_STATUS";
|
||||
String INTENT_ACTION_SCHEDULE_STATUS = INTENT_PACKAGE_PREFIX + "SCHEDULE_STATUS";
|
||||
String INTENT_ACTION_SEND_DIRECT_MESSAGE = INTENT_PACKAGE_PREFIX + "SEND_DIRECT_MESSAGE";
|
||||
String INTENT_ACTION_DISCARD_DRAFT = INTENT_PACKAGE_PREFIX + "DISCARD_DRAFT";
|
||||
String INTENT_ACTION_SEND_DRAFT = INTENT_PACKAGE_PREFIX + "SEND_DRAFT";
|
||||
|
|
|
@ -1383,7 +1383,12 @@ class ComposeActivity : BaseActivity(), OnMenuItemClickListener, OnClickListener
|
|||
update.in_reply_to_status = inReplyToStatus
|
||||
update.is_possibly_sensitive = isPossiblySensitive
|
||||
update.attachment_url = (draft?.action_extras as? UpdateStatusActionExtras)?.attachmentUrl
|
||||
LengthyOperationsService.updateStatusesAsync(this, action, update)
|
||||
val scheduleInfo = this.scheduleInfo
|
||||
if (scheduleInfo != null) {
|
||||
LengthyOperationsService.scheduleStatus(this, action, update, scheduleInfo)
|
||||
} else {
|
||||
LengthyOperationsService.updateStatusesAsync(this, action, update)
|
||||
}
|
||||
if (preferences[noCloseAfterTweetSentKey] && inReplyToStatus == null) {
|
||||
possiblySensitive = false
|
||||
shouldSaveAccounts = true
|
||||
|
|
|
@ -60,8 +60,8 @@ class MessagesConversationAdapter(
|
|||
val nameFirst: Boolean = preferences[nameFirstKey]
|
||||
val linkify: TwidereLinkify = TwidereLinkify(DirectMessageOnLinkClickHandler(context, null, preferences))
|
||||
val mediaClickListener: OnMediaClickListener = object : OnMediaClickListener {
|
||||
override fun onMediaClick(view: View, media: ParcelableMedia, accountKey: UserKey?, id: Long) {
|
||||
listener?.onMediaClick(id.toInt(), media, accountKey)
|
||||
override fun onMediaClick(view: View, current: ParcelableMedia, accountKey: UserKey?, id: Long) {
|
||||
listener?.onMediaClick(id.toInt(), current, accountKey)
|
||||
}
|
||||
}
|
||||
val messageRange: IntRange
|
||||
|
|
|
@ -356,12 +356,17 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
null)
|
||||
}
|
||||
|
||||
override fun onMediaClick(view: View, media: ParcelableMedia, accountKey: UserKey?, id: Long) {
|
||||
override fun onMediaClick(view: View, current: ParcelableMedia, accountKey: UserKey?, id: Long) {
|
||||
val status = adapter.status ?: return
|
||||
IntentUtils.openMediaDirectly(activity, accountKey, status, media,
|
||||
preferences[newDocumentApiKey], null)
|
||||
if ((view.parent as View).id == R.id.quotedMediaPreview && status.quoted_media != null) {
|
||||
IntentUtils.openMediaDirectly(activity, accountKey, status.quoted_media!!, current,
|
||||
newDocument = preferences[newDocumentApiKey], status = status)
|
||||
} else if (status.media != null) {
|
||||
IntentUtils.openMediaDirectly(activity, accountKey, status.media!!, current,
|
||||
newDocument = preferences[newDocumentApiKey], status = status)
|
||||
} else return
|
||||
// BEGIN HotMobi
|
||||
val event = MediaEvent.create(activity, status, media, TimelineType.OTHER,
|
||||
val event = MediaEvent.create(activity, status, current, TimelineType.OTHER,
|
||||
adapter.mediaPreviewEnabled)
|
||||
HotMobiLogger.getInstance(activity).log(status.account_key, event)
|
||||
// END HotMobi
|
||||
|
|
|
@ -61,6 +61,7 @@ import org.mariotaku.twidere.TwidereConstants.*
|
|||
import org.mariotaku.twidere.model.*
|
||||
import org.mariotaku.twidere.model.draft.SendDirectMessageActionExtras
|
||||
import org.mariotaku.twidere.model.draft.StatusObjectExtras
|
||||
import org.mariotaku.twidere.model.schedule.ScheduleInfo
|
||||
import org.mariotaku.twidere.model.util.AccountUtils
|
||||
import org.mariotaku.twidere.model.util.ParcelableStatusUpdateUtils
|
||||
import org.mariotaku.twidere.provider.TwidereDataStore.Drafts
|
||||
|
@ -94,6 +95,9 @@ class LengthyOperationsService : BaseIntentService("lengthy_operations") {
|
|||
INTENT_ACTION_UPDATE_STATUS -> {
|
||||
handleUpdateStatusIntent(intent)
|
||||
}
|
||||
INTENT_ACTION_SCHEDULE_STATUS -> {
|
||||
handleScheduleStatusIntent(intent)
|
||||
}
|
||||
INTENT_ACTION_SEND_DIRECT_MESSAGE -> {
|
||||
handleSendDirectMessageIntent(intent)
|
||||
}
|
||||
|
@ -233,6 +237,15 @@ class LengthyOperationsService : BaseIntentService("lengthy_operations") {
|
|||
updateStatuses(*statuses)
|
||||
}
|
||||
|
||||
private fun handleScheduleStatusIntent(intent: Intent) {
|
||||
val status = intent.getParcelableExtra<ParcelableStatusUpdate>(EXTRA_STATUS)
|
||||
val scheduleInfo = intent.getParcelableExtra<ScheduleInfo>(EXTRA_SCHEDULE_INFO)
|
||||
@Draft.Action
|
||||
val actionType = intent.getStringExtra(EXTRA_ACTION)
|
||||
status.draft_action = actionType
|
||||
|
||||
}
|
||||
|
||||
private fun updateStatuses(vararg statuses: ParcelableStatusUpdate) {
|
||||
val context = this
|
||||
val builder = Builder(context)
|
||||
|
@ -460,6 +473,16 @@ class LengthyOperationsService : BaseIntentService("lengthy_operations") {
|
|||
context.startService(intent)
|
||||
}
|
||||
|
||||
fun scheduleStatus(context: Context, @Draft.Action action: String,
|
||||
status: ParcelableStatusUpdate, scheduleInfo: ScheduleInfo) {
|
||||
val intent = Intent(context, LengthyOperationsService::class.java)
|
||||
intent.action = INTENT_ACTION_SCHEDULE_STATUS
|
||||
intent.putExtra(EXTRA_STATUS, status)
|
||||
intent.putExtra(EXTRA_SCHEDULE_INFO, scheduleInfo)
|
||||
intent.putExtra(EXTRA_ACTION, action)
|
||||
context.startService(intent)
|
||||
}
|
||||
|
||||
fun sendMessageAsync(context: Context, message: ParcelableNewMessage) {
|
||||
val intent = Intent(context, LengthyOperationsService::class.java)
|
||||
intent.action = INTENT_ACTION_SEND_DIRECT_MESSAGE
|
||||
|
|
|
@ -353,7 +353,7 @@ class CardMediaContainer(context: Context, attrs: AttributeSet? = null) : ViewGr
|
|||
}
|
||||
|
||||
interface OnMediaClickListener {
|
||||
fun onMediaClick(view: View, media: ParcelableMedia, accountKey: UserKey?, id: Long)
|
||||
fun onMediaClick(view: View, current: ParcelableMedia, accountKey: UserKey?, id: Long)
|
||||
}
|
||||
|
||||
private class MediaItemViewClickListener(
|
||||
|
|
|
@ -97,7 +97,7 @@ class MediaStatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView:
|
|||
return false
|
||||
}
|
||||
|
||||
override fun onMediaClick(view: View, media: ParcelableMedia, accountKey: UserKey?, id: Long) {
|
||||
override fun onMediaClick(view: View, current: ParcelableMedia, accountKey: UserKey?, id: Long) {
|
||||
}
|
||||
|
||||
override fun setStatusClickListener(listener: IStatusViewHolder.StatusClickListener?) {
|
||||
|
|
|
@ -456,11 +456,11 @@ class StatusViewHolder(private val adapter: IStatusesAdapter<*>, itemView: View)
|
|||
}
|
||||
}
|
||||
|
||||
override fun onMediaClick(view: View, media: ParcelableMedia, accountKey: UserKey?, id: Long) {
|
||||
override fun onMediaClick(view: View, current: ParcelableMedia, accountKey: UserKey?, id: Long) {
|
||||
if (view.parent == quotedMediaPreview) {
|
||||
statusClickListener?.onQuotedMediaClick(this, view, media, layoutPosition)
|
||||
statusClickListener?.onQuotedMediaClick(this, view, current, layoutPosition)
|
||||
} else {
|
||||
statusClickListener?.onMediaClick(this, view, media, layoutPosition)
|
||||
statusClickListener?.onMediaClick(this, view, current, layoutPosition)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ interface IStatusViewHolder : CardMediaContainer.OnMediaClickListener {
|
|||
|
||||
val profileTypeView: ImageView?
|
||||
|
||||
override fun onMediaClick(view: View, media: ParcelableMedia, accountKey: UserKey?, id: Long)
|
||||
override fun onMediaClick(view: View, current: ParcelableMedia, accountKey: UserKey?, id: Long)
|
||||
|
||||
fun setStatusClickListener(listener: StatusClickListener?)
|
||||
|
||||
|
|
Loading…
Reference in New Issue