Skip to content

Commit

Permalink
Merge pull request #323 from HKMOpen/v23.1.1-upgrade
Browse files Browse the repository at this point in the history
V23.1.1 upgrade
  • Loading branch information
jjhesk committed Feb 24, 2016
2 parents ec096fe + 6fb9903 commit 3ad736c
Show file tree
Hide file tree
Showing 28 changed files with 1,068 additions and 736 deletions.
4 changes: 2 additions & 2 deletions UltimateRecyclerView/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
android:name=".loadmoredemo.PullToRefreshActivity"
android:label="CustomSwipeToRefreshRefreshActivity" />
<activity
android:name=".loadmoredemo.DNoHeaderLoadMoreActivity"
android:name=".loadmoredemo.DebugNoHeaderLoadMoreActivity"
android:label="NO Header Load More" />
<activity
android:name=".admobdemo.TestAdMob"
android:name=".admobdemo.TestAdMobClassicActivity"
android:label="TestAdMob" />
<activity
android:name=".expandemo.TestExpandableRV"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.marshalchen.ultimaterecyclerview.demo.admobdemo;

import android.graphics.Color;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.marshalchen.ultimaterecyclerview.demo.R;
import com.marshalchen.ultimaterecyclerview.quickAdapter.AdItemHolder;

/**
* Created by hesk on 24/2/16.
*/
public class SingleItemCommonLayout extends AdItemHolder {
public TextView textViewSample;
public ImageView imageViewSample;
public ProgressBar progressBarSample;
public RelativeLayout item_view;
public SingleItemCommonLayout(View itemView, int type) {
super(itemView, type);
}

@Override
protected void bindNormal(View view) {
textViewSample = (TextView) itemView.findViewById(R.id.str_textview_holder);
imageViewSample = (ImageView) itemView.findViewById(R.id.str_image_holder);
progressBarSample = (ProgressBar) itemView.findViewById(R.id.str_progress_holder);
item_view = (RelativeLayout) itemView.findViewById(R.id.str_item_view);

}

@Override
protected void bindAd(View view) {

}


@Override
public void onItemSelected() {
itemView.setBackgroundColor(Color.LTGRAY);
}

@Override
public void onItemClear() {
itemView.setBackgroundColor(0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.marshalchen.ultimaterecyclerview.demo.admobdemo;

import android.support.annotation.NonNull;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.marshalchen.ultimaterecyclerview.URLogs;
import com.marshalchen.ultimaterecyclerview.demo.R;
import com.marshalchen.ultimaterecyclerview.quickAdapter.AdItemHolder;

/**
* Created by hesk on 24/2/16.
*/
public class SingleItemHolder extends AdItemHolder implements
View.OnClickListener, View.OnLongClickListener {
public TextView textViewSample, num;
public ImageView imageViewSample;
public ProgressBar progressBarSample;

public SingleItemHolder(View itemView, int type) {
super(itemView, type);
}

@Override
protected void bindNormal(View view) {
textViewSample = (TextView) itemView.findViewById(R.id.textview);
num = (TextView) itemView.findViewById(R.id.numb_coun);
imageViewSample = (ImageView) itemView.findViewById(R.id.imageview);
progressBarSample = (ProgressBar) itemView.findViewById(R.id.progressbar);
progressBarSample.setVisibility(View.GONE);
}

@Override
protected void bindAd(View view) {

}

@Override
public void onClick(@NonNull View v) {
URLogs.d(textViewSample.getText() + " clicked!");
}

@Override
public boolean onLongClick(@NonNull View v) {
URLogs.d(textViewSample.getText() + " long clicked!");
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.ActionMode;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
Expand All @@ -18,7 +16,7 @@
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
import com.marshalchen.ultimaterecyclerview.AdmobAdapter;
import com.marshalchen.ultimaterecyclerview.quickAdapter.AdmobAdapter;
import com.marshalchen.ultimaterecyclerview.UltimateRecyclerView;
import com.marshalchen.ultimaterecyclerview.demo.R;
import com.marshalchen.ultimaterecyclerview.demo.modules.FastBinding;
Expand All @@ -29,10 +27,10 @@
/**
* Created by hesk on 20/5/15.
*/
public class TestAdMob extends AppCompatActivity {
public class TestAdMobClassicActivity extends AppCompatActivity {

private UltimateRecyclerView ultimateRecyclerView;
private admobdfpadapter simpleRecyclerViewAdapter = null;
private ZeroStickyAdvertistmentAdapter simpleRecyclerViewAdapter = null;
private LinearLayoutManager linearLayoutManager;
private int moreNum = 2;
private ActionMode actionMode;
Expand Down Expand Up @@ -79,18 +77,16 @@ public void run() {
}

private void enableLoadMore() {

ultimateRecyclerView.setLoadMoreView(R.layout.custom_bottom_progressbar);
ultimateRecyclerView.setOnLoadMoreListener(new UltimateRecyclerView.OnLoadMoreListener() {
@Override
public void loadMore(int itemsCount, final int maxLastVisiblePosition) {
public void loadMore(final int itemsCount, final int maxLastVisiblePosition) {
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
ArrayList<String> li = new ArrayList<String>();
li.add("i " + moreNum++);
li.add("i " + moreNum++);
li.add("i " + moreNum++);
li.add("No. ====" + itemsCount + "=======");
SampleDataboxset.genItems(10, li);
simpleRecyclerViewAdapter.insert(li);
}
}, 1000);
Expand All @@ -99,7 +95,7 @@ public void run() {
}

private void enableEmptyView() {
ultimateRecyclerView.setEmptyView(R.layout.empty_view, UltimateRecyclerView.EMPTY_KEEP_HEADER_AND_LOARMORE);
ultimateRecyclerView.setEmptyView(R.layout.empty_view, UltimateRecyclerView.EMPTY_KEEP_HEADER_AND_LOARMORE, UltimateRecyclerView.STARTWITH_ONLINE_ITEMS);
}

private void enableClick() {
Expand Down Expand Up @@ -139,12 +135,7 @@ protected void onCreate(Bundle savedInstanceState) {
/**
* working example 2 with multiple called Adviews
*/
simpleRecyclerViewAdapter = new admobdfpadapter(createadmob(), 11, SampleDataboxset.newListFromGen(), new AdmobAdapter.AdviewListener() {
@Override
public AdView onGenerateAdview() {
return createadmob();
}
});
simpleRecyclerViewAdapter = new ZeroStickyAdvertistmentAdapter(createadmob(), SampleDataboxset.newListFromGen());
linearLayoutManager = new LinearLayoutManager(this);
ultimateRecyclerView.setLayoutManager(linearLayoutManager);
ultimateRecyclerView.setAdapter(simpleRecyclerViewAdapter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.DisplayMetrics;
import android.view.View;
Expand All @@ -21,14 +22,13 @@
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
import com.marshalchen.ultimaterecyclerview.AdmobAdapter;
import com.marshalchen.ultimaterecyclerview.quickAdapter.AdmobAdapter;
import com.marshalchen.ultimaterecyclerview.URLogs;
import com.marshalchen.ultimaterecyclerview.UltimateRecyclerView;
import com.marshalchen.ultimaterecyclerview.UltimateRecyclerviewViewHolder;
import com.marshalchen.ultimaterecyclerview.demo.R;
import com.marshalchen.ultimaterecyclerview.demo.modules.SampleDataboxset;
import com.marshalchen.ultimaterecyclerview.quickAdapter.easyRegularAdapter;
import com.marshalchen.ultimaterecyclerview.quickAdapter.simpleAdmobAdapter;
import com.marshalchen.ultimaterecyclerview.quickAdapter.BiAdAdapterSwitcher;
import com.marshalchen.ultimaterecyclerview.ui.AdGoogleDisplaySupport;

Expand All @@ -45,16 +45,12 @@ public class TestAdvancedAdmobActivity extends AppCompatActivity {
private Toolbar toolbar;
private BiAdAdapterSwitcher bi_sw;

public static class adap extends simpleAdmobAdapter<String, VMoler, RelativeLayout> {
public static class adap extends AdmobAdapter<RelativeLayout, String, SingleItemHolder> {

public adap(RelativeLayout v, boolean insertOnce, int setInterval, List<String> L, AdviewListener listener) {
super(v, insertOnce, setInterval, L, listener);
public adap(RelativeLayout v, List<String> L) {
super(v, false, 13, L, null);
}

@Override
protected void withBindHolder(VMoler var1, String var2, int var3) {
bindthisInhere(var1, var2, var3);
}

@Override
protected int getNormalLayoutResId() {
Expand All @@ -63,13 +59,25 @@ protected int getNormalLayoutResId() {


@Override
protected VMoler newViewHolder(View mview) {
return new VMoler(mview);
protected SingleItemHolder newViewHolder(View mview) {
return new SingleItemHolder(mview, VIEW_TYPES.NORMAL);
}

/**
* binding normal view holder
*
* @param holder holder class
* @param data data
* @param position position
*/
@Override
protected void withBindHolder(SingleItemHolder holder, String data, int position) {
bindthisInhere(holder, data, position);
}

}

public static class regular extends easyRegularAdapter<String, VMoler> {
public static class regular extends easyRegularAdapter<String, SingleItemHolder> {

public regular(List list) {
super(list);
Expand All @@ -81,17 +89,17 @@ protected int getNormalLayoutResId() {
}

@Override
protected VMoler newViewHolder(View view) {
return new VMoler(view);
protected SingleItemHolder newViewHolder(View view) {
return new SingleItemHolder(view, VIEW_TYPES.NORMAL);
}

@Override
protected void withBindHolder(VMoler holderm, String data, int position) {
protected void withBindHolder(SingleItemHolder holderm, String data, int position) {
bindthisInhere(holderm, data, position);
}
}

private static void bindthisInhere(VMoler d, String data, int pos) {
private static void bindthisInhere(SingleItemHolder d, String data, int pos) {
d.textViewSample.setText(data);
d.num.setText("@:" + pos);
}
Expand Down Expand Up @@ -154,45 +162,11 @@ public void onAdLoaded() {
}


public static class VMoler extends UltimateRecyclerviewViewHolder implements
View.OnClickListener, View.OnLongClickListener {
public TextView textViewSample, num;
public ImageView imageViewSample;
public ProgressBar progressBarSample;

public VMoler(View itemView) {
super(itemView);
textViewSample = (TextView) itemView.findViewById(R.id.textview);
num = (TextView) itemView.findViewById(R.id.numb_coun);
imageViewSample = (ImageView) itemView.findViewById(R.id.imageview);
progressBarSample = (ProgressBar) itemView.findViewById(R.id.progressbar);
progressBarSample.setVisibility(View.GONE);
}

@Override
public void onClick(@NonNull View v) {
URLogs.d(textViewSample.getText() + " clicked!");
}

@Override
public boolean onLongClick(@NonNull View v) {
URLogs.d(textViewSample.getText() + " long clicked!");
return true;
}
}


/**
* example 1 implementation of the switch view
*/
private BiAdAdapterSwitcher imple_switch_view(final UltimateRecyclerView rv) {
final adap adp1 = new adap(createadmob(), false, 10, new ArrayList<String>(),
new AdmobAdapter.AdviewListener() {
@Override
public RelativeLayout onGenerateAdview() {
return createadmob();
}
});
final adap adp1 = new adap(createadmob(), new ArrayList<String>());
final regular adp2 = new regular(new ArrayList<String>());
final BiAdAdapterSwitcher switchable = new BiAdAdapterSwitcher(rv, adp2, adp1);
return switchable;
Expand Down
Loading

0 comments on commit 3ad736c

Please sign in to comment.