mirror of https://github.com/kurisufriend/Clover
parent
4f45eb2b44
commit
0860fa4a31
@ -0,0 +1,36 @@ |
|||||||
|
package org.floens.chan.ui.adapter; |
||||||
|
|
||||||
|
import android.support.v7.widget.RecyclerView; |
||||||
|
import android.view.View; |
||||||
|
import android.view.ViewGroup; |
||||||
|
import android.widget.TextView; |
||||||
|
|
||||||
|
public class PinAdapter extends RecyclerView.Adapter<PinAdapter.PinViewHolder> { |
||||||
|
@Override |
||||||
|
public PinViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { |
||||||
|
|
||||||
|
TextView test = new TextView(parent.getContext()); |
||||||
|
|
||||||
|
return new PinViewHolder(test); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onBindViewHolder(PinViewHolder holder, int position) { |
||||||
|
((TextView)holder.itemView).setText("Position = " + position); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int getItemCount() { |
||||||
|
return 1000; |
||||||
|
} |
||||||
|
|
||||||
|
public static class PinViewHolder extends RecyclerView.ViewHolder { |
||||||
|
private View itemView; |
||||||
|
|
||||||
|
public PinViewHolder(View itemView) { |
||||||
|
super(itemView); |
||||||
|
this.itemView = itemView; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
package org.floens.chan.ui.cell; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.util.AttributeSet; |
||||||
|
import android.widget.LinearLayout; |
||||||
|
|
||||||
|
public class PinCell extends LinearLayout { |
||||||
|
public PinCell(Context context) { |
||||||
|
super(context); |
||||||
|
} |
||||||
|
|
||||||
|
public PinCell(Context context, AttributeSet attrs) { |
||||||
|
super(context, attrs); |
||||||
|
} |
||||||
|
|
||||||
|
public PinCell(Context context, AttributeSet attrs, int defStyleAttr) { |
||||||
|
super(context, attrs, defStyleAttr); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void onFinishInflate() { |
||||||
|
super.onFinishInflate(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,41 @@ |
|||||||
|
package org.floens.chan.ui.view; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
import android.util.AttributeSet; |
||||||
|
import android.widget.ImageView; |
||||||
|
|
||||||
|
import com.android.volley.VolleyError; |
||||||
|
import com.android.volley.toolbox.ImageLoader; |
||||||
|
|
||||||
|
import org.floens.chan.ChanApplication; |
||||||
|
|
||||||
|
public class ThumbnailView extends ImageView implements ImageLoader.ImageListener { |
||||||
|
private String url; |
||||||
|
|
||||||
|
public ThumbnailView(Context context) { |
||||||
|
super(context); |
||||||
|
} |
||||||
|
|
||||||
|
public ThumbnailView(Context context, AttributeSet attrs) { |
||||||
|
super(context, attrs); |
||||||
|
} |
||||||
|
|
||||||
|
public ThumbnailView(Context context, AttributeSet attrs, int defStyleAttr) { |
||||||
|
super(context, attrs, defStyleAttr); |
||||||
|
} |
||||||
|
|
||||||
|
public void setUrl(String url) { |
||||||
|
this.url = url; |
||||||
|
|
||||||
|
ImageLoader.ImageContainer container = ChanApplication.getVolleyImageLoader().get(url, this); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onResponse(ImageLoader.ImageContainer response, boolean isImmediate) { |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void onErrorResponse(VolleyError error) { |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,68 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<org.floens.chan.ui.cell.PinCell xmlns:android="http://schemas.android.com/apk/res/android" |
||||||
|
android:orientation="vertical" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="48dp"> |
||||||
|
|
||||||
|
<org.floens.chan.ui.view.CustomNetworkImageView |
||||||
|
android:id="@+id/pin_image" |
||||||
|
android:layout_width="48dp" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:scaleType="centerCrop" /> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/pin_text" |
||||||
|
android:layout_width="0dp" |
||||||
|
android:layout_height="48dp" |
||||||
|
android:layout_weight="1" |
||||||
|
android:ellipsize="end" |
||||||
|
android:gravity="center_vertical" |
||||||
|
android:lines="1" |
||||||
|
android:paddingBottom="8dp" |
||||||
|
android:paddingLeft="16dp" |
||||||
|
android:paddingRight="0dp" |
||||||
|
android:paddingTop="8dp" |
||||||
|
android:singleLine="true" |
||||||
|
android:textColor="#fff" |
||||||
|
android:textSize="19sp" /> |
||||||
|
|
||||||
|
<FrameLayout |
||||||
|
android:id="@+id/pin_time_container" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="48dp" |
||||||
|
android:paddingLeft="4dp"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/pin_time" |
||||||
|
android:layout_width="wrap_content" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:gravity="center" |
||||||
|
android:lines="1" |
||||||
|
android:minWidth="36dp" |
||||||
|
android:textColor="#fff" |
||||||
|
android:textSize="16dp" /> |
||||||
|
|
||||||
|
</FrameLayout> |
||||||
|
|
||||||
|
<FrameLayout |
||||||
|
android:id="@+id/pin_count_container" |
||||||
|
android:layout_width="48dp" |
||||||
|
android:layout_height="48dp" |
||||||
|
android:background="@drawable/pin_icon_blue"> |
||||||
|
|
||||||
|
<TextView |
||||||
|
android:id="@+id/pin_count" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" |
||||||
|
android:gravity="center" |
||||||
|
android:textColor="#fff" |
||||||
|
android:textSize="16dp" /> |
||||||
|
|
||||||
|
<ProgressBar |
||||||
|
android:id="@+id/pin_load" |
||||||
|
android:layout_width="match_parent" |
||||||
|
android:layout_height="match_parent" /> |
||||||
|
|
||||||
|
</FrameLayout> |
||||||
|
|
||||||
|
</org.floens.chan.ui.cell.PinCell> |
Loading…
Reference in new issue