mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-01-19 03:29:58 +01:00
improved FAB
This commit is contained in:
parent
8ed618e0f1
commit
00e969f806
@ -95,8 +95,7 @@ public interface TwidereConstants extends SharedPreferenceConstants, IntentConst
|
||||
String AUTHORITY_USER_BLOCKS = "user_blocks";
|
||||
String AUTHORITY_STATUS = "status";
|
||||
String AUTHORITY_PUBLIC_TIMELINE = "public_timeline";
|
||||
String AUTHORITY_DIRECT_MESSAGES_CONVERSATION = "direct_messages_conversation";
|
||||
String AUTHORITY_DIRECT_MESSAGES = "direct_messages";
|
||||
String AUTHORITY_MESSAGES = "direct_messages";
|
||||
String AUTHORITY_SEARCH = "search";
|
||||
String AUTHORITY_MAP = "map";
|
||||
String AUTHORITY_SCHEDULED_STATUSES = "scheduled_statuses";
|
||||
@ -131,6 +130,10 @@ public interface TwidereConstants extends SharedPreferenceConstants, IntentConst
|
||||
String PATH_FILTERS_SUBSCRIPTIONS = "subscriptions";
|
||||
String PATH_FILTERS_SUBSCRIPTIONS_ADD = "subscriptions/add";
|
||||
|
||||
String PATH_MESSAGES_CONVERSATION = "conversation";
|
||||
String PATH_MESSAGES_CONVERSATION_NEW = "conversation/new";
|
||||
String PATH_MESSAGES_CONVERSATION_INFO = "conversation/info";
|
||||
|
||||
String QUERY_PARAM_ACCOUNT_KEY = "account_key";
|
||||
String QUERY_PARAM_ACCOUNT_HOST = "account_host";
|
||||
String QUERY_PARAM_ACCOUNT_NAME = "account_name";
|
||||
|
@ -53,13 +53,14 @@ public interface Constants extends TwidereConstants {
|
||||
int LINK_ID_USER_FRIENDS = 6;
|
||||
int LINK_ID_USER_BLOCKS = 7;
|
||||
int LINK_ID_USER_MEDIA_TIMELINE = 8;
|
||||
int LINK_ID_DIRECT_MESSAGES_CONVERSATION = 9;
|
||||
|
||||
int LINK_ID_USER_LIST = 10;
|
||||
int LINK_ID_USER_LISTS = 11;
|
||||
int LINK_ID_USER_LIST_TIMELINE = 12;
|
||||
int LINK_ID_USER_LIST_MEMBERS = 13;
|
||||
int LINK_ID_USER_LIST_SUBSCRIBERS = 14;
|
||||
int LINK_ID_USER_LIST_MEMBERSHIPS = 15;
|
||||
|
||||
int LINK_ID_GROUP = 16;
|
||||
int LINK_ID_USER_GROUPS = 17;
|
||||
int LINK_ID_SAVED_SEARCHES = 19;
|
||||
@ -69,9 +70,14 @@ public interface Constants extends TwidereConstants {
|
||||
int LINK_ID_STATUS_RETWEETERS = 25;
|
||||
int LINK_ID_STATUS_FAVORITERS = 27;
|
||||
int LINK_ID_SEARCH = 28;
|
||||
int LINK_ID_DIRECT_MESSAGES = 29;
|
||||
int LINK_ID_INTERACTIONS = 30;
|
||||
int LINK_ID_PUBLIC_TIMELINE = 31;
|
||||
|
||||
int LINK_ID_MESSAGES = 30;
|
||||
int LINK_ID_MESSAGES_CONVERSATION = 31;
|
||||
int LINK_ID_MESSAGES_CONVERSATION_NEW = 32;
|
||||
int LINK_ID_MESSAGES_CONVERSATION_INFO = 33;
|
||||
|
||||
int LINK_ID_INTERACTIONS = 35;
|
||||
int LINK_ID_PUBLIC_TIMELINE = 36;
|
||||
int LINK_ID_MUTES_USERS = 41;
|
||||
int LINK_ID_MAP = 51;
|
||||
int LINK_ID_SCHEDULED_STATUSES = 61;
|
||||
|
@ -79,6 +79,7 @@ import org.mariotaku.twidere.annotation.ReadPositionTag
|
||||
import org.mariotaku.twidere.constant.*
|
||||
import org.mariotaku.twidere.extension.applyTheme
|
||||
import org.mariotaku.twidere.fragment.*
|
||||
import org.mariotaku.twidere.fragment.iface.IFloatingActionButtonFragment
|
||||
import org.mariotaku.twidere.fragment.iface.RefreshScrollTopInterface
|
||||
import org.mariotaku.twidere.fragment.iface.SupportFragmentCallback
|
||||
import org.mariotaku.twidere.graphic.EmptyDrawable
|
||||
@ -620,8 +621,8 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp
|
||||
}
|
||||
|
||||
private fun handleFragmentKeyboardShortcutRepeat(handler: KeyboardShortcutsHandler,
|
||||
keyCode: Int, repeatCount: Int,
|
||||
event: KeyEvent, metaState: Int): Boolean {
|
||||
keyCode: Int, repeatCount: Int,
|
||||
event: KeyEvent, metaState: Int): Boolean {
|
||||
val fragment = keyboardShortcutRecipient
|
||||
if (fragment is KeyboardShortcutCallback) {
|
||||
return fragment.handleKeyboardShortcutRepeat(handler, keyCode,
|
||||
@ -631,8 +632,8 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp
|
||||
}
|
||||
|
||||
private fun handleFragmentKeyboardShortcutSingle(handler: KeyboardShortcutsHandler,
|
||||
keyCode: Int, event: KeyEvent,
|
||||
metaState: Int): Boolean {
|
||||
keyCode: Int, event: KeyEvent,
|
||||
metaState: Int): Boolean {
|
||||
val fragment = keyboardShortcutRecipient
|
||||
if (fragment is KeyboardShortcutCallback) {
|
||||
return fragment.handleKeyboardShortcutSingle(handler, keyCode,
|
||||
@ -642,7 +643,7 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp
|
||||
}
|
||||
|
||||
private fun isFragmentKeyboardShortcutHandled(handler: KeyboardShortcutsHandler,
|
||||
keyCode: Int, event: KeyEvent, metaState: Int): Boolean {
|
||||
keyCode: Int, event: KeyEvent, metaState: Int): Boolean {
|
||||
val fragment = keyboardShortcutRecipient
|
||||
if (fragment is KeyboardShortcutCallback) {
|
||||
return fragment.isKeyboardShortcutHandled(handler, keyCode,
|
||||
@ -833,6 +834,8 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp
|
||||
private fun triggerActionsClick() {
|
||||
val position = mainPager.currentItem
|
||||
if (pagerAdapter.count == 0) return
|
||||
val fragment = pagerAdapter.instantiateItem(mainPager, position) as? IFloatingActionButtonFragment ?: return
|
||||
fragment.onActionClick("home")
|
||||
val tab = pagerAdapter.getTab(position)
|
||||
when (tab.cls) {
|
||||
MessagesEntriesFragment::class.java -> {
|
||||
@ -844,23 +847,17 @@ class HomeActivity : BaseActivity(), OnClickListener, OnPageChangeListener, Supp
|
||||
}
|
||||
|
||||
private fun updateActionsButton() {
|
||||
val icon: Int
|
||||
val title: Int
|
||||
val position = mainPager.currentItem
|
||||
if (pagerAdapter.count == 0) return
|
||||
val tab = pagerAdapter.getTab(position)
|
||||
if (MessagesEntriesFragment::class.java == tab.cls) {
|
||||
icon = R.drawable.ic_action_add
|
||||
title = R.string.new_direct_message
|
||||
} else if (TrendsSuggestionsFragment::class.java == tab.cls) {
|
||||
icon = R.drawable.ic_action_search
|
||||
title = android.R.string.search_go
|
||||
} else {
|
||||
icon = R.drawable.ic_action_status_compose
|
||||
title = R.string.action_compose
|
||||
val fragment = pagerAdapter.instantiateItem(mainPager, position) as? IFloatingActionButtonFragment
|
||||
val info = fragment?.getActionInfo("home") ?: run {
|
||||
actionsButton.setImageResource(R.drawable.ic_action_status_compose)
|
||||
actionsButton.contentDescription = getString(R.string.action_compose)
|
||||
return
|
||||
}
|
||||
actionsButton.setImageResource(icon)
|
||||
actionsButton.contentDescription = getString(title)
|
||||
|
||||
actionsButton.setImageResource(info.icon)
|
||||
actionsButton.contentDescription = info.title
|
||||
}
|
||||
|
||||
|
||||
|
@ -232,7 +232,7 @@ class LinkHandlerActivity : BaseActivity(), SystemWindowsInsetsCallback, IContro
|
||||
}
|
||||
|
||||
private fun isFragmentKeyboardShortcutHandled(handler: KeyboardShortcutsHandler,
|
||||
keyCode: Int, event: KeyEvent, metaState: Int): Boolean {
|
||||
keyCode: Int, event: KeyEvent, metaState: Int): Boolean {
|
||||
val fragment = currentVisibleFragment
|
||||
if (fragment is KeyboardShortcutCallback) {
|
||||
return fragment.isKeyboardShortcutHandled(handler, keyCode, event, metaState)
|
||||
@ -336,7 +336,7 @@ class LinkHandlerActivity : BaseActivity(), SystemWindowsInsetsCallback, IContro
|
||||
LINK_ID_MUTES_USERS -> {
|
||||
setTitle(R.string.action_twitter_muted_users)
|
||||
}
|
||||
LINK_ID_DIRECT_MESSAGES_CONVERSATION -> {
|
||||
LINK_ID_MESSAGES_CONVERSATION -> {
|
||||
setTitle(R.string.direct_messages)
|
||||
}
|
||||
LINK_ID_USER_LIST -> {
|
||||
@ -409,7 +409,7 @@ class LinkHandlerActivity : BaseActivity(), SystemWindowsInsetsCallback, IContro
|
||||
LINK_ID_SCHEDULED_STATUSES -> {
|
||||
title = getString(R.string.scheduled_statuses)
|
||||
}
|
||||
LINK_ID_DIRECT_MESSAGES -> {
|
||||
LINK_ID_MESSAGES -> {
|
||||
title = getString(R.string.direct_messages)
|
||||
}
|
||||
LINK_ID_INTERACTIONS -> {
|
||||
@ -436,7 +436,7 @@ class LinkHandlerActivity : BaseActivity(), SystemWindowsInsetsCallback, IContro
|
||||
}
|
||||
|
||||
private fun handleFragmentKeyboardShortcutRepeat(handler: KeyboardShortcutsHandler, keyCode: Int,
|
||||
repeatCount: Int, event: KeyEvent, metaState: Int): Boolean {
|
||||
repeatCount: Int, event: KeyEvent, metaState: Int): Boolean {
|
||||
val fragment = currentVisibleFragment
|
||||
if (fragment is KeyboardShortcutCallback) {
|
||||
return fragment.handleKeyboardShortcutRepeat(handler, keyCode,
|
||||
@ -446,7 +446,7 @@ class LinkHandlerActivity : BaseActivity(), SystemWindowsInsetsCallback, IContro
|
||||
}
|
||||
|
||||
private fun handleFragmentKeyboardShortcutSingle(handler: KeyboardShortcutsHandler, keyCode: Int,
|
||||
event: KeyEvent, metaState: Int): Boolean {
|
||||
event: KeyEvent, metaState: Int): Boolean {
|
||||
val fragment = currentVisibleFragment
|
||||
if (fragment is KeyboardShortcutCallback) {
|
||||
if (fragment.handleKeyboardShortcutSingle(handler, keyCode,
|
||||
@ -614,14 +614,24 @@ class LinkHandlerActivity : BaseActivity(), SystemWindowsInsetsCallback, IContro
|
||||
fragment = MutesUsersListFragment()
|
||||
args[EXTRA_SIMPLE_LAYOUT] = true
|
||||
}
|
||||
LINK_ID_DIRECT_MESSAGES_CONVERSATION -> {
|
||||
LINK_ID_MESSAGES -> {
|
||||
fragment = MessagesEntriesFragment()
|
||||
}
|
||||
LINK_ID_MESSAGES_CONVERSATION -> {
|
||||
fragment = MessagesConversationFragment()
|
||||
accountRequired = true
|
||||
val conversationId = uri.getQueryParameter(QUERY_PARAM_CONVERSATION_ID) ?: return null
|
||||
args.putString(EXTRA_CONVERSATION_ID, conversationId)
|
||||
}
|
||||
LINK_ID_DIRECT_MESSAGES -> {
|
||||
fragment = MessagesEntriesFragment()
|
||||
LINK_ID_MESSAGES_CONVERSATION_NEW -> {
|
||||
fragment = Fragment()
|
||||
val conversationId = uri.getQueryParameter(QUERY_PARAM_CONVERSATION_ID) ?: return null
|
||||
accountRequired = true
|
||||
}
|
||||
LINK_ID_MESSAGES_CONVERSATION_INFO -> {
|
||||
fragment = Fragment()
|
||||
val conversationId = uri.getQueryParameter(QUERY_PARAM_CONVERSATION_ID) ?: return null
|
||||
accountRequired = true
|
||||
}
|
||||
LINK_ID_INTERACTIONS -> {
|
||||
fragment = InteractionsTimelineFragment()
|
||||
|
@ -2,7 +2,7 @@ package org.mariotaku.twidere.fragment
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.support.v4.app.LoaderManager
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks
|
||||
import android.support.v4.content.Loader
|
||||
import com.squareup.otto.Subscribe
|
||||
import org.mariotaku.kpreferences.get
|
||||
@ -11,9 +11,12 @@ import org.mariotaku.sqliteqb.library.Expression
|
||||
import org.mariotaku.sqliteqb.library.OrderBy
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.adapter.MessagesEntriesAdapter
|
||||
import org.mariotaku.twidere.adapter.MessagesEntriesAdapter.MessageConversationClickListener
|
||||
import org.mariotaku.twidere.adapter.iface.ILoadMoreSupportAdapter
|
||||
import org.mariotaku.twidere.constant.newDocumentApiKey
|
||||
import org.mariotaku.twidere.extension.model.user
|
||||
import org.mariotaku.twidere.fragment.iface.IFloatingActionButtonFragment
|
||||
import org.mariotaku.twidere.fragment.iface.IFloatingActionButtonFragment.ActionInfo
|
||||
import org.mariotaku.twidere.loader.ObjectCursorLoader
|
||||
import org.mariotaku.twidere.model.ParcelableMessageConversation
|
||||
import org.mariotaku.twidere.model.ParcelableMessageConversationCursorIndices
|
||||
@ -30,7 +33,8 @@ import org.mariotaku.twidere.util.Utils
|
||||
* Created by mariotaku on 16/3/28.
|
||||
*/
|
||||
class MessagesEntriesFragment : AbsContentListRecyclerViewFragment<MessagesEntriesAdapter>(),
|
||||
LoaderManager.LoaderCallbacks<List<ParcelableMessageConversation>?>, MessagesEntriesAdapter.MessageConversationClickListener {
|
||||
LoaderCallbacks<List<ParcelableMessageConversation>?>, MessageConversationClickListener,
|
||||
IFloatingActionButtonFragment {
|
||||
|
||||
private val accountKeys: Array<UserKey> by lazy {
|
||||
Utils.getAccountKeys(context, arguments) ?: DataStoreUtils.getActivatedAccountKeys(context)
|
||||
@ -109,6 +113,18 @@ class MessagesEntriesFragment : AbsContentListRecyclerViewFragment<MessagesEntri
|
||||
IntentUtils.openUserProfile(context, user, preferences[newDocumentApiKey])
|
||||
}
|
||||
|
||||
override fun getActionInfo(tag: String): ActionInfo? {
|
||||
return ActionInfo(R.drawable.ic_action_add, getString(R.string.new_direct_message))
|
||||
}
|
||||
|
||||
override fun onActionClick(tag: String) {
|
||||
val accountKey = accountKeys.singleOrNull() ?: run {
|
||||
|
||||
return
|
||||
}
|
||||
startActivity(IntentUtils.newMessageConversation(accountKey))
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
fun onGetMessagesTaskEvent(event: GetMessagesTaskEvent) {
|
||||
if (!event.running) {
|
||||
|
@ -45,7 +45,6 @@ import android.support.v4.app.DialogFragment
|
||||
import android.support.v4.app.Fragment
|
||||
import android.support.v4.app.FragmentActivity
|
||||
import android.support.v4.app.LoaderManager.LoaderCallbacks
|
||||
import android.support.v4.content.AsyncTaskLoader
|
||||
import android.support.v4.content.FixedAsyncTaskLoader
|
||||
import android.support.v4.content.Loader
|
||||
import android.support.v4.content.res.ResourcesCompat
|
||||
@ -91,6 +90,7 @@ import org.mariotaku.microblog.library.twitter.model.Paging
|
||||
import org.mariotaku.microblog.library.twitter.model.UserList
|
||||
import org.mariotaku.twidere.Constants.*
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.TwidereConstants
|
||||
import org.mariotaku.twidere.activity.AccountSelectorActivity
|
||||
import org.mariotaku.twidere.activity.BaseActivity
|
||||
import org.mariotaku.twidere.activity.ColorPickerDialogActivity
|
||||
@ -195,7 +195,7 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
||||
}
|
||||
|
||||
override fun onLoadFinished(loader: Loader<SingleResponse<ParcelableRelationship>>,
|
||||
data: SingleResponse<ParcelableRelationship>) {
|
||||
data: SingleResponse<ParcelableRelationship>) {
|
||||
followProgress.visibility = View.GONE
|
||||
val relationship = data.data
|
||||
displayRelationship(user, relationship)
|
||||
@ -228,7 +228,7 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
||||
}
|
||||
|
||||
override fun onLoadFinished(loader: Loader<SingleResponse<ParcelableUser>>,
|
||||
data: SingleResponse<ParcelableUser>) {
|
||||
data: SingleResponse<ParcelableUser>) {
|
||||
val activity = activity ?: return
|
||||
if (data.data != null) {
|
||||
val user = data.data
|
||||
@ -274,7 +274,7 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
||||
}
|
||||
|
||||
private fun displayRelationship(user: ParcelableUser?,
|
||||
userRelationship: ParcelableRelationship?) {
|
||||
userRelationship: ParcelableRelationship?) {
|
||||
if (user == null) {
|
||||
relationship = null
|
||||
return
|
||||
@ -554,7 +554,7 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
||||
}
|
||||
|
||||
fun getUserInfo(accountKey: UserKey, userKey: UserKey?, screenName: String?,
|
||||
omitIntentExtra: Boolean) {
|
||||
omitIntentExtra: Boolean) {
|
||||
val lm = loaderManager
|
||||
lm.destroyLoader(LOADER_ID_USER)
|
||||
lm.destroyLoader(LOADER_ID_FRIENDSHIP)
|
||||
@ -893,7 +893,8 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
||||
R.id.send_direct_message -> {
|
||||
val builder = Uri.Builder()
|
||||
builder.scheme(SCHEME_TWIDERE)
|
||||
builder.authority(AUTHORITY_DIRECT_MESSAGES_CONVERSATION)
|
||||
builder.authority(AUTHORITY_MESSAGES)
|
||||
builder.path(PATH_MESSAGES_CONVERSATION_NEW)
|
||||
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_KEY, user.account_key.toString())
|
||||
builder.appendQueryParameter(QUERY_PARAM_USER_KEY, user.key.toString())
|
||||
val intent = Intent(Intent.ACTION_VIEW, builder.build())
|
||||
@ -1088,13 +1089,13 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
||||
}
|
||||
|
||||
override fun handleKeyboardShortcutRepeat(handler: KeyboardShortcutsHandler,
|
||||
keyCode: Int, repeatCount: Int,
|
||||
event: KeyEvent, metaState: Int): Boolean {
|
||||
keyCode: Int, repeatCount: Int,
|
||||
event: KeyEvent, metaState: Int): Boolean {
|
||||
return handleFragmentKeyboardShortcutRepeat(handler, keyCode, repeatCount, event, metaState)
|
||||
}
|
||||
|
||||
private fun handleFragmentKeyboardShortcutRepeat(handler: KeyboardShortcutsHandler,
|
||||
keyCode: Int, repeatCount: Int, event: KeyEvent, metaState: Int): Boolean {
|
||||
keyCode: Int, repeatCount: Int, event: KeyEvent, metaState: Int): Boolean {
|
||||
val fragment = keyboardShortcutRecipient
|
||||
if (fragment is KeyboardShortcutCallback) {
|
||||
return fragment.handleKeyboardShortcutRepeat(handler, keyCode, repeatCount, event, metaState)
|
||||
@ -1103,7 +1104,7 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
||||
}
|
||||
|
||||
private fun handleFragmentKeyboardShortcutSingle(handler: KeyboardShortcutsHandler,
|
||||
keyCode: Int, event: KeyEvent, metaState: Int): Boolean {
|
||||
keyCode: Int, event: KeyEvent, metaState: Int): Boolean {
|
||||
val fragment = keyboardShortcutRecipient
|
||||
if (fragment is KeyboardShortcutCallback) {
|
||||
return fragment.handleKeyboardShortcutSingle(handler, keyCode, event, metaState)
|
||||
@ -1112,7 +1113,7 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
||||
}
|
||||
|
||||
private fun isFragmentKeyboardShortcutHandled(handler: KeyboardShortcutsHandler,
|
||||
keyCode: Int, event: KeyEvent, metaState: Int): Boolean {
|
||||
keyCode: Int, event: KeyEvent, metaState: Int): Boolean {
|
||||
val fragment = keyboardShortcutRecipient
|
||||
if (fragment is KeyboardShortcutCallback) {
|
||||
return fragment.isKeyboardShortcutHandled(handler, keyCode, event, metaState)
|
||||
@ -1209,8 +1210,8 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener,
|
||||
}
|
||||
|
||||
override fun onLinkClick(link: String, orig: String?, accountKey: UserKey?,
|
||||
extraId: Long, type: Int, sensitive: Boolean,
|
||||
start: Int, end: Int): Boolean {
|
||||
extraId: Long, type: Int, sensitive: Boolean,
|
||||
start: Int, end: Int): Boolean {
|
||||
val user = user ?: return false
|
||||
when (type) {
|
||||
TwidereLinkify.LINK_TYPE_MENTION -> {
|
||||
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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.iface
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 2017/2/15.
|
||||
*/
|
||||
|
||||
interface IFloatingActionButtonFragment {
|
||||
|
||||
fun getActionInfo(tag: String): ActionInfo?
|
||||
fun onActionClick(tag: String)
|
||||
|
||||
data class ActionInfo(val icon: Int, val title: String)
|
||||
}
|
@ -14,64 +14,9 @@ import android.support.v4.app.FragmentActivity
|
||||
import android.text.TextUtils
|
||||
import org.mariotaku.twidere.BuildConfig
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_ACCOUNTS
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_DIRECT_MESSAGES
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_DIRECT_MESSAGES_CONVERSATION
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_DRAFTS
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_FILTERS
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_GROUP
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_INCOMING_FRIENDSHIPS
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_INTERACTIONS
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_ITEMS
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_MAP
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_MUTES_USERS
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_PROFILE_EDITOR
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_PUBLIC_TIMELINE
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_SAVED_SEARCHES
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_SCHEDULED_STATUSES
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_SEARCH
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_STATUS
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_STATUS_FAVORITERS
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_STATUS_RETWEETERS
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_USER_BLOCKS
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_USER_FAVORITES
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_USER_FOLLOWERS
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_USER_FRIENDS
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_USER_GROUPS
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_USER_LIST
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_USER_LISTS
|
||||
import org.mariotaku.twidere.TwidereConstants.AUTHORITY_USER_MENTIONS
|
||||
import org.mariotaku.twidere.TwidereConstants.EXTRA_ACCOUNT_KEY
|
||||
import org.mariotaku.twidere.TwidereConstants.EXTRA_ACTIVITY_OPTIONS
|
||||
import org.mariotaku.twidere.TwidereConstants.EXTRA_CURRENT_MEDIA
|
||||
import org.mariotaku.twidere.TwidereConstants.EXTRA_GROUP
|
||||
import org.mariotaku.twidere.TwidereConstants.EXTRA_MEDIA
|
||||
import org.mariotaku.twidere.TwidereConstants.EXTRA_NEW_DOCUMENT
|
||||
import org.mariotaku.twidere.TwidereConstants.EXTRA_QUERY
|
||||
import org.mariotaku.twidere.TwidereConstants.EXTRA_STATUS
|
||||
import org.mariotaku.twidere.TwidereConstants.EXTRA_TYPE
|
||||
import org.mariotaku.twidere.TwidereConstants.EXTRA_USER
|
||||
import org.mariotaku.twidere.TwidereConstants.EXTRA_USER_LIST
|
||||
import org.mariotaku.twidere.TwidereConstants.LOGTAG
|
||||
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_ACCOUNT_KEY
|
||||
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_CONVERSATION_ID
|
||||
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_GROUP_ID
|
||||
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_GROUP_NAME
|
||||
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_LAT
|
||||
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_LIST_ID
|
||||
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_LIST_NAME
|
||||
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_LNG
|
||||
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_QUERY
|
||||
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_SCREEN_NAME
|
||||
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_STATUS_ID
|
||||
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_TYPE
|
||||
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_USER_KEY
|
||||
import org.mariotaku.twidere.TwidereConstants.QUERY_PARAM_VALUE_TWEETS
|
||||
import org.mariotaku.twidere.TwidereConstants.SCHEME_HTTP
|
||||
import org.mariotaku.twidere.TwidereConstants.SCHEME_TWIDERE
|
||||
import org.mariotaku.twidere.TwidereConstants.*
|
||||
import org.mariotaku.twidere.activity.MediaViewerActivity
|
||||
import org.mariotaku.twidere.annotation.Referral
|
||||
import org.mariotaku.twidere.constant.IntentConstants.*
|
||||
import org.mariotaku.twidere.fragment.SensitiveContentWarningDialogFragment
|
||||
import org.mariotaku.twidere.model.*
|
||||
import org.mariotaku.twidere.model.util.ParcelableLocationUtils
|
||||
@ -285,7 +230,8 @@ object IntentUtils {
|
||||
fun openMessageConversation(context: Context, accountKey: UserKey, conversationId: String) {
|
||||
val builder = Uri.Builder()
|
||||
builder.scheme(SCHEME_TWIDERE)
|
||||
builder.authority(AUTHORITY_DIRECT_MESSAGES_CONVERSATION)
|
||||
builder.authority(AUTHORITY_MESSAGES)
|
||||
builder.path(PATH_MESSAGES_CONVERSATION)
|
||||
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_KEY, accountKey.toString())
|
||||
builder.appendQueryParameter(QUERY_PARAM_CONVERSATION_ID, conversationId)
|
||||
val intent = Intent(Intent.ACTION_VIEW, builder.build())
|
||||
@ -293,6 +239,29 @@ object IntentUtils {
|
||||
context.startActivity(intent)
|
||||
}
|
||||
|
||||
fun messageConversationInfo(accountKey: UserKey, conversationId: String): Intent {
|
||||
val builder = Uri.Builder()
|
||||
builder.scheme(SCHEME_TWIDERE)
|
||||
builder.authority(AUTHORITY_MESSAGES)
|
||||
builder.path(PATH_MESSAGES_CONVERSATION_INFO)
|
||||
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_KEY, accountKey.toString())
|
||||
builder.appendQueryParameter(QUERY_PARAM_CONVERSATION_ID, conversationId)
|
||||
val intent = Intent(Intent.ACTION_VIEW, builder.build())
|
||||
intent.`package` = BuildConfig.APPLICATION_ID
|
||||
return intent
|
||||
}
|
||||
|
||||
fun newMessageConversation(accountKey: UserKey): Intent {
|
||||
val builder = Uri.Builder()
|
||||
builder.scheme(SCHEME_TWIDERE)
|
||||
builder.authority(AUTHORITY_MESSAGES)
|
||||
builder.path(PATH_MESSAGES_CONVERSATION_NEW)
|
||||
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_KEY, accountKey.toString())
|
||||
val intent = Intent(Intent.ACTION_VIEW, builder.build())
|
||||
intent.`package` = BuildConfig.APPLICATION_ID
|
||||
return intent
|
||||
}
|
||||
|
||||
fun openIncomingFriendships(context: Context,
|
||||
accountKey: UserKey?) {
|
||||
val builder = Uri.Builder()
|
||||
@ -610,7 +579,7 @@ object IntentUtils {
|
||||
fun openDirectMessages(context: Context, accountKey: UserKey?) {
|
||||
val builder = Uri.Builder()
|
||||
builder.scheme(SCHEME_TWIDERE)
|
||||
builder.authority(AUTHORITY_DIRECT_MESSAGES)
|
||||
builder.authority(AUTHORITY_MESSAGES)
|
||||
if (accountKey != null) {
|
||||
builder.appendQueryParameter(QUERY_PARAM_ACCOUNT_KEY, accountKey.toString())
|
||||
}
|
||||
|
@ -18,9 +18,10 @@ object TwidereLinkMatcher {
|
||||
addURI(AUTHORITY_USER_FRIENDS, null, LINK_ID_USER_FRIENDS)
|
||||
addURI(AUTHORITY_USER_FAVORITES, null, LINK_ID_USER_FAVORITES)
|
||||
addURI(AUTHORITY_USER_BLOCKS, null, LINK_ID_USER_BLOCKS)
|
||||
addURI(AUTHORITY_DIRECT_MESSAGES_CONVERSATION, null,
|
||||
LINK_ID_DIRECT_MESSAGES_CONVERSATION)
|
||||
addURI(AUTHORITY_DIRECT_MESSAGES, null, LINK_ID_DIRECT_MESSAGES)
|
||||
addURI(AUTHORITY_MESSAGES, null, LINK_ID_MESSAGES)
|
||||
addURI(AUTHORITY_MESSAGES, PATH_MESSAGES_CONVERSATION, LINK_ID_MESSAGES_CONVERSATION)
|
||||
addURI(AUTHORITY_MESSAGES, PATH_MESSAGES_CONVERSATION_NEW, LINK_ID_MESSAGES_CONVERSATION_NEW)
|
||||
addURI(AUTHORITY_MESSAGES, PATH_MESSAGES_CONVERSATION_INFO, LINK_ID_MESSAGES_CONVERSATION_INFO)
|
||||
addURI(AUTHORITY_INTERACTIONS, null, LINK_ID_INTERACTIONS)
|
||||
addURI(AUTHORITY_PUBLIC_TIMELINE, null, LINK_ID_PUBLIC_TIMELINE)
|
||||
addURI(AUTHORITY_USER_LIST, null, LINK_ID_USER_LIST)
|
||||
|
Loading…
Reference in New Issue
Block a user