added confirmation for favorite
This commit is contained in:
parent
658953306f
commit
f1bafacfd4
|
@ -557,6 +557,9 @@
|
|||
<activity
|
||||
android:name=".activity.content.RetweetQuoteDialogActivity"
|
||||
android:theme="@style/Theme.Twidere.NoDisplay"/>
|
||||
<activity
|
||||
android:name=".activity.content.FavoriteConfirmDialogActivity"
|
||||
android:theme="@style/Theme.Twidere.NoDisplay"/>
|
||||
|
||||
<service
|
||||
android:name=".service.LegacyTaskService"
|
||||
|
@ -628,7 +631,6 @@
|
|||
<action android:name="android.service.dreams.DreamService"/>
|
||||
</intent-filter>
|
||||
</service>
|
||||
<service android:name="edu.tsinghua.hotmobi.UploadLogsService"/>
|
||||
|
||||
<provider
|
||||
android:name=".provider.TwidereDataProvider"
|
||||
|
|
|
@ -41,6 +41,7 @@ import android.widget.Toast
|
|||
import kotlinx.android.synthetic.main.activity_media_viewer.*
|
||||
import org.mariotaku.chameleon.Chameleon
|
||||
import org.mariotaku.ktextension.checkAllSelfPermissionsGranted
|
||||
import org.mariotaku.ktextension.setItemAvailability
|
||||
import org.mariotaku.ktextension.toTypedArray
|
||||
import org.mariotaku.mediaviewer.library.*
|
||||
import org.mariotaku.mediaviewer.library.subsampleimageview.SubsampleImageViewerFragment.EXTRA_MEDIA_URI
|
||||
|
@ -59,7 +60,10 @@ import org.mariotaku.twidere.provider.CacheProvider
|
|||
import org.mariotaku.twidere.provider.ShareProvider
|
||||
import org.mariotaku.twidere.task.SaveFileTask
|
||||
import org.mariotaku.twidere.task.SaveMediaToGalleryTask
|
||||
import org.mariotaku.twidere.util.*
|
||||
import org.mariotaku.twidere.util.AsyncTaskUtils
|
||||
import org.mariotaku.twidere.util.IntentUtils
|
||||
import org.mariotaku.twidere.util.PermissionUtils
|
||||
import org.mariotaku.twidere.util.ThemeUtils
|
||||
import org.mariotaku.twidere.util.dagger.GeneralComponentHelper
|
||||
import org.mariotaku.twidere.util.support.WindowSupport
|
||||
import org.mariotaku.twidere.view.viewer.MediaSwipeCloseContainer
|
||||
|
@ -175,9 +179,9 @@ class MediaViewerActivity : BaseActivity(), IMediaViewerActivity, MediaSwipeClos
|
|||
if (obj.isDetached || obj.host == null) return false
|
||||
val running = obj.isMediaLoading
|
||||
val downloaded = obj.isMediaLoaded
|
||||
MenuUtils.setItemAvailability(menu, R.id.refresh, !running && !downloaded)
|
||||
MenuUtils.setItemAvailability(menu, R.id.share, !running && downloaded)
|
||||
MenuUtils.setItemAvailability(menu, R.id.save, !running && downloaded)
|
||||
menu.setItemAvailability(R.id.refresh, !running && !downloaded)
|
||||
menu.setItemAvailability(R.id.share, !running && downloaded)
|
||||
menu.setItemAvailability(R.id.save, !running && downloaded)
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2017 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.activity.content
|
||||
|
||||
import android.os.Bundle
|
||||
import org.mariotaku.twidere.activity.BaseActivity
|
||||
import org.mariotaku.twidere.constant.IntentConstants.*
|
||||
import org.mariotaku.twidere.fragment.content.FavoriteConfirmDialogFragment
|
||||
import org.mariotaku.twidere.model.ParcelableStatus
|
||||
import org.mariotaku.twidere.model.UserKey
|
||||
|
||||
/**
|
||||
* Opens [FavoriteConfirmDialogFragment] to favorite a status
|
||||
*
|
||||
* Created by mariotaku on 2017/4/12.
|
||||
*/
|
||||
class FavoriteConfirmDialogActivity : BaseActivity() {
|
||||
|
||||
private val status: ParcelableStatus
|
||||
get() = intent.getParcelableExtra(EXTRA_STATUS)
|
||||
|
||||
private val statusId: String
|
||||
get() = intent.getStringExtra(EXTRA_STATUS_ID)
|
||||
|
||||
private val accountKey: UserKey?
|
||||
get() = intent.getParcelableExtra(EXTRA_ACCOUNT_KEY)
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
if (savedInstanceState == null) {
|
||||
FavoriteConfirmDialogFragment.show(supportFragmentManager, accountKey, statusId, status)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,14 +27,18 @@ import org.mariotaku.twidere.model.ParcelableStatus
|
|||
import org.mariotaku.twidere.model.UserKey
|
||||
|
||||
/**
|
||||
* Opens [RetweetQuoteDialogFragment] to retweet/quote a status
|
||||
*
|
||||
* Created by mariotaku on 2017/4/8.
|
||||
*/
|
||||
|
||||
class RetweetQuoteDialogActivity : BaseActivity() {
|
||||
|
||||
private val status: ParcelableStatus
|
||||
get() = intent.getParcelableExtra(EXTRA_STATUS)
|
||||
|
||||
private val statusId: String
|
||||
get() = intent.getStringExtra(EXTRA_STATUS_ID)
|
||||
|
||||
private val accountKey: UserKey?
|
||||
get() = intent.getParcelableExtra(EXTRA_ACCOUNT_KEY)
|
||||
|
||||
|
@ -44,7 +48,8 @@ class RetweetQuoteDialogActivity : BaseActivity() {
|
|||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
if (savedInstanceState == null) {
|
||||
RetweetQuoteDialogFragment.show(supportFragmentManager, status, accountKey, text)
|
||||
RetweetQuoteDialogFragment.show(supportFragmentManager, accountKey, statusId, status,
|
||||
text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ val bandwidthSavingModeKey = KBooleanKey(KEY_BANDWIDTH_SAVING_MODE, false)
|
|||
val displaySensitiveContentsKey = KBooleanKey(KEY_DISPLAY_SENSITIVE_CONTENTS, false)
|
||||
val hideCardActionsKey = KBooleanKey(KEY_HIDE_CARD_ACTIONS, false)
|
||||
val iWantMyStarsBackKey = KBooleanKey(KEY_I_WANT_MY_STARS_BACK, false)
|
||||
val favoriteConfirmationKey = KBooleanKey("favorite_confirmation", false)
|
||||
val showAbsoluteTimeKey = KBooleanKey(KEY_SHOW_ABSOLUTE_TIME, false)
|
||||
val statusShortenerKey = KNullableStringKey(KEY_STATUS_SHORTENER, null)
|
||||
val mediaUploaderKey = KNullableStringKey(KEY_MEDIA_UPLOADER, null)
|
||||
|
|
|
@ -50,7 +50,7 @@ import org.mariotaku.twidere.adapter.ParcelableActivitiesAdapter.Companion.ITEM_
|
|||
import org.mariotaku.twidere.adapter.decorator.ExtendedDividerItemDecoration
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter
|
||||
import org.mariotaku.twidere.annotation.ReadPositionTag
|
||||
import org.mariotaku.twidere.constant.IntentConstants.*
|
||||
import org.mariotaku.twidere.constant.IntentConstants.EXTRA_FROM_USER
|
||||
import org.mariotaku.twidere.constant.KeyboardShortcutConstants.*
|
||||
import org.mariotaku.twidere.constant.displaySensitiveContentsKey
|
||||
import org.mariotaku.twidere.constant.newDocumentApiKey
|
||||
|
@ -58,8 +58,6 @@ import org.mariotaku.twidere.constant.readFromBottomKey
|
|||
import org.mariotaku.twidere.constant.rememberPositionKey
|
||||
import org.mariotaku.twidere.extension.model.getAccountType
|
||||
import org.mariotaku.twidere.extension.model.id
|
||||
import org.mariotaku.twidere.fragment.AbsStatusesFragment.DefaultOnLikedListener
|
||||
import org.mariotaku.twidere.fragment.content.RetweetQuoteDialogFragment
|
||||
import org.mariotaku.twidere.loader.iface.IExtendedLoader
|
||||
import org.mariotaku.twidere.model.*
|
||||
import org.mariotaku.twidere.model.analyzer.Share
|
||||
|
@ -148,28 +146,8 @@ abstract class AbsActivitiesFragment protected constructor() :
|
|||
action = handler.getKeyAction(CONTEXT_TAG_STATUS, keyCode, event, metaState)
|
||||
}
|
||||
if (action == null) return false
|
||||
when (action) {
|
||||
ACTION_STATUS_REPLY -> {
|
||||
val intent = Intent(INTENT_ACTION_REPLY)
|
||||
intent.putExtra(EXTRA_STATUS, status)
|
||||
startActivity(intent)
|
||||
return true
|
||||
}
|
||||
ACTION_STATUS_RETWEET -> {
|
||||
RetweetQuoteDialogFragment.show(fragmentManager, status)
|
||||
return true
|
||||
}
|
||||
ACTION_STATUS_FAVORITE -> {
|
||||
val twitter = twitterWrapper
|
||||
if (status.is_favorite) {
|
||||
twitter.destroyFavoriteAsync(status.account_key, status.id)
|
||||
} else {
|
||||
val holder = recyclerView.findViewHolderForLayoutPosition(position) as StatusViewHolder
|
||||
holder.playLikeAnimation(DefaultOnLikedListener(twitter, status))
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
return AbsStatusesFragment.handleKeyboardShortcutAction(this, action, status,
|
||||
position)
|
||||
}
|
||||
return navigationHelper.handleKeyboardShortcutSingle(handler, keyCode, event, metaState)
|
||||
}
|
||||
|
@ -181,7 +159,8 @@ abstract class AbsActivitiesFragment protected constructor() :
|
|||
}
|
||||
}
|
||||
|
||||
override fun isKeyboardShortcutHandled(handler: KeyboardShortcutsHandler, keyCode: Int, event: KeyEvent, metaState: Int): Boolean {
|
||||
override fun isKeyboardShortcutHandled(handler: KeyboardShortcutsHandler, keyCode: Int,
|
||||
event: KeyEvent, metaState: Int): Boolean {
|
||||
var action = handler.getKeyAction(CONTEXT_TAG_NAVIGATION, keyCode, event, metaState)
|
||||
if (ACTION_NAVIGATION_REFRESH == action) {
|
||||
return true
|
||||
|
@ -196,8 +175,8 @@ abstract class AbsActivitiesFragment protected constructor() :
|
|||
return navigationHelper.isKeyboardShortcutHandled(handler, keyCode, event, metaState)
|
||||
}
|
||||
|
||||
override fun handleKeyboardShortcutRepeat(handler: KeyboardShortcutsHandler, keyCode: Int, repeatCount: Int,
|
||||
event: KeyEvent, metaState: Int): Boolean {
|
||||
override fun handleKeyboardShortcutRepeat(handler: KeyboardShortcutsHandler, keyCode: Int,
|
||||
repeatCount: Int, event: KeyEvent, metaState: Int): Boolean {
|
||||
return navigationHelper.handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event, metaState)
|
||||
}
|
||||
|
||||
|
@ -341,25 +320,7 @@ abstract class AbsActivitiesFragment protected constructor() :
|
|||
|
||||
override fun onStatusActionClick(holder: IStatusViewHolder, id: Int, position: Int) {
|
||||
val status = getActivityStatus(position) ?: return
|
||||
val activity = activity
|
||||
when (id) {
|
||||
R.id.reply -> {
|
||||
val intent = Intent(INTENT_ACTION_REPLY)
|
||||
intent.`package` = activity.packageName
|
||||
intent.putExtra(EXTRA_STATUS, status)
|
||||
activity.startActivity(intent)
|
||||
}
|
||||
R.id.retweet -> {
|
||||
RetweetQuoteDialogFragment.show(fragmentManager, status)
|
||||
}
|
||||
R.id.favorite -> {
|
||||
if (status.is_favorite) {
|
||||
twitterWrapper.destroyFavoriteAsync(status.account_key, status.id)
|
||||
} else {
|
||||
holder.playLikeAnimation(DefaultOnLikedListener(twitterWrapper, status))
|
||||
}
|
||||
}
|
||||
}
|
||||
AbsStatusesFragment.handleActionClick(this, id, status, holder as StatusViewHolder)
|
||||
}
|
||||
|
||||
override fun onStatusActionLongClick(holder: IStatusViewHolder, id: Int, position: Int): Boolean {
|
||||
|
@ -505,8 +466,8 @@ abstract class AbsActivitiesFragment protected constructor() :
|
|||
ITEM_VIEW_TYPE_STATUS -> {
|
||||
val status = getActivityStatus(position) ?: return
|
||||
inflater.inflate(R.menu.action_status, menu)
|
||||
MenuUtils.setupForStatus(context, preferences, menu, status, twitterWrapper,
|
||||
userColorNameManager)
|
||||
MenuUtils.setupForStatus(context, menu, preferences, twitterWrapper, userColorNameManager,
|
||||
status)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -540,7 +501,7 @@ abstract class AbsActivitiesFragment protected constructor() :
|
|||
return true
|
||||
}
|
||||
else -> MenuUtils.handleStatusClick(activity, this, fragmentManager,
|
||||
userColorNameManager, twitterWrapper, status, item)
|
||||
preferences, userColorNameManager, twitterWrapper, status, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,13 +46,11 @@ import org.mariotaku.twidere.adapter.decorator.ExtendedDividerItemDecoration
|
|||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter
|
||||
import org.mariotaku.twidere.annotation.ReadPositionTag
|
||||
import org.mariotaku.twidere.annotation.Referral
|
||||
import org.mariotaku.twidere.constant.*
|
||||
import org.mariotaku.twidere.constant.IntentConstants.*
|
||||
import org.mariotaku.twidere.constant.KeyboardShortcutConstants.*
|
||||
import org.mariotaku.twidere.constant.displaySensitiveContentsKey
|
||||
import org.mariotaku.twidere.constant.newDocumentApiKey
|
||||
import org.mariotaku.twidere.constant.readFromBottomKey
|
||||
import org.mariotaku.twidere.constant.rememberPositionKey
|
||||
import org.mariotaku.twidere.extension.model.getAccountType
|
||||
import org.mariotaku.twidere.fragment.content.FavoriteConfirmDialogFragment
|
||||
import org.mariotaku.twidere.fragment.content.RetweetQuoteDialogFragment
|
||||
import org.mariotaku.twidere.graphic.like.LikeAnimationDrawable
|
||||
import org.mariotaku.twidere.loader.iface.IExtendedLoader
|
||||
|
@ -202,30 +200,7 @@ abstract class AbsStatusesFragment : AbsContentListRecyclerViewFragment<Parcelab
|
|||
action = handler.getKeyAction(CONTEXT_TAG_STATUS, keyCode, event, metaState)
|
||||
}
|
||||
if (action == null) return false
|
||||
when (action) {
|
||||
ACTION_STATUS_REPLY -> {
|
||||
val intent = Intent(INTENT_ACTION_REPLY)
|
||||
intent.putExtra(EXTRA_STATUS, status)
|
||||
startActivity(intent)
|
||||
return true
|
||||
}
|
||||
ACTION_STATUS_RETWEET -> {
|
||||
executeAfterFragmentResumed {
|
||||
RetweetQuoteDialogFragment.show(fragmentManager, status)
|
||||
}
|
||||
return true
|
||||
}
|
||||
ACTION_STATUS_FAVORITE -> {
|
||||
val twitter = twitterWrapper
|
||||
if (status.is_favorite) {
|
||||
twitter.destroyFavoriteAsync(status.account_key, status.id)
|
||||
} else {
|
||||
val holder = recyclerView.findViewHolderForLayoutPosition(position) as StatusViewHolder
|
||||
holder.playLikeAnimation(DefaultOnLikedListener(twitter, status))
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
return handleKeyboardShortcutAction(this, action, status, position)
|
||||
}
|
||||
return navigationHelper.handleKeyboardShortcutSingle(handler, keyCode, event, metaState)
|
||||
}
|
||||
|
@ -393,7 +368,7 @@ abstract class AbsStatusesFragment : AbsContentListRecyclerViewFragment<Parcelab
|
|||
|
||||
override fun onItemActionClick(holder: RecyclerView.ViewHolder, id: Int, position: Int) {
|
||||
val status = adapter.getStatus(position)
|
||||
handleActionClick(holder as StatusViewHolder, status, id)
|
||||
handleActionClick(this@AbsStatusesFragment, id, status, holder as StatusViewHolder)
|
||||
}
|
||||
|
||||
override fun onItemActionLongClick(holder: RecyclerView.ViewHolder, id: Int, position: Int): Boolean {
|
||||
|
@ -517,8 +492,8 @@ abstract class AbsStatusesFragment : AbsContentListRecyclerViewFragment<Parcelab
|
|||
val contextMenuInfo = menuInfo as ExtendedRecyclerView.ContextMenuInfo?
|
||||
val status = adapter.getStatus(contextMenuInfo!!.position)
|
||||
inflater.inflate(R.menu.action_status, menu)
|
||||
MenuUtils.setupForStatus(context, preferences, menu, status, twitterWrapper,
|
||||
userColorNameManager)
|
||||
MenuUtils.setupForStatus(context, menu, preferences, twitterWrapper, userColorNameManager,
|
||||
status)
|
||||
}
|
||||
|
||||
override fun onContextItemSelected(item: MenuItem): Boolean {
|
||||
|
@ -546,7 +521,7 @@ abstract class AbsStatusesFragment : AbsContentListRecyclerViewFragment<Parcelab
|
|||
return true
|
||||
}
|
||||
else -> return MenuUtils.handleStatusClick(activity, this, fragmentManager,
|
||||
userColorNameManager, twitterWrapper, status, item)
|
||||
preferences, userColorNameManager, twitterWrapper, status, item)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -581,24 +556,31 @@ abstract class AbsStatusesFragment : AbsContentListRecyclerViewFragment<Parcelab
|
|||
const val REQUEST_FAVORITE_SELECT_ACCOUNT = 101
|
||||
const val REQUEST_RETWEET_SELECT_ACCOUNT = 102
|
||||
|
||||
fun BaseFragment.handleActionClick(holder: StatusViewHolder, status: ParcelableStatus, id: Int) {
|
||||
fun handleActionClick(fragment: BaseFragment, id: Int, status: ParcelableStatus,
|
||||
holder: StatusViewHolder) {
|
||||
when (id) {
|
||||
R.id.reply -> {
|
||||
val intent = Intent(INTENT_ACTION_REPLY)
|
||||
intent.`package` = context.packageName
|
||||
intent.`package` = fragment.context.packageName
|
||||
intent.putExtra(EXTRA_STATUS, status)
|
||||
startActivity(intent)
|
||||
fragment.startActivity(intent)
|
||||
}
|
||||
R.id.retweet -> {
|
||||
executeAfterFragmentResumed { fragment ->
|
||||
RetweetQuoteDialogFragment.show(fragment.childFragmentManager, status)
|
||||
fragment.executeAfterFragmentResumed { fragment ->
|
||||
RetweetQuoteDialogFragment.show(fragment.childFragmentManager,
|
||||
status.account_key, status.id, status)
|
||||
}
|
||||
}
|
||||
R.id.favorite -> {
|
||||
if (status.is_favorite) {
|
||||
twitterWrapper.destroyFavoriteAsync(status.account_key, status.id)
|
||||
if (fragment.preferences[favoriteConfirmationKey]) {
|
||||
fragment.executeAfterFragmentResumed {
|
||||
FavoriteConfirmDialogFragment.show(it.childFragmentManager,
|
||||
status.account_key, status.id, status)
|
||||
}
|
||||
} else if (status.is_favorite) {
|
||||
fragment.twitterWrapper.destroyFavoriteAsync(status.account_key, status.id)
|
||||
} else {
|
||||
holder.playLikeAnimation(DefaultOnLikedListener(twitterWrapper, status))
|
||||
holder.playLikeAnimation(DefaultOnLikedListener(fragment.twitterWrapper, status))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -627,7 +609,14 @@ abstract class AbsStatusesFragment : AbsContentListRecyclerViewFragment<Parcelab
|
|||
val accountKey = data.getParcelableExtra<UserKey>(EXTRA_ACCOUNT_KEY)
|
||||
val extras = data.getBundleExtra(EXTRA_EXTRAS)
|
||||
val status = extras.getParcelable<ParcelableStatus>(EXTRA_STATUS)
|
||||
fragment.twitterWrapper.createFavoriteAsync(accountKey, status)
|
||||
if (fragment.preferences[favoriteConfirmationKey]) {
|
||||
fragment.executeAfterFragmentResumed {
|
||||
FavoriteConfirmDialogFragment.show(it.childFragmentManager,
|
||||
accountKey, status.id, status)
|
||||
}
|
||||
} else {
|
||||
fragment.twitterWrapper.createFavoriteAsync(accountKey, status)
|
||||
}
|
||||
}
|
||||
AbsStatusesFragment.REQUEST_RETWEET_SELECT_ACCOUNT -> {
|
||||
if (resultCode != Activity.RESULT_OK || data == null) return
|
||||
|
@ -635,7 +624,8 @@ abstract class AbsStatusesFragment : AbsContentListRecyclerViewFragment<Parcelab
|
|||
val extras = data.getBundleExtra(EXTRA_EXTRAS)
|
||||
val status = extras.getParcelable<ParcelableStatus>(EXTRA_STATUS)
|
||||
fragment.executeAfterFragmentResumed {
|
||||
RetweetQuoteDialogFragment.show(it.childFragmentManager, status, accountKey)
|
||||
RetweetQuoteDialogFragment.show(it.childFragmentManager, accountKey,
|
||||
status.id, status)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -653,5 +643,40 @@ abstract class AbsStatusesFragment : AbsContentListRecyclerViewFragment<Parcelab
|
|||
return intent
|
||||
}
|
||||
|
||||
|
||||
fun handleKeyboardShortcutAction(fragment: BaseFragment, action: String,
|
||||
status: ParcelableStatus, position: Int): Boolean {
|
||||
when (action) {
|
||||
ACTION_STATUS_REPLY -> {
|
||||
val intent = Intent(INTENT_ACTION_REPLY)
|
||||
intent.putExtra(EXTRA_STATUS, status)
|
||||
fragment.startActivity(intent)
|
||||
return true
|
||||
}
|
||||
ACTION_STATUS_RETWEET -> {
|
||||
fragment.executeAfterFragmentResumed {
|
||||
RetweetQuoteDialogFragment.show(it.childFragmentManager,
|
||||
status.account_key, status.id, status)
|
||||
}
|
||||
return true
|
||||
}
|
||||
ACTION_STATUS_FAVORITE -> {
|
||||
if (fragment.preferences[favoriteConfirmationKey]) {
|
||||
fragment.executeAfterFragmentResumed {
|
||||
FavoriteConfirmDialogFragment.show(it.childFragmentManager,
|
||||
status.account_key, status.id, status)
|
||||
}
|
||||
} else if (status.is_favorite) {
|
||||
fragment.twitterWrapper.destroyFavoriteAsync(status.account_key, status.id)
|
||||
} else {
|
||||
val holder = fragment.recyclerView.findViewHolderForLayoutPosition(position) as StatusViewHolder
|
||||
holder.playLikeAnimation(DefaultOnLikedListener(fragment.twitterWrapper, status))
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,8 +99,8 @@ abstract class AbsToolbarTabPagesFragment : BaseFragment(), RefreshScrollTopInte
|
|||
super.onDetach()
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater!!.inflate(R.layout.fragment_toolbar_tab_pages, container, false)
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.fragment_toolbar_tab_pages, container, false)
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
|
|
|
@ -377,9 +377,9 @@ class AccountsDashboardFragment : BaseFragment(), LoaderCallbacks<AccountsInfo>,
|
|||
hasPublicTimeline = true
|
||||
}
|
||||
}
|
||||
MenuUtils.setItemAvailability(menu, R.id.groups, hasGroups)
|
||||
MenuUtils.setItemAvailability(menu, R.id.lists, hasLists)
|
||||
MenuUtils.setItemAvailability(menu, R.id.public_timeline, hasPublicTimeline)
|
||||
menu.setItemAvailability(R.id.groups, hasGroups)
|
||||
menu.setItemAvailability(R.id.lists, hasLists)
|
||||
menu.setItemAvailability(R.id.public_timeline, hasPublicTimeline)
|
||||
}
|
||||
|
||||
private fun hasAccountInTab(tab: SupportTabSpec, accountId: UserKey, isActivated: Boolean): Boolean {
|
||||
|
|
|
@ -53,7 +53,7 @@ open class BaseWebViewFragment : BaseFragment() {
|
|||
/**
|
||||
* Called to instantiate the view. Creates and returns the WebView.
|
||||
*/
|
||||
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?,
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
internalWebView?.destroy()
|
||||
internalWebView = WebView(activity)
|
||||
|
|
|
@ -101,8 +101,8 @@ class ExtensionsListFragment : AbsContentListViewFragment<ExtensionsAdapter>(),
|
|||
|
||||
}
|
||||
|
||||
override fun onContextItemSelected(item: MenuItem?): Boolean {
|
||||
val adapterMenuInfo = item!!.menuInfo as AdapterContextMenuInfo
|
||||
override fun onContextItemSelected(item: MenuItem): Boolean {
|
||||
val adapterMenuInfo = item.menuInfo as AdapterContextMenuInfo
|
||||
val extensionInfo = adapter.getItem(adapterMenuInfo.position)
|
||||
when (item.itemId) {
|
||||
R.id.settings -> {
|
||||
|
|
|
@ -98,8 +98,8 @@ class HostMappingsListFragment : AbsContentListViewFragment<HostMappingsListFrag
|
|||
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
|
||||
inflater!!.inflate(R.menu.menu_host_mapping, menu)
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
inflater.inflate(R.menu.menu_host_mapping, menu)
|
||||
}
|
||||
|
||||
override fun onItemClick(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
|
||||
|
@ -114,8 +114,8 @@ class HostMappingsListFragment : AbsContentListViewFragment<HostMappingsListFrag
|
|||
df.show(fragmentManager, "add_mapping")
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
|
||||
when (item!!.itemId) {
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.add -> {
|
||||
val df = AddMappingDialogFragment()
|
||||
df.show(fragmentManager, "add_mapping")
|
||||
|
|
|
@ -60,7 +60,7 @@ class ItemsListFragment : AbsContentListRecyclerViewFragment<VariousItemsAdapter
|
|||
|
||||
override fun onItemActionClick(holder: RecyclerView.ViewHolder, id: Int, position: Int) {
|
||||
val status = dummyItemAdapter.getStatus(position)
|
||||
handleActionClick(holder as StatusViewHolder, status, id)
|
||||
handleActionClick(this@ItemsListFragment, id, status, holder as StatusViewHolder)
|
||||
}
|
||||
|
||||
override fun onItemActionLongClick(holder: RecyclerView.ViewHolder, id: Int, position: Int): Boolean {
|
||||
|
@ -135,15 +135,15 @@ class ItemsListFragment : AbsContentListRecyclerViewFragment<VariousItemsAdapter
|
|||
val dummyAdapter = adapter.dummyAdapter
|
||||
val status = dummyAdapter.getStatus(contextMenuInfo.position)
|
||||
inflater.inflate(R.menu.action_status, menu)
|
||||
MenuUtils.setupForStatus(context, preferences, menu, status,
|
||||
twitterWrapper, userColorNameManager)
|
||||
MenuUtils.setupForStatus(context, menu, preferences, twitterWrapper,
|
||||
userColorNameManager, status)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onContextItemSelected(item: MenuItem?): Boolean {
|
||||
override fun onContextItemSelected(item: MenuItem): Boolean {
|
||||
if (!userVisibleHint) return false
|
||||
val contextMenuInfo = item!!.menuInfo as ExtendedRecyclerView.ContextMenuInfo
|
||||
val contextMenuInfo = item.menuInfo as ExtendedRecyclerView.ContextMenuInfo
|
||||
val position = contextMenuInfo.position
|
||||
when (adapter.getItemViewType(position)) {
|
||||
VariousItemsAdapter.VIEW_TYPE_STATUS -> {
|
||||
|
@ -156,7 +156,7 @@ class ItemsListFragment : AbsContentListRecyclerViewFragment<VariousItemsAdapter
|
|||
return true
|
||||
}
|
||||
return MenuUtils.handleStatusClick(activity, this, fragmentManager,
|
||||
userColorNameManager, twitterWrapper, status, item)
|
||||
preferences, userColorNameManager, twitterWrapper, status, item)
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
|
|
@ -125,8 +125,8 @@ class SearchFragment : AbsToolbarTabPagesFragment(), RefreshScrollTopInterface,
|
|||
item.title = getString(R.string.tweet_hashtag, query)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
|
||||
when (item!!.itemId) {
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.save -> {
|
||||
val twitter = twitterWrapper
|
||||
val args = arguments
|
||||
|
|
|
@ -66,6 +66,7 @@ import org.mariotaku.kpreferences.get
|
|||
import org.mariotaku.ktextension.applyFontFamily
|
||||
import org.mariotaku.ktextension.contains
|
||||
import org.mariotaku.ktextension.findPositionByItemId
|
||||
import org.mariotaku.ktextension.setItemAvailability
|
||||
import org.mariotaku.library.objectcursor.ObjectCursor
|
||||
import org.mariotaku.microblog.library.MicroBlogException
|
||||
import org.mariotaku.microblog.library.twitter.model.Paging
|
||||
|
@ -94,7 +95,6 @@ import org.mariotaku.twidere.extension.model.getAccountType
|
|||
import org.mariotaku.twidere.extension.model.media_type
|
||||
import org.mariotaku.twidere.extension.view.calculateSpaceItemHeight
|
||||
import org.mariotaku.twidere.fragment.AbsStatusesFragment.Companion.handleActionClick
|
||||
import org.mariotaku.twidere.fragment.content.RetweetQuoteDialogFragment
|
||||
import org.mariotaku.twidere.loader.ConversationLoader
|
||||
import org.mariotaku.twidere.loader.ParcelableStatusLoader
|
||||
import org.mariotaku.twidere.menu.FavoriteItemProvider
|
||||
|
@ -320,7 +320,7 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
|
||||
override fun onItemActionClick(holder: ViewHolder, id: Int, position: Int) {
|
||||
val status = adapter.getStatus(position)
|
||||
handleActionClick(holder as StatusViewHolder, status, id)
|
||||
handleActionClick(this@StatusFragment, id, status, holder as StatusViewHolder)
|
||||
}
|
||||
|
||||
|
||||
|
@ -382,28 +382,7 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
if (position == -1) return false
|
||||
val status = adapter.getStatus(position)
|
||||
val action = handler.getKeyAction(CONTEXT_TAG_STATUS, keyCode, event, metaState) ?: return false
|
||||
when (action) {
|
||||
ACTION_STATUS_REPLY -> {
|
||||
val intent = Intent(INTENT_ACTION_REPLY)
|
||||
intent.putExtra(EXTRA_STATUS, status)
|
||||
startActivity(intent)
|
||||
return true
|
||||
}
|
||||
ACTION_STATUS_RETWEET -> {
|
||||
RetweetQuoteDialogFragment.show(fragmentManager, status)
|
||||
return true
|
||||
}
|
||||
ACTION_STATUS_FAVORITE -> {
|
||||
val twitter = twitterWrapper
|
||||
if (status.is_favorite) {
|
||||
twitter.destroyFavoriteAsync(status.account_key, status.id)
|
||||
} else {
|
||||
twitter.createFavoriteAsync(status.account_key, status)
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
return AbsStatusesFragment.handleKeyboardShortcutAction(this, action, status, position)
|
||||
}
|
||||
|
||||
override fun isKeyboardShortcutHandled(handler: KeyboardShortcutsHandler, keyCode: Int, event: KeyEvent, metaState: Int): Boolean {
|
||||
|
@ -478,7 +457,7 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
}
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu) {
|
||||
MenuUtils.setItemAvailability(menu, R.id.current_status, adapter.status != null)
|
||||
menu.setItemAvailability(R.id.current_status, adapter.status != null)
|
||||
super.onPrepareOptionsMenu(menu)
|
||||
}
|
||||
|
||||
|
@ -616,7 +595,6 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
if (position == null) return
|
||||
val adapterPosition = adapter.findPositionByItemId(position.statusId)
|
||||
if (adapterPosition < 0) return
|
||||
//TODO maintain read position
|
||||
layoutManager.scrollToPositionWithOffset(adapterPosition, position.offsetTop)
|
||||
}
|
||||
|
||||
|
@ -626,10 +604,6 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
errorContainer.visibility = if (state == STATE_ERROR) View.VISIBLE else View.GONE
|
||||
}
|
||||
|
||||
private fun showConversationError(exception: Exception) {
|
||||
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
bus.register(this)
|
||||
|
@ -650,8 +624,8 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
val status = adapter.getStatus(contextMenuInfo.position)
|
||||
val inflater = MenuInflater(context)
|
||||
inflater.inflate(R.menu.action_status, menu)
|
||||
MenuUtils.setupForStatus(context, preferences, menu, status, twitterWrapper,
|
||||
userColorNameManager)
|
||||
MenuUtils.setupForStatus(context, menu, preferences, twitterWrapper, userColorNameManager,
|
||||
status)
|
||||
}
|
||||
|
||||
override fun onContextItemSelected(item: MenuItem): Boolean {
|
||||
|
@ -671,7 +645,7 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
return true
|
||||
}
|
||||
return MenuUtils.handleStatusClick(activity, this, fragmentManager,
|
||||
userColorNameManager, twitterWrapper, status, item)
|
||||
preferences, userColorNameManager, twitterWrapper, status, item)
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
@ -820,7 +794,6 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
|
||||
itemView.quotedView.visibility = View.VISIBLE
|
||||
|
||||
val originalIdAvailable = !TextUtils.isEmpty(status.quoted_id)
|
||||
val quoteContentAvailable = status.quoted_text_plain != null && status.quoted_text_unescaped != null
|
||||
|
||||
if (quoteContentAvailable) {
|
||||
|
@ -1034,8 +1007,8 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
itemView.twitterCard.visibility = View.GONE
|
||||
}
|
||||
|
||||
MenuUtils.setupForStatus(context, fragment.preferences, itemView.menuBar.menu, status,
|
||||
adapter.statusAccount!!, twitter, colorNameManager)
|
||||
MenuUtils.setupForStatus(context, itemView.menuBar.menu, fragment.preferences, twitter,
|
||||
colorNameManager, status, adapter.statusAccount!!)
|
||||
|
||||
|
||||
val lang = status.lang
|
||||
|
@ -1109,16 +1082,12 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
if (layoutPosition < 0) return false
|
||||
val fragment = adapter.fragment
|
||||
val status = adapter.getStatus(layoutPosition)
|
||||
val preferences = fragment.preferences
|
||||
val twitter = fragment.twitterWrapper
|
||||
val manager = fragment.userColorNameManager
|
||||
val activity = fragment.activity
|
||||
val fm = fragment.fragmentManager
|
||||
if (item.itemId == R.id.retweet) {
|
||||
RetweetQuoteDialogFragment.show(fm, status)
|
||||
return true
|
||||
}
|
||||
return MenuUtils.handleStatusClick(activity, fragment, fm, manager, twitter,
|
||||
status, item)
|
||||
return MenuUtils.handleStatusClick(activity, fragment, fragment.childFragmentManager,
|
||||
preferences, manager, twitter, status, item)
|
||||
}
|
||||
|
||||
internal fun updateStatusActivity(activity: StatusActivity) {
|
||||
|
@ -1128,7 +1097,6 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
}
|
||||
|
||||
private fun initViews() {
|
||||
// menuBar.setOnMenuItemClickListener(this);
|
||||
itemView.menuBar.setOnMenuItemClickListener(this)
|
||||
val fragment = adapter.fragment
|
||||
val activity = fragment.activity
|
||||
|
@ -2112,15 +2080,10 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
val paging = Paging()
|
||||
paging.setCount(10)
|
||||
val activitySummary = StatusActivity(statusId, emptyList())
|
||||
val retweeters = ArrayList<ParcelableUser>()
|
||||
try {
|
||||
for (status in twitter.getRetweets(statusId, paging)) {
|
||||
val user = ParcelableUserUtils.fromUser(status.user, accountKey, details.type)
|
||||
if (!DataStoreUtils.isFilteringUser(context, user.key.toString())) {
|
||||
retweeters.add(user)
|
||||
}
|
||||
}
|
||||
activitySummary.retweeters = retweeters
|
||||
activitySummary.retweeters = twitter.getRetweets(statusId, paging)
|
||||
.filterNot { DataStoreUtils.isFilteringUser(context, UserKeyUtils.fromUser(it.user)) }
|
||||
.map { ParcelableUserUtils.fromUser(it.user, accountKey, details.type) }
|
||||
val countValues = ContentValues()
|
||||
val status = twitter.showStatus(statusId)
|
||||
activitySummary.favoriteCount = status.favoriteCount
|
||||
|
|
|
@ -38,7 +38,7 @@ class StubFragment : Fragment() {
|
|||
text.text = arguments.get(EXTRA_TAB_POSITION).toString()
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater!!.inflate(R.layout.fragment_stub, container, false)
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.fragment_stub, container, false)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -821,13 +821,13 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
|||
user.name, user.screen_name, nameFirst)
|
||||
mentionItem.title = getString(R.string.mention_user_name, displayName)
|
||||
}
|
||||
MenuUtils.setItemAvailability(menu, R.id.mention, !isMyself)
|
||||
MenuUtils.setItemAvailability(menu, R.id.qr_code, isMyself || BuildConfig.DEBUG)
|
||||
MenuUtils.setItemAvailability(menu, R.id.incoming_friendships, isMyself)
|
||||
MenuUtils.setItemAvailability(menu, R.id.saved_searches, isMyself)
|
||||
menu.setItemAvailability(R.id.mention, !isMyself)
|
||||
menu.setItemAvailability(R.id.qr_code, isMyself || BuildConfig.DEBUG)
|
||||
menu.setItemAvailability(R.id.incoming_friendships, isMyself)
|
||||
menu.setItemAvailability(R.id.saved_searches, isMyself)
|
||||
|
||||
MenuUtils.setItemAvailability(menu, R.id.blocked_users, isMyself)
|
||||
MenuUtils.setItemAvailability(menu, R.id.block, !isMyself)
|
||||
menu.setItemAvailability(R.id.blocked_users, isMyself)
|
||||
menu.setItemAvailability(R.id.block, !isMyself)
|
||||
|
||||
|
||||
val isTwitter: Boolean
|
||||
|
@ -838,11 +838,11 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
|||
isTwitter = false
|
||||
}
|
||||
|
||||
MenuUtils.setItemAvailability(menu, R.id.add_to_list, isTwitter)
|
||||
MenuUtils.setItemAvailability(menu, R.id.mute_user, !isMyself && isTwitter)
|
||||
MenuUtils.setItemAvailability(menu, R.id.muted_users, isMyself && isTwitter)
|
||||
MenuUtils.setItemAvailability(menu, R.id.report_spam, !isMyself && isTwitter)
|
||||
MenuUtils.setItemAvailability(menu, R.id.enable_retweets, !isMyself && isTwitter)
|
||||
menu.setItemAvailability(R.id.add_to_list, isTwitter)
|
||||
menu.setItemAvailability(R.id.mute_user, !isMyself && isTwitter)
|
||||
menu.setItemAvailability(R.id.muted_users, isMyself && isTwitter)
|
||||
menu.setItemAvailability(R.id.report_spam, !isMyself && isTwitter)
|
||||
menu.setItemAvailability(R.id.enable_retweets, !isMyself && isTwitter)
|
||||
|
||||
if (relationship != null) {
|
||||
menu.findItem(R.id.add_to_filter)?.apply {
|
||||
|
@ -850,12 +850,12 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
|||
}
|
||||
|
||||
if (isMyself) {
|
||||
MenuUtils.setItemAvailability(menu, R.id.send_direct_message, false)
|
||||
MenuUtils.setItemAvailability(menu, R.id.enable_notifications, false)
|
||||
menu.setItemAvailability(R.id.send_direct_message, false)
|
||||
menu.setItemAvailability(R.id.enable_notifications, false)
|
||||
} else {
|
||||
MenuUtils.setItemAvailability(menu, R.id.send_direct_message, relationship.can_dm)
|
||||
MenuUtils.setItemAvailability(menu, R.id.block, true)
|
||||
MenuUtils.setItemAvailability(menu, R.id.enable_notifications, isTwitter && relationship.following)
|
||||
menu.setItemAvailability(R.id.send_direct_message, relationship.can_dm)
|
||||
menu.setItemAvailability(R.id.block, true)
|
||||
menu.setItemAvailability(R.id.enable_notifications, isTwitter && relationship.following)
|
||||
|
||||
menu.findItem(R.id.block)?.apply {
|
||||
ActionIconDrawable.setMenuHighlight(this, TwidereMenuInfo(relationship.blocking))
|
||||
|
@ -873,8 +873,8 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
|||
}
|
||||
|
||||
} else {
|
||||
MenuUtils.setItemAvailability(menu, R.id.send_direct_message, false)
|
||||
MenuUtils.setItemAvailability(menu, R.id.enable_notifications, false)
|
||||
menu.setItemAvailability(R.id.send_direct_message, false)
|
||||
menu.setItemAvailability(R.id.enable_notifications, false)
|
||||
}
|
||||
val intent = Intent(INTENT_ACTION_EXTENSION_OPEN_USER)
|
||||
val extras = Bundle()
|
||||
|
|
|
@ -44,6 +44,7 @@ import android.widget.CheckBox
|
|||
import com.rengwuxian.materialedittext.MaterialEditText
|
||||
import com.squareup.otto.Subscribe
|
||||
import org.mariotaku.kpreferences.get
|
||||
import org.mariotaku.ktextension.setItemAvailability
|
||||
import org.mariotaku.microblog.library.MicroBlogException
|
||||
import org.mariotaku.microblog.library.twitter.model.UserList
|
||||
import org.mariotaku.microblog.library.twitter.model.UserListUpdate
|
||||
|
@ -176,21 +177,21 @@ class UserListFragment : AbsToolbarTabPagesFragment(), OnClickListener,
|
|||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
|
||||
inflater!!.inflate(R.menu.menu_user_list, menu)
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
inflater.inflate(R.menu.menu_user_list, menu)
|
||||
}
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu?) {
|
||||
override fun onPrepareOptionsMenu(menu: Menu) {
|
||||
val userList = this.userList
|
||||
MenuUtils.setItemAvailability(menu, R.id.info, userList != null)
|
||||
menu!!.removeGroup(MENU_GROUP_USER_LIST_EXTENSION)
|
||||
menu.setItemAvailability(R.id.info, userList != null)
|
||||
menu.removeGroup(MENU_GROUP_USER_LIST_EXTENSION)
|
||||
if (userList != null) {
|
||||
val isMyList = userList.user_key == userList.account_key
|
||||
val isFollowing = userList.is_following
|
||||
MenuUtils.setItemAvailability(menu, R.id.edit, isMyList)
|
||||
MenuUtils.setItemAvailability(menu, R.id.follow, !isMyList)
|
||||
MenuUtils.setItemAvailability(menu, R.id.add, isMyList)
|
||||
MenuUtils.setItemAvailability(menu, R.id.delete, isMyList)
|
||||
menu.setItemAvailability(R.id.edit, isMyList)
|
||||
menu.setItemAvailability(R.id.follow, !isMyList)
|
||||
menu.setItemAvailability(R.id.add, isMyList)
|
||||
menu.setItemAvailability(R.id.delete, isMyList)
|
||||
val followItem = menu.findItem(R.id.follow)
|
||||
if (isFollowing) {
|
||||
followItem.setIcon(R.drawable.ic_action_cancel)
|
||||
|
@ -204,17 +205,17 @@ class UserListFragment : AbsToolbarTabPagesFragment(), OnClickListener,
|
|||
extensionsIntent.putExtra(EXTRA_USER_LIST, userList)
|
||||
MenuUtils.addIntentToMenu(activity, menu, extensionsIntent, MENU_GROUP_USER_LIST_EXTENSION)
|
||||
} else {
|
||||
MenuUtils.setItemAvailability(menu, R.id.edit, false)
|
||||
MenuUtils.setItemAvailability(menu, R.id.follow, false)
|
||||
MenuUtils.setItemAvailability(menu, R.id.add, false)
|
||||
MenuUtils.setItemAvailability(menu, R.id.delete, false)
|
||||
menu.setItemAvailability(R.id.edit, false)
|
||||
menu.setItemAvailability(R.id.follow, false)
|
||||
menu.setItemAvailability(R.id.add, false)
|
||||
menu.setItemAvailability(R.id.delete, false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
val twitter = twitterWrapper
|
||||
val userList = userList ?: return false
|
||||
when (item!!.itemId) {
|
||||
when (item.itemId) {
|
||||
R.id.add -> {
|
||||
if (userList.user_key != userList.account_key) return false
|
||||
val intent = Intent(INTENT_ACTION_SELECT_USER)
|
||||
|
|
|
@ -94,10 +94,10 @@ class UserListMembersFragment : CursorUsersListFragment() {
|
|||
menu.setHeaderTitle(userColorNameManager.getDisplayName(user, preferences[nameFirstKey]))
|
||||
}
|
||||
|
||||
override fun onContextItemSelected(item: MenuItem?): Boolean {
|
||||
override fun onContextItemSelected(item: MenuItem): Boolean {
|
||||
if (!userVisibleHint) return false
|
||||
val userList = userList ?: return false
|
||||
val contextMenuInfo = item!!.menuInfo as ExtendedRecyclerView.ContextMenuInfo
|
||||
val contextMenuInfo = item.menuInfo as ExtendedRecyclerView.ContextMenuInfo
|
||||
val user = adapter.getUser(contextMenuInfo.position) ?: return false
|
||||
when (item.itemId) {
|
||||
R.id.delete_from_list -> {
|
||||
|
|
|
@ -26,6 +26,7 @@ import android.view.Menu
|
|||
import android.view.MenuInflater
|
||||
import android.view.MenuItem
|
||||
import com.squareup.otto.Subscribe
|
||||
import org.mariotaku.ktextension.setItemAvailability
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.constant.IntentConstants.*
|
||||
import org.mariotaku.twidere.loader.UserListOwnershipsLoader
|
||||
|
@ -78,10 +79,10 @@ class UserListsOwnershipsFragment : ParcelableUserListsFragment() {
|
|||
val accountId = accountKey
|
||||
if (accountId == null || item == null) return
|
||||
if (accountId == userId) {
|
||||
MenuUtils.setItemAvailability(menu, R.id.new_user_list, true)
|
||||
menu.setItemAvailability(R.id.new_user_list, true)
|
||||
} else {
|
||||
val screenName = this.screenName
|
||||
MenuUtils.setItemAvailability(menu, R.id.new_user_list, screenName != null &&
|
||||
menu.setItemAvailability(R.id.new_user_list, screenName != null &&
|
||||
Utils.isMyAccount(activity, screenName))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,8 +151,8 @@ class UserProfileEditorFragment : BaseFragment(), OnSizeChangedListener, TextWat
|
|||
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
|
||||
inflater!!.inflate(R.menu.menu_profile_editor, menu)
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
inflater.inflate(R.menu.menu_profile_editor, menu)
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
|
|
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2017 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.fragment.content
|
||||
|
||||
import android.accounts.AccountManager
|
||||
import android.app.Dialog
|
||||
import android.content.DialogInterface
|
||||
import android.os.Bundle
|
||||
import android.support.v4.app.FragmentManager
|
||||
import android.support.v7.app.AlertDialog
|
||||
import android.view.View
|
||||
import android.widget.ImageButton
|
||||
import android.widget.LinearLayout
|
||||
import com.bumptech.glide.Glide
|
||||
import org.mariotaku.kpreferences.get
|
||||
import org.mariotaku.ktextension.Bundle
|
||||
import org.mariotaku.ktextension.set
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.activity.content.RetweetQuoteDialogActivity
|
||||
import org.mariotaku.twidere.adapter.DummyItemAdapter
|
||||
import org.mariotaku.twidere.constant.IntentConstants.*
|
||||
import org.mariotaku.twidere.constant.iWantMyStarsBackKey
|
||||
import org.mariotaku.twidere.extension.applyTheme
|
||||
import org.mariotaku.twidere.fragment.BaseDialogFragment
|
||||
import org.mariotaku.twidere.model.ParcelableStatus
|
||||
import org.mariotaku.twidere.model.UserKey
|
||||
import org.mariotaku.twidere.model.util.AccountUtils
|
||||
import org.mariotaku.twidere.view.ColorLabelRelativeLayout
|
||||
import org.mariotaku.twidere.view.holder.StatusViewHolder
|
||||
|
||||
/**
|
||||
* Asks user to favorite a status.
|
||||
*
|
||||
* Created by mariotaku on 2017/4/12.
|
||||
*/
|
||||
class FavoriteConfirmDialogFragment : BaseDialogFragment() {
|
||||
|
||||
private val Dialog.loadProgress get() = findViewById(R.id.loadProgress)
|
||||
private val Dialog.itemContent get() = findViewById(R.id.itemContent) as ColorLabelRelativeLayout
|
||||
private val Dialog.itemMenu get() = findViewById(R.id.itemMenu) as ImageButton
|
||||
private val Dialog.actionButtons get() = findViewById(R.id.actionButtons) as LinearLayout
|
||||
|
||||
private val status: ParcelableStatus
|
||||
get() = arguments.getParcelable<ParcelableStatus>(EXTRA_STATUS)
|
||||
|
||||
private val accountKey: UserKey
|
||||
get() = arguments.getParcelable(EXTRA_ACCOUNT_KEY) ?: status.account_key
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val builder = AlertDialog.Builder(context)
|
||||
val accountKey = this.accountKey
|
||||
val details = AccountUtils.getAccountDetails(AccountManager.get(context), accountKey, true)!!
|
||||
val status = this.status.apply {
|
||||
if (account_key != accountKey) {
|
||||
is_favorite = false
|
||||
}
|
||||
account_key = details.key
|
||||
account_color = details.color
|
||||
}
|
||||
|
||||
|
||||
builder.setView(R.layout.dialog_status_favorite_confirm)
|
||||
builder.setTitle(R.string.title_favorite_confirm)
|
||||
if (preferences[iWantMyStarsBackKey]) {
|
||||
builder.setPositiveButton(R.string.action_favorite, null)
|
||||
} else {
|
||||
builder.setPositiveButton(R.string.action_like, null)
|
||||
}
|
||||
builder.setNegativeButton(android.R.string.cancel, null)
|
||||
val dialog = builder.create()
|
||||
dialog.setOnShowListener { dialog ->
|
||||
dialog as AlertDialog
|
||||
dialog.applyTheme()
|
||||
|
||||
val adapter = DummyItemAdapter(context, requestManager = Glide.with(this))
|
||||
adapter.setShouldShowAccountsColor(true)
|
||||
val holder = StatusViewHolder(adapter, dialog.itemContent)
|
||||
holder.displayStatus(status = status, displayInReplyTo = false)
|
||||
|
||||
dialog.loadProgress.visibility = View.GONE
|
||||
dialog.itemMenu.visibility = View.GONE
|
||||
dialog.actionButtons.visibility = View.GONE
|
||||
dialog.itemContent.isFocusable = false
|
||||
|
||||
val positiveButton = dialog.getButton(DialogInterface.BUTTON_POSITIVE)
|
||||
if (preferences[iWantMyStarsBackKey]) {
|
||||
if (status.is_favorite) {
|
||||
positiveButton.setText(R.string.action_unfavorite)
|
||||
} else {
|
||||
positiveButton.setText(R.string.action_favorite)
|
||||
}
|
||||
} else {
|
||||
if (status.is_favorite) {
|
||||
positiveButton.setText(R.string.action_undo_like)
|
||||
} else {
|
||||
positiveButton.setText(R.string.action_like)
|
||||
}
|
||||
}
|
||||
positiveButton.setOnClickListener {
|
||||
if (status.is_favorite) {
|
||||
twitterWrapper.destroyFavoriteAsync(accountKey, status.id)
|
||||
} else {
|
||||
twitterWrapper.createFavoriteAsync(accountKey, status)
|
||||
}
|
||||
dismiss()
|
||||
}
|
||||
|
||||
}
|
||||
return dialog
|
||||
}
|
||||
|
||||
override fun onCancel(dialog: DialogInterface) {
|
||||
finishFavoriteConfirmActivity()
|
||||
}
|
||||
|
||||
override fun onDismiss(dialog: DialogInterface) {
|
||||
super.onDismiss(dialog)
|
||||
finishFavoriteConfirmActivity()
|
||||
}
|
||||
|
||||
private fun finishFavoriteConfirmActivity() {
|
||||
val activity = this.activity
|
||||
if (activity is RetweetQuoteDialogActivity && !activity.isFinishing) {
|
||||
activity.finish()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
val FRAGMENT_TAG = "favorite_confirm"
|
||||
|
||||
fun show(fm: FragmentManager, accountKey: UserKey? = null, statusId: String,
|
||||
status: ParcelableStatus?): FavoriteConfirmDialogFragment {
|
||||
val f = FavoriteConfirmDialogFragment()
|
||||
f.arguments = Bundle {
|
||||
this[EXTRA_ACCOUNT_KEY] = accountKey
|
||||
this[EXTRA_STATUS_ID] = statusId
|
||||
this[EXTRA_STATUS] = status
|
||||
}
|
||||
f.show(fm, FRAGMENT_TAG)
|
||||
return f
|
||||
}
|
||||
}
|
||||
}
|
|
@ -63,10 +63,14 @@ import org.mariotaku.twidere.view.StatusTextCountView
|
|||
import org.mariotaku.twidere.view.holder.StatusViewHolder
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Asks user to retweet/quote a status.
|
||||
*/
|
||||
class RetweetQuoteDialogFragment : BaseDialogFragment() {
|
||||
private lateinit var popupMenu: PopupMenu
|
||||
|
||||
private val PopupMenu.quoteOriginalStatus get() = menu.isItemChecked(R.id.quote_original_status)
|
||||
private val Dialog.loadProgress get() = findViewById(R.id.loadProgress)
|
||||
private val Dialog.itemContent get() = findViewById(R.id.itemContent) as ColorLabelRelativeLayout
|
||||
private val Dialog.textCountView get() = findViewById(R.id.commentTextCount) as StatusTextCountView
|
||||
private val Dialog.itemMenu get() = findViewById(R.id.itemMenu) as ImageButton
|
||||
|
@ -90,12 +94,15 @@ class RetweetQuoteDialogFragment : BaseDialogFragment() {
|
|||
val accountKey = this.accountKey
|
||||
val details = AccountUtils.getAccountDetails(AccountManager.get(context), accountKey, true)!!
|
||||
val status = this.status.apply {
|
||||
if (account_key != accountKey) {
|
||||
my_retweet_id = null
|
||||
}
|
||||
account_key = details.key
|
||||
account_color = details.color
|
||||
}
|
||||
|
||||
builder.setView(R.layout.dialog_status_quote_retweet)
|
||||
builder.setTitle(R.string.retweet_quote_confirm_title)
|
||||
builder.setTitle(R.string.title_retweet_quote_confirm)
|
||||
builder.setPositiveButton(R.string.action_retweet, null)
|
||||
builder.setNegativeButton(android.R.string.cancel, null)
|
||||
builder.setNeutralButton(R.string.action_quote) { _, _ ->
|
||||
|
@ -119,6 +126,7 @@ class RetweetQuoteDialogFragment : BaseDialogFragment() {
|
|||
|
||||
dialog.textCountView.maxLength = details.textLimit
|
||||
|
||||
dialog.loadProgress.visibility = View.GONE
|
||||
dialog.itemMenu.visibility = View.GONE
|
||||
dialog.actionButtons.visibility = View.GONE
|
||||
dialog.itemContent.isFocusable = false
|
||||
|
@ -383,12 +391,13 @@ class RetweetQuoteDialogFragment : BaseDialogFragment() {
|
|||
val FRAGMENT_TAG = "retweet_quote"
|
||||
private val SHOW_PROTECTED_CONFIRM = java.lang.Boolean.parseBoolean("false")
|
||||
|
||||
fun show(fm: FragmentManager, status: ParcelableStatus, accountKey: UserKey? = null,
|
||||
text: String? = null): RetweetQuoteDialogFragment {
|
||||
fun show(fm: FragmentManager, accountKey: UserKey? = null, statusId: String,
|
||||
status: ParcelableStatus?, text: String? = null): RetweetQuoteDialogFragment {
|
||||
val f = RetweetQuoteDialogFragment()
|
||||
f.arguments = Bundle {
|
||||
this[EXTRA_STATUS] = status
|
||||
this[EXTRA_ACCOUNT_KEY] = accountKey
|
||||
this[EXTRA_STATUS_ID] = statusId
|
||||
this[EXTRA_STATUS] = status
|
||||
this[EXTRA_TEXT] = text
|
||||
}
|
||||
f.show(fm, FRAGMENT_TAG)
|
||||
|
|
|
@ -35,18 +35,18 @@ import org.mariotaku.twidere.util.Utils.createStatusShareIntent
|
|||
class SupportStatusShareProvider(context: Context) : ActionProvider(context) {
|
||||
var status: ParcelableStatus? = null
|
||||
|
||||
override fun onCreateActionView(): View? = null
|
||||
override fun onCreateActionView() = null
|
||||
|
||||
override fun onCreateActionView(forItem: MenuItem?): View? = null
|
||||
override fun onCreateActionView(forItem: MenuItem) = null
|
||||
|
||||
override fun onPerformDefaultAction(): Boolean = true
|
||||
override fun onPerformDefaultAction() = true
|
||||
|
||||
override fun hasSubMenu(): Boolean = true
|
||||
override fun hasSubMenu() = true
|
||||
|
||||
override fun onPrepareSubMenu(subMenu: SubMenu?) {
|
||||
override fun onPrepareSubMenu(subMenu: SubMenu) {
|
||||
val status = status ?: return
|
||||
val shareIntent = createStatusShareIntent(context, status)
|
||||
subMenu!!.removeGroup(MENU_GROUP_STATUS_SHARE)
|
||||
subMenu.removeGroup(MENU_GROUP_STATUS_SHARE)
|
||||
MenuUtils.addIntentToMenu(context, subMenu, shareIntent, MENU_GROUP_STATUS_SHARE)
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2017 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.mariotaku.twidere.preference
|
||||
|
||||
import android.content.Context
|
||||
import android.support.v7.preference.PreferenceManager
|
||||
import android.support.v7.preference.SwitchPreferenceCompat
|
||||
import android.util.AttributeSet
|
||||
import org.mariotaku.kpreferences.get
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.constant.iWantMyStarsBackKey
|
||||
|
||||
/**
|
||||
* Changes title to "Favorite/Like" confirmation respect to user settings
|
||||
*
|
||||
* Created by mariotaku on 2017/4/12.
|
||||
*/
|
||||
class FavoriteConfirmSwitchPreference(context: Context, attrs: AttributeSet? = null) :
|
||||
SwitchPreferenceCompat(context, attrs) {
|
||||
|
||||
override fun onAttachedToHierarchy(preferenceManager: PreferenceManager) {
|
||||
super.onAttachedToHierarchy(preferenceManager)
|
||||
if (preferenceManager.sharedPreferences[iWantMyStarsBackKey]) {
|
||||
setTitle(R.string.preference_title_favorite_confirmation)
|
||||
setSummary(R.string.preference_summary_favorite_confirmation)
|
||||
} else {
|
||||
setTitle(R.string.preference_title_like_confirmation)
|
||||
setSummary(R.string.preference_summary_like_confirmation)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,11 +24,10 @@ import android.app.Activity
|
|||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.content.pm.PackageManager
|
||||
import android.graphics.PorterDuff
|
||||
import android.os.Parcelable
|
||||
import android.support.annotation.DrawableRes
|
||||
import android.support.annotation.StringRes
|
||||
import android.support.annotation.UiThread
|
||||
import android.support.v4.app.Fragment
|
||||
import android.support.v4.app.FragmentManager
|
||||
|
@ -42,18 +41,18 @@ import android.view.MenuItem
|
|||
import org.mariotaku.kpreferences.get
|
||||
import org.mariotaku.ktextension.Bundle
|
||||
import org.mariotaku.ktextension.set
|
||||
import org.mariotaku.ktextension.setItemChecked
|
||||
import org.mariotaku.ktextension.setMenuItemIcon
|
||||
import org.mariotaku.ktextension.setItemAvailability
|
||||
import org.mariotaku.twidere.Constants.*
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.activity.AccountSelectorActivity
|
||||
import org.mariotaku.twidere.activity.BaseActivity
|
||||
import org.mariotaku.twidere.activity.ColorPickerDialogActivity
|
||||
import org.mariotaku.twidere.constant.SharedPreferenceConstants
|
||||
import org.mariotaku.twidere.constant.favoriteConfirmationKey
|
||||
import org.mariotaku.twidere.constant.iWantMyStarsBackKey
|
||||
import org.mariotaku.twidere.constant.nameFirstKey
|
||||
import org.mariotaku.twidere.fragment.AbsStatusesFragment
|
||||
import org.mariotaku.twidere.fragment.AddStatusFilterDialogFragment
|
||||
import org.mariotaku.twidere.fragment.DestroyStatusDialogFragment
|
||||
import org.mariotaku.twidere.fragment.SetUserNicknameDialogFragment
|
||||
import org.mariotaku.twidere.fragment.*
|
||||
import org.mariotaku.twidere.fragment.content.FavoriteConfirmDialogFragment
|
||||
import org.mariotaku.twidere.fragment.content.RetweetQuoteDialogFragment
|
||||
import org.mariotaku.twidere.fragment.status.BlockStatusUsersDialogFragment
|
||||
import org.mariotaku.twidere.fragment.status.MuteStatusUsersDialogFragment
|
||||
import org.mariotaku.twidere.graphic.ActionIconDrawable
|
||||
|
@ -74,27 +73,6 @@ import java.io.IOException
|
|||
*/
|
||||
object MenuUtils {
|
||||
|
||||
fun setItemAvailability(menu: Menu?, id: Int, available: Boolean) {
|
||||
if (menu == null) return
|
||||
val item = menu.findItem(id) ?: return
|
||||
item.isVisible = available
|
||||
item.isEnabled = available
|
||||
}
|
||||
|
||||
fun setItemChecked(menu: Menu?, id: Int, checked: Boolean) {
|
||||
menu?.setItemChecked(id, checked)
|
||||
}
|
||||
|
||||
fun setMenuItemIcon(menu: Menu?, id: Int, @DrawableRes icon: Int) {
|
||||
menu?.setMenuItemIcon(id, icon)
|
||||
}
|
||||
|
||||
fun setMenuItemTitle(menu: Menu?, id: Int, @StringRes icon: Int) {
|
||||
if (menu == null) return
|
||||
val item = menu.findItem(id) ?: return
|
||||
item.setTitle(icon)
|
||||
}
|
||||
|
||||
fun addIntentToMenu(context: Context, menu: Menu, queryIntent: Intent,
|
||||
groupId: Int = Menu.NONE) {
|
||||
val pm = context.packageManager
|
||||
|
@ -120,29 +98,21 @@ object MenuUtils {
|
|||
}
|
||||
}
|
||||
|
||||
fun setupForStatus(context: Context,
|
||||
preferences: SharedPreferencesWrapper,
|
||||
menu: Menu,
|
||||
status: ParcelableStatus,
|
||||
twitter: AsyncTwitterWrapper,
|
||||
manager: UserColorNameManager) {
|
||||
fun setupForStatus(context: Context, menu: Menu, preferences: SharedPreferences,
|
||||
twitter: AsyncTwitterWrapper, manager: UserColorNameManager, status: ParcelableStatus) {
|
||||
val account = AccountUtils.getAccountDetails(AccountManager.get(context),
|
||||
status.account_key, true) ?: return
|
||||
setupForStatus(context, preferences, menu, status, account, twitter, manager)
|
||||
setupForStatus(context, menu, preferences, twitter, manager, status, account)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun setupForStatus(context: Context,
|
||||
preferences: SharedPreferencesWrapper,
|
||||
menu: Menu,
|
||||
status: ParcelableStatus,
|
||||
details: AccountDetails,
|
||||
twitter: AsyncTwitterWrapper,
|
||||
manager: UserColorNameManager) {
|
||||
fun setupForStatus(context: Context, menu: Menu, preferences: SharedPreferences,
|
||||
twitter: AsyncTwitterWrapper, manager: UserColorNameManager, status: ParcelableStatus,
|
||||
details: AccountDetails) {
|
||||
if (menu is ContextMenu) {
|
||||
menu.setHeaderTitle(context.getString(R.string.status_menu_title_format,
|
||||
manager.getDisplayName(status.user_key, status.user_name, status.user_screen_name,
|
||||
preferences[nameFirstKey]),
|
||||
val displayName = manager.getDisplayName(status.user_key, status.user_name,
|
||||
status.user_screen_name, preferences[nameFirstKey])
|
||||
menu.setHeaderTitle(context.getString(R.string.status_menu_title_format, displayName,
|
||||
status.text_unescaped))
|
||||
}
|
||||
val retweetHighlight = ContextCompat.getColor(context, R.color.highlight_retweet)
|
||||
|
@ -176,7 +146,7 @@ object MenuUtils {
|
|||
isFavorite = status.is_favorite
|
||||
}
|
||||
val provider = MenuItemCompat.getActionProvider(favorite)
|
||||
val useStar = preferences.getBoolean(SharedPreferenceConstants.KEY_I_WANT_MY_STARS_BACK)
|
||||
val useStar = preferences[iWantMyStarsBackKey]
|
||||
if (provider is FavoriteItemProvider) {
|
||||
provider.setIsFavorite(favorite, isFavorite)
|
||||
} else {
|
||||
|
@ -202,7 +172,7 @@ object MenuUtils {
|
|||
val translate = menu.findItem(R.id.translate)
|
||||
if (translate != null) {
|
||||
val isOfficialKey = Utils.isOfficialCredentials(context, details)
|
||||
setItemAvailability(menu, R.id.translate, isOfficialKey)
|
||||
menu.setItemAvailability(R.id.translate, isOfficialKey)
|
||||
}
|
||||
menu.removeGroup(MENU_GROUP_STATUS_EXTENSION)
|
||||
addIntentToMenuForExtension(context, menu, MENU_GROUP_STATUS_EXTENSION,
|
||||
|
@ -227,13 +197,9 @@ object MenuUtils {
|
|||
|
||||
}
|
||||
|
||||
fun handleStatusClick(context: Context,
|
||||
fragment: Fragment?,
|
||||
fm: FragmentManager,
|
||||
colorNameManager: UserColorNameManager,
|
||||
twitter: AsyncTwitterWrapper,
|
||||
status: ParcelableStatus,
|
||||
item: MenuItem): Boolean {
|
||||
fun handleStatusClick(context: Context, fragment: Fragment?, fm: FragmentManager,
|
||||
preferences: SharedPreferences, colorNameManager: UserColorNameManager,
|
||||
twitter: AsyncTwitterWrapper, status: ParcelableStatus, item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.copy -> {
|
||||
if (ClipboardUtils.setText(context, status.text_plain)) {
|
||||
|
@ -241,10 +207,19 @@ object MenuUtils {
|
|||
}
|
||||
}
|
||||
R.id.retweet -> {
|
||||
if (Utils.isMyRetweet(status)) {
|
||||
twitter.cancelRetweetAsync(status.account_key, status.id, status.my_retweet_id)
|
||||
if (fragment is BaseFragment) {
|
||||
fragment.executeAfterFragmentResumed {
|
||||
RetweetQuoteDialogFragment.show(it.childFragmentManager, status.account_key,
|
||||
status.id, status)
|
||||
}
|
||||
} else if (context is BaseActivity) {
|
||||
context.executeAfterFragmentResumed {
|
||||
RetweetQuoteDialogFragment.show(it.supportFragmentManager, status.account_key,
|
||||
status.id, status)
|
||||
}
|
||||
} else {
|
||||
twitter.retweetStatusAsync(status.account_key, status)
|
||||
RetweetQuoteDialogFragment.show(fm, status.account_key,
|
||||
status.id, status)
|
||||
}
|
||||
}
|
||||
R.id.quote -> {
|
||||
|
@ -258,7 +233,22 @@ object MenuUtils {
|
|||
context.startActivity(intent)
|
||||
}
|
||||
R.id.favorite -> {
|
||||
if (status.is_favorite) {
|
||||
if (preferences[favoriteConfirmationKey]) {
|
||||
if (fragment is BaseFragment) {
|
||||
fragment.executeAfterFragmentResumed {
|
||||
FavoriteConfirmDialogFragment.show(it.childFragmentManager,
|
||||
status.account_key, status.id, status)
|
||||
}
|
||||
} else if (context is BaseActivity) {
|
||||
context.executeAfterFragmentResumed {
|
||||
FavoriteConfirmDialogFragment.show(it.supportFragmentManager,
|
||||
status.account_key, status.id, status)
|
||||
}
|
||||
} else {
|
||||
FavoriteConfirmDialogFragment.show(fm, status.account_key, status.id,
|
||||
status)
|
||||
}
|
||||
} else if (status.is_favorite) {
|
||||
twitter.destroyFavoriteAsync(status.account_key, status.id)
|
||||
} else {
|
||||
val provider = MenuItemCompat.getActionProvider(item)
|
||||
|
@ -359,12 +349,8 @@ object MenuUtils {
|
|||
}
|
||||
|
||||
|
||||
fun addIntentToMenuForExtension(context: Context?, menu: Menu?,
|
||||
groupId: Int, action: String?,
|
||||
parcelableKey: String?, parcelableJSONKey: String,
|
||||
parcelable: Parcelable?) {
|
||||
if (context == null || menu == null || action == null || parcelableKey == null || parcelable == null)
|
||||
return
|
||||
fun addIntentToMenuForExtension(context: Context, menu: Menu, groupId: Int, action: String,
|
||||
parcelableKey: String, jsonKey: String, obj: Parcelable) {
|
||||
val pm = context.packageManager
|
||||
val res = context.resources
|
||||
val density = res.displayMetrics.density
|
||||
|
@ -373,16 +359,16 @@ object MenuUtils {
|
|||
queryIntent.setExtrasClassLoader(context.classLoader)
|
||||
val activities = pm.queryIntentActivities(queryIntent, PackageManager.GET_META_DATA)
|
||||
val parcelableJson = try {
|
||||
JsonSerializer.serialize(parcelable)
|
||||
JsonSerializer.serialize(obj)
|
||||
} catch (e: IOException) {
|
||||
null
|
||||
}
|
||||
for (info in activities) {
|
||||
val intent = Intent(queryIntent)
|
||||
if (Utils.isExtensionUseJSON(info) && parcelableJson != null) {
|
||||
intent.putExtra(parcelableJSONKey, parcelableJson)
|
||||
intent.putExtra(jsonKey, parcelableJson)
|
||||
} else {
|
||||
intent.putExtra(parcelableKey, parcelable)
|
||||
intent.putExtra(parcelableKey, obj)
|
||||
}
|
||||
intent.setClassName(info.activityInfo.packageName, info.activityInfo.name)
|
||||
val item = menu.add(groupId, Menu.NONE, Menu.NONE, info.loadLabel(pm))
|
||||
|
|
|
@ -29,6 +29,7 @@ import android.view.MenuInflater
|
|||
import android.view.MenuItem
|
||||
import android.webkit.URLUtil
|
||||
import android.widget.TextView
|
||||
import org.mariotaku.ktextension.setItemAvailability
|
||||
|
||||
import org.mariotaku.twidere.R
|
||||
|
||||
|
@ -50,8 +51,8 @@ class StatusActionModeCallback(private val textView: TextView, private val conte
|
|||
val string = SpannableString.valueOf(textView.text)
|
||||
val spans = string.getSpans(start, end, URLSpan::class.java)
|
||||
val selectingLink = spans.size == 1 && URLUtil.isValidUrl(spans[0].url)
|
||||
MenuUtils.setItemAvailability(menu, R.id.copy_url, selectingLink)
|
||||
MenuUtils.setItemAvailability(menu, R.id.share_url, selectingLink)
|
||||
menu.setItemAvailability(R.id.copy_url, selectingLink)
|
||||
menu.setItemAvailability(R.id.share_url, selectingLink)
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
@ -807,7 +807,7 @@ Convertilu a un tuit normal amiesta una caráuter estra.</string>
|
|||
<string name="reset_to_default">Reafitar</string>
|
||||
<string name="retry_on_network_issue">Reintentar nos fallos de rede</string>
|
||||
<string name="retry_on_network_issue_summary">Intenta recuperase automáticamente d\'un fallu de rede</string>
|
||||
<string name="retweet_quote_confirm_title">¿Retuitiar a los tos siguidores?</string>
|
||||
<string name="title_retweet_quote_confirm">¿Retuitiar a los tos siguidores?</string>
|
||||
<string name="retweeted_by_count">Retuitiáu por <xliff:g id="retweet_count">%d</xliff:g> usuarios</string>
|
||||
<string name="retweeted_by_name">Retuitiáu por <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">Retuitiáu por <xliff:g id="user_name">%1$s</xliff:g> y <xliff:g id="retweet_count">%2$d</xliff:g> más</string>
|
||||
|
|
|
@ -569,7 +569,7 @@
|
|||
<string name="reset_to_default">Reinicia als valors per defecte</string>
|
||||
<string name="retry_on_network_issue">Torna a provar en errors de connexió</string>
|
||||
<string name="retry_on_network_issue_summary">Prova de recuperar-te automàticament d\'errors de xarxa</string>
|
||||
<string name="retweet_quote_confirm_title">Retweet als teus seguidors?</string>
|
||||
<string name="title_retweet_quote_confirm">Retweet als teus seguidors?</string>
|
||||
<string name="retweeted_by_count">Repiulat per <xliff:g id="retweet_count">%d</xliff:g> usuaris</string>
|
||||
<string name="retweeted_by_name">Repiulat per <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">Repiulat per <xliff:g id="user_name">%1$s</xliff:g> i <xliff:g id="retweet_count">%2$d</xliff:g> més</string>
|
||||
|
|
|
@ -812,7 +812,7 @@
|
|||
<string name="reset_to_default">Auf Standard zurücksetzen</string>
|
||||
<string name="retry_on_network_issue">Versuche es bei Netzwerkproblemen erneut</string>
|
||||
<string name="retry_on_network_issue_summary">Versuche, es automatisch bei Netzwerkproblemen wiederherzustellen</string>
|
||||
<string name="retweet_quote_confirm_title">An deine Follower retweeten?</string>
|
||||
<string name="title_retweet_quote_confirm">An deine Follower retweeten?</string>
|
||||
<string name="retweeted_by_count">Retweetet von <xliff:g id="retweet_count">%d</xliff:g> Benutzern</string>
|
||||
<string name="retweeted_by_name">Retweetet von <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">Retweetet von <xliff:g id="user_name">%1$s</xliff:g> und <xliff:g id="retweet_count">%2$d</xliff:g> weiteren</string>
|
||||
|
|
|
@ -811,7 +811,7 @@
|
|||
<string name="reset_to_default">Restablecer a los valores por defecto</string>
|
||||
<string name="retry_on_network_issue">Reintentar el problema de red</string>
|
||||
<string name="retry_on_network_issue_summary">Intente recuperarse del problema de red de forma automática</string>
|
||||
<string name="retweet_quote_confirm_title">¿Retweetear a tus seguidores?</string>
|
||||
<string name="title_retweet_quote_confirm">¿Retweetear a tus seguidores?</string>
|
||||
<string name="retweeted_by_count">Retwitteado por <xliff:g id="retweet_count">%d</xliff:g> usuarios</string>
|
||||
<string name="retweeted_by_name">Retwitteado por <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">Retwitteado por <xliff:g id="user_name">%1$s</xliff:g> y <xliff:g id="retweet_count">%2$d</xliff:g> otros</string>
|
||||
|
|
|
@ -704,7 +704,7 @@
|
|||
<string name="reset_to_default">بازنشانی به پیشگزیده</string>
|
||||
<string name="retry_on_network_issue">تلاش دوباره هنگام مشکل شبکه</string>
|
||||
<string name="retry_on_network_issue_summary">تلاش برای بازیابی خودکار از مشکل شبکه</string>
|
||||
<string name="retweet_quote_confirm_title">بازتوییت برای دنبالکنندهها؟</string>
|
||||
<string name="title_retweet_quote_confirm">بازتوییت برای دنبالکنندهها؟</string>
|
||||
<string name="retweeted_by_count">بازتوییت شده توسّط <xliff:g id="retweet_count">%d</xliff:g> کاربر</string>
|
||||
<string name="retweeted_by_name">بازتوییت شده توسّط <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">بازتوییت شده توسّط <xliff:g id="user_name">%1$s</xliff:g> و <xliff:g id="retweet_count">%2$d</xliff:g> نفر دیگر</string>
|
||||
|
|
|
@ -559,7 +559,7 @@
|
|||
<string name="reset_keyboard_shortcuts_confirm">Resetoidaanko näppäimistöoikotiet oletuksiin?</string>
|
||||
<string name="reset_to_default">Resetoi oletuksiin</string>
|
||||
<string name="retry_on_network_issue">Yritä uudelleen kohdatessa verkko-ongelmia</string>
|
||||
<string name="retweet_quote_confirm_title">Haluatko uudelleentwiitata seuraajillesi?</string>
|
||||
<string name="title_retweet_quote_confirm">Haluatko uudelleentwiitata seuraajillesi?</string>
|
||||
<string name="retweeted_by_count"><xliff:g id="retweet_count">%d</xliff:g> käyttäjää uudelleentwiittasivat</string>
|
||||
<string name="retweeted_by_name"><xliff:g id="user_name">%s</xliff:g> uudelleentwiittasi</string>
|
||||
<string name="retweeted_by_name_with_count"><xliff:g id="user_name">%1$s</xliff:g> ja <xliff:g id="retweet_count">%2$d</xliff:g> muuta uudelleentwiittasivat</string>
|
||||
|
|
|
@ -808,7 +808,7 @@
|
|||
<string name="reset_to_default">Réinitialiser par défaut</string>
|
||||
<string name="retry_on_network_issue">Ré-essayer en cas de problème réseau</string>
|
||||
<string name="retry_on_network_issue_summary">Récupérer automatiquement en cas d\'erreur réseau</string>
|
||||
<string name="retweet_quote_confirm_title">Retweeter à vos followers ?</string>
|
||||
<string name="title_retweet_quote_confirm">Retweeter à vos followers ?</string>
|
||||
<string name="retweeted_by_count">Retweeté par <xliff:g id="retweet_count">%d</xliff:g> utilisateurs</string>
|
||||
<string name="retweeted_by_name">Retweeté par <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">Retweeté par <xliff:g id="user_name">%1$s</xliff:g> et <xliff:g id="retweet_count">%2$d</xliff:g> autres</string>
|
||||
|
|
|
@ -819,7 +819,7 @@
|
|||
<string name="reset_to_default">Reiniciar a orixinal</string>
|
||||
<string name="retry_on_network_issue">Con problemas de rede, tentar de novo</string>
|
||||
<string name="retry_on_network_issue_summary">Con problemas de rede, tentar recuperar automaticamente</string>
|
||||
<string name="retweet_quote_confirm_title">Rechouchiar para os teus seguidores?</string>
|
||||
<string name="title_retweet_quote_confirm">Rechouchiar para os teus seguidores?</string>
|
||||
<string name="retweeted_by_count">Rechouchiado por <xliff:g id="retweet_count">%d</xliff:g> usuarios</string>
|
||||
<string name="retweeted_by_name">Rechouchiado por <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">Rechouchiado por <xliff:g id="user_name">%1$s</xliff:g> e outros <xliff:g id="retweet_count">%2$d</xliff:g></string>
|
||||
|
|
|
@ -482,7 +482,7 @@
|
|||
<string name="requested">Zatraženo</string>
|
||||
<string name="reset_keyboard_shortcuts_confirm">Vrati postavke tipkovničkih prečaca na zadano?</string>
|
||||
<string name="reset_to_default">Vrati na zadano</string>
|
||||
<string name="retweet_quote_confirm_title">Retweetati svojim sljedbenicima?</string>
|
||||
<string name="title_retweet_quote_confirm">Retweetati svojim sljedbenicima?</string>
|
||||
<string name="retweeted_by_count">Retweetali <xliff:g id="retweet_count">%d</xliff:g> korisnika</string>
|
||||
<string name="retweeted_by_name">Retweetao/-la <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">Retweetao/-la <xliff:g id="user_name">%1$s</xliff:g> i još <xliff:g id="retweet_count">%2$d</xliff:g> drugih</string>
|
||||
|
|
|
@ -574,7 +574,7 @@
|
|||
<string name="reset_to_default">Beállítás alapértelmezettre</string>
|
||||
<string name="retry_on_network_issue">Újraindítás hálózati hiba esetén</string>
|
||||
<string name="retry_on_network_issue_summary">Automatikus helyreállítási kísérlet hálózati hiba esetén</string>
|
||||
<string name="retweet_quote_confirm_title">Retweeteled a követőidnek?</string>
|
||||
<string name="title_retweet_quote_confirm">Retweeteled a követőidnek?</string>
|
||||
<string name="retweeted_by_count">Retweetelte <xliff:g id="retweet_count">%d</xliff:g> felhasználó</string>
|
||||
<string name="retweeted_by_name">Retweetelte <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">Retweetelte <xliff:g id="user_name">%1$s</xliff:g> és még <xliff:g id="retweet_count">%2$d</xliff:g> felhasználó</string>
|
||||
|
|
|
@ -630,7 +630,7 @@
|
|||
<string name="reset_to_default">Reset ke default</string>
|
||||
<string name="retry_on_network_issue">Coba lagi untuk masalah jaringan</string>
|
||||
<string name="retry_on_network_issue_summary">Mencoba memulihkan masalah jaringan secara otomatis</string>
|
||||
<string name="retweet_quote_confirm_title">Retweet ke follower anda?</string>
|
||||
<string name="title_retweet_quote_confirm">Retweet ke follower anda?</string>
|
||||
<string name="retweeted_by_count">Di-retweet oleh <xliff:g id="retweet_count">%d</xliff:g> pengguna</string>
|
||||
<string name="retweeted_by_name">Di-retweet oleh <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">Di-retweet oleh <xliff:g id="user_name">%1$s</xliff:g> dan <xliff:g id="retweet_count">%2$d</xliff:g> lainnya</string>
|
||||
|
|
|
@ -557,7 +557,7 @@
|
|||
<string name="reset_keyboard_shortcuts_confirm">Resettare le scorciatoie da tastiera ai valori di default?</string>
|
||||
<string name="reset_to_default">Ripristina come da default</string>
|
||||
<string name="retry_on_network_issue">Riprova se si verifica un errore di rete</string>
|
||||
<string name="retweet_quote_confirm_title">Retweet ai tuoi followers?</string>
|
||||
<string name="title_retweet_quote_confirm">Retweet ai tuoi followers?</string>
|
||||
<string name="retweeted_by_count">ReTweettato da <xliff:g id="retweet_count">%d</xliff:g> utenti</string>
|
||||
<string name="retweeted_by_name">ReTweettato da <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">ReTweettato da <xliff:g id="user_name">%1$s</xliff:g> e altri <xliff:g id="retweet_count">%2$d</xliff:g></string>
|
||||
|
|
|
@ -825,7 +825,7 @@
|
|||
<string name="reset_to_default">初期化する</string>
|
||||
<string name="retry_on_network_issue">ネットワークに問題がある場合に再接続</string>
|
||||
<string name="retry_on_network_issue_summary">ネットワークに問題が生じている場合に、自動的に接続を回復しようと試みます</string>
|
||||
<string name="retweet_quote_confirm_title">フォロワーにリツイートしますか?</string>
|
||||
<string name="title_retweet_quote_confirm">フォロワーにリツイートしますか?</string>
|
||||
<string name="retweeted_by_count"><xliff:g id="retweet_count">%d</xliff:g>人のリツイート</string>
|
||||
<string name="retweeted_by_name"><xliff:g id="user_name">%s</xliff:g>さんのリツイート</string>
|
||||
<string name="retweeted_by_name_with_count"><xliff:g id="user_name">%1$s</xliff:g>さんと他<xliff:g id="retweet_count">%2$d</xliff:g>人のリツイート</string>
|
||||
|
|
|
@ -729,7 +729,7 @@
|
|||
<string name="reset_to_default">기본값으로 초기화</string>
|
||||
<string name="retry_on_network_issue">네트워크 문제 발생 시 재시도</string>
|
||||
<string name="retry_on_network_issue_summary">네트워크 문제를 자동으로 복구 시도</string>
|
||||
<string name="retweet_quote_confirm_title">팔로워들에게 리트윗할까요?</string>
|
||||
<string name="title_retweet_quote_confirm">팔로워들에게 리트윗할까요?</string>
|
||||
<string name="retweeted_by_count"><xliff:g id="retweet_count">%d</xliff:g>명이 리트윗했습니다</string>
|
||||
<string name="retweeted_by_name"><xliff:g id="user_name">%s</xliff:g> 님이 리트윗했습니다</string>
|
||||
<string name="retweeted_by_name_with_count"><xliff:g id="user_name">%1$s</xliff:g> 님과 다른 <xliff:g id="retweet_count">%2$d</xliff:g>명이 리트윗했습니다</string>
|
||||
|
|
|
@ -575,7 +575,7 @@
|
|||
<string name="reset_to_default">Standaardinstellingen herstellen</string>
|
||||
<string name="retry_on_network_issue">Opnieuw proberen bij netwerkproblemen</string>
|
||||
<string name="retry_on_network_issue_summary">Probeer automatisch te herstellen na netwerkproblemen</string>
|
||||
<string name="retweet_quote_confirm_title">Retweeten naar je volgers?</string>
|
||||
<string name="title_retweet_quote_confirm">Retweeten naar je volgers?</string>
|
||||
<string name="retweeted_by_count">Geretweet door <xliff:g id="retweet_count">%d</xliff:g> gebruikers</string>
|
||||
<string name="retweeted_by_name">Geretweet door <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">Geretweet door <xliff:g id="user_name">%1$s</xliff:g> en <xliff:g id="retweet_count">%2$d</xliff:g> anderen</string>
|
||||
|
|
|
@ -502,7 +502,7 @@
|
|||
<string name="requested">Forespurt</string>
|
||||
<string name="reset_keyboard_shortcuts_confirm">Tilbakestill hurtigtaster til standard?</string>
|
||||
<string name="reset_to_default">Tilbakestill til standard</string>
|
||||
<string name="retweet_quote_confirm_title">Retweet til følgerne dine?</string>
|
||||
<string name="title_retweet_quote_confirm">Retweet til følgerne dine?</string>
|
||||
<string name="retweeted_by_count">Retweetet av <xliff:g id="retweet_count">%d</xliff:g> brukere</string>
|
||||
<string name="retweeted_by_name">Retweetet av <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">Retweetet av <xliff:g id="user_name">%1$s</xliff:g> og <xliff:g id="retweet_count">%2$d</xliff:g> andre</string>
|
||||
|
|
|
@ -615,7 +615,7 @@
|
|||
<string name="reset_to_default">Resetado para predefinição</string>
|
||||
<string name="retry_on_network_issue">Tentar novamente quando um erro de rede acontecer</string>
|
||||
<string name="retry_on_network_issue_summary">Tentar recuperar de um erro de rede automaticamente</string>
|
||||
<string name="retweet_quote_confirm_title">Retweetar para os seus seguidores?</string>
|
||||
<string name="title_retweet_quote_confirm">Retweetar para os seus seguidores?</string>
|
||||
<string name="retweeted_by_count">Retweetado por <xliff:g id="retweet_count">%d</xliff:g> usuários</string>
|
||||
<string name="retweeted_by_name">Retweetado por <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">Retweetado por <xliff:g id="user_name">%1$s</xliff:g> e <xliff:g id="retweet_count">%2$d</xliff:g> outros</string>
|
||||
|
|
|
@ -646,7 +646,7 @@
|
|||
<string name="reset_to_default">Сбросить до исходного состояния</string>
|
||||
<string name="retry_on_network_issue">Повторить по сети</string>
|
||||
<string name="retry_on_network_issue_summary">Попытаться восстановить из сети автоматически</string>
|
||||
<string name="retweet_quote_confirm_title">Ретвитнуть вашим читателям?</string>
|
||||
<string name="title_retweet_quote_confirm">Ретвитнуть вашим читателям?</string>
|
||||
<string name="retweeted_by_count">Ретвитнули <xliff:g id="retweet_count">%d</xliff:g> пользователей</string>
|
||||
<string name="retweeted_by_name">Ретвитнуто <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">Ретвитнул <xliff:g id="user_name">%1$s</xliff:g> и <xliff:g id="retweet_count">%2$d</xliff:g> других</string>
|
||||
|
|
|
@ -818,7 +818,7 @@
|
|||
<string name="reset_to_default">เรียกคืนค่าเริ่มต้น</string>
|
||||
<string name="retry_on_network_issue">แก้ปัญหาเครือข่ายอีกครั้ง</string>
|
||||
<string name="retry_on_network_issue_summary">พยายามแก้ปัญหาเครือข่ายอัตโนมัติ</string>
|
||||
<string name="retweet_quote_confirm_title">รีทวีตหรือไม่</string>
|
||||
<string name="title_retweet_quote_confirm">รีทวีตหรือไม่</string>
|
||||
<string name="retweeted_by_count">รีทวีตโดยผู้ใช้ <xliff:g id="retweet_count">%d</xliff:g> คน</string>
|
||||
<string name="retweeted_by_name">รีทวีตโดย <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">รีทวีตโดย <xliff:g id="user_name">%1$s</xliff:g> และอีก <xliff:g id="retweet_count">%2$d</xliff:g> คน</string>
|
||||
|
|
|
@ -577,7 +577,7 @@
|
|||
<string name="reset_to_default">Varsayılana dön</string>
|
||||
<string name="retry_on_network_issue">Ağ sorunu üzerinde yeniden deneyin</string>
|
||||
<string name="retry_on_network_issue_summary">Ağ sorununu otomatik kurtarmayı yeniden deneyin</string>
|
||||
<string name="retweet_quote_confirm_title">Takipçilerine retweetle?</string>
|
||||
<string name="title_retweet_quote_confirm">Takipçilerine retweetle?</string>
|
||||
<string name="retweeted_by_count"><xliff:g id="retweet_count">%d</xliff:g> kullanıcı bunu retweet etti</string>
|
||||
<string name="retweeted_by_name"><xliff:g id="user_name">%s</xliff:g> bunu retweet etti</string>
|
||||
<string name="retweeted_by_name_with_count"><xliff:g id="user_name">%1$s</xliff:g> ve <xliff:g id="retweet_count">%2$d</xliff:g> kişi daha bunu retweet etti</string>
|
||||
|
|
|
@ -578,7 +578,7 @@
|
|||
<string name="reset_to_default">Скидання налаштувань до усталених</string>
|
||||
<string name="retry_on_network_issue">Повторити спробу при мережевій проблемі</string>
|
||||
<string name="retry_on_network_issue_summary">Спробувати автоматично відновитися після мережевих проблем</string>
|
||||
<string name="retweet_quote_confirm_title">Ретвітнути вашим читачам?</string>
|
||||
<string name="title_retweet_quote_confirm">Ретвітнути вашим читачам?</string>
|
||||
<string name="retweeted_by_count">Ретвітнули <xliff:g id="retweet_count">%d</xliff:g> користувачі</string>
|
||||
<string name="retweeted_by_name">Ретвітнув(ла) <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">Ретвітнув(ла) <xliff:g id="user_name">%1$s</xliff:g> і ще <xliff:g id="retweet_count">%2$d</xliff:g> інших</string>
|
||||
|
|
|
@ -819,7 +819,7 @@
|
|||
<string name="reset_to_default">重置</string>
|
||||
<string name="retry_on_network_issue">遇到网络错误时重试</string>
|
||||
<string name="retry_on_network_issue_summary">尝试自动从网络错误中恢复</string>
|
||||
<string name="retweet_quote_confirm_title">转推给您的关注者?</string>
|
||||
<string name="title_retweet_quote_confirm">转推给您的关注者?</string>
|
||||
<string name="retweeted_by_count">由 <xliff:g id="retweet_count">%d</xliff:g> 人转推</string>
|
||||
<string name="retweeted_by_name">由 <xliff:g id="user_name">%s</xliff:g> 转推</string>
|
||||
<string name="retweeted_by_name_with_count"><xliff:g id="user_name">%1$s</xliff:g> 和其他 <xliff:g id="retweet_count">%2$d</xliff:g> 人已转推</string>
|
||||
|
|
|
@ -822,7 +822,7 @@
|
|||
<string name="reset_to_default">重置</string>
|
||||
<string name="retry_on_network_issue">遇到網路錯誤時重試</string>
|
||||
<string name="retry_on_network_issue_summary">自動嘗試從網路錯誤中恢復</string>
|
||||
<string name="retweet_quote_confirm_title">轉推給您的關注者?</string>
|
||||
<string name="title_retweet_quote_confirm">轉推給您的關注者?</string>
|
||||
<string name="retweeted_by_count">由<xliff:g id="retweet_count">%d</xliff:g>人轉推</string>
|
||||
<string name="retweeted_by_name">由<xliff:g id="user_name">%s</xliff:g>轉推</string>
|
||||
<string name="retweeted_by_name_with_count"><xliff:g id="user_name">%1$s</xliff:g>和其他<xliff:g id="retweet_count">%2$d</xliff:g>人已轉推</string>
|
||||
|
|
|
@ -822,7 +822,7 @@
|
|||
<string name="reset_to_default">重置</string>
|
||||
<string name="retry_on_network_issue">遇到網路錯誤時重試</string>
|
||||
<string name="retry_on_network_issue_summary">自動嘗試從網路錯誤中恢復</string>
|
||||
<string name="retweet_quote_confirm_title">轉推給您的關注者?</string>
|
||||
<string name="title_retweet_quote_confirm">轉推給您的關注者?</string>
|
||||
<string name="retweeted_by_count">由<xliff:g id="retweet_count">%d</xliff:g>人轉推</string>
|
||||
<string name="retweeted_by_name">由<xliff:g id="user_name">%s</xliff:g>轉推</string>
|
||||
<string name="retweeted_by_name_with_count"><xliff:g id="user_name">%1$s</xliff:g>和其他<xliff:g id="retweet_count">%2$d</xliff:g>人已轉推</string>
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
~ Twidere - Twitter client for Android
|
||||
~
|
||||
~ Copyright (C) 2012-2017 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
~
|
||||
~ This program is free software: you can redistribute it and/or modify
|
||||
~ it under the terms of the GNU General Public License as published by
|
||||
~ the Free Software Foundation, either version 3 of the License, or
|
||||
~ (at your option) any later version.
|
||||
~
|
||||
~ This program is distributed in the hope that it will be useful,
|
||||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
~ GNU General Public License for more details.
|
||||
~
|
||||
~ You should have received a copy of the GNU General Public License
|
||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/status_container"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/element_spacing_normal"
|
||||
android:paddingLeft="@dimen/element_spacing_large"
|
||||
android:paddingRight="@dimen/element_spacing_large"
|
||||
android:paddingTop="@dimen/element_spacing_normal">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include layout="@layout/list_item_status"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/loadProgress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="96dp">
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"/>
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
||||
|
||||
</ScrollView>
|
|
@ -84,7 +84,24 @@
|
|||
android:src="@drawable/ic_action_more_vertical"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<include layout="@layout/list_item_status"/>
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<include layout="@layout/list_item_status"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/loadProgress"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="96dp">
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"/>
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
|
@ -852,6 +852,8 @@
|
|||
<string name="preference_summary_streaming_non_metered_network">Streaming only on free networks like Wi-Fi</string>
|
||||
<string name="preference_summary_streaming_power_saving">Streaming only when charging</string>
|
||||
<string name="preference_summary_trends_location">Now you can set location separately in tab settings.</string>
|
||||
<string name="preference_summary_favorite_confirmation">Show confirmation before favoriting a tweet</string>
|
||||
<string name="preference_summary_like_confirmation">Show confirmation before liking a tweet</string>
|
||||
<string name="preference_title_accounts">Accounts</string>
|
||||
<string name="preference_title_advanced">Advanced</string>
|
||||
<string name="preference_title_auto_refresh_compatibility_mode">Compatibility mode</string>
|
||||
|
@ -859,11 +861,13 @@
|
|||
<string name="preference_title_background_streaming">Background streaming</string>
|
||||
<string name="preference_title_chrome_custom_tab">In-app browser</string>
|
||||
<string name="preference_title_database_item_limit">Database size limit</string>
|
||||
<string name="preference_title_favorite_confirmation">Favorite confirmation</string>
|
||||
<string name="preference_title_filter_manage_subscriptions">Manage</string>
|
||||
<string name="preference_title_filter_subscriptions">Filter subscriptions</string>
|
||||
<string name="preference_title_floating_detailed_view">Floating detailed view</string>
|
||||
<string name="preference_title_landscape">Landscape</string>
|
||||
<string name="preference_title_light_font">Light font</string>
|
||||
<string name="preference_title_like_confirmation">Like confirmation</string>
|
||||
<string name="preference_title_media_preload_non_metered_network">Preload on free network</string>
|
||||
<string name="preference_title_multi_column_tab_width">Multi column tab width</string>
|
||||
<string name="preference_title_multi_column_tabs">Multi column tabs</string>
|
||||
|
@ -992,8 +996,6 @@
|
|||
<string name="retry_on_network_issue">Retry on network issue</string>
|
||||
<string name="retry_on_network_issue_summary">Try recover from network issue automatically</string>
|
||||
|
||||
<string name="retweet_quote_confirm_title">Retweet to your followers?</string>
|
||||
|
||||
<string name="retweeted_by_count">Retweeted by <xliff:g id="retweet_count">%d</xliff:g> users</string>
|
||||
<string name="retweeted_by_name">Retweeted by <xliff:g id="user_name">%s</xliff:g></string>
|
||||
<string name="retweeted_by_name_with_count">Retweeted by <xliff:g id="user_name">%1$s</xliff:g> and <xliff:g id="retweet_count">%2$d</xliff:g> others</string>
|
||||
|
@ -1020,8 +1022,8 @@
|
|||
<string name="search_hint">Search tweets or users</string>
|
||||
<string name="search_hint_users">Search users</string>
|
||||
<string name="search_statuses">Search Tweets</string>
|
||||
<string name="search_type_statuses">Tweets</string>
|
||||
<string name="search_type_media">Media</string>
|
||||
<string name="search_type_statuses">Tweets</string>
|
||||
<string name="search_type_users">Users</string>
|
||||
|
||||
<string name="security_key">Security key</string>
|
||||
|
@ -1189,6 +1191,7 @@
|
|||
<string name="title_error_invalid_account">Invalid account</string>
|
||||
<!-- Enhanced (paid) features title -->
|
||||
<string name="title_extra_features">Enhanced features</string>
|
||||
<string name="title_favorite_confirm">Favorite this tweet?</string>
|
||||
<!-- [noun] Twitter's favorite, in the plural -->
|
||||
<string name="title_favorites">Favorites</string>
|
||||
<string name="title_filters">Filters</string>
|
||||
|
@ -1207,6 +1210,7 @@
|
|||
<string name="title_open_source_license">Open source license</string>
|
||||
<string name="title_premium_features_name">Twidere ∞</string>
|
||||
<string name="title_quick_action">Quick action</string>
|
||||
<string name="title_retweet_quote_confirm">Retweet to your followers?</string>
|
||||
<string name="title_scheduled_statuses">Scheduled tweets</string>
|
||||
<string name="title_search">Search</string>
|
||||
<string name="title_search_gif">Search GIF</string>
|
||||
|
|
|
@ -110,4 +110,11 @@
|
|||
android:value="true"/>
|
||||
</SwitchPreferenceCompat>
|
||||
|
||||
<org.mariotaku.twidere.preference.FavoriteConfirmSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="favorite_confirmation"
|
||||
android:order="35"
|
||||
android:summary="@string/preference_summary_favorite_confirmation"
|
||||
android:title="@string/preference_title_favorite_confirmation"/>
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue