migrating to RoundedImageView
This commit is contained in:
parent
8451c50104
commit
81b3d5bbdd
|
@ -21,6 +21,7 @@ package org.mariotaku.twidere.view;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import com.makeramen.roundedimageview.RoundedImageView;
|
import com.makeramen.roundedimageview.RoundedImageView;
|
||||||
|
|
||||||
|
@ -39,4 +40,26 @@ public class ProfileImageView extends RoundedImageView {
|
||||||
public ProfileImageView(final Context context, final AttributeSet attrs, final int defStyle) {
|
public ProfileImageView(final Context context, final AttributeSet attrs, final int defStyle) {
|
||||||
super(context, attrs, 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?><!--
|
|
||||||
~ 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/>.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<org.mariotaku.twidere.view.ColorLabelFrameLayout
|
|
||||||
style="?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.SquareShapedImageView
|
|
||||||
android:id="@+id/recipient_profile_image"
|
|
||||||
style="?profileImageStyle"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_margin="@dimen/element_spacing_msmall" />
|
|
||||||
|
|
||||||
</org.mariotaku.twidere.view.ColorLabelFrameLayout>
|
|
|
@ -26,7 +26,7 @@
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:padding="@dimen/element_spacing_msmall">
|
android:padding="@dimen/element_spacing_msmall">
|
||||||
|
|
||||||
<org.mariotaku.twidere.view.SquareShapedImageView
|
<org.mariotaku.twidere.view.ProfileImageView
|
||||||
android:id="@android:id/icon"
|
android:id="@android:id/icon"
|
||||||
style="?profileImageStyleLarge"
|
style="?profileImageStyleLarge"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:padding="@dimen/element_spacing_small">
|
android:padding="@dimen/element_spacing_small">
|
||||||
|
|
||||||
<org.mariotaku.twidere.view.SquareShapedImageView
|
<org.mariotaku.twidere.view.ProfileImageView
|
||||||
android:id="@android:id/icon"
|
android:id="@android:id/icon"
|
||||||
style="?profileImageStyle"
|
style="?profileImageStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in New Issue