1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-02-17 04:00:48 +01:00

fixed profile image transition in direct messages conversation

This commit is contained in:
Mariotaku Lee 2015-03-08 17:47:28 +08:00
parent 6a03b06164
commit 3c31e49f4f
3 changed files with 9 additions and 68 deletions

View File

@ -373,7 +373,8 @@ public class DirectMessagesConversationFragment extends BaseSupportFragment impl
final ParcelableUser recipient = mRecipient;
if (recipient == null) return;
final Bundle options = Utils.makeSceneTransitionOption(getActivity(),
new Pair<>(view, UserFragment.TRANSITION_NAME_PROFILE_IMAGE));
new Pair<View, String>(mRecipientProfileImageView,
UserFragment.TRANSITION_NAME_PROFILE_IMAGE));
Utils.openUserProfile(getActivity(), recipient.account_id, recipient.id,
recipient.screen_name, options);
break;

View File

@ -1,61 +0,0 @@
/*
* Twidere - Twitter client for Android
*
* Copyright (C) 2012-2014 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;
import android.content.Context;
import android.util.AttributeSet;
import android.view.ViewGroup;
public class SquareCircularImageView extends ShapedImageView {
public SquareCircularImageView(final Context context) {
this(context, null);
}
public SquareCircularImageView(final Context context, final AttributeSet attrs) {
this(context, attrs, 0);
}
public SquareCircularImageView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onMeasure(final int widthMeasureSpec, final int heightMeasureSpec) {
final int width = MeasureSpec.getSize(widthMeasureSpec), height = MeasureSpec.getSize(heightMeasureSpec);
final ViewGroup.LayoutParams lp = getLayoutParams();
if (lp.height == ViewGroup.LayoutParams.MATCH_PARENT && lp.width == ViewGroup.LayoutParams.WRAP_CONTENT) {
super.onMeasure(heightMeasureSpec, heightMeasureSpec);
setMeasuredDimension(height, height);
} else if (lp.width == ViewGroup.LayoutParams.MATCH_PARENT && lp.height == ViewGroup.LayoutParams.WRAP_CONTENT) {
super.onMeasure(widthMeasureSpec, widthMeasureSpec);
setMeasuredDimension(width, width);
} else {
if (width > height) {
super.onMeasure(heightMeasureSpec, heightMeasureSpec);
setMeasuredDimension(height, height);
} else {
super.onMeasure(widthMeasureSpec, widthMeasureSpec);
setMeasuredDimension(width, width);
}
}
}
}

View File

@ -18,21 +18,22 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<org.mariotaku.twidere.view.ColorLabelRelativeLayout
<org.mariotaku.twidere.view.ColorLabelFrameLayout
style="?android:actionButtonStyle"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:clickable="true"
android:padding="0dp"
app:ignorePadding="true">
<org.mariotaku.twidere.view.SquareCircularImageView
style="?profileImageStyle"
<org.mariotaku.twidere.view.SquareShapedImageView
android:id="@+id/recipient_profile_image"
style="?profileImageStyle"
android:layout_width="wrap_content"
android:layout_margin="@dimen/element_spacing_msmall"
android:layout_height="match_parent"
android:layout_centerVertical="true"/>
android:layout_gravity="center"
android:layout_margin="@dimen/element_spacing_msmall"/>
</org.mariotaku.twidere.view.ColorLabelRelativeLayout>
</org.mariotaku.twidere.view.ColorLabelFrameLayout>