improving dm ui
This commit is contained in:
parent
9c24a984dc
commit
8dbacf5528
|
@ -28,7 +28,6 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.ImageView.ScaleType;
|
|
||||||
|
|
||||||
import org.mariotaku.twidere.Constants;
|
import org.mariotaku.twidere.Constants;
|
||||||
import org.mariotaku.twidere.R;
|
import org.mariotaku.twidere.R;
|
||||||
|
@ -40,24 +39,30 @@ import org.mariotaku.twidere.util.DirectMessageOnLinkClickHandler;
|
||||||
import org.mariotaku.twidere.util.MediaLoaderWrapper;
|
import org.mariotaku.twidere.util.MediaLoaderWrapper;
|
||||||
import org.mariotaku.twidere.util.MediaLoadingHandler;
|
import org.mariotaku.twidere.util.MediaLoadingHandler;
|
||||||
import org.mariotaku.twidere.util.MultiSelectManager;
|
import org.mariotaku.twidere.util.MultiSelectManager;
|
||||||
|
import org.mariotaku.twidere.util.SharedPreferencesWrapper;
|
||||||
import org.mariotaku.twidere.util.ThemeUtils;
|
import org.mariotaku.twidere.util.ThemeUtils;
|
||||||
import org.mariotaku.twidere.util.TwidereLinkify;
|
import org.mariotaku.twidere.util.TwidereLinkify;
|
||||||
import org.mariotaku.twidere.util.Utils;
|
import org.mariotaku.twidere.util.Utils;
|
||||||
import org.mariotaku.twidere.view.holder.MessageConversationViewHolder;
|
import org.mariotaku.twidere.view.ShapedImageView;
|
||||||
|
import org.mariotaku.twidere.view.holder.IncomingMessageViewHolder;
|
||||||
|
import org.mariotaku.twidere.view.holder.MessageViewHolder;
|
||||||
|
|
||||||
public class MessageConversationAdapter extends Adapter<ViewHolder>
|
public class MessageConversationAdapter extends Adapter<ViewHolder> implements Constants,
|
||||||
implements Constants, IDirectMessagesAdapter, OnClickListener {
|
IDirectMessagesAdapter, OnClickListener {
|
||||||
|
|
||||||
private static final int ITEM_VIEW_TYPE_MESSAGE_OUTGOING = 1;
|
private static final int ITEM_VIEW_TYPE_MESSAGE_OUTGOING = 1;
|
||||||
private static final int ITEM_VIEW_TYPE_MESSAGE_INCOMING = 2;
|
private static final int ITEM_VIEW_TYPE_MESSAGE_INCOMING = 2;
|
||||||
private final int mOutgoingMessageColor;
|
private final int mOutgoingMessageColor;
|
||||||
private final int mIncomingMessageColor;
|
private final int mIncomingMessageColor;
|
||||||
|
private final boolean mDisplayProfileImage;
|
||||||
|
|
||||||
private ScaleType mImagePreviewScaleType;
|
@ShapedImageView.ShapeStyle
|
||||||
|
private final int mProfileImageStyle;
|
||||||
|
private final int mMediaPreviewStyle;
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final LayoutInflater mInflater;
|
private final LayoutInflater mInflater;
|
||||||
private final MediaLoaderWrapper mImageLoader;
|
private final MediaLoaderWrapper mMediaLoader;
|
||||||
private final MultiSelectManager mMultiSelectManager;
|
private final MultiSelectManager mMultiSelectManager;
|
||||||
private final MediaLoadingHandler mMediaLoadingHandler;
|
private final MediaLoadingHandler mMediaLoadingHandler;
|
||||||
|
|
||||||
|
@ -71,7 +76,12 @@ public class MessageConversationAdapter extends Adapter<ViewHolder>
|
||||||
final TwidereApplication app = TwidereApplication.getInstance(context);
|
final TwidereApplication app = TwidereApplication.getInstance(context);
|
||||||
mLinkify = new TwidereLinkify(new DirectMessageOnLinkClickHandler(context, null));
|
mLinkify = new TwidereLinkify(new DirectMessageOnLinkClickHandler(context, null));
|
||||||
mMultiSelectManager = app.getMultiSelectManager();
|
mMultiSelectManager = app.getMultiSelectManager();
|
||||||
mImageLoader = app.getMediaLoaderWrapper();
|
mMediaLoader = app.getMediaLoaderWrapper();
|
||||||
|
final SharedPreferencesWrapper preferences = SharedPreferencesWrapper.getInstance(context,
|
||||||
|
SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
|
||||||
|
mDisplayProfileImage = preferences.getBoolean(KEY_DISPLAY_PROFILE_IMAGE, true);
|
||||||
|
mProfileImageStyle = Utils.getProfileImageStyle(preferences.getString(KEY_PROFILE_IMAGE_STYLE, null));
|
||||||
|
mMediaPreviewStyle = Utils.getMediaPreviewStyle(preferences.getString(KEY_MEDIA_PREVIEW_STYLE, null));
|
||||||
mMediaLoadingHandler = new MediaLoadingHandler(R.id.media_preview_progress);
|
mMediaLoadingHandler = new MediaLoadingHandler(R.id.media_preview_progress);
|
||||||
mIncomingMessageColor = ThemeUtils.getUserAccentColor(context);
|
mIncomingMessageColor = ThemeUtils.getUserAccentColor(context);
|
||||||
mOutgoingMessageColor = ThemeUtils.getCardBackgroundColor(context, ThemeUtils.getThemeBackgroundOption(context), ThemeUtils.getUserThemeBackgroundAlpha(context));
|
mOutgoingMessageColor = ThemeUtils.getCardBackgroundColor(context, ThemeUtils.getThemeBackgroundOption(context), ThemeUtils.getUserThemeBackgroundAlpha(context));
|
||||||
|
@ -82,8 +92,9 @@ public class MessageConversationAdapter extends Adapter<ViewHolder>
|
||||||
return mContext;
|
return mContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MediaLoaderWrapper getImageLoader() {
|
@Override
|
||||||
return mImageLoader;
|
public MediaLoaderWrapper getMediaLoader() {
|
||||||
|
return mMediaLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TwidereLinkify getLinkify() {
|
public TwidereLinkify getLinkify() {
|
||||||
|
@ -95,13 +106,13 @@ public class MessageConversationAdapter extends Adapter<ViewHolder>
|
||||||
switch (viewType) {
|
switch (viewType) {
|
||||||
case ITEM_VIEW_TYPE_MESSAGE_INCOMING: {
|
case ITEM_VIEW_TYPE_MESSAGE_INCOMING: {
|
||||||
final View view = mInflater.inflate(R.layout.card_item_message_conversation_incoming, parent, false);
|
final View view = mInflater.inflate(R.layout.card_item_message_conversation_incoming, parent, false);
|
||||||
final MessageConversationViewHolder holder = new MessageConversationViewHolder(this, view);
|
final MessageViewHolder holder = new IncomingMessageViewHolder(this, view);
|
||||||
holder.setMessageColor(mIncomingMessageColor);
|
holder.setMessageColor(mIncomingMessageColor);
|
||||||
return holder;
|
return holder;
|
||||||
}
|
}
|
||||||
case ITEM_VIEW_TYPE_MESSAGE_OUTGOING: {
|
case ITEM_VIEW_TYPE_MESSAGE_OUTGOING: {
|
||||||
final View view = mInflater.inflate(R.layout.card_item_message_conversation_outgoing, parent, false);
|
final View view = mInflater.inflate(R.layout.card_item_message_conversation_outgoing, parent, false);
|
||||||
final MessageConversationViewHolder holder = new MessageConversationViewHolder(this, view);
|
final MessageViewHolder holder = new MessageViewHolder(this, view);
|
||||||
holder.setMessageColor(mOutgoingMessageColor);
|
holder.setMessageColor(mOutgoingMessageColor);
|
||||||
return holder;
|
return holder;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +127,7 @@ public class MessageConversationAdapter extends Adapter<ViewHolder>
|
||||||
case ITEM_VIEW_TYPE_MESSAGE_OUTGOING: {
|
case ITEM_VIEW_TYPE_MESSAGE_OUTGOING: {
|
||||||
final Cursor c = mCursor;
|
final Cursor c = mCursor;
|
||||||
c.moveToPosition(getCursorPosition(position));
|
c.moveToPosition(getCursorPosition(position));
|
||||||
((MessageConversationViewHolder) holder).displayMessage(c, mIndices);
|
((MessageViewHolder) holder).displayMessage(c, mIndices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,6 +162,16 @@ public class MessageConversationAdapter extends Adapter<ViewHolder>
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final int getProfileImageStyle() {
|
||||||
|
return mProfileImageStyle;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isProfileImageEnabled() {
|
||||||
|
return mDisplayProfileImage;
|
||||||
|
}
|
||||||
|
|
||||||
public ParcelableDirectMessage getDirectMessage(final int position) {
|
public ParcelableDirectMessage getDirectMessage(final int position) {
|
||||||
final Cursor c = mCursor;
|
final Cursor c = mCursor;
|
||||||
if (c == null || c.isClosed()) return null;
|
if (c == null || c.isClosed()) return null;
|
||||||
|
@ -178,27 +199,8 @@ public class MessageConversationAdapter extends Adapter<ViewHolder>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDisplayImagePreview(final boolean display) {
|
public final int getMediaPreviewStyle() {
|
||||||
// Images in DM are always enabled
|
return mMediaPreviewStyle;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setImagePreviewScaleType(final String scaleTypeString) {
|
|
||||||
final ScaleType scaleType;
|
|
||||||
switch (Utils.getMediaPreviewStyle(scaleTypeString)) {
|
|
||||||
case VALUE_MEDIA_PREVIEW_STYLE_CODE_CROP: {
|
|
||||||
scaleType = ScaleType.CENTER_CROP;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case VALUE_MEDIA_PREVIEW_STYLE_CODE_SCALE: {
|
|
||||||
scaleType = ScaleType.CENTER_INSIDE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mImagePreviewScaleType = scaleType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCursor(final Cursor cursor) {
|
public void setCursor(final Cursor cursor) {
|
||||||
|
|
|
@ -40,12 +40,12 @@ public interface IContentCardAdapter extends ILoadMoreSupportAdapter {
|
||||||
@ShapeStyle
|
@ShapeStyle
|
||||||
int getProfileImageStyle();
|
int getProfileImageStyle();
|
||||||
|
|
||||||
|
boolean isProfileImageEnabled();
|
||||||
|
|
||||||
float getTextSize();
|
float getTextSize();
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
AsyncTwitterWrapper getTwitterWrapper();
|
AsyncTwitterWrapper getTwitterWrapper();
|
||||||
|
|
||||||
boolean isProfileImageEnabled();
|
|
||||||
|
|
||||||
MediaLoaderWrapper getMediaLoader();
|
MediaLoaderWrapper getMediaLoader();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,19 @@
|
||||||
package org.mariotaku.twidere.adapter.iface;
|
package org.mariotaku.twidere.adapter.iface;
|
||||||
|
|
||||||
import org.mariotaku.twidere.model.ParcelableDirectMessage;
|
import org.mariotaku.twidere.model.ParcelableDirectMessage;
|
||||||
|
import org.mariotaku.twidere.util.MediaLoaderWrapper;
|
||||||
|
import org.mariotaku.twidere.view.ShapedImageView;
|
||||||
|
|
||||||
public interface IDirectMessagesAdapter {
|
public interface IDirectMessagesAdapter {
|
||||||
|
|
||||||
public ParcelableDirectMessage findItem(long id);
|
public ParcelableDirectMessage findItem(long id);
|
||||||
|
|
||||||
public void setDisplayImagePreview(boolean display);
|
@ShapedImageView.ShapeStyle
|
||||||
|
int getProfileImageStyle();
|
||||||
|
|
||||||
public void setImagePreviewScaleType(String scaleType);
|
boolean isProfileImageEnabled();
|
||||||
|
|
||||||
|
int getMediaPreviewStyle();
|
||||||
|
|
||||||
|
MediaLoaderWrapper getMediaLoader();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,14 +31,11 @@ import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.app.FragmentManagerTrojan;
|
|
||||||
import android.support.v4.app.LoaderManager;
|
import android.support.v4.app.LoaderManager;
|
||||||
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
import android.support.v4.app.LoaderManager.LoaderCallbacks;
|
||||||
import android.support.v4.content.CursorLoader;
|
import android.support.v4.content.CursorLoader;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
import android.support.v4.util.Pair;
|
import android.support.v4.util.Pair;
|
||||||
import android.support.v4.view.LayoutInflaterCompat;
|
|
||||||
import android.support.v4.view.LayoutInflaterFactory;
|
|
||||||
import android.support.v4.view.MenuItemCompat;
|
import android.support.v4.view.MenuItemCompat;
|
||||||
import android.support.v7.app.ActionBar;
|
import android.support.v7.app.ActionBar;
|
||||||
import android.support.v7.widget.FixedLinearLayoutManager;
|
import android.support.v7.widget.FixedLinearLayoutManager;
|
||||||
|
@ -61,7 +58,6 @@ import android.widget.AdapterView.OnItemClickListener;
|
||||||
import android.widget.AdapterView.OnItemSelectedListener;
|
import android.widget.AdapterView.OnItemSelectedListener;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ImageView.ScaleType;
|
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -77,7 +73,6 @@ import org.mariotaku.querybuilder.Expression;
|
||||||
import org.mariotaku.querybuilder.OrderBy;
|
import org.mariotaku.querybuilder.OrderBy;
|
||||||
import org.mariotaku.querybuilder.RawItemArray;
|
import org.mariotaku.querybuilder.RawItemArray;
|
||||||
import org.mariotaku.twidere.R;
|
import org.mariotaku.twidere.R;
|
||||||
import org.mariotaku.twidere.activity.iface.IThemedActivity;
|
|
||||||
import org.mariotaku.twidere.activity.support.BaseAppCompatActivity;
|
import org.mariotaku.twidere.activity.support.BaseAppCompatActivity;
|
||||||
import org.mariotaku.twidere.activity.support.ImagePickerActivity;
|
import org.mariotaku.twidere.activity.support.ImagePickerActivity;
|
||||||
import org.mariotaku.twidere.adapter.AccountsSpinnerAdapter;
|
import org.mariotaku.twidere.adapter.AccountsSpinnerAdapter;
|
||||||
|
@ -107,7 +102,6 @@ import org.mariotaku.twidere.util.MediaLoaderWrapper;
|
||||||
import org.mariotaku.twidere.util.ParseUtils;
|
import org.mariotaku.twidere.util.ParseUtils;
|
||||||
import org.mariotaku.twidere.util.ReadStateManager;
|
import org.mariotaku.twidere.util.ReadStateManager;
|
||||||
import org.mariotaku.twidere.util.SharedPreferencesWrapper;
|
import org.mariotaku.twidere.util.SharedPreferencesWrapper;
|
||||||
import org.mariotaku.twidere.util.ThemedLayoutInflaterFactory;
|
|
||||||
import org.mariotaku.twidere.util.TwidereValidator;
|
import org.mariotaku.twidere.util.TwidereValidator;
|
||||||
import org.mariotaku.twidere.util.UserColorNameManager;
|
import org.mariotaku.twidere.util.UserColorNameManager;
|
||||||
import org.mariotaku.twidere.util.Utils;
|
import org.mariotaku.twidere.util.Utils;
|
||||||
|
@ -344,10 +338,6 @@ public class MessagesConversationFragment extends BaseSupportFragment implements
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
final String previewScaleType = Utils.getNonEmptyString(mPreferences, KEY_MEDIA_PREVIEW_STYLE,
|
|
||||||
ScaleType.CENTER_CROP.name());
|
|
||||||
mAdapter.setImagePreviewScaleType(previewScaleType);
|
|
||||||
mAdapter.notifyDataSetChanged();
|
|
||||||
updateAddImageButton();
|
updateAddImageButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,14 +48,19 @@ public class UserAgentUtils {
|
||||||
constructor.setAccessible(false);
|
constructor.setAccessible(false);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
final WebView webView = new WebView(context);
|
WebView webView = null;
|
||||||
try {
|
try {
|
||||||
|
webView = new WebView(context);
|
||||||
return webView.getSettings().getUserAgentString();
|
return webView.getSettings().getUserAgentString();
|
||||||
|
} catch (Exception e2) {
|
||||||
|
return System.getProperty("http.agent");
|
||||||
} finally {
|
} finally {
|
||||||
|
if (webView != null) {
|
||||||
webView.destroy();
|
webView.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
|
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
|
||||||
static class NewApiWrapper {
|
static class NewApiWrapper {
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* Twidere - Twitter client for Android
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012-2015 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;
|
||||||
|
|
||||||
|
import android.database.Cursor;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import org.mariotaku.twidere.R;
|
||||||
|
import org.mariotaku.twidere.adapter.MessageConversationAdapter;
|
||||||
|
import org.mariotaku.twidere.model.ParcelableDirectMessage;
|
||||||
|
import org.mariotaku.twidere.util.MediaLoaderWrapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by mariotaku on 15/4/25.
|
||||||
|
*/
|
||||||
|
public class IncomingMessageViewHolder extends MessageViewHolder {
|
||||||
|
|
||||||
|
private final ImageView profileImageView;
|
||||||
|
|
||||||
|
public IncomingMessageViewHolder(MessageConversationAdapter adapter, View itemView) {
|
||||||
|
super(adapter, itemView);
|
||||||
|
profileImageView = (ImageView) itemView.findViewById(R.id.profile_image);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void displayMessage(Cursor cursor, ParcelableDirectMessage.CursorIndices indices) {
|
||||||
|
super.displayMessage(cursor, indices);
|
||||||
|
final MediaLoaderWrapper wrapper = adapter.getMediaLoader();
|
||||||
|
if (adapter.isProfileImageEnabled()) {
|
||||||
|
profileImageView.setVisibility(View.VISIBLE);
|
||||||
|
wrapper.displayProfileImage(profileImageView, cursor.getString(indices.sender_profile_image_url));
|
||||||
|
} else {
|
||||||
|
profileImageView.setVisibility(View.GONE);
|
||||||
|
wrapper.cancelDisplayTask(profileImageView);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -41,19 +41,18 @@ import org.mariotaku.twidere.util.Utils;
|
||||||
import org.mariotaku.twidere.view.CardMediaContainer;
|
import org.mariotaku.twidere.view.CardMediaContainer;
|
||||||
import org.mariotaku.twidere.view.CardMediaContainer.OnMediaClickListener;
|
import org.mariotaku.twidere.view.CardMediaContainer.OnMediaClickListener;
|
||||||
|
|
||||||
public class MessageConversationViewHolder extends ViewHolder implements OnMediaClickListener {
|
public class MessageViewHolder extends ViewHolder implements OnMediaClickListener {
|
||||||
|
|
||||||
public final CardMediaContainer mediaContainer;
|
public final CardMediaContainer mediaContainer;
|
||||||
public final TextView text, time;
|
public final TextView text, time;
|
||||||
|
|
||||||
private final MessageBubbleView messageContent;
|
private final MessageBubbleView messageContent;
|
||||||
private final MessageConversationAdapter adapter;
|
protected final MessageConversationAdapter adapter;
|
||||||
|
|
||||||
private final int textColorPrimary, textColorPrimaryInverse, textColorSecondary, textColorSecondaryInverse;
|
private final int textColorPrimary, textColorPrimaryInverse, textColorSecondary, textColorSecondaryInverse;
|
||||||
|
|
||||||
private float textSize;
|
|
||||||
|
|
||||||
public MessageConversationViewHolder(final MessageConversationAdapter adapter, final View itemView) {
|
public MessageViewHolder(final MessageConversationAdapter adapter, final View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
this.adapter = adapter;
|
this.adapter = adapter;
|
||||||
final Context context = itemView.getContext();
|
final Context context = itemView.getContext();
|
||||||
|
@ -74,7 +73,7 @@ public class MessageConversationViewHolder extends ViewHolder implements OnMedia
|
||||||
public void displayMessage(Cursor cursor, CursorIndices indices) {
|
public void displayMessage(Cursor cursor, CursorIndices indices) {
|
||||||
final Context context = adapter.getContext();
|
final Context context = adapter.getContext();
|
||||||
final TwidereLinkify linkify = adapter.getLinkify();
|
final TwidereLinkify linkify = adapter.getLinkify();
|
||||||
final MediaLoaderWrapper loader = adapter.getImageLoader();
|
final MediaLoaderWrapper loader = adapter.getMediaLoader();
|
||||||
|
|
||||||
final long accountId = cursor.getLong(indices.account_id);
|
final long accountId = cursor.getLong(indices.account_id);
|
||||||
final long timestamp = cursor.getLong(indices.message_timestamp);
|
final long timestamp = cursor.getLong(indices.message_timestamp);
|
||||||
|
@ -118,11 +117,8 @@ public class MessageConversationViewHolder extends ViewHolder implements OnMedia
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTextSize(final float textSize) {
|
public void setTextSize(final float textSize) {
|
||||||
if (this.textSize != textSize) {
|
|
||||||
this.textSize = textSize;
|
|
||||||
text.setTextSize(textSize);
|
text.setTextSize(textSize);
|
||||||
time.setTextSize(textSize * 0.75f);
|
time.setTextSize(textSize * 0.75f);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
|
||||||
~ Twidere - Twitter client for Android
|
~ Twidere - Twitter client for Android
|
||||||
~
|
~
|
||||||
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||||
|
@ -18,18 +17,25 @@
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<FrameLayout
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="8dp">
|
android:padding="8dp">
|
||||||
|
|
||||||
|
<org.mariotaku.twidere.view.ShapedImageView
|
||||||
|
android:id="@+id/profile_image"
|
||||||
|
style="?profileImageStyle"
|
||||||
|
android:layout_width="@dimen/icon_size_card_list_item"
|
||||||
|
android:layout_height="@dimen/icon_size_card_list_item"
|
||||||
|
android:layout_alignTop="@+id/message_content" />
|
||||||
|
|
||||||
<org.mariotaku.messagebubbleview.library.MessageBubbleView
|
<org.mariotaku.messagebubbleview.library.MessageBubbleView
|
||||||
android:id="@+id/message_content"
|
android:id="@+id/message_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="left"
|
android:layout_gravity="left"
|
||||||
|
android:layout_toRightOf="@+id/profile_image"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
app:bubbleColor="?colorAccent"
|
app:bubbleColor="?colorAccent"
|
||||||
app:caretHeight="8dp"
|
app:caretHeight="8dp"
|
||||||
|
@ -40,4 +46,4 @@
|
||||||
<include layout="@layout/card_item_message_conversation_common" />
|
<include layout="@layout/card_item_message_conversation_common" />
|
||||||
</org.mariotaku.messagebubbleview.library.MessageBubbleView>
|
</org.mariotaku.messagebubbleview.library.MessageBubbleView>
|
||||||
|
|
||||||
</FrameLayout>
|
</RelativeLayout>
|
|
@ -1,5 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?><!--
|
||||||
<!--
|
|
||||||
~ Twidere - Twitter client for Android
|
~ Twidere - Twitter client for Android
|
||||||
~
|
~
|
||||||
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
~ Copyright (C) 2012-2014 Mariotaku Lee <mariotaku.lee@gmail.com>
|
||||||
|
@ -18,8 +17,8 @@
|
||||||
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/fragment_content"
|
android:id="@+id/fragment_content"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -30,7 +29,7 @@
|
||||||
android:id="@+id/conversation_container"
|
android:id="@+id/conversation_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:divider="?android:dividerVertical"
|
android:divider="?dividerVertical"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:showDividers="middle"
|
android:showDividers="middle"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
@ -49,68 +48,82 @@
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:id="@+id/input_send_container"
|
android:id="@+id/input_send_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
|
android:background="?android:colorBackground"
|
||||||
android:gravity="bottom"
|
android:gravity="bottom"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
android:padding="@dimen/element_spacing_normal">
|
||||||
|
|
||||||
<org.mariotaku.twidere.view.ActionIconView
|
<org.mariotaku.twidere.view.ActionIconView
|
||||||
android:id="@+id/add_image"
|
android:id="@+id/add_image"
|
||||||
android:layout_width="?android:actionBarSize"
|
android:layout_width="@dimen/element_size_normal"
|
||||||
android:layout_height="?android:actionBarSize"
|
android:layout_height="@dimen/element_size_normal"
|
||||||
android:layout_weight="0"
|
android:layout_alignParentLeft="true"
|
||||||
android:background="?selectableItemBackgroundBorderless"
|
android:background="?selectableItemBackground"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:color="?android:textColorSecondary"
|
android:color="?android:textColorSecondary"
|
||||||
android:contentDescription="@string/add_image"
|
android:contentDescription="@string/add_image"
|
||||||
android:padding="0dp"
|
|
||||||
android:scaleType="centerInside"
|
android:scaleType="centerInside"
|
||||||
android:src="@drawable/ic_action_gallery" />
|
android:src="@drawable/ic_action_gallery" />
|
||||||
|
|
||||||
|
<org.mariotaku.twidere.view.ActionIconView
|
||||||
|
android:id="@+id/send"
|
||||||
|
android:layout_width="@dimen/element_size_normal"
|
||||||
|
android:layout_height="@dimen/element_size_normal"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:background="?selectableItemBackground"
|
||||||
|
android:clickable="true"
|
||||||
|
android:color="?android:textColorSecondary"
|
||||||
|
android:contentDescription="@string/send"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
android:src="@drawable/ic_action_send" />
|
||||||
|
|
||||||
|
<org.mariotaku.messagebubbleview.library.MessageBubbleView
|
||||||
|
android:id="@+id/edit_text_container"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="right"
|
||||||
|
android:layout_toLeftOf="@+id/send"
|
||||||
|
android:layout_toRightOf="@+id/add_image"
|
||||||
|
android:clickable="true"
|
||||||
|
app:bubbleColor="?messageBubbleColor"
|
||||||
|
app:caretHeight="8dp"
|
||||||
|
app:caretPosition="topRight"
|
||||||
|
app:caretWidth="8dp"
|
||||||
|
app:cornerRadius="2dp">
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="@dimen/element_spacing_normal">
|
||||||
|
|
||||||
<org.mariotaku.twidere.view.StatusComposeEditText
|
<org.mariotaku.twidere.view.StatusComposeEditText
|
||||||
android:id="@+id/edit_text"
|
android:id="@+id/edit_text"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:background="@null"
|
||||||
android:completionThreshold="1"
|
android:completionThreshold="1"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:gravity="left|bottom"
|
android:layout_gravity="center"
|
||||||
|
android:gravity="left|center_vertical"
|
||||||
android:hint="@string/type_to_compose"
|
android:hint="@string/type_to_compose"
|
||||||
android:inputType="textShortMessage|textMultiLine"
|
android:inputType="textShortMessage|textMultiLine"
|
||||||
android:maxHeight="140dp"
|
android:maxHeight="140dp"
|
||||||
android:minHeight="?android:actionBarSize"
|
|
||||||
android:singleLine="false">
|
android:singleLine="false">
|
||||||
|
|
||||||
<requestFocus />
|
<requestFocus />
|
||||||
</org.mariotaku.twidere.view.StatusComposeEditText>
|
</org.mariotaku.twidere.view.StatusComposeEditText>
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:id="@+id/send"
|
|
||||||
android:layout_width="?android:actionBarSize"
|
|
||||||
android:layout_height="?android:actionBarSize"
|
|
||||||
android:layout_weight="0"
|
|
||||||
android:background="?selectableItemBackgroundBorderless"
|
|
||||||
android:clickable="true"
|
|
||||||
android:padding="0dp">
|
|
||||||
|
|
||||||
<org.mariotaku.twidere.view.ActionIconView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:color="?android:textColorSecondary"
|
|
||||||
android:contentDescription="@string/send"
|
|
||||||
android:scaleType="centerInside"
|
|
||||||
android:src="@drawable/ic_action_send"/>
|
|
||||||
|
|
||||||
<org.mariotaku.twidere.view.StatusTextCountView
|
<org.mariotaku.twidere.view.StatusTextCountView
|
||||||
android:id="@+id/text_count"
|
android:id="@+id/text_count"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom|right"
|
android:layout_gravity="bottom|right"
|
||||||
android:layout_marginBottom="@dimen/element_spacing_small"
|
android:layout_margin="@dimen/element_spacing_small"
|
||||||
android:layout_marginRight="@dimen/element_spacing_small"
|
|
||||||
android:fontFamily="sans-serif-light"
|
android:fontFamily="sans-serif-light"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:textAllCaps="true"
|
android:textAllCaps="true"
|
||||||
|
@ -120,7 +133,9 @@
|
||||||
tools:ignore="UnusedAttribute"
|
tools:ignore="UnusedAttribute"
|
||||||
tools:text="140" />
|
tools:text="140" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</LinearLayout>
|
</org.mariotaku.messagebubbleview.library.MessageBubbleView>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
|
Loading…
Reference in New Issue