mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-02-17 04:00:48 +01:00
updated support lib version
This commit is contained in:
parent
6e0826c4ef
commit
b9e97e698c
@ -32,10 +32,10 @@ allprojects {
|
||||
subprojects {
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.0.6'
|
||||
ext.android_support_lib_version = '25.1.1'
|
||||
ext.android_support_lib_version = '25.2.0'
|
||||
ext.mariotaku_commons_library_version = '0.9.11'
|
||||
ext.mariotaku_restfu_version = '0.9.35'
|
||||
ext.mariotaku_object_cursor_version = '0.9.13-SNAPSHOT'
|
||||
ext.mariotaku_object_cursor_version = '0.9.13'
|
||||
ext.play_services_version = '10.2.0'
|
||||
ext.crashlyrics_version = '2.6.6'
|
||||
ext.fabric_plugin_version = '1.22.0'
|
||||
|
@ -45,7 +45,8 @@ public interface PrivateDirectMessagesResources extends PrivateResources {
|
||||
|
||||
@POST("/dm/conversation/{conversation_id}/delete.json")
|
||||
@BodyType(BodyType.FORM)
|
||||
ResponseCode deleteDmConversation(@Path("conversation_id") String conversationId) throws MicroBlogException;
|
||||
ResponseCode deleteDmConversation(@Path("conversation_id") String conversationId)
|
||||
throws MicroBlogException;
|
||||
|
||||
@POST("/dm/conversation/{conversation_id}/mark_read.json")
|
||||
@BodyType(BodyType.FORM)
|
||||
@ -54,7 +55,21 @@ public interface PrivateDirectMessagesResources extends PrivateResources {
|
||||
|
||||
@POST("/dm/conversation/{conversation_id}/update_name.json")
|
||||
@BodyType(BodyType.FORM)
|
||||
ResponseCode updateDmConversationName(@Path("conversation_id") String conversationId, @Param("name") String name) throws MicroBlogException;
|
||||
ResponseCode updateDmConversationName(@Path("conversation_id") String conversationId,
|
||||
@Param("name") String name) throws MicroBlogException;
|
||||
|
||||
@POST("/dm/conversation/{conversation_id}/update_avatar.json")
|
||||
@BodyType(BodyType.FORM)
|
||||
ResponseCode updateDmConversationAvatar(@Path("conversation_id") String conversationId,
|
||||
@Param("avatar_id") String avatarId) throws MicroBlogException;
|
||||
|
||||
@POST("/dm/conversation/{conversation_id}/disable_notifications.json")
|
||||
ResponseCode disableDmConversations(@Path("conversation_id") String conversationId)
|
||||
throws MicroBlogException;
|
||||
|
||||
@POST("/dm/conversation/{conversation_id}/enable_notifications.json")
|
||||
ResponseCode enableDmConversations(@Path("conversation_id") String conversationId)
|
||||
throws MicroBlogException;
|
||||
|
||||
@POST("/dm/new.json")
|
||||
DMResponse sendDm(@Param NewDm newDm) throws MicroBlogException;
|
||||
@ -69,5 +84,6 @@ public interface PrivateDirectMessagesResources extends PrivateResources {
|
||||
UserEvents getUserUpdates(@Query("cursor") String cursor) throws MicroBlogException;
|
||||
|
||||
@GET("/dm/conversation/{conversation_id}.json")
|
||||
ConversationTimeline getDmConversation(@Path("conversation_id") String conversationId, @Query Paging paging) throws MicroBlogException;
|
||||
ConversationTimeline getDmConversation(@Path("conversation_id") String conversationId,
|
||||
@Query Paging paging) throws MicroBlogException;
|
||||
}
|
||||
|
@ -1,47 +0,0 @@
|
||||
/*
|
||||
* 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.util.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.view.View;
|
||||
|
||||
import org.mariotaku.twidere.activity.LinkHandlerActivity;
|
||||
import org.mariotaku.twidere.fragment.iface.IToolBarSupportFragment;
|
||||
|
||||
/**
|
||||
* Created by mariotaku on 2017/2/19.
|
||||
*/
|
||||
|
||||
public class LinkHandlerFragmentLifecycleCallbacks {
|
||||
|
||||
public static FragmentManager.FragmentLifecycleCallbacks get(final LinkHandlerActivity activity) {
|
||||
final FragmentManager fm = activity.getSupportFragmentManager();
|
||||
return fm.new FragmentLifecycleCallbacks() {
|
||||
@Override
|
||||
public void onFragmentViewCreated(final FragmentManager fm1, final Fragment f, final View v, final Bundle savedInstanceState) {
|
||||
if (f instanceof IToolBarSupportFragment) {
|
||||
activity.setSupportActionBar(((IToolBarSupportFragment) f).getToolbar());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -28,6 +28,7 @@ import android.net.Uri
|
||||
import android.os.BadParcelableException
|
||||
import android.os.Bundle
|
||||
import android.support.v4.app.Fragment
|
||||
import android.support.v4.app.FragmentManager
|
||||
import android.support.v4.app.FragmentManager.FragmentLifecycleCallbacks
|
||||
import android.support.v4.app.NavUtils
|
||||
import android.support.v4.view.WindowCompat
|
||||
@ -65,7 +66,6 @@ import org.mariotaku.twidere.model.analyzer.PurchaseFinished
|
||||
import org.mariotaku.twidere.util.*
|
||||
import org.mariotaku.twidere.util.KeyboardShortcutsHandler.KeyboardShortcutCallback
|
||||
import org.mariotaku.twidere.util.Utils.LINK_ID_FILTERS_IMPORT_BLOCKS
|
||||
import org.mariotaku.twidere.util.activity.LinkHandlerFragmentLifecycleCallbacks
|
||||
import org.mariotaku.twidere.util.linkhandler.TwidereLinkMatcher
|
||||
import org.mariotaku.twidere.util.theme.getCurrentThemeResource
|
||||
|
||||
@ -89,7 +89,13 @@ class LinkHandlerActivity : BaseActivity(), SystemWindowsInsetsCallback, IContro
|
||||
controlBarShowHideHelper = ControlBarShowHideHelper(this)
|
||||
multiSelectHandler.dispatchOnCreate()
|
||||
|
||||
fragmentLifecycleCallbacks = LinkHandlerFragmentLifecycleCallbacks.get(this)
|
||||
fragmentLifecycleCallbacks = object : FragmentManager.FragmentLifecycleCallbacks() {
|
||||
override fun onFragmentViewCreated(fm: FragmentManager, f: Fragment, v: View, savedInstanceState: Bundle?) {
|
||||
if (f is IToolBarSupportFragment) {
|
||||
setSupportActionBar(f.toolbar)
|
||||
}
|
||||
}
|
||||
}
|
||||
supportFragmentManager.registerFragmentLifecycleCallbacks(fragmentLifecycleCallbacks, false)
|
||||
|
||||
val uri = intent.data ?: run {
|
||||
|
@ -66,6 +66,7 @@ import org.mariotaku.twidere.fragment.message.MessageConversationInfoFragment.Co
|
||||
import org.mariotaku.twidere.model.*
|
||||
import org.mariotaku.twidere.provider.TwidereDataStore.Messages.Conversations
|
||||
import org.mariotaku.twidere.task.twitter.message.DestroyConversationTask
|
||||
import org.mariotaku.twidere.util.IntentUtils
|
||||
import org.mariotaku.twidere.view.holder.SimpleUserViewHolder
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
@ -98,6 +99,13 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
||||
val theme = Chameleon.getOverrideTheme(context, activity)
|
||||
|
||||
adapter = ConversationInfoAdapter(context)
|
||||
adapter.listener = object : ConversationInfoAdapter.Listener {
|
||||
override fun onUserClick(position: Int) {
|
||||
val user = adapter.getUser(position) ?: return
|
||||
startActivity(IntentUtils.userProfile(user))
|
||||
}
|
||||
|
||||
}
|
||||
recyclerView.adapter = adapter
|
||||
recyclerView.layoutManager = LayoutManager(context)
|
||||
|
||||
@ -224,6 +232,10 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
init {
|
||||
setHasStableIds(true)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
val conversation = this.conversation ?: return 0
|
||||
itemCounts[ITEM_INDEX_HEADER] = 1
|
||||
@ -240,7 +252,7 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
||||
}
|
||||
VIEW_TYPE_USER -> {
|
||||
val participantIdx = position - itemCounts.getItemStartPosition(ITEM_INDEX_ITEM)
|
||||
val user = this.conversation!!.participants[participantIdx]
|
||||
val user = getUser(position)!!
|
||||
(holder as UserViewHolder).display(user, participantIdx == 0)
|
||||
}
|
||||
}
|
||||
@ -278,9 +290,26 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
when (itemCounts.getItemCountIndex(position)) {
|
||||
ITEM_INDEX_ITEM -> {
|
||||
val user = getUser(position)!!
|
||||
return user.hashCode().toLong()
|
||||
}
|
||||
else -> {
|
||||
return Integer.MAX_VALUE.toLong() + getItemViewType(position)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getUser(position: Int): ParcelableUser? {
|
||||
val itemPos = position - itemCounts.getItemStartPosition(ITEM_INDEX_ITEM)
|
||||
return conversation?.participants?.getOrNull(itemPos)
|
||||
}
|
||||
|
||||
interface Listener {
|
||||
fun onUserClick(position: Int)
|
||||
fun onAddUserClick(position: Int)
|
||||
fun onUserClick(position: Int) {}
|
||||
fun onAddUserClick(position: Int) {}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@ -305,7 +334,7 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
||||
|
||||
init {
|
||||
itemContent.setOnClickListener {
|
||||
adapter.listener?.onUserClick(layoutPosition)
|
||||
adapter.listener?.onAddUserClick(layoutPosition)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,21 +40,9 @@ object IntentUtils {
|
||||
status.user_name, status.user_screen_name, timeString)
|
||||
}
|
||||
|
||||
fun openUserProfile(context: Context, user: ParcelableUser,
|
||||
newDocument: Boolean, @Referral referral: String? = null,
|
||||
activityOptions: Bundle? = null) {
|
||||
val extras = Bundle()
|
||||
extras.putParcelable(EXTRA_USER, user)
|
||||
if (user.extras != null) {
|
||||
extras.putString(EXTRA_PROFILE_URL, user.extras.statusnet_profile_url)
|
||||
}
|
||||
val uri = LinkCreator.getTwidereUserLink(user.account_key, user.key, user.screen_name)
|
||||
val intent = Intent(Intent.ACTION_VIEW, uri)
|
||||
intent.setExtrasClassLoader(context.classLoader)
|
||||
intent.putExtras(extras)
|
||||
if (referral != null) {
|
||||
intent.putExtra(EXTRA_REFERRAL, referral)
|
||||
}
|
||||
fun openUserProfile(context: Context, user: ParcelableUser, newDocument: Boolean,
|
||||
@Referral referral: String? = null, activityOptions: Bundle? = null) {
|
||||
val intent = userProfile(user, referral)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && newDocument) {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT)
|
||||
}
|
||||
@ -72,6 +60,21 @@ object IntentUtils {
|
||||
ActivityCompat.startActivity(context, intent, activityOptions)
|
||||
}
|
||||
|
||||
|
||||
fun userProfile(user: ParcelableUser, @Referral referral: String? = null): Intent {
|
||||
val uri = LinkCreator.getTwidereUserLink(user.account_key, user.key, user.screen_name)
|
||||
val intent = Intent(Intent.ACTION_VIEW, uri)
|
||||
intent.setExtrasClassLoader(ParcelableUser::class.java.classLoader)
|
||||
intent.putExtra(EXTRA_USER, user)
|
||||
if (user.extras != null) {
|
||||
intent.putExtra(EXTRA_PROFILE_URL, user.extras.statusnet_profile_url)
|
||||
}
|
||||
if (referral != null) {
|
||||
intent.putExtra(EXTRA_REFERRAL, referral)
|
||||
}
|
||||
return intent
|
||||
}
|
||||
|
||||
fun userProfile(accountKey: UserKey?, userKey: UserKey?, screenName: String?,
|
||||
@Referral referral: String? = null, profileUrl: String?): Intent {
|
||||
val uri = LinkCreator.getTwidereUserLink(accountKey, userKey, screenName)
|
||||
|
Loading…
x
Reference in New Issue
Block a user