migrating to RoundedImageView

This commit is contained in:
Mariotaku Lee 2015-06-06 23:15:33 +08:00
parent a2f0cf6f56
commit 8451c50104
17 changed files with 70 additions and 30 deletions

View File

@ -113,7 +113,6 @@ import org.mariotaku.twidere.view.CardMediaContainer;
import org.mariotaku.twidere.view.CardMediaContainer.OnMediaClickListener;
import org.mariotaku.twidere.view.ColorLabelRelativeLayout;
import org.mariotaku.twidere.view.ForegroundColorView;
import org.mariotaku.twidere.view.ShapedImageView;
import org.mariotaku.twidere.view.StatusTextView;
import org.mariotaku.twidere.view.TwitterCardContainer;
import org.mariotaku.twidere.view.holder.GapViewHolder;
@ -606,7 +605,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
private final StatusTextView textView;
private final TextView quoteTextView;
private final TextView quotedNameView, quotedScreenNameView;
private final ShapedImageView profileImageView;
private final ImageView profileImageView;
private final ImageView profileTypeView;
private final TextView timeSourceView;
private final TextView retweetedByView;
@ -636,7 +635,7 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
nameView = (TextView) itemView.findViewById(R.id.name);
screenNameView = (TextView) itemView.findViewById(R.id.screen_name);
textView = (StatusTextView) itemView.findViewById(R.id.text);
profileImageView = (ShapedImageView) itemView.findViewById(R.id.profile_image);
profileImageView = (ImageView) itemView.findViewById(R.id.profile_image);
profileTypeView = (ImageView) itemView.findViewById(R.id.profile_type);
timeSourceView = (TextView) itemView.findViewById(R.id.time_source);
retweetedByView = (TextView) itemView.findViewById(R.id.retweeted_by);

View File

@ -48,6 +48,7 @@ import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.AppCompatPreferenceActivity;
import org.mariotaku.twidere.activity.iface.IThemedActivity;
import org.mariotaku.twidere.util.support.ViewSupport;
import org.mariotaku.twidere.view.ProfileImageView;
import org.mariotaku.twidere.view.ShapedImageView;
import org.mariotaku.twidere.view.TwidereToolbar;
import org.mariotaku.twidere.view.iface.ICustomTypefaceTextView;
@ -124,6 +125,10 @@ public class ThemedLayoutInflaterFactory implements LayoutInflaterFactory {
final ShapedImageView shapedImageView = (ShapedImageView) view;
shapedImageView.setStyle(activity.getCurrentProfileImageStyle());
}
if (view instanceof ProfileImageView) {
final ProfileImageView profileImageView = (ProfileImageView) view;
profileImageView.setOval(activity.getCurrentProfileImageStyle() == ShapedImageView.SHAPE_CIRCLE);
}
if (view instanceof TextView && (!(view instanceof ICustomTypefaceTextView))) {
final String fontFamily = activity.getCurrentThemeFontFamily();
final TextView textView = (TextView) view;
@ -165,8 +170,8 @@ public class ThemedLayoutInflaterFactory implements LayoutInflaterFactory {
// View context is derived from ActionBar and it's light theme, so we use contrast color
final int actionBarColor = activity.getCurrentThemeColor();
final int actionBarTheme = ThemeUtils.getActionBarThemeResource(activity.getThemeResourceId(), actionBarColor);
accentColor = ThemeUtils.getColorFromAttribute(viewContext,android.R.attr.colorForeground, 0);
noTintColor = ThemeUtils.getColorFromAttribute(viewContext,android.R.attr.colorBackground, 0);
accentColor = ThemeUtils.getColorFromAttribute(viewContext, android.R.attr.colorForeground, 0);
noTintColor = ThemeUtils.getColorFromAttribute(viewContext, android.R.attr.colorBackground, 0);
backgroundTintColor = accentColor;
backgroundColorApprox = Color.WHITE;
isColorTint = false;

View File

@ -0,0 +1,42 @@
/*
* 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;
import android.content.Context;
import android.util.AttributeSet;
import com.makeramen.roundedimageview.RoundedImageView;
/**
* Created by mariotaku on 15/6/6.
*/
public class ProfileImageView extends RoundedImageView {
public ProfileImageView(final Context context) {
super(context);
}
public ProfileImageView(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
public ProfileImageView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
}
}

View File

@ -15,8 +15,6 @@ import android.view.View.OnLongClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import com.makeramen.roundedimageview.RoundedImageView;
import org.mariotaku.twidere.Constants;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.adapter.iface.ContentCardClickListener;
@ -39,7 +37,6 @@ import org.mariotaku.twidere.view.CardMediaContainer;
import org.mariotaku.twidere.view.CardMediaContainer.OnMediaClickListener;
import org.mariotaku.twidere.view.ForegroundColorView;
import org.mariotaku.twidere.view.NameView;
import org.mariotaku.twidere.view.ShapedImageView;
import org.mariotaku.twidere.view.ShortTimeView;
import org.mariotaku.twidere.view.iface.IColorLabelView;
@ -60,7 +57,7 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
private final IStatusesAdapter<?> adapter;
private final ImageView replyRetweetIcon;
private final RoundedImageView profileImageView;
private final ImageView profileImageView;
private final ImageView profileTypeView;
private final ImageView extraTypeView;
private final TextView textView;
@ -82,7 +79,7 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
super(itemView);
this.adapter = adapter;
itemContent = (IColorLabelView) itemView.findViewById(R.id.item_content);
profileImageView = (RoundedImageView) itemView.findViewById(R.id.profile_image);
profileImageView = (ImageView) itemView.findViewById(R.id.profile_image);
profileTypeView = (ImageView) itemView.findViewById(R.id.profile_type);
extraTypeView = (ImageView) itemView.findViewById(R.id.extra_type);
textView = (TextView) itemView.findViewById(R.id.text);
@ -634,7 +631,6 @@ public class StatusViewHolder extends ViewHolder implements Constants, OnClickLi
setTextSize(adapter.getTextSize());
mediaPreview.setStyle(adapter.getMediaPreviewStyle());
// profileImageView.setStyle(adapter.getProfileImageStyle());
profileImageView.setOval(adapter.getProfileImageStyle() == ShapedImageView.SHAPE_CIRCLE);
actionButtons.setVisibility(adapter.isCardActionsHidden() ? View.GONE : View.VISIBLE);
itemMenu.setVisibility(adapter.isCardActionsHidden() ? View.GONE : View.VISIBLE);

View File

@ -23,6 +23,7 @@ import android.content.Context;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import org.mariotaku.twidere.R;
@ -32,7 +33,6 @@ import org.mariotaku.twidere.model.ParcelableUserList;
import org.mariotaku.twidere.util.MediaLoaderWrapper;
import org.mariotaku.twidere.util.UserColorNameManager;
import org.mariotaku.twidere.util.Utils;
import org.mariotaku.twidere.view.ShapedImageView;
import org.mariotaku.twidere.view.iface.IColorLabelView;
import java.util.Locale;
@ -45,7 +45,7 @@ public class UserListViewHolder extends ViewHolder implements View.OnClickListen
private final IUserListsAdapter<?> adapter;
private final IColorLabelView itemContent;
private final ShapedImageView profileImageView;
private final ImageView profileImageView;
private final TextView nameView;
private final TextView createdByView;
private final TextView descriptionView;
@ -58,7 +58,7 @@ public class UserListViewHolder extends ViewHolder implements View.OnClickListen
super(itemView);
itemContent = (IColorLabelView) itemView.findViewById(R.id.item_content);
this.adapter = adapter;
profileImageView = (ShapedImageView) itemView.findViewById(R.id.profile_image);
profileImageView = (ImageView) itemView.findViewById(R.id.profile_image);
nameView = (TextView) itemView.findViewById(R.id.name);
createdByView = (TextView) itemView.findViewById(R.id.created_by);
descriptionView = (TextView) itemView.findViewById(R.id.description);
@ -125,7 +125,6 @@ public class UserListViewHolder extends ViewHolder implements View.OnClickListen
public void setupViewOptions() {
setTextSize(adapter.getTextSize());
profileImageView.setStyle(adapter.getProfileImageStyle());
}
public void setTextSize(final float textSize) {

View File

@ -46,7 +46,7 @@ public class UserViewHolder extends ViewHolder implements OnClickListener, OnLon
private final IUsersAdapter<?> adapter;
private final IColorLabelView itemContent;
private final ShapedImageView profileImageView;
private final ImageView profileImageView;
private final ImageView profileTypeView;
private final TextView nameView, screenNameView, descriptionView, locationView, urlView,
statusesCountView, followersCountView, friendsCountView;
@ -57,7 +57,7 @@ public class UserViewHolder extends ViewHolder implements OnClickListener, OnLon
super(itemView);
this.adapter = adapter;
itemContent = (IColorLabelView) itemView.findViewById(R.id.item_content);
profileImageView = (ShapedImageView) itemView.findViewById(R.id.profile_image);
profileImageView = (ImageView) itemView.findViewById(R.id.profile_image);
profileTypeView = (ImageView) itemView.findViewById(R.id.profile_type);
nameView = (TextView) itemView.findViewById(R.id.name);
screenNameView = (TextView) itemView.findViewById(R.id.screen_name);
@ -104,7 +104,7 @@ public class UserViewHolder extends ViewHolder implements OnClickListener, OnLon
}
}
public ShapedImageView getProfileImageView() {
public ImageView getProfileImageView() {
return profileImageView;
}
@ -157,7 +157,6 @@ public class UserViewHolder extends ViewHolder implements OnClickListener, OnLon
public void setupViewOptions() {
setTextSize(adapter.getTextSize());
profileImageView.setStyle(adapter.getProfileImageStyle());
}
public interface UserClickListener extends ContentCardClickListener {

View File

@ -23,7 +23,7 @@
android:layout_height="wrap_content"
android:padding="8dp">
<com.makeramen.roundedimageview.RoundedImageView
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/profile_image"
style="?profileImageStyle"
android:layout_width="@dimen/icon_size_card_list_item"

View File

@ -91,7 +91,7 @@
android:paddingRight="0dp"
android:paddingStart="@dimen/element_spacing_normal">
<com.makeramen.roundedimageview.RoundedImageView
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/profile_image"
style="?profileImageStyle"
android:layout_width="@dimen/icon_size_status_profile_image"

View File

@ -70,7 +70,7 @@
tools:textSize="@dimen/text_size_extra_small"
tools:visibility="visible"/>
<com.makeramen.roundedimageview.RoundedImageView
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/profile_image"
style="?profileImageStyle"
android:layout_width="@dimen/icon_size_status_profile_image"

View File

@ -56,7 +56,7 @@
android:paddingStart="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.ShapedImageView
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/profile_image"
style="?profileImageStyle"
android:layout_width="@dimen/icon_size_card_list_item"

View File

@ -39,7 +39,7 @@
android:paddingStart="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.ShapedImageView
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/profile_image"
style="?profileImageStyle"
android:layout_width="@dimen/icon_size_card_list_item"

View File

@ -58,7 +58,7 @@
android:paddingStart="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.ShapedImageView
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/profile_image"
style="?profileImageStyle"
android:layout_width="@dimen/icon_size_card_list_item"

View File

@ -39,7 +39,7 @@
android:paddingStart="@dimen/element_spacing_normal"
android:paddingTop="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.ShapedImageView
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/profile_image"
style="?profileImageStyle"
android:layout_width="@dimen/icon_size_card_list_item"

View File

@ -65,7 +65,7 @@
android:padding="@dimen/element_spacing_small"
app:ignorePadding="true">
<org.mariotaku.twidere.view.ShapedImageView
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/profile_image"
style="?profileImageStyle"
android:layout_width="@dimen/icon_size_card_details"

View File

@ -25,7 +25,7 @@
android:orientation="horizontal"
android:padding="@dimen/element_spacing_small">
<org.mariotaku.twidere.view.ShapedImageView
<org.mariotaku.twidere.view.ProfileImageView
android:id="@android:id/icon"
style="?profileImageStyle"
android:layout_width="@dimen/icon_size_list_item_small"

View File

@ -26,7 +26,7 @@
android:orientation="horizontal"
android:padding="@dimen/element_spacing_normal">
<org.mariotaku.twidere.view.SquareShapedImageView
<org.mariotaku.twidere.view.ProfileImageView
android:id="@android:id/icon"
style="?profileImageStyle"
android:layout_width="@dimen/icon_size_list_item_small"

View File

@ -58,7 +58,7 @@
tools:text="Created by Mariotaku" />
</LinearLayout>
<org.mariotaku.twidere.view.SquareShapedImageView
<org.mariotaku.twidere.view.ProfileImageView
android:id="@+id/profile_image"
style="?profileImageStyle"
android:layout_width="@dimen/icon_size_card_list_item"