forked from captain-miao/RecyclerViewUtils
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
126 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ | |
/.idea/workspace.xml | ||
.DS_Store | ||
/build | ||
local.properties | ||
.idea | ||
*/*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package com.github.learn; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.View; | ||
import android.widget.AdapterView; | ||
import android.widget.ArrayAdapter; | ||
import android.widget.ListView; | ||
|
||
import com.github.learn.databinding.DataBindingRecyclerActivity; | ||
import com.github.learn.expandable.ExpandableRecyclerActivity; | ||
import com.github.learn.index.IndexRecyclerActivity; | ||
import com.github.learn.refreshandload.HeaderRecyclerActivity; | ||
import com.github.learn.refreshandload.R; | ||
import com.github.learn.refreshandload.RefreshRecyclerActivity; | ||
import com.github.learn.refreshandload.gridview.GridViewActivity; | ||
import com.github.learn.refreshandload.gridview.RefreshGridViewActivity; | ||
import com.github.learn.staggeredgrid.StaggeredGridRecyclerActivity; | ||
import com.github.learn.stickyheaders.StickyHeadersActivity; | ||
|
||
import java.util.ArrayList; | ||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Created by hesk on 2016/9/15. | ||
*/ | ||
|
||
public class CIndex extends AppCompatActivity implements AdapterView.OnItemClickListener { | ||
|
||
private ListView mList; | ||
private LinkedHashMap<String, Class> data = new LinkedHashMap<>(); | ||
private ArrayList<Class> o = new ArrayList<>(); | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.main_list); | ||
mList = (ListView) findViewById(android.R.id.list); | ||
ArrayList<String> items = new ArrayList<>(); | ||
initList(); | ||
for (Map.Entry<String, Class> entry : data.entrySet()) { | ||
String key = entry.getKey(); | ||
items.add(key); | ||
o.add(entry.getValue()); | ||
} | ||
mList.setAdapter(new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, items)); | ||
mList.setOnItemClickListener(this); | ||
} | ||
|
||
public void initList() { | ||
data.put(getString(R.string.label_action_label_header_view), HeaderRecyclerActivity.class); | ||
data.put(getString(R.string.label_action_label_recycler_view), RefreshRecyclerActivity.class); | ||
data.put(getString(R.string.label_action_label_grid_view), GridViewActivity.class); | ||
data.put(getString(R.string.label_action_label_refresh_grid_view), RefreshGridViewActivity.class); | ||
data.put(getString(R.string.label_action_label_sticky_header_view), StickyHeadersActivity.class); | ||
data.put(getString(R.string.label_action_label_expandable_view), ExpandableRecyclerActivity.class); | ||
data.put(getString(R.string.label_action_label_sticky_expandable_view), StickyHeadersActivity.class); | ||
data.put(getString(R.string.label_action_label_index_view), IndexRecyclerActivity.class); | ||
data.put(getString(R.string.label_action_label_staggered_grid_view), StaggeredGridRecyclerActivity.class); | ||
data.put(getString(R.string.label_action_label_data_binding), DataBindingRecyclerActivity.class); | ||
// data.put("Demo Index Recycler Activity", IndexRecyclerActivity.class); | ||
// data.put("Viewpager Activity", ViewPagerActivity.class); | ||
// data.put("Header Grid Footer", ViewPagerActivity.class); | ||
} | ||
|
||
@Override | ||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { | ||
Intent intent = new Intent(this, o.get(position)); | ||
if (position == 6) { | ||
intent.putExtra("StickyAndExpandable", true); | ||
} | ||
|
||
/* | ||
if (position == 2) { | ||
intent.putExtra(GridViewActivity.span_count, 2); | ||
} | ||
if (position == 3) { | ||
intent.putExtra(GridViewActivity.span_count, 3); | ||
} | ||
*/ | ||
startActivity(intent); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical"> | ||
|
||
<ListView | ||
android:id="@android:id/list" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
</RelativeLayout> |