improved dm conversation ui
This commit is contained in:
parent
6de24eff0c
commit
7edf73c7ff
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.mariotaku.twidere.view.holder;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -26,19 +27,19 @@ import org.mariotaku.twidere.R;
|
|||
import org.mariotaku.twidere.view.CardMediaContainer;
|
||||
import org.mariotaku.twidere.view.iface.IColorLabelView;
|
||||
|
||||
public class DraftViewHolder extends ViewListHolder {
|
||||
public class DraftViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public final IColorLabelView content;
|
||||
public final TextView text;
|
||||
public final TextView time;
|
||||
public CardMediaContainer media_preview_container;
|
||||
public CardMediaContainer mediaPreviewContainer;
|
||||
|
||||
public DraftViewHolder(final View view) {
|
||||
super(view);
|
||||
content = (IColorLabelView) findViewById(R.id.content);
|
||||
text = (TextView) findViewById(R.id.text);
|
||||
time = (TextView) findViewById(R.id.time);
|
||||
media_preview_container = (CardMediaContainer) findViewById(R.id.media_preview_container);
|
||||
public DraftViewHolder(final View itemView) {
|
||||
super(itemView);
|
||||
content = (IColorLabelView) itemView.findViewById(R.id.content);
|
||||
text = (TextView) itemView.findViewById(R.id.text);
|
||||
time = (TextView) itemView.findViewById(R.id.time);
|
||||
mediaPreviewContainer = (CardMediaContainer) itemView.findViewById(R.id.media_preview_container);
|
||||
}
|
||||
|
||||
public void setTextSize(final float textSize) {
|
||||
|
|
|
@ -19,22 +19,23 @@
|
|||
|
||||
package org.mariotaku.twidere.view.holder;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class TwoLineWithIconViewHolder extends ViewListHolder {
|
||||
public class TwoLineWithIconViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public final ImageView icon;
|
||||
public final TextView text1, text2;
|
||||
public final CheckBox checkbox;
|
||||
|
||||
public TwoLineWithIconViewHolder(final View view) {
|
||||
super(view);
|
||||
icon = (ImageView) findViewById(android.R.id.icon);
|
||||
text1 = (TextView) findViewById(android.R.id.text1);
|
||||
text2 = (TextView) findViewById(android.R.id.text2);
|
||||
checkbox = (CheckBox) findViewById(android.R.id.checkbox);
|
||||
public TwoLineWithIconViewHolder(final View itemView) {
|
||||
super(itemView);
|
||||
icon = (ImageView) itemView.findViewById(android.R.id.icon);
|
||||
text1 = (TextView) itemView.findViewById(android.R.id.text1);
|
||||
text2 = (TextView) itemView.findViewById(android.R.id.text2);
|
||||
checkbox = (CheckBox) itemView.findViewById(android.R.id.checkbox);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,42 +1,22 @@
|
|||
/*
|
||||
* Twidere - Twitter client for Android
|
||||
*
|
||||
* Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||
*
|
||||
* 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.view.holder;
|
||||
package android.support.v7.widget
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
public class ViewListHolder {
|
||||
|
||||
public View view;
|
||||
|
||||
public ViewListHolder(final View view) {
|
||||
if (view == null) throw new NullPointerException();
|
||||
this.view = view;
|
||||
}
|
||||
|
||||
public View findViewById(final int id) {
|
||||
return view.findViewById(id);
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return view.getContext();
|
||||
}
|
||||
|
||||
}
|
||||
val RecyclerView.LayoutManager.recyclerView: RecyclerView? get() = mRecyclerView
|
|
@ -72,8 +72,8 @@ class DraftsAdapter(context: Context) : SimpleCursorAdapter(context, R.layout.li
|
|||
Draft.Action.UPDATE_STATUS, Draft.Action.UPDATE_STATUS_COMPAT_1,
|
||||
Draft.Action.UPDATE_STATUS_COMPAT_2, Draft.Action.REPLY, Draft.Action.QUOTE -> {
|
||||
val media = ParcelableMediaUtils.fromMediaUpdates(draft.media)
|
||||
holder.media_preview_container.visibility = View.VISIBLE
|
||||
holder.media_preview_container.displayMedia(loader = imageLoader, media = media,
|
||||
holder.mediaPreviewContainer.visibility = View.VISIBLE
|
||||
holder.mediaPreviewContainer.displayMedia(loader = imageLoader, media = media,
|
||||
loadingHandler = mediaLoadingHandler)
|
||||
}
|
||||
Draft.Action.FAVORITE, Draft.Action.RETWEET -> {
|
||||
|
@ -81,10 +81,10 @@ class DraftsAdapter(context: Context) : SimpleCursorAdapter(context, R.layout.li
|
|||
if (extras != null) {
|
||||
summaryText = extras.status.text_unescaped
|
||||
}
|
||||
holder.media_preview_container.visibility = View.GONE
|
||||
holder.mediaPreviewContainer.visibility = View.GONE
|
||||
}
|
||||
else -> {
|
||||
holder.media_preview_container.visibility = View.GONE
|
||||
holder.mediaPreviewContainer.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
if (accountKeys != null) {
|
||||
|
@ -113,7 +113,7 @@ class DraftsAdapter(context: Context) : SimpleCursorAdapter(context, R.layout.li
|
|||
val view = super.newView(context, cursor, parent)
|
||||
if (view.tag !is DraftViewHolder) {
|
||||
view.tag = DraftViewHolder(view).apply {
|
||||
this.media_preview_container.style = mediaPreviewStyle
|
||||
this.mediaPreviewContainer.style = mediaPreviewStyle
|
||||
}
|
||||
}
|
||||
return view
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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.extension.view
|
||||
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.support.v7.widget.recyclerView
|
||||
import android.view.View
|
||||
|
||||
fun RecyclerView.LayoutManager.calculateSpaceItemHeight(child: View, spaceViewType: Int, typeStart: Int): Int {
|
||||
val recyclerView = recyclerView ?: return 0
|
||||
var heightBeforeSpace = 0
|
||||
for (i in 0 until childCount) {
|
||||
val childToMeasure = getChildAt(i)
|
||||
val typeToMeasure = getItemViewType(childToMeasure)
|
||||
if (typeToMeasure == spaceViewType) {
|
||||
break
|
||||
}
|
||||
if (typeToMeasure == typeStart || heightBeforeSpace != 0) {
|
||||
heightBeforeSpace += getDecoratedMeasuredHeight(childToMeasure)
|
||||
}
|
||||
}
|
||||
if (heightBeforeSpace != 0) {
|
||||
val spaceHeight = recyclerView.measuredHeight - heightBeforeSpace
|
||||
return Math.max(0, spaceHeight)
|
||||
}
|
||||
return getDecoratedMeasuredHeight(child)
|
||||
}
|
|
@ -43,7 +43,6 @@ import android.support.v7.widget.ActionMenuView
|
|||
import android.support.v7.widget.FixedLinearLayoutManager
|
||||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.support.v7.widget.RecyclerView.LayoutParams
|
||||
import android.support.v7.widget.RecyclerView.ViewHolder
|
||||
import android.text.SpannableString
|
||||
import android.text.SpannableStringBuilder
|
||||
|
@ -94,6 +93,7 @@ import org.mariotaku.twidere.extension.applyTheme
|
|||
import org.mariotaku.twidere.extension.model.applyTo
|
||||
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.loader.ConversationLoader
|
||||
import org.mariotaku.twidere.loader.ParcelableStatusLoader
|
||||
|
@ -1956,25 +1956,9 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
}
|
||||
|
||||
override fun getDecoratedMeasuredHeight(child: View): Int {
|
||||
var heightBeforeSpace = 0
|
||||
if (getItemViewType(child) == StatusAdapter.VIEW_TYPE_SPACE) {
|
||||
for (i in 0 until childCount) {
|
||||
val childToMeasure = getChildAt(i)
|
||||
val paramsToMeasure = childToMeasure.layoutParams as LayoutParams
|
||||
val typeToMeasure = getItemViewType(childToMeasure)
|
||||
if (typeToMeasure == StatusAdapter.VIEW_TYPE_SPACE) {
|
||||
break
|
||||
}
|
||||
if (typeToMeasure == StatusAdapter.VIEW_TYPE_DETAIL_STATUS || heightBeforeSpace != 0) {
|
||||
heightBeforeSpace += super.getDecoratedMeasuredHeight(childToMeasure)
|
||||
+paramsToMeasure.topMargin + paramsToMeasure.bottomMargin
|
||||
}
|
||||
}
|
||||
if (heightBeforeSpace != 0) {
|
||||
val spaceHeight = recyclerView.measuredHeight - heightBeforeSpace
|
||||
this.spaceHeight = Math.max(0, spaceHeight)
|
||||
return this.spaceHeight
|
||||
}
|
||||
return calculateSpaceItemHeight(child, StatusAdapter.VIEW_TYPE_SPACE,
|
||||
StatusAdapter.VIEW_TYPE_DETAIL_STATUS)
|
||||
}
|
||||
return super.getDecoratedMeasuredHeight(child)
|
||||
}
|
||||
|
@ -2089,7 +2073,8 @@ class StatusFragment : BaseFragment(), LoaderCallbacks<SingleResponse<Parcelable
|
|||
|
||||
private fun calculateSpaceHeight(): Int {
|
||||
val space = findViewByPosition(itemCount - 1) ?: return spaceHeight
|
||||
return getDecoratedMeasuredHeight(space)
|
||||
spaceHeight = getDecoratedMeasuredHeight(space)
|
||||
return spaceHeight
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,9 +30,7 @@ import android.support.v7.widget.FixedLinearLayoutManager
|
|||
import android.support.v7.widget.LinearLayoutManager
|
||||
import android.support.v7.widget.RecyclerView
|
||||
import android.support.v7.widget.Toolbar
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.*
|
||||
import kotlinx.android.synthetic.main.activity_home_content.view.*
|
||||
import kotlinx.android.synthetic.main.fragment_messages_conversation_info.*
|
||||
import kotlinx.android.synthetic.main.header_message_conversation_info.view.*
|
||||
|
@ -44,6 +42,7 @@ import org.mariotaku.ktextension.useCursor
|
|||
import org.mariotaku.sqliteqb.library.Expression
|
||||
import org.mariotaku.twidere.R
|
||||
import org.mariotaku.twidere.adapter.BaseRecyclerViewAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.IContentAdapter
|
||||
import org.mariotaku.twidere.adapter.iface.IItemCountsAdapter
|
||||
import org.mariotaku.twidere.constant.IntentConstants.EXTRA_ACCOUNT_KEY
|
||||
import org.mariotaku.twidere.constant.IntentConstants.EXTRA_CONVERSATION_ID
|
||||
|
@ -52,12 +51,12 @@ import org.mariotaku.twidere.constant.profileImageStyleKey
|
|||
import org.mariotaku.twidere.extension.model.displayAvatarTo
|
||||
import org.mariotaku.twidere.extension.model.getConversationName
|
||||
import org.mariotaku.twidere.extension.model.notificationDisabled
|
||||
import org.mariotaku.twidere.extension.view.calculateSpaceItemHeight
|
||||
import org.mariotaku.twidere.fragment.BaseFragment
|
||||
import org.mariotaku.twidere.fragment.iface.IToolBarSupportFragment
|
||||
import org.mariotaku.twidere.model.ItemCounts
|
||||
import org.mariotaku.twidere.model.ParcelableMessageConversation
|
||||
import org.mariotaku.twidere.model.ParcelableMessageConversationCursorIndices
|
||||
import org.mariotaku.twidere.model.UserKey
|
||||
import org.mariotaku.twidere.fragment.message.MessageConversationInfoFragment.ConversationInfoAdapter.Companion.VIEW_TYPE_HEADER
|
||||
import org.mariotaku.twidere.fragment.message.MessageConversationInfoFragment.ConversationInfoAdapter.Companion.VIEW_TYPE_SPACE
|
||||
import org.mariotaku.twidere.model.*
|
||||
import org.mariotaku.twidere.provider.TwidereDataStore.Messages.Conversations
|
||||
import org.mariotaku.twidere.view.holder.SimpleUserViewHolder
|
||||
|
||||
|
@ -81,19 +80,19 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
|||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
setHasOptionsMenu(true)
|
||||
val activity = this.activity
|
||||
|
||||
if (activity is AppCompatActivity) {
|
||||
activity.supportActionBar?.setDisplayShowTitleEnabled(false)
|
||||
}
|
||||
|
||||
adapter = ConversationInfoAdapter(context)
|
||||
recyclerView.adapter = adapter
|
||||
recyclerView.layoutManager = FixedLinearLayoutManager(context, LinearLayoutManager.VERTICAL,
|
||||
false)
|
||||
|
||||
val theme = Chameleon.getOverrideTheme(context, activity)
|
||||
|
||||
adapter = ConversationInfoAdapter(context, theme)
|
||||
recyclerView.adapter = adapter
|
||||
recyclerView.layoutManager = LayoutManager(context)
|
||||
|
||||
|
||||
val profileImageStyle = preferences[profileImageStyleKey]
|
||||
appBarIcon.style = profileImageStyle
|
||||
conversationAvatar.style = profileImageStyle
|
||||
|
@ -116,6 +115,10 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
|||
return inflater.inflate(R.layout.fragment_messages_conversation_info, container, false)
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) {
|
||||
inflater.inflate(R.menu.menu_messages_conversation_info, menu)
|
||||
}
|
||||
|
||||
override fun setupWindow(activity: FragmentActivity): Boolean {
|
||||
return false
|
||||
}
|
||||
|
@ -135,7 +138,7 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
|||
adapter.conversation = data
|
||||
|
||||
val name = data.getConversationName(context, userColorNameManager, preferences[nameFirstKey]).first
|
||||
val summary = resources.getQuantityString(R.plurals.N_users, data.participants.size, data.participants.size)
|
||||
val summary = resources.getQuantityString(R.plurals.N_message_participants, data.participants.size, data.participants.size)
|
||||
|
||||
data.displayAvatarTo(mediaLoader, conversationAvatar)
|
||||
data.displayAvatarTo(mediaLoader, appBarIcon)
|
||||
|
@ -167,10 +170,10 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
|||
}
|
||||
}
|
||||
|
||||
class ConversationInfoAdapter(context: Context) : BaseRecyclerViewAdapter<RecyclerView.ViewHolder>(context),
|
||||
class ConversationInfoAdapter(context: Context, val theme: Chameleon.Theme) : BaseRecyclerViewAdapter<RecyclerView.ViewHolder>(context),
|
||||
IItemCountsAdapter {
|
||||
private val inflater = LayoutInflater.from(context)
|
||||
override val itemCounts: ItemCounts = ItemCounts(2)
|
||||
override val itemCounts: ItemCounts = ItemCounts(4)
|
||||
var conversation: ParcelableMessageConversation? = null
|
||||
set(value) {
|
||||
field = value
|
||||
|
@ -181,6 +184,8 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
|||
val conversation = this.conversation ?: return 0
|
||||
itemCounts[ITEM_INDEX_HEADER] = 1
|
||||
itemCounts[ITEM_INDEX_ITEM] = conversation.participants.size
|
||||
itemCounts[ITEM_INDEX_ADD_USER] = 1
|
||||
itemCounts[ITEM_INDEX_SPACE] = 1
|
||||
return itemCounts.itemCount
|
||||
}
|
||||
|
||||
|
@ -190,8 +195,9 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
|||
(holder as HeaderViewHolder).display(this.conversation!!)
|
||||
}
|
||||
VIEW_TYPE_USER -> {
|
||||
val user = this.conversation!!.participants[position - itemCounts.getItemStartPosition(ITEM_INDEX_ITEM)]
|
||||
(holder as SimpleUserViewHolder).displayUser(user)
|
||||
val participantIdx = position - itemCounts.getItemStartPosition(ITEM_INDEX_ITEM)
|
||||
val user = this.conversation!!.participants[participantIdx]
|
||||
(holder as UserViewHolder).display(user, participantIdx == 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -203,8 +209,16 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
|||
return HeaderViewHolder(view)
|
||||
}
|
||||
VIEW_TYPE_USER -> {
|
||||
val view = inflater.inflate(SimpleUserViewHolder.layoutResource, parent, false)
|
||||
return SimpleUserViewHolder(view, this)
|
||||
val view = inflater.inflate(R.layout.list_item_conversation_info_user, parent, false)
|
||||
return UserViewHolder(view, this)
|
||||
}
|
||||
VIEW_TYPE_ADD_USER -> {
|
||||
val view = inflater.inflate(R.layout.list_item_conversation_info_add_user, parent, false)
|
||||
return AddUserViewHolder(view, theme)
|
||||
}
|
||||
VIEW_TYPE_SPACE -> {
|
||||
val view = inflater.inflate(R.layout.list_item_conversation_info_space, parent, false)
|
||||
return SpaceViewHolder(view)
|
||||
}
|
||||
}
|
||||
throw UnsupportedOperationException()
|
||||
|
@ -214,6 +228,8 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
|||
when (itemCounts.getItemCountIndex(position)) {
|
||||
ITEM_INDEX_HEADER -> return VIEW_TYPE_HEADER
|
||||
ITEM_INDEX_ITEM -> return VIEW_TYPE_USER
|
||||
ITEM_INDEX_ADD_USER -> return VIEW_TYPE_ADD_USER
|
||||
ITEM_INDEX_SPACE -> return VIEW_TYPE_SPACE
|
||||
}
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
|
@ -221,13 +237,29 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
|||
companion object {
|
||||
private const val ITEM_INDEX_HEADER = 0
|
||||
private const val ITEM_INDEX_ITEM = 1
|
||||
private const val ITEM_INDEX_ADD_USER = 2
|
||||
private const val ITEM_INDEX_SPACE = 3
|
||||
|
||||
private const val VIEW_TYPE_HEADER = 1
|
||||
private const val VIEW_TYPE_USER = 2
|
||||
internal const val VIEW_TYPE_HEADER = 1
|
||||
internal const val VIEW_TYPE_USER = 2
|
||||
internal const val VIEW_TYPE_ADD_USER = 3
|
||||
internal const val VIEW_TYPE_SPACE = 4
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal class SpaceViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
|
||||
|
||||
internal class AddUserViewHolder(itemView: View, theme: Chameleon.Theme) : RecyclerView.ViewHolder(itemView)
|
||||
|
||||
internal class UserViewHolder(itemView: View, adapter: IContentAdapter) : SimpleUserViewHolder(itemView, adapter) {
|
||||
private val headerIcon = itemView.findViewById(R.id.headerIcon)
|
||||
fun display(user: ParcelableUser, displayHeaderIcon: Boolean) {
|
||||
super.displayUser(user)
|
||||
headerIcon.visibility = if (displayHeaderIcon) View.VISIBLE else View.INVISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
internal class HeaderViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
private val muteSwitch = itemView.muteNotifications
|
||||
|
||||
|
@ -240,4 +272,17 @@ class MessageConversationInfoFragment : BaseFragment(), IToolBarSupportFragment,
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
internal class LayoutManager(
|
||||
context: Context
|
||||
) : FixedLinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) {
|
||||
|
||||
override fun getDecoratedMeasuredHeight(child: View): Int {
|
||||
if (getItemViewType(child) == VIEW_TYPE_SPACE) {
|
||||
return calculateSpaceItemHeight(child, VIEW_TYPE_SPACE, VIEW_TYPE_HEADER)
|
||||
}
|
||||
return super.getDecoratedMeasuredHeight(child)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,10 @@ class ConversationAvatarTransformation : AppBarChildBehavior.ScaleTransformation
|
|||
override fun onTargetChanged(child: View, frame: Rect, target: View, targetFrame: Rect, percent: Float, offset: Int) {
|
||||
super.onTargetChanged(child, frame, target, targetFrame, percent, offset)
|
||||
if (percent < 1) {
|
||||
child.visibility = View.VISIBLE
|
||||
target.visibility = View.INVISIBLE
|
||||
} else {
|
||||
child.visibility = View.INVISIBLE
|
||||
target.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,8 +30,10 @@ class ConversationTitlesTransformation : AppBarChildBehavior.TextViewTransformat
|
|||
override fun onTargetChanged(child: View, frame: Rect, target: View, targetFrame: Rect, percent: Float, offset: Int) {
|
||||
super.onTargetChanged(child, frame, target, targetFrame, percent, offset)
|
||||
if (percent < 1) {
|
||||
child.visibility = View.VISIBLE
|
||||
target.visibility = View.INVISIBLE
|
||||
} else {
|
||||
child.visibility = View.INVISIBLE
|
||||
target.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,8 @@
|
|||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:listitem="@layout/list_item_conversation_info_user"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/editButton"
|
||||
|
|
|
@ -18,27 +18,57 @@
|
|||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
<android.support.v7.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
android:layout_marginBottom="@dimen/element_spacing_large"
|
||||
app:cardBackgroundColor="?cardItemBackgroundColor"
|
||||
app:cardCornerRadius="0dp"
|
||||
app:cardElevation="1dp"
|
||||
app:cardPreventCornerOverlap="false"
|
||||
app:cardUseCompatPadding="false">
|
||||
|
||||
<org.mariotaku.twidere.view.FixedTextView
|
||||
style="?android:listSeparatorTextViewStyle"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:text="@string/title_conversation"
|
||||
android:textColor="?colorAccent"/>
|
||||
android:layout_marginTop="@dimen/element_size_small">
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/muteNotifications"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/element_size_normal"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:text="@string/action_mute_notifications"/>
|
||||
</LinearLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/headerSpace"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?listPreferredItemHeight">
|
||||
|
||||
<org.mariotaku.twidere.view.IconActionView
|
||||
android:layout_width="@dimen/icon_size_list_item_small"
|
||||
android:layout_height="@dimen/icon_size_list_item_small"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/element_spacing_normal"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_action_info"
|
||||
app:iabColor="?android:textColorSecondary"/>
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@+id/headerSpace"
|
||||
android:layout_toEndOf="@+id/headerSpace"
|
||||
android:layout_toRightOf="@+id/headerSpace"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
||||
|
||||
<android.support.v7.widget.SwitchCompat
|
||||
android:id="@+id/muteNotifications"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/element_size_normal"
|
||||
android:padding="@dimen/element_spacing_normal"
|
||||
android:text="@string/action_mute_notifications"/>
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</android.support.v7.widget.CardView>
|
|
@ -0,0 +1,75 @@
|
|||
<?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/>.
|
||||
-->
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardBackgroundColor="?cardItemBackgroundColor"
|
||||
app:cardCornerRadius="0dp"
|
||||
app:cardElevation="1dp"
|
||||
app:cardPreventCornerOverlap="false"
|
||||
app:cardUseCompatPadding="false">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Space
|
||||
android:id="@+id/headerSpace"
|
||||
android:layout_width="@dimen/icon_size_list_item_small"
|
||||
android:layout_height="@dimen/icon_size_list_item_small"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="@dimen/element_spacing_normal"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toEndOf="@+id/headerSpace"
|
||||
android:layout_toRightOf="@+id/headerSpace"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="?listPreferredItemHeight"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/element_spacing_normal">
|
||||
|
||||
<org.mariotaku.twidere.view.IconActionView
|
||||
android:layout_width="@dimen/icon_size_list_item_small"
|
||||
android:layout_height="@dimen/icon_size_list_item_small"
|
||||
android:layout_weight="0"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_action_add"
|
||||
app:iabColor="?android:textColorPrimary"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="0dp"
|
||||
android:paddingLeft="@dimen/element_spacing_small"
|
||||
android:paddingRight="0dp"
|
||||
android:paddingStart="@dimen/element_spacing_small"
|
||||
android:text="@string/action_add_conversation_participant"
|
||||
android:textAppearance="?android:textAppearanceMedium"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
|
@ -0,0 +1,29 @@
|
|||
<?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/>.
|
||||
-->
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardBackgroundColor="?cardItemBackgroundColor"
|
||||
app:cardCornerRadius="0dp"
|
||||
app:cardElevation="1dp"
|
||||
app:cardPreventCornerOverlap="false"
|
||||
app:cardUseCompatPadding="false"/>
|
|
@ -0,0 +1,56 @@
|
|||
<?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/>.
|
||||
-->
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardBackgroundColor="?cardItemBackgroundColor"
|
||||
app:cardCornerRadius="0dp"
|
||||
app:cardElevation="1dp"
|
||||
app:cardPreventCornerOverlap="false"
|
||||
app:cardUseCompatPadding="false">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<org.mariotaku.twidere.view.IconActionView
|
||||
android:id="@+id/headerIcon"
|
||||
android:layout_width="@dimen/icon_size_list_item_small"
|
||||
android:layout_height="@dimen/icon_size_list_item_small"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_margin="@dimen/element_spacing_normal"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_action_list"
|
||||
app:iabColor="?android:textColorSecondary"/>
|
||||
|
||||
<include
|
||||
layout="@layout/list_item_simple_user"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_toEndOf="@+id/headerIcon"
|
||||
android:layout_toRightOf="@+id/headerIcon"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
|
@ -0,0 +1,30 @@
|
|||
<?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/>.
|
||||
-->
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/leave_conversation"
|
||||
android:icon="@drawable/ic_action_delete"
|
||||
android:title="@string/action_leave_conversation"/>
|
||||
<item
|
||||
android:id="@+id/clear_messages"
|
||||
android:icon="@drawable/ic_action_delete"
|
||||
android:title="@string/action_delete_messages"/>
|
||||
</menu>
|
|
@ -65,5 +65,9 @@
|
|||
<item quantity="one"><xliff:g id="count">%d</xliff:g> user</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> users</item>
|
||||
</plurals>
|
||||
<plurals name="N_message_participants">
|
||||
<item quantity="one"><xliff:g id="count">%d</xliff:g> member</item>
|
||||
<item quantity="other"><xliff:g id="count">%d</xliff:g> members</item>
|
||||
</plurals>
|
||||
|
||||
</resources>
|
|
@ -12,6 +12,7 @@
|
|||
<string name="action_accept_permission_request">Accept</string>
|
||||
<string name="action_accepting_follow_request">accepting follow request</string>
|
||||
<string name="action_add">Add</string>
|
||||
<string name="action_add_conversation_participant">Add member</string>
|
||||
<!-- [verb] Add mute filter rule -->
|
||||
<string name="action_add_filter_rule">Add rule</string>
|
||||
<string name="action_add_filters_subscription">Add subscription</string>
|
||||
|
|
Loading…
Reference in New Issue