mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-25 18:47:51 +02:00
Add proguard rules. Show unread count. Use compact font
This commit is contained in:
@ -17,22 +17,29 @@ import uk.co.ribot.easyadapter.annotations.ViewId;
|
||||
@LayoutId(R.layout.item_library)
|
||||
public class MangaLibraryHolder extends ItemViewHolder<Manga> {
|
||||
|
||||
@ViewId(R.id.thumbnailImageView)
|
||||
ImageView mImageView;
|
||||
@ViewId(R.id.thumbnailImage)
|
||||
ImageView mThumbImage;
|
||||
|
||||
@ViewId(R.id.nameTextView)
|
||||
TextView mTextView;
|
||||
@ViewId(R.id.titleText)
|
||||
TextView mTitleText;
|
||||
|
||||
@ViewId(R.id.unreadText)
|
||||
TextView mUnreadText;
|
||||
|
||||
public MangaLibraryHolder(View view) {
|
||||
super(view);
|
||||
}
|
||||
|
||||
public void onSetValues(Manga manga, PositionInfo positionInfo) {
|
||||
mTextView.setText(manga.title);
|
||||
mTitleText.setText(manga.title);
|
||||
if (manga.unread > 0) {
|
||||
mUnreadText.setVisibility(View.VISIBLE);
|
||||
mUnreadText.setText(Integer.toString(manga.unread));
|
||||
}
|
||||
Glide.with(getContext())
|
||||
.load("http://img1.wikia.nocookie.net/__cb20090524204255/starwars/images/thumb/1/1a/R2d2.jpg/400px-R2d2.jpg")
|
||||
.centerCrop()
|
||||
.into(mImageView);
|
||||
.into(mThumbImage);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
package eu.kanade.mangafeed.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Typeface;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
import eu.kanade.mangafeed.R;
|
||||
|
||||
|
||||
public class PTSansTextView extends TextView {
|
||||
private final static int PTSANS_NARROW = 0;
|
||||
private final static int PTSANS_NARROW_BOLD = 1;
|
||||
|
||||
|
||||
public PTSansTextView(Context c) {
|
||||
super(c);
|
||||
}
|
||||
|
||||
public PTSansTextView(Context c, AttributeSet attrs) {
|
||||
super(c, attrs);
|
||||
parseAttributes(c, attrs);
|
||||
}
|
||||
|
||||
public PTSansTextView(Context c, AttributeSet attrs, int defStyle) {
|
||||
super(c, attrs, defStyle);
|
||||
parseAttributes(c, attrs);
|
||||
}
|
||||
|
||||
private void parseAttributes(Context c, AttributeSet attrs) {
|
||||
TypedArray values = c.obtainStyledAttributes(attrs, R.styleable.PTSansTextView);
|
||||
|
||||
//The value 0 is a default, but shouldn't ever be used since the attr is an enum
|
||||
int typeface = values.getInt(R.styleable.PTSansTextView_typeface, 0);
|
||||
|
||||
switch(typeface) {
|
||||
case PTSANS_NARROW:
|
||||
//You can instantiate your typeface anywhere, I would suggest as a
|
||||
//singleton somewhere to avoid unnecessary copies
|
||||
setTypeface(Typeface.createFromAsset(c.getAssets(), "fonts/PTSans-Narrow.ttf"));
|
||||
break;
|
||||
case PTSANS_NARROW_BOLD:
|
||||
setTypeface(Typeface.createFromAsset(c.getAssets(), "fonts/PTSans-NarrowBold.ttf"));
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException("Font not found " + typeface);
|
||||
}
|
||||
|
||||
values.recycle();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user