update protype
This commit is contained in:
parent
e1097dcd30
commit
dd76d76870
|
@ -1,7 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.deiniu.zhuike">
|
package="com.deiniu.zhuike">
|
||||||
|
|
||||||
<!-- To access Google+ APIs: -->
|
<!-- To access Google+ APIs: -->
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
@ -15,6 +14,15 @@
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/ToolBarTheme"
|
android:theme="@style/ToolBarTheme"
|
||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true">
|
||||||
|
<activity
|
||||||
|
android:name=".Activity_shudan_my"
|
||||||
|
android:label="@string/title_activity_shudan_my"
|
||||||
|
android:theme="@style/ToolBarTheme.NoActionBar"></activity>
|
||||||
|
<activity
|
||||||
|
android:name=".Activity_createShudan"
|
||||||
|
android:label="@string/title_activity_create_shudan"
|
||||||
|
android:parentActivityName=".Main2Activity"
|
||||||
|
android:theme="@style/ToolBarTheme.NoActionBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".Activity_shudan"
|
android:name=".Activity_shudan"
|
||||||
android:label="@string/title_activity_shudan"
|
android:label="@string/title_activity_shudan"
|
||||||
|
|
|
@ -0,0 +1,215 @@
|
||||||
|
package com.deiniu.zhuike;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.deiniu.zhuike.utils.OnItemClickListener;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
public class Activity_base extends AppCompatActivity {
|
||||||
|
List<String> mDatas;
|
||||||
|
BookListAdapter mAdapter;
|
||||||
|
@BindView(R.id.recycleViewBookList)
|
||||||
|
RecyclerView rvshudan;
|
||||||
|
void showBook(String bookName) { //show paihangbang activity
|
||||||
|
Intent intent = new Intent(this, BookActivity.class);
|
||||||
|
intent.putExtra("BOOKNAME",bookName);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
void initData() {
|
||||||
|
|
||||||
|
mDatas = new ArrayList<String>();
|
||||||
|
for (int i = 'A'; i <'K'; i++)
|
||||||
|
{
|
||||||
|
mDatas.add("小说" + (char) i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void initialAdapter(){
|
||||||
|
mAdapter = new BookListAdapter(this ,mDatas,R.layout.recycle_list_item_horizon,new OnItemClickListener()
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClick(View view, int position)
|
||||||
|
{
|
||||||
|
showBook("射雕" +position);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemLongClick(View view, int position)
|
||||||
|
{
|
||||||
|
// initDialog(position);
|
||||||
|
// mAdapter.removeData(position);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onLinearOutClick(View view, int bookId) {
|
||||||
|
// Toast.makeText(activity, "book "+ bookId + " clicked", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
// showBookDetail( mData.get(bookId));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
void initialBookList() {
|
||||||
|
initData();
|
||||||
|
initialAdapter();
|
||||||
|
rvshudan.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
rvshudan.setAdapter(mAdapter);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class MyViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
@BindView(R.id.title)
|
||||||
|
TextView tvTitle;
|
||||||
|
@BindView(R.id.author)
|
||||||
|
TextView tvAuthor;
|
||||||
|
@BindView(R.id.category)
|
||||||
|
TextView tvCate;
|
||||||
|
@BindView(R.id.desc)
|
||||||
|
TextView tvDesc;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@BindView(R.id.btnItemDelete)
|
||||||
|
Button btnDelete;
|
||||||
|
|
||||||
|
public MyViewHolder(View view) {
|
||||||
|
super(view);
|
||||||
|
ButterKnife.bind(this, view);
|
||||||
|
//tvTitle = (TextView) view.findViewById(R.id.title);
|
||||||
|
// tvAuthor = (TextView) view.findViewById(R.id.author);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class BookListAdapter extends RecyclerView.Adapter<MyViewHolder> {
|
||||||
|
private final int EMPTY_VIEW = 1;
|
||||||
|
private final int PROGRESS_VIEW = 2;
|
||||||
|
private final int IMAGE_VIEW = 3;
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
private List<String> mDatas = new ArrayList<String>();
|
||||||
|
private OnItemClickListener mOnItemClickListener;
|
||||||
|
private int listItemID;
|
||||||
|
|
||||||
|
public BookListAdapter(Context context, List<String> mDatas, int listItemID, OnItemClickListener clicklistener) {
|
||||||
|
this.context = context;
|
||||||
|
this.mDatas = mDatas;
|
||||||
|
this.mOnItemClickListener = clicklistener;
|
||||||
|
this.listItemID = listItemID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BookListAdapter(Context context, OnItemClickListener clickLitener) {
|
||||||
|
this.context = context;
|
||||||
|
this.mOnItemClickListener = clickLitener;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
if (mDatas.size() == 0) {
|
||||||
|
return EMPTY_VIEW;
|
||||||
|
} else if (mDatas.get(position) == null) {
|
||||||
|
return PROGRESS_VIEW;
|
||||||
|
} else {
|
||||||
|
return super.getItemViewType(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
MyViewHolder holder = new MyViewHolder(LayoutInflater.from(
|
||||||
|
context).inflate(listItemID, parent,
|
||||||
|
false));
|
||||||
|
return holder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setParameters(List<String> mDatas, int listItemID) {
|
||||||
|
this.mDatas = mDatas;
|
||||||
|
this.listItemID = listItemID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnItemClickLitener(OnItemClickListener mOnItemClickListener) {
|
||||||
|
this.mOnItemClickListener = mOnItemClickListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(MyViewHolder holder, int position) {
|
||||||
|
|
||||||
|
holder.tvTitle.setText(mDatas.get(position));
|
||||||
|
holder.tvAuthor.setText("金庸" + position);
|
||||||
|
holder.tvCate.setText("cate" + position);
|
||||||
|
holder.tvDesc.setText("this is desc " + position);
|
||||||
|
|
||||||
|
|
||||||
|
// 如果设置了回调,则设置点击事件
|
||||||
|
if (mOnItemClickListener != null) {
|
||||||
|
holder.itemView.setOnClickListener(new View.OnClickListener() //show more cate paihang
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int pos = holder.getLayoutPosition();
|
||||||
|
mOnItemClickListener.onItemClick(holder.itemView, pos);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
int pos = holder.getLayoutPosition();
|
||||||
|
mOnItemClickListener.onItemLongClick(holder.itemView, pos);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return mDatas.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addData(int position) {
|
||||||
|
mDatas.add(position, "Insert One");
|
||||||
|
notifyItemInserted(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeData(int position) {
|
||||||
|
mDatas.remove(position);
|
||||||
|
notifyItemRemoved(position);
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,232 @@
|
||||||
|
package com.deiniu.zhuike;
|
||||||
|
|
||||||
|
import android.app.SearchManager;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
|
import android.support.design.widget.Snackbar;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.support.v7.widget.SearchView;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.deiniu.zhuike.utils.OnItemClickListener;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class Activity_createShudan extends Activity_base {
|
||||||
|
|
||||||
|
@BindView(R.id.toolbar)
|
||||||
|
Toolbar toolbar ;
|
||||||
|
BookListAdapter mAdapter;
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_create_shudan);
|
||||||
|
ButterKnife.bind(this);
|
||||||
|
setupToolbar();
|
||||||
|
setTitle("创建书单");
|
||||||
|
|
||||||
|
initialBookList();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
void initialBookList() {
|
||||||
|
initData();
|
||||||
|
initialAdapter();
|
||||||
|
rvshudan.setLayoutManager(new LinearLayoutManager(this));
|
||||||
|
rvshudan.setAdapter(mAdapter);
|
||||||
|
}
|
||||||
|
|
||||||
|
void initialAdapter(){
|
||||||
|
mAdapter = new BookListAdapter(this ,mDatas,R.layout.recycle_list_item_horizon_with_delete,new OnItemClickListener()
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClick(View view, int position)
|
||||||
|
{
|
||||||
|
setCover();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemLongClick(View view, int position)
|
||||||
|
{
|
||||||
|
// initDialog(position);
|
||||||
|
// mAdapter.removeData(position);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onLinearOutClick(View view, int bookId) {
|
||||||
|
// Toast.makeText(activity, "book "+ bookId + " clicked", Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
// showBookDetail( mData.get(bookId));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setCover() {
|
||||||
|
Toast.makeText(this,"封面设定",Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void setupToolbar(){
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
toolbar.inflateMenu(R.menu.menu_create_shudan);//设置右上角的填充菜单
|
||||||
|
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
int menuItemId = item.getItemId();
|
||||||
|
if (menuItemId == R.id.mnSave) {
|
||||||
|
|
||||||
|
saveShudan();
|
||||||
|
|
||||||
|
|
||||||
|
}else if(menuItemId == R.id.mnPublish) {
|
||||||
|
publishShudan();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveShudan() {
|
||||||
|
}
|
||||||
|
private void publishShudan() {
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
|
getMenuInflater().inflate(R.menu.menu_create_shudan, menu);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
class BookListAdapter extends RecyclerView.Adapter<MyViewHolder> {
|
||||||
|
private final int EMPTY_VIEW = 1;
|
||||||
|
private final int PROGRESS_VIEW = 2;
|
||||||
|
private final int IMAGE_VIEW = 3;
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
private List<String> mDatas = new ArrayList<String>();
|
||||||
|
private OnItemClickListener mOnItemClickListener;
|
||||||
|
private int listItemID;
|
||||||
|
|
||||||
|
public BookListAdapter(Context context, List<String> mDatas, int listItemID, OnItemClickListener clicklistener) {
|
||||||
|
this.context = context;
|
||||||
|
this.mDatas = mDatas;
|
||||||
|
this.mOnItemClickListener = clicklistener;
|
||||||
|
this.listItemID = listItemID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BookListAdapter(Context context, OnItemClickListener clickLitener) {
|
||||||
|
this.context = context;
|
||||||
|
this.mOnItemClickListener = clickLitener;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
if (mDatas.size() == 0) {
|
||||||
|
return EMPTY_VIEW;
|
||||||
|
} else if (mDatas.get(position) == null) {
|
||||||
|
return PROGRESS_VIEW;
|
||||||
|
} else {
|
||||||
|
return super.getItemViewType(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
MyViewHolder holder = new MyViewHolder(LayoutInflater.from(
|
||||||
|
context).inflate(listItemID, parent,
|
||||||
|
false));
|
||||||
|
return holder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void setParameters(List<String> mDatas, int listItemID) {
|
||||||
|
this.mDatas = mDatas;
|
||||||
|
this.listItemID = listItemID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnItemClickLitener(OnItemClickListener mOnItemClickListener) {
|
||||||
|
this.mOnItemClickListener = mOnItemClickListener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(MyViewHolder holder, int position) {
|
||||||
|
|
||||||
|
holder.tvTitle.setText(mDatas.get(position));
|
||||||
|
holder.tvAuthor.setText("金庸" + position);
|
||||||
|
holder.tvCate.setText("cate" + position);
|
||||||
|
holder.tvDesc.setText("this is desc " + position);
|
||||||
|
|
||||||
|
|
||||||
|
// 如果设置了回调,则设置点击事件
|
||||||
|
if (mOnItemClickListener != null) {
|
||||||
|
holder.itemView.setOnClickListener(new View.OnClickListener() //show more cate paihang
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int pos = holder.getLayoutPosition();
|
||||||
|
mOnItemClickListener.onItemClick(holder.itemView, pos);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v) {
|
||||||
|
int pos = holder.getLayoutPosition();
|
||||||
|
mOnItemClickListener.onItemLongClick(holder.itemView, pos);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
holder.btnDelete.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int pos = holder.getLayoutPosition();
|
||||||
|
removeData(pos);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount() {
|
||||||
|
return mDatas.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addData(int position) {
|
||||||
|
mDatas.add(position, "Insert One");
|
||||||
|
notifyItemInserted(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeData(int position) {
|
||||||
|
mDatas.remove(position);
|
||||||
|
notifyItemRemoved(position);
|
||||||
|
notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
public class Activity_shudan extends AppCompatActivity {
|
public class Activity_shudan extends Activity_base {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -37,30 +37,7 @@ public class Activity_shudan extends AppCompatActivity {
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
String title = getIntent().getStringExtra("CATENAME");
|
String title = getIntent().getStringExtra("CATENAME");
|
||||||
this.setTitle(title);
|
this.setTitle(title);
|
||||||
initData();
|
|
||||||
mAdapter = new BookListAdapter(this ,mDatas,R.layout.recycle_list_item_horizon,new OnItemClickListener()
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemClick(View view, int position)
|
|
||||||
{
|
|
||||||
showBook("射雕" +position);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemLongClick(View view, int position)
|
|
||||||
{
|
|
||||||
// initDialog(position);
|
|
||||||
// mAdapter.removeData(position);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onLinearOutClick(View view, int bookId) {
|
|
||||||
// Toast.makeText(activity, "book "+ bookId + " clicked", Toast.LENGTH_SHORT).show();
|
|
||||||
|
|
||||||
// showBookDetail( mData.get(bookId));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
initialBookList();
|
initialBookList();
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,149 +45,12 @@ public class Activity_shudan extends AppCompatActivity {
|
||||||
|
|
||||||
//------------------------列表绑定------------
|
//------------------------列表绑定------------
|
||||||
|
|
||||||
private BookListAdapter mAdapter;
|
|
||||||
|
|
||||||
@BindView(R.id.recycleViewBookList)
|
|
||||||
RecyclerView rvshudan;
|
|
||||||
List<String> mDatas;
|
|
||||||
private void initData() {
|
|
||||||
|
|
||||||
mDatas = new ArrayList<String>();
|
|
||||||
for (int i = 'A'; i <'K'; i++)
|
|
||||||
{
|
|
||||||
mDatas.add("小说" + (char) i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void initialBookList() {
|
|
||||||
rvshudan.setLayoutManager(new LinearLayoutManager(this));
|
|
||||||
rvshudan.setAdapter(mAdapter);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
class MyViewHolder extends RecyclerView.ViewHolder {
|
|
||||||
@BindView(R.id.title)
|
|
||||||
TextView tvTitle;
|
|
||||||
@BindView(R.id.author)
|
|
||||||
TextView tvAuthor;
|
|
||||||
@BindView(R.id.category)
|
|
||||||
TextView tvCate;
|
|
||||||
@BindView(R.id.desc)
|
|
||||||
TextView tvDesc;
|
|
||||||
|
|
||||||
|
|
||||||
public MyViewHolder(View view) {
|
|
||||||
super(view);
|
|
||||||
ButterKnife.bind(this, view);
|
|
||||||
//tvTitle = (TextView) view.findViewById(R.id.title);
|
|
||||||
// tvAuthor = (TextView) view.findViewById(R.id.author);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void showBook(String bookName) { //show paihangbang activity
|
|
||||||
Intent intent = new Intent(this, BookActivity.class);
|
|
||||||
intent.putExtra("BOOKNAME",bookName);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
class BookListAdapter extends RecyclerView.Adapter<MyViewHolder> {
|
|
||||||
private final int EMPTY_VIEW = 1;
|
|
||||||
private final int PROGRESS_VIEW = 2;
|
|
||||||
private final int IMAGE_VIEW = 3;
|
|
||||||
|
|
||||||
private Context context;
|
|
||||||
private List<String> mDatas = new ArrayList<String>();
|
|
||||||
private OnItemClickListener mOnItemClickListener;
|
|
||||||
private int listItemID;
|
|
||||||
|
|
||||||
public BookListAdapter(Context context, List<String> mDatas, int listItemID, OnItemClickListener clicklistener) {
|
|
||||||
this.context = context;
|
|
||||||
this.mDatas = mDatas;
|
|
||||||
this.mOnItemClickListener = clicklistener;
|
|
||||||
this.listItemID = listItemID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BookListAdapter(Context context, OnItemClickListener clickLitener) {
|
|
||||||
this.context = context;
|
|
||||||
this.mOnItemClickListener = clickLitener;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemViewType(int position) {
|
|
||||||
if (mDatas.size() == 0) {
|
|
||||||
return EMPTY_VIEW;
|
|
||||||
} else if (mDatas.get(position) == null) {
|
|
||||||
return PROGRESS_VIEW;
|
|
||||||
} else {
|
|
||||||
return super.getItemViewType(position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
||||||
MyViewHolder holder = new MyViewHolder(LayoutInflater.from(
|
|
||||||
context).inflate(listItemID, parent,
|
|
||||||
false));
|
|
||||||
return holder;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setParameters(List<String> mDatas, int listItemID) {
|
|
||||||
this.mDatas = mDatas;
|
|
||||||
this.listItemID = listItemID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOnItemClickLitener(OnItemClickListener mOnItemClickListener) {
|
|
||||||
this.mOnItemClickListener = mOnItemClickListener;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(MyViewHolder holder, int position) {
|
|
||||||
|
|
||||||
holder.tvTitle.setText(mDatas.get(position));
|
|
||||||
holder.tvAuthor.setText("金庸" + position);
|
|
||||||
holder.tvCate.setText("cate" + position);
|
|
||||||
holder.tvDesc.setText("this is desc " + position);
|
|
||||||
|
|
||||||
|
|
||||||
// 如果设置了回调,则设置点击事件
|
|
||||||
if (mOnItemClickListener != null) {
|
|
||||||
holder.itemView.setOnClickListener(new View.OnClickListener() //show more cate paihang
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
int pos = holder.getLayoutPosition();
|
|
||||||
mOnItemClickListener.onItemClick(holder.itemView, pos);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
holder.itemView.setOnLongClickListener(new View.OnLongClickListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onLongClick(View v) {
|
|
||||||
int pos = holder.getLayoutPosition();
|
|
||||||
mOnItemClickListener.onItemLongClick(holder.itemView, pos);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return mDatas.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addData(int position) {
|
|
||||||
mDatas.add(position, "Insert One");
|
|
||||||
notifyItemInserted(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeData(int position) {
|
|
||||||
mDatas.remove(position);
|
|
||||||
notifyItemRemoved(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.deiniu.zhuike;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.design.widget.FloatingActionButton;
|
||||||
|
import android.support.design.widget.Snackbar;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
public class Activity_shudan_my extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_shudan_my);
|
||||||
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
FloatingActionButton fab = findViewById(R.id.fab);
|
||||||
|
fab.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
||||||
|
.setAction("Action", null).show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.support.design.widget.TabLayout;
|
import android.support.design.widget.TabLayout;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
|
@ -17,6 +18,7 @@ import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
@ -159,9 +161,9 @@ public abstract class BasicFragment extends Fragment {
|
||||||
public void onBindViewHolder(MyViewHolder holder, int position)
|
public void onBindViewHolder(MyViewHolder holder, int position)
|
||||||
{
|
{
|
||||||
holder.tvTitle.setText(mDatas.get(position));
|
holder.tvTitle.setText(mDatas.get(position));
|
||||||
holder.tvAuthor.setText("金庸" +position);
|
if(holder.tvAuthor!=null) holder.tvAuthor.setText("金庸" +position);
|
||||||
holder.tvCate.setText("cate"+position);
|
if(holder.tvCate!=null) holder.tvCate.setText("cate"+position);
|
||||||
holder.tvDesc.setText("this is desc " +position);
|
if(holder.tvDesc!=null) holder.tvDesc.setText("this is desc " +position);
|
||||||
// 如果设置了回调,则设置点击事件
|
// 如果设置了回调,则设置点击事件
|
||||||
if (mOnItemClickListener != null)
|
if (mOnItemClickListener != null)
|
||||||
{
|
{
|
||||||
|
@ -204,12 +206,17 @@ public abstract class BasicFragment extends Fragment {
|
||||||
}
|
}
|
||||||
class MyViewHolder extends RecyclerView.ViewHolder
|
class MyViewHolder extends RecyclerView.ViewHolder
|
||||||
{
|
{
|
||||||
|
@BindView(R.id.imageView)
|
||||||
|
ImageView imageView;
|
||||||
@BindView(R.id.title)
|
@BindView(R.id.title)
|
||||||
TextView tvTitle;
|
TextView tvTitle;
|
||||||
|
@Nullable
|
||||||
@BindView(R.id.author)
|
@BindView(R.id.author)
|
||||||
TextView tvAuthor;
|
TextView tvAuthor;
|
||||||
|
@Nullable
|
||||||
@BindView(R.id.category)
|
@BindView(R.id.category)
|
||||||
TextView tvCate;
|
TextView tvCate;
|
||||||
|
@Nullable
|
||||||
@BindView(R.id.desc)
|
@BindView(R.id.desc)
|
||||||
TextView tvDesc;
|
TextView tvDesc;
|
||||||
public MyViewHolder(View view)
|
public MyViewHolder(View view)
|
||||||
|
|
|
@ -8,6 +8,7 @@ import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
@ -25,6 +26,8 @@ public class BookActivity extends AppCompatActivity {
|
||||||
// private BookListAdapter mAdapter;
|
// private BookListAdapter mAdapter;
|
||||||
private List<String> mData;;
|
private List<String> mData;;
|
||||||
|
|
||||||
|
@BindView(R.id.toolbar)
|
||||||
|
Toolbar toolbar;
|
||||||
@BindView(R.id.rvBooklist)
|
@BindView(R.id.rvBooklist)
|
||||||
RecyclerView rvBooklist;
|
RecyclerView rvBooklist;
|
||||||
// @BindView(R.id.blurLayout)
|
// @BindView(R.id.blurLayout)
|
||||||
|
@ -35,9 +38,8 @@ public class BookActivity extends AppCompatActivity {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_book);
|
setContentView(R.layout.activity_book);
|
||||||
ButterKnife.bind(this);
|
ButterKnife.bind(this);
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
setupToolbar();
|
||||||
setSupportActionBar(toolbar);
|
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
String title = getIntent().getStringExtra("BOOKNAME");
|
String title = getIntent().getStringExtra("BOOKNAME");
|
||||||
this.setTitle(title);
|
this.setTitle(title);
|
||||||
mData =initData(mData,'D');
|
mData =initData(mData,'D');
|
||||||
|
@ -73,6 +75,22 @@ public class BookActivity extends AppCompatActivity {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setupToolbar(){
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
toolbar.inflateMenu(R.menu.menu_book);//设置右上角的填充菜单
|
||||||
|
toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
int menuItemId = item.getItemId();
|
||||||
|
if (menuItemId == R.id.menuShelf) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
private void showBookDetail(String s) {
|
private void showBookDetail(String s) {
|
||||||
Intent intent = new Intent(this, BookActivity.class);
|
Intent intent = new Intent(this, BookActivity.class);
|
||||||
intent.putExtra("BOOKNAME",s);
|
intent.putExtra("BOOKNAME",s);
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.deiniu.zhuike;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.support.design.widget.BottomSheetDialog;
|
import android.support.design.widget.BottomSheetDialog;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.view.ViewPager;
|
import android.support.v4.view.ViewPager;
|
||||||
|
@ -13,6 +14,11 @@ import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
@ -24,6 +30,7 @@ import java.util.List;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.OnClick;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A fragment with a Google +1 button.
|
* A fragment with a Google +1 button.
|
||||||
|
@ -48,8 +55,13 @@ public class Fragment_Shelf extends BasicFragment {
|
||||||
// TODO: Rename and change types of parameters
|
// TODO: Rename and change types of parameters
|
||||||
private String mParam1;
|
private String mParam1;
|
||||||
private String mParam2;
|
private String mParam2;
|
||||||
|
private boolean[] flag ;//此处添加一个boolean类型的数组
|
||||||
|
private boolean isSelectAll =true;
|
||||||
|
|
||||||
|
@BindView(R.id.llShelfBottom)
|
||||||
|
LinearLayout llShelfBottom;
|
||||||
|
|
||||||
|
|
||||||
private OnFragmentInteractionListener mListener;
|
|
||||||
|
|
||||||
public Fragment_Shelf() {
|
public Fragment_Shelf() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
|
@ -135,18 +147,23 @@ public class Fragment_Shelf extends BasicFragment {
|
||||||
// mRecyclerView.setLayoutManager(new LinearLayoutManager(this.activity));
|
// mRecyclerView.setLayoutManager(new LinearLayoutManager(this.activity));
|
||||||
mRecyclerView.setLayoutManager(new GridLayoutManager(activity,3));
|
mRecyclerView.setLayoutManager(new GridLayoutManager(activity,3));
|
||||||
mRecyclerView.setAdapter(mAdapter );
|
mRecyclerView.setAdapter(mAdapter );
|
||||||
|
llShelfBottom.setVisibility(View.GONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void initData()
|
protected void initData()
|
||||||
{
|
{ flag = new boolean[100];
|
||||||
mDatas = new ArrayList<String>();
|
mDatas = new ArrayList<String>();
|
||||||
for (int i = 'A'; i < 'G'; i++)
|
for (int i = 'A'; i < 'G'; i++)
|
||||||
{
|
{
|
||||||
mDatas.add("射雕" + (char) i);
|
mDatas.add("射雕" + (char) i);
|
||||||
|
flag[i] =false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showShelfMoreSheet() {
|
public void showShelfMoreSheet() {
|
||||||
BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this.activity );
|
BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this.activity );
|
||||||
bottomSheetDialog.setContentView(R.layout.fragment_shelf_more_sheet);
|
bottomSheetDialog.setContentView(R.layout.fragment_shelf_more_sheet);
|
||||||
|
@ -154,6 +171,14 @@ public class Fragment_Shelf extends BasicFragment {
|
||||||
bottomSheetDialog.getDelegate().findViewById(android.support.design.R.id.design_bottom_sheet)
|
bottomSheetDialog.getDelegate().findViewById(android.support.design.R.id.design_bottom_sheet)
|
||||||
.setBackgroundColor(getResources().getColor(android.R.color.transparent));
|
.setBackgroundColor(getResources().getColor(android.R.color.transparent));
|
||||||
|
|
||||||
|
Button btnZhengli = bottomSheetDialog.findViewById(R.id.btnZhengli);
|
||||||
|
btnZhengli.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
bottomSheetDialog.dismiss();
|
||||||
|
initZhengliDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
bottomSheetDialog.show();
|
bottomSheetDialog.show();
|
||||||
|
@ -172,7 +197,90 @@ public class Fragment_Shelf extends BasicFragment {
|
||||||
bottomSheetDialog.show();
|
bottomSheetDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@BindView(R.id.btnDelete)
|
||||||
|
Button btnDelete;
|
||||||
|
@BindView(R.id.btnSelect)
|
||||||
|
Button btnSelectAll;
|
||||||
|
|
||||||
|
@OnClick({R.id.btnSelect,R.id.btnDelete})
|
||||||
|
void shelfZhengliSubmit(View view){
|
||||||
|
if(view.getId()== R.id.btnSelect) {
|
||||||
|
|
||||||
|
if(isSelectAll) {
|
||||||
|
btnSelectAll.setText("全不选");
|
||||||
|
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
btnSelectAll.setText("全选");
|
||||||
|
}
|
||||||
|
for (int i = 0; i < flag.length; i++) {
|
||||||
|
flag[i] = isSelectAll;
|
||||||
|
}
|
||||||
|
isSelectAll =!isSelectAll;
|
||||||
|
mChkAdapter.notifyDataSetChanged();
|
||||||
|
}else if(view.getId()== R.id.btnDelete){
|
||||||
|
for (int i = 0; i < mDatas.size(); i++) {
|
||||||
|
if(flag[i] ){
|
||||||
|
mDatas.remove(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mChkAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void initZhengliDialog( ) {
|
||||||
|
zhengliShelf();
|
||||||
|
llShelfBottom.setVisibility(View.VISIBLE);
|
||||||
|
Main2Activity main2Activity = (Main2Activity)activity;
|
||||||
|
main2Activity.switchShelfZhengli(false);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this.activity);
|
||||||
|
bottomSheetDialog.setContentView(R.layout.fragment_shelf_zhengli_sheet);
|
||||||
|
//给布局设置透明背景色
|
||||||
|
bottomSheetDialog.getDelegate().findViewById(android.support.design.R.id.design_bottom_sheet)
|
||||||
|
.setBackgroundColor(getResources().getColor(android.R.color.transparent));
|
||||||
|
Button btnSelectAll = bottomSheetDialog.findViewById(R.id.btnSelect);
|
||||||
|
btnSelectAll.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
|
||||||
|
isSelectAll =!isSelectAll;
|
||||||
|
if(isSelectAll) {
|
||||||
|
btnSelectAll.setText("全选");
|
||||||
|
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
btnSelectAll.setText("全不选");
|
||||||
|
}
|
||||||
|
for (int i = 0; i < flag.length; i++) {
|
||||||
|
flag[i] = isSelectAll;
|
||||||
|
}
|
||||||
|
mChkAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Button btnDel = bottomSheetDialog.findViewById(R.id.btnDelete);
|
||||||
|
btnDel.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
|
||||||
|
for (int i = 0; i < mDatas.size(); i++) {
|
||||||
|
if(flag[i] ){
|
||||||
|
mDatas.remove(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mChkAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
bottomSheetDialog.show();
|
||||||
|
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
|
@ -189,5 +297,173 @@ public class Fragment_Shelf extends BasicFragment {
|
||||||
TAG="com.deiniu.zhuike.Fragment_Shelf";
|
TAG="com.deiniu.zhuike.Fragment_Shelf";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CheckAdapter mChkAdapter;
|
||||||
|
void zhengliShelf(){
|
||||||
|
mChkAdapter = new CheckAdapter(activity,mDatas,R.layout.recycle_list_item,new OnItemClickListener()
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClick(View view, int position)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemLongClick(View view, int position)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLinearOutClick(View view, int bookId) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mRecyclerView.setLayoutManager(new GridLayoutManager(activity,3));
|
||||||
|
mRecyclerView.setAdapter(mChkAdapter );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------整理 adapter---------------
|
||||||
|
|
||||||
|
class CheckAdapter extends RecyclerView.Adapter<CheckAdapter.MyViewHolder> {
|
||||||
|
private final int EMPTY_VIEW = 1;
|
||||||
|
private final int PROGRESS_VIEW = 2;
|
||||||
|
private final int IMAGE_VIEW = 3;
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
private List<String> mDatas = new ArrayList<String>();
|
||||||
|
private OnItemClickListener mOnItemClickListener;
|
||||||
|
private int listItemID;
|
||||||
|
public CheckAdapter(Context context,List<String> mDatas,int listItemID,OnItemClickListener clickLitener) {
|
||||||
|
this.context = context;
|
||||||
|
this.mDatas = mDatas;
|
||||||
|
this.mOnItemClickListener = clickLitener;
|
||||||
|
this.listItemID = listItemID;
|
||||||
|
}
|
||||||
|
public CheckAdapter(Context context, OnItemClickListener clickLitener) {
|
||||||
|
this.context = context;
|
||||||
|
this.mOnItemClickListener = clickLitener;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
if(mDatas.size() == 0){
|
||||||
|
return EMPTY_VIEW;
|
||||||
|
} else if(mDatas.get(position) == null){
|
||||||
|
return PROGRESS_VIEW;
|
||||||
|
} else {
|
||||||
|
return super.getItemViewType(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
|
||||||
|
{
|
||||||
|
MyViewHolder holder = new MyViewHolder(LayoutInflater.from(
|
||||||
|
context).inflate(listItemID, parent,
|
||||||
|
false));
|
||||||
|
return holder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void setParameters(List<String> mDatas,int listItemID ) {
|
||||||
|
this.mDatas = mDatas;
|
||||||
|
this.listItemID = listItemID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnItemClickLitener(OnItemClickListener mOnItemClickLitener)
|
||||||
|
{
|
||||||
|
this.mOnItemClickListener = mOnItemClickLitener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(MyViewHolder holder, int position)
|
||||||
|
{
|
||||||
|
|
||||||
|
holder.tvTitle.setText(mDatas.get(position));
|
||||||
|
if(holder.tvAuthor!=null) holder.tvAuthor.setText("金庸" +position);
|
||||||
|
if(holder.tvCate!=null) holder.tvCate.setText("cate"+position);
|
||||||
|
if(holder.tvDesc!=null) holder.tvDesc.setText("this is desc " +position);
|
||||||
|
if(holder.checkBox!=null) holder.checkBox.setVisibility(View.VISIBLE);
|
||||||
|
// 如果设置了回调,则设置点击事件
|
||||||
|
if (mOnItemClickListener != null)
|
||||||
|
{
|
||||||
|
holder.itemView.setOnClickListener(new View.OnClickListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onClick(View v)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
holder.itemView.setOnLongClickListener(new View.OnLongClickListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
holder.checkBox.setOnCheckedChangeListener(null);//先设置一次CheckBox的选中监听器,传入参数null
|
||||||
|
holder.checkBox.setChecked(flag[position]);//用数组中的值设置CheckBox的选中状态
|
||||||
|
|
||||||
|
//再设置一次CheckBox的选中监听器,当CheckBox的选中状态发生改变时,把改变后的状态储存在数组中
|
||||||
|
holder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||||
|
flag[position] = b;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount()
|
||||||
|
{
|
||||||
|
return mDatas.size();
|
||||||
|
}
|
||||||
|
public void addData(int position) {
|
||||||
|
mDatas.add(position, "Insert One");
|
||||||
|
notifyItemInserted(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeData(int position) {
|
||||||
|
mDatas.remove(position);
|
||||||
|
notifyItemRemoved(position);
|
||||||
|
}
|
||||||
|
class MyViewHolder extends RecyclerView.ViewHolder
|
||||||
|
{
|
||||||
|
@BindView(R.id.id_check_box)
|
||||||
|
CheckBox checkBox;
|
||||||
|
@BindView(R.id.imageView)
|
||||||
|
ImageView imageView;
|
||||||
|
@BindView(R.id.title)
|
||||||
|
TextView tvTitle;
|
||||||
|
@Nullable
|
||||||
|
@BindView(R.id.author)
|
||||||
|
TextView tvAuthor;
|
||||||
|
@Nullable
|
||||||
|
@BindView(R.id.category)
|
||||||
|
TextView tvCate;
|
||||||
|
@Nullable
|
||||||
|
@BindView(R.id.desc)
|
||||||
|
TextView tvDesc;
|
||||||
|
public MyViewHolder(View view)
|
||||||
|
{
|
||||||
|
super(view);
|
||||||
|
ButterKnife.bind(this, view);
|
||||||
|
//tvTitle = (TextView) view.findViewById(R.id.title);
|
||||||
|
// tvAuthor = (TextView) view.findViewById(R.id.author);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.deiniu.zhuike.utils.BandanAdapter;
|
||||||
import com.deiniu.zhuike.utils.OnItemClickListener;
|
import com.deiniu.zhuike.utils.OnItemClickListener;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -76,7 +77,7 @@ public class Fragment_bangdan extends BasicFragment {
|
||||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||||
}
|
}
|
||||||
initData();
|
initData();
|
||||||
mAdapter = new MyListAdapter(activity ,mData,R.layout.recycle_list_item_bangdan,new OnItemClickListener()
|
mAdapter = new BandanAdapter(activity ,mData,R.layout.recycle_list_item_bangdan,new OnItemClickListener()
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -103,7 +104,7 @@ public class Fragment_bangdan extends BasicFragment {
|
||||||
|
|
||||||
//------------------------列表绑定------------
|
//------------------------列表绑定------------
|
||||||
|
|
||||||
private MyListAdapter mAdapter;
|
private BandanAdapter mAdapter;
|
||||||
private List<String> mData;
|
private List<String> mData;
|
||||||
@BindView(R.id.rvBangdan)
|
@BindView(R.id.rvBangdan)
|
||||||
RecyclerView rvBandan;
|
RecyclerView rvBandan;
|
||||||
|
@ -136,192 +137,7 @@ public class Fragment_bangdan extends BasicFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class MyListAdapter extends RecyclerView.Adapter<MyListAdapter.MyViewHolder> {
|
|
||||||
private final int EMPTY_VIEW = 1;
|
|
||||||
private final int PROGRESS_VIEW = 2;
|
|
||||||
private final int IMAGE_VIEW = 3;
|
|
||||||
|
|
||||||
private Context context;
|
|
||||||
private List<String> mDatas = new ArrayList<String>();
|
|
||||||
private OnItemClickListener mOnItemClickLitener;
|
|
||||||
private int listItemID;
|
|
||||||
public MyListAdapter(Context context,List<String> mDatas,int listItemID,OnItemClickListener clickLitener) {
|
|
||||||
this.context = context;
|
|
||||||
this.mDatas = mDatas;
|
|
||||||
this.mOnItemClickLitener = clickLitener;
|
|
||||||
this.listItemID = listItemID;
|
|
||||||
}
|
|
||||||
public MyListAdapter(Context context, OnItemClickListener clickLitener) {
|
|
||||||
this.context = context;
|
|
||||||
this.mOnItemClickLitener = clickLitener;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemViewType(int position) {
|
|
||||||
if(mDatas.size() == 0){
|
|
||||||
return EMPTY_VIEW;
|
|
||||||
} else if(mDatas.get(position) == null){
|
|
||||||
return PROGRESS_VIEW;
|
|
||||||
} else {
|
|
||||||
return super.getItemViewType(position);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
|
|
||||||
{
|
|
||||||
MyViewHolder holder = new MyViewHolder(LayoutInflater.from(
|
|
||||||
context).inflate(listItemID, parent,
|
|
||||||
false));
|
|
||||||
return holder;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setParameters(List<String> mDatas,int listItemID ) {
|
|
||||||
this.mDatas = mDatas;
|
|
||||||
this.listItemID = listItemID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOnItemClickLitener(OnItemClickListener mOnItemClickLitener)
|
|
||||||
{
|
|
||||||
this.mOnItemClickLitener = mOnItemClickLitener;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(MyViewHolder holder, int position)
|
|
||||||
{
|
|
||||||
holder.tvCateName .setText("分类名称" +position);
|
|
||||||
holder.tvTitle.setText(mDatas.get(position));
|
|
||||||
holder.tvAuthor.setText("作者" +position);
|
|
||||||
holder.tvCate.setText("cate"+position);
|
|
||||||
holder.tvDesc.setText("this is desc " +position);
|
|
||||||
|
|
||||||
holder.tvTitle2.setText(mDatas.get(position) +1);
|
|
||||||
holder.tvAuthor2.setText("作者2" +position);
|
|
||||||
holder.tvCate2.setText("cate2"+position);
|
|
||||||
holder.tvDesc2.setText("this is desc2 " +position);
|
|
||||||
|
|
||||||
holder.tvTitle3.setText(mDatas.get(position)+2);
|
|
||||||
holder.tvAuthor3.setText("作者3" +position);
|
|
||||||
holder.tvCate3.setText("cate3-"+position);
|
|
||||||
holder.tvDesc3.setText("this is desc3- " +position);
|
|
||||||
|
|
||||||
// 如果设置了回调,则设置点击事件
|
|
||||||
if (mOnItemClickLitener != null)
|
|
||||||
{
|
|
||||||
holder.itemView.setOnClickListener(new View.OnClickListener() //show more cate paihang
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onClick(View v)
|
|
||||||
{
|
|
||||||
int pos = holder.getLayoutPosition();
|
|
||||||
mOnItemClickLitener.onItemClick(holder.itemView, pos);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
holder.itemView.setOnLongClickListener(new View.OnLongClickListener()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public boolean onLongClick(View v)
|
|
||||||
{
|
|
||||||
int pos = holder.getLayoutPosition();
|
|
||||||
mOnItemClickLitener.onItemLongClick(holder.itemView, pos);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
holder.ll1.setOnClickListener(new View.OnClickListener() { //show bookdetail
|
|
||||||
@Override
|
|
||||||
public void onClick(View v)
|
|
||||||
{
|
|
||||||
int pos = position;
|
|
||||||
mOnItemClickLitener.onLinearOutClick(holder.itemView, pos);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
holder.ll2.setOnClickListener(new View.OnClickListener() { //show bookdetail
|
|
||||||
@Override
|
|
||||||
public void onClick(View v)
|
|
||||||
{
|
|
||||||
int pos = position;
|
|
||||||
mOnItemClickLitener.onLinearOutClick(holder.itemView, pos);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
holder.ll3.setOnClickListener(new View.OnClickListener() { //show bookdetail
|
|
||||||
@Override
|
|
||||||
public void onClick(View v)
|
|
||||||
{
|
|
||||||
int pos = position;
|
|
||||||
mOnItemClickLitener.onLinearOutClick(holder.itemView, pos);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getItemCount()
|
|
||||||
{
|
|
||||||
return mDatas.size();
|
|
||||||
}
|
|
||||||
public void addData(int position) {
|
|
||||||
mDatas.add(position, "Insert One");
|
|
||||||
notifyItemInserted(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeData(int position) {
|
|
||||||
mDatas.remove(position);
|
|
||||||
notifyItemRemoved(position);
|
|
||||||
}
|
|
||||||
class MyViewHolder extends RecyclerView.ViewHolder
|
|
||||||
{
|
|
||||||
@BindView(R.id.title)
|
|
||||||
TextView tvTitle;
|
|
||||||
@BindView(R.id.author)
|
|
||||||
TextView tvAuthor;
|
|
||||||
@BindView(R.id.category)
|
|
||||||
TextView tvCate;
|
|
||||||
@BindView(R.id.desc)
|
|
||||||
TextView tvDesc;
|
|
||||||
@BindView(R.id.title2)
|
|
||||||
TextView tvTitle2;
|
|
||||||
@BindView(R.id.author2)
|
|
||||||
TextView tvAuthor2;
|
|
||||||
@BindView(R.id.category2)
|
|
||||||
TextView tvCate2;
|
|
||||||
@BindView(R.id.desc2)
|
|
||||||
TextView tvDesc2;
|
|
||||||
@BindView(R.id.title3)
|
|
||||||
TextView tvTitle3;
|
|
||||||
@BindView(R.id.author3)
|
|
||||||
TextView tvAuthor3;
|
|
||||||
@BindView(R.id.category3)
|
|
||||||
TextView tvCate3;
|
|
||||||
@BindView(R.id.desc3)
|
|
||||||
TextView tvDesc3;
|
|
||||||
@BindView(R.id.tvCateName)
|
|
||||||
TextView tvCateName;
|
|
||||||
@BindView(R.id.ll1)
|
|
||||||
LinearLayout ll1;
|
|
||||||
@BindView(R.id.ll2)
|
|
||||||
LinearLayout ll2;
|
|
||||||
@BindView(R.id.ll3)
|
|
||||||
LinearLayout ll3;
|
|
||||||
|
|
||||||
public MyViewHolder(View view)
|
|
||||||
{
|
|
||||||
super(view);
|
|
||||||
ButterKnife.bind(this, view);
|
|
||||||
//tvTitle = (TextView) view.findViewById(R.id.title);
|
|
||||||
// tvAuthor = (TextView) view.findViewById(R.id.author);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,41 @@ public class Fragment_paihang extends BasicFragment {
|
||||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||||
}
|
}
|
||||||
initData();
|
initData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
View view = inflater.inflate(R.layout.fragment_fragment_paihang, container, false);
|
||||||
|
|
||||||
|
ButterKnife.bind(this, view);
|
||||||
|
// if (mData1 == null)
|
||||||
|
{
|
||||||
|
|
||||||
|
initTabs();
|
||||||
|
initialBookList();
|
||||||
|
setScrollListner();
|
||||||
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ArrayList<CustomTabEntity> mData1,mData2,mData3 ;
|
||||||
|
private int tab1Pos,tab2Pos,tab3Pos;
|
||||||
|
void initData(){
|
||||||
|
mData =initData(mData,'Z');
|
||||||
|
mData1= new ArrayList<>();
|
||||||
|
mData2 = new ArrayList<>();
|
||||||
|
mData3 = new ArrayList<>();
|
||||||
|
mData1.add(new TabEntry("男A",0,0) );
|
||||||
|
mData1.add(new TabEntry("女A",0,0));
|
||||||
|
for (int i = 'A'; i < 'I'; i++)
|
||||||
|
{
|
||||||
|
mData2.add(new TabEntry("类" + (char) i,0,0) );
|
||||||
|
if(i<'D')
|
||||||
|
mData3.add(new TabEntry("榜" + (char) i,0,0) );
|
||||||
|
}
|
||||||
mAdapter = new BookListAdapter(activity, mData, R.layout.recycle_list_item_shudan, new OnItemClickListener() {
|
mAdapter = new BookListAdapter(activity, mData, R.layout.recycle_list_item_shudan, new OnItemClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,38 +137,6 @@ public class Fragment_paihang extends BasicFragment {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
||||||
Bundle savedInstanceState) {
|
|
||||||
// Inflate the layout for this fragment
|
|
||||||
View view = inflater.inflate(R.layout.fragment_fragment_paihang, container, false);
|
|
||||||
|
|
||||||
ButterKnife.bind(this, view);
|
|
||||||
initTabs();
|
|
||||||
initialBookList();
|
|
||||||
setScrollListner();
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private ArrayList<CustomTabEntity> mData1,mData2,mData3 ;
|
|
||||||
private int tab1Pos,tab2Pos,tab3Pos;
|
|
||||||
void initData(){
|
|
||||||
mData =initData(mData,'Z');
|
|
||||||
mData1= new ArrayList<>();
|
|
||||||
mData2 = new ArrayList<>();
|
|
||||||
mData3 = new ArrayList<>();
|
|
||||||
mData1.add(new TabEntry("男生",0,0) );
|
|
||||||
mData1.add(new TabEntry("女生",0,0));
|
|
||||||
for (int i = 'A'; i < 'I'; i++)
|
|
||||||
{
|
|
||||||
mData2.add(new TabEntry("类" + (char) i,0,0) );
|
|
||||||
if(i<'D')
|
|
||||||
mData3.add(new TabEntry("榜" + (char) i,0,0) );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
class TabEntry implements CustomTabEntity{
|
class TabEntry implements CustomTabEntity{
|
||||||
|
|
||||||
public String title;
|
public String title;
|
||||||
|
@ -170,6 +173,10 @@ public class Fragment_paihang extends BasicFragment {
|
||||||
CommonTabLayout tabLayout3;
|
CommonTabLayout tabLayout3;
|
||||||
private void initTabs() {
|
private void initTabs() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
tabLayout1.setTabData(mData1);
|
tabLayout1.setTabData(mData1);
|
||||||
tabLayout1.setOnTabSelectListener(new OnTabSelectListener() {
|
tabLayout1.setOnTabSelectListener(new OnTabSelectListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -258,6 +265,8 @@ public class Fragment_paihang extends BasicFragment {
|
||||||
LinearLayout llTabs;
|
LinearLayout llTabs;
|
||||||
@BindView(R.id.tvHint)
|
@BindView(R.id.tvHint)
|
||||||
TextView tvHint;
|
TextView tvHint;
|
||||||
|
|
||||||
|
private boolean isShowHint =false;
|
||||||
void setScrollListner(){
|
void setScrollListner(){
|
||||||
|
|
||||||
llTabs.measure(0,0);
|
llTabs.measure(0,0);
|
||||||
|
@ -270,7 +279,7 @@ public class Fragment_paihang extends BasicFragment {
|
||||||
// float scale = 0;
|
// float scale = 0;
|
||||||
@Override
|
@Override
|
||||||
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
|
public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
|
||||||
|
isShowHint = scrollY > height;
|
||||||
if (scrollY <= height) {
|
if (scrollY <= height) {
|
||||||
// scale = (float) scrollY / height;
|
// scale = (float) scrollY / height;
|
||||||
// alpha = (int) (255 * scale);
|
// alpha = (int) (255 * scale);
|
||||||
|
@ -300,7 +309,8 @@ public class Fragment_paihang extends BasicFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
//mNestedScrollView.smoothScrollBy(1,1);
|
||||||
|
tvHint.setVisibility(isShowHint? View.VISIBLE:View.GONE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package com.deiniu.zhuike;
|
package com.deiniu.zhuike;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.design.widget.BottomSheetDialog;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
import android.support.design.widget.FloatingActionButton;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.design.widget.TabLayout;
|
import android.support.design.widget.TabLayout;
|
||||||
|
@ -13,6 +15,7 @@ import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.flyco.tablayout.SlidingTabLayout;
|
import com.flyco.tablayout.SlidingTabLayout;
|
||||||
|
@ -22,6 +25,7 @@ import java.util.List;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
import butterknife.OnClick;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,12 +42,11 @@ public class Fragment_shudan extends BasicFragment {
|
||||||
private static final String ARG_PARAM1 = "param1";
|
private static final String ARG_PARAM1 = "param1";
|
||||||
private static final String ARG_PARAM2 = "param2";
|
private static final String ARG_PARAM2 = "param2";
|
||||||
|
|
||||||
// TODO: Rename and change types of parameters
|
|
||||||
private String mParam1;
|
private String mParam1;
|
||||||
private String mParam2;
|
private String mParam2;
|
||||||
|
@BindView(R.id.fab)
|
||||||
private OnFragmentInteractionListener mListener;
|
FloatingActionButton fab;
|
||||||
|
private BottomSheetDialog bottomSheetDialog;
|
||||||
public Fragment_shudan() {
|
public Fragment_shudan() {
|
||||||
// Required empty public constructor
|
// Required empty public constructor
|
||||||
}
|
}
|
||||||
|
@ -89,7 +92,7 @@ public class Fragment_shudan extends BasicFragment {
|
||||||
fab.setOnClickListener(new View.OnClickListener() {
|
fab.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
Toast.makeText(getContext(),"。。。。。。",Toast.LENGTH_LONG).show();
|
showShelfMoreSheet();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return v;
|
return v;
|
||||||
|
@ -101,8 +104,7 @@ public class Fragment_shudan extends BasicFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------tabs-------------
|
//---------tabs-------------
|
||||||
@BindView(R.id.fab)
|
|
||||||
FloatingActionButton fab;
|
|
||||||
@BindView(R.id.viewpager)
|
@BindView(R.id.viewpager)
|
||||||
ViewPager mViewpager;
|
ViewPager mViewpager;
|
||||||
@BindView(R.id.tab_layout2)
|
@BindView(R.id.tab_layout2)
|
||||||
|
@ -149,6 +151,64 @@ public class Fragment_shudan extends BasicFragment {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//---------------书单浮动工具栏
|
||||||
|
|
||||||
|
/*
|
||||||
|
@OnClick({R.id.btnCreateShudan,R.id.btnMyShudan})
|
||||||
|
void shudanSubmit(View view) {
|
||||||
|
if(view.getId() == R.id.btnCreateShudan)
|
||||||
|
{
|
||||||
|
//to show newshudan
|
||||||
|
}else if(view.getId() == R.id.btnMyShudan)
|
||||||
|
{
|
||||||
|
//to show myshudan
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
public void showShelfMoreSheet() {
|
||||||
|
bottomSheetDialog = new BottomSheetDialog(this.activity );
|
||||||
|
bottomSheetDialog.setContentView(R.layout.fragment_shudan_bottom_sheet);
|
||||||
|
//给布局设置透明背景色
|
||||||
|
bottomSheetDialog.getDelegate().findViewById(android.support.design.R.id.design_bottom_sheet)
|
||||||
|
.setBackgroundColor(getResources().getColor(android.R.color.transparent));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Button btnCreateShudan =(Button) bottomSheetDialog.findViewById(R.id.btnCreateShudan);
|
||||||
|
Button btnMyButton =(Button) bottomSheetDialog.findViewById(R.id.btnMyShudan);
|
||||||
|
Button btnCancel =(Button) bottomSheetDialog.findViewById(R.id.btnCancel);
|
||||||
|
btnCreateShudan.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent intent = new Intent(activity, Activity_createShudan.class);
|
||||||
|
intent.putExtra("SHUDANID",0);
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
|
}
|
||||||
|
}); ;
|
||||||
|
|
||||||
|
btnMyButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
Intent intent = new Intent(activity, Activity_createShudan.class);
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
|
}
|
||||||
|
}); ;
|
||||||
|
btnCancel.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
bottomSheetDialog.dismiss();
|
||||||
|
}
|
||||||
|
}); ;
|
||||||
|
bottomSheetDialog.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
if( bottomSheetDialog !=null ){
|
||||||
|
bottomSheetDialog.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,11 +157,18 @@ public class Main2Activity extends AppCompatActivity
|
||||||
}else if(menuItemId == R.id.menuMore) {
|
}else if(menuItemId == R.id.menuMore) {
|
||||||
showShelfMoreSheet();
|
showShelfMoreSheet();
|
||||||
}
|
}
|
||||||
|
else if(menuItemId == R.id.menuFinshi) {
|
||||||
|
udateShelfZhengli();
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void udateShelfZhengli() {
|
||||||
|
switchShelfZhengli(true);
|
||||||
|
}
|
||||||
|
|
||||||
Fragment_Shelf fragment_shelf;
|
Fragment_Shelf fragment_shelf;
|
||||||
private void showShelfMoreSheet() {
|
private void showShelfMoreSheet() {
|
||||||
{
|
{
|
||||||
|
@ -311,10 +318,18 @@ private int bottomSelectedIndex;
|
||||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
Log.e(TAG, "onPrepareOptionsMenu");
|
Log.e(TAG, "onPrepareOptionsMenu");
|
||||||
|
|
||||||
|
menu.findItem(R.id.menuFinshi).setVisible(false);
|
||||||
// menu.findItem(R.id.menuSearch).setVisible(true);
|
// menu.findItem(R.id.menuSearch).setVisible(true);
|
||||||
if(bottomSelectedIndex==0) {
|
if(bottomSelectedIndex==0) {
|
||||||
menu.findItem(R.id.menuFenlei).setVisible(false);
|
menu.findItem(R.id.menuFinshi).setVisible(isShelfZhengli);
|
||||||
menu.findItem(R.id.menuMore).setVisible(true);
|
if(isShelfZhengli){
|
||||||
|
menu.findItem(R.id.menuFenlei).setVisible(false);
|
||||||
|
menu.findItem(R.id.menuMore).setVisible(false);
|
||||||
|
menu.findItem(R.id.menuSearch).setVisible(false);
|
||||||
|
}else {
|
||||||
|
menu.findItem(R.id.menuFenlei).setVisible(false);
|
||||||
|
menu.findItem(R.id.menuMore).setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}else if(bottomSelectedIndex==1) {
|
}else if(bottomSelectedIndex==1) {
|
||||||
|
@ -362,7 +377,7 @@ private int bottomSelectedIndex;
|
||||||
Fragment_paihang fragment = (Fragment_paihang) getSupportFragmentManager()
|
Fragment_paihang fragment = (Fragment_paihang) getSupportFragmentManager()
|
||||||
.findFragmentByTag(Fragment_paihang.getFTag());
|
.findFragmentByTag(Fragment_paihang.getFTag());
|
||||||
if(fragment ==null) fragment =new Fragment_paihang();
|
if(fragment ==null) fragment =new Fragment_paihang();
|
||||||
showFragment(fragment ,Fragment_other.getFTag());
|
showFragment(fragment ,Fragment_paihang.getFTag());
|
||||||
swithToolbarItems( );
|
swithToolbarItems( );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -452,11 +467,33 @@ private int bottomSelectedIndex;
|
||||||
super.onResume();
|
super.onResume();
|
||||||
// swithToolbarItems( );
|
// swithToolbarItems( );
|
||||||
// setTitle("title on resume");
|
// setTitle("title on resume");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void hideBottomNavi(){
|
||||||
|
botoomNavigation.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
boolean isShelfZhengli =false;
|
||||||
|
public void switchShelfZhengli(boolean finished){
|
||||||
|
|
||||||
|
|
||||||
|
if(finished) {
|
||||||
|
isShelfZhengli = false;
|
||||||
|
swithToolbarItems();
|
||||||
|
botoomNavigation.setVisibility(View.VISIBLE);
|
||||||
|
fragment_shelf.initReceyleView();
|
||||||
|
|
||||||
|
}else {
|
||||||
|
toggle.setDrawerIndicatorEnabled(false);
|
||||||
|
toggle.syncState();
|
||||||
|
supportInvalidateOptionsMenu();
|
||||||
|
isShelfZhengli = true;
|
||||||
|
botoomNavigation.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ public class activity_cates extends AppCompatActivity {
|
||||||
RecyclerView mRecyclerView;
|
RecyclerView mRecyclerView;
|
||||||
private List<String> mDatas;
|
private List<String> mDatas;
|
||||||
private BookListAdapter mAdapter;
|
private BookListAdapter mAdapter;
|
||||||
|
|
||||||
//@BindView(R.id.textTile)
|
//@BindView(R.id.textTile)
|
||||||
//TextView tvTitle;
|
//TextView tvTitle;
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,206 @@
|
||||||
|
package com.deiniu.zhuike.utils;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.deiniu.zhuike.BasicFragment;
|
||||||
|
import com.deiniu.zhuike.Fragment_bangdan;
|
||||||
|
import com.deiniu.zhuike.R;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
|
public class BandanAdapter extends RecyclerView.Adapter<BandanAdapter.MyViewHolder> {
|
||||||
|
private final int EMPTY_VIEW = 1;
|
||||||
|
private final int PROGRESS_VIEW = 2;
|
||||||
|
private final int IMAGE_VIEW = 3;
|
||||||
|
|
||||||
|
private Context context;
|
||||||
|
private List<String> mDatas = new ArrayList<String>();
|
||||||
|
private OnItemClickListener mOnItemClickLitener;
|
||||||
|
private int listItemID;
|
||||||
|
public BandanAdapter(Context context,List<String> mDatas,int listItemID,OnItemClickListener clickLitener) {
|
||||||
|
this.context = context;
|
||||||
|
this.mDatas = mDatas;
|
||||||
|
this.mOnItemClickLitener = clickLitener;
|
||||||
|
this.listItemID = listItemID;
|
||||||
|
}
|
||||||
|
public BandanAdapter(Context context, OnItemClickListener clickLitener) {
|
||||||
|
this.context = context;
|
||||||
|
this.mOnItemClickLitener = clickLitener;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemViewType(int position) {
|
||||||
|
if(mDatas.size() == 0){
|
||||||
|
return EMPTY_VIEW;
|
||||||
|
} else if(mDatas.get(position) == null){
|
||||||
|
return PROGRESS_VIEW;
|
||||||
|
} else {
|
||||||
|
return super.getItemViewType(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
|
||||||
|
{
|
||||||
|
MyViewHolder holder = new MyViewHolder(LayoutInflater.from(
|
||||||
|
context).inflate(listItemID, parent,
|
||||||
|
false));
|
||||||
|
return holder;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void setParameters(List<String> mDatas,int listItemID ) {
|
||||||
|
this.mDatas = mDatas;
|
||||||
|
this.listItemID = listItemID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnItemClickLitener(OnItemClickListener mOnItemClickLitener)
|
||||||
|
{
|
||||||
|
this.mOnItemClickLitener = mOnItemClickLitener;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBindViewHolder(MyViewHolder holder, int position)
|
||||||
|
{
|
||||||
|
holder.tvCateName .setText("分类名称" +position);
|
||||||
|
holder.tvTitle.setText(mDatas.get(position));
|
||||||
|
holder.tvAuthor.setText("作者" +position);
|
||||||
|
holder.tvCate.setText("cate"+position);
|
||||||
|
holder.tvDesc.setText("this is desc " +position);
|
||||||
|
|
||||||
|
holder.tvTitle2.setText(mDatas.get(position) +1);
|
||||||
|
holder.tvAuthor2.setText("作者2" +position);
|
||||||
|
holder.tvCate2.setText("cate2"+position);
|
||||||
|
holder.tvDesc2.setText("this is desc2 " +position);
|
||||||
|
|
||||||
|
holder.tvTitle3.setText(mDatas.get(position)+2);
|
||||||
|
holder.tvAuthor3.setText("作者3" +position);
|
||||||
|
holder.tvCate3.setText("cate3-"+position);
|
||||||
|
holder.tvDesc3.setText("this is desc3- " +position);
|
||||||
|
|
||||||
|
// 如果设置了回调,则设置点击事件
|
||||||
|
if (mOnItemClickLitener != null)
|
||||||
|
{
|
||||||
|
holder.itemView.setOnClickListener(new View.OnClickListener() //show more cate paihang
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void onClick(View v)
|
||||||
|
{
|
||||||
|
int pos = holder.getLayoutPosition();
|
||||||
|
mOnItemClickLitener.onItemClick(holder.itemView, pos);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
holder.itemView.setOnLongClickListener(new View.OnLongClickListener()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public boolean onLongClick(View v)
|
||||||
|
{
|
||||||
|
int pos = holder.getLayoutPosition();
|
||||||
|
mOnItemClickLitener.onItemLongClick(holder.itemView, pos);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
holder.ll1.setOnClickListener(new View.OnClickListener() { //show bookdetail
|
||||||
|
@Override
|
||||||
|
public void onClick(View v)
|
||||||
|
{
|
||||||
|
int pos = position;
|
||||||
|
mOnItemClickLitener.onLinearOutClick(holder.itemView, pos);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
holder.ll2.setOnClickListener(new View.OnClickListener() { //show bookdetail
|
||||||
|
@Override
|
||||||
|
public void onClick(View v)
|
||||||
|
{
|
||||||
|
int pos = position;
|
||||||
|
mOnItemClickLitener.onLinearOutClick(holder.itemView, pos);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
holder.ll3.setOnClickListener(new View.OnClickListener() { //show bookdetail
|
||||||
|
@Override
|
||||||
|
public void onClick(View v)
|
||||||
|
{
|
||||||
|
int pos = position;
|
||||||
|
mOnItemClickLitener.onLinearOutClick(holder.itemView, pos);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getItemCount()
|
||||||
|
{
|
||||||
|
return mDatas.size();
|
||||||
|
}
|
||||||
|
public void addData(int position) {
|
||||||
|
mDatas.add(position, "Insert One");
|
||||||
|
notifyItemInserted(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeData(int position) {
|
||||||
|
mDatas.remove(position);
|
||||||
|
notifyItemRemoved(position);
|
||||||
|
}
|
||||||
|
class MyViewHolder extends RecyclerView.ViewHolder
|
||||||
|
{
|
||||||
|
@BindView(R.id.title)
|
||||||
|
TextView tvTitle;
|
||||||
|
@BindView(R.id.author)
|
||||||
|
TextView tvAuthor;
|
||||||
|
@BindView(R.id.category)
|
||||||
|
TextView tvCate;
|
||||||
|
@BindView(R.id.desc)
|
||||||
|
TextView tvDesc;
|
||||||
|
@BindView(R.id.title2)
|
||||||
|
TextView tvTitle2;
|
||||||
|
@BindView(R.id.author2)
|
||||||
|
TextView tvAuthor2;
|
||||||
|
@BindView(R.id.category2)
|
||||||
|
TextView tvCate2;
|
||||||
|
@BindView(R.id.desc2)
|
||||||
|
TextView tvDesc2;
|
||||||
|
@BindView(R.id.title3)
|
||||||
|
TextView tvTitle3;
|
||||||
|
@BindView(R.id.author3)
|
||||||
|
TextView tvAuthor3;
|
||||||
|
@BindView(R.id.category3)
|
||||||
|
TextView tvCate3;
|
||||||
|
@BindView(R.id.desc3)
|
||||||
|
TextView tvDesc3;
|
||||||
|
@BindView(R.id.tvCateName)
|
||||||
|
TextView tvCateName;
|
||||||
|
@BindView(R.id.ll1)
|
||||||
|
LinearLayout ll1;
|
||||||
|
@BindView(R.id.ll2)
|
||||||
|
LinearLayout ll2;
|
||||||
|
@BindView(R.id.ll3)
|
||||||
|
LinearLayout ll3;
|
||||||
|
|
||||||
|
public MyViewHolder(View view)
|
||||||
|
{
|
||||||
|
super(view);
|
||||||
|
ButterKnife.bind(this, view);
|
||||||
|
//tvTitle = (TextView) view.findViewById(R.id.title);
|
||||||
|
// tvAuthor = (TextView) view.findViewById(R.id.author);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,20 +0,0 @@
|
||||||
package com.deiniu.zhuike.utils;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.support.v7.widget.RecyclerView;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.deiniu.zhuike.BasicFragment;
|
|
||||||
import com.deiniu.zhuike.Fragment_bangdan;
|
|
||||||
import com.deiniu.zhuike.R;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import butterknife.BindView;
|
|
||||||
import butterknife.ButterKnife;
|
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".BookActivity"
|
tools:context=".BookActivity"
|
||||||
|
|
||||||
>
|
>
|
||||||
<android.support.design.widget.CoordinatorLayout
|
<android.support.design.widget.CoordinatorLayout
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,7 @@
|
||||||
tools:context=".Activity_cate_books">
|
tools:context=".Activity_cate_books">
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
style="@style/barLayout">
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:fitsSystemWindows="true"
|
|
||||||
android:paddingTop="@dimen/toolbarPadding"
|
|
||||||
android:theme="@style/ToolBarTheme.AppBarOverlay">
|
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
|
|
@ -8,11 +8,7 @@
|
||||||
tools:context=".activity_cates">
|
tools:context=".activity_cates">
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
style="@style/barLayout">
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:fitsSystemWindows="true"
|
|
||||||
android:paddingTop="@dimen/toolbarPadding"
|
|
||||||
android:theme="@style/ToolBarTheme.AppBarOverlay">
|
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".Activity_createShudan">
|
||||||
|
|
||||||
|
<android.support.design.widget.AppBarLayout
|
||||||
|
style="@style/barLayout">
|
||||||
|
|
||||||
|
<android.support.v7.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
app:popupTheme="@style/ToolBarTheme.PopupOverlay" />
|
||||||
|
|
||||||
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
<include layout="@layout/content_activity_create_shudan" />
|
||||||
|
|
||||||
|
|
||||||
|
</android.support.design.widget.CoordinatorLayout>
|
|
@ -10,11 +10,7 @@
|
||||||
>
|
>
|
||||||
<!-- 即toolbar悬浮在statusbar之后 https://blog.csdn.net/zafir6453/article/details/51344241-->
|
<!-- 即toolbar悬浮在statusbar之后 https://blog.csdn.net/zafir6453/article/details/51344241-->
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
style="@style/barLayout">
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingTop="@dimen/toolbarPadding"
|
|
||||||
android:fitsSystemWindows="true"
|
|
||||||
android:theme="@style/ToolBarTheme.AppBarOverlay">
|
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
|
|
@ -7,11 +7,7 @@
|
||||||
tools:context=".Activity_shudan">
|
tools:context=".Activity_shudan">
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout
|
<android.support.design.widget.AppBarLayout
|
||||||
android:layout_width="match_parent"
|
style="@style/barLayout">
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:fitsSystemWindows="true"
|
|
||||||
android:paddingTop="@dimen/toolbarPadding"
|
|
||||||
android:theme="@style/ToolBarTheme.AppBarOverlay">
|
|
||||||
|
|
||||||
<android.support.v7.widget.Toolbar
|
<android.support.v7.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".Activity_shudan_my">
|
||||||
|
|
||||||
|
<android.support.design.widget.AppBarLayout
|
||||||
|
style="@style/barLayout">
|
||||||
|
|
||||||
|
<android.support.v7.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
app:popupTheme="@style/ToolBarTheme.PopupOverlay" />
|
||||||
|
|
||||||
|
</android.support.design.widget.AppBarLayout>
|
||||||
|
|
||||||
|
<include layout="@layout/content_activity_shudan_my" />
|
||||||
|
|
||||||
|
<android.support.design.widget.FloatingActionButton
|
||||||
|
android:id="@+id/fab"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:layout_marginRight="@dimen/fab_margin"
|
||||||
|
android:layout_marginBottom="60dp"
|
||||||
|
app:srcCompat="@android:drawable/ic_input_add" />
|
||||||
|
|
||||||
|
</android.support.design.widget.CoordinatorLayout>
|
|
@ -2,8 +2,8 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
style="@style/llOutside"
|
||||||
android:layout_height="match_parent"
|
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
tools:context=".Activity_cate_books"
|
tools:context=".Activity_cate_books"
|
||||||
tools:showIn="@layout/activity_cate_books"
|
tools:showIn="@layout/activity_cate_books"
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
style="@style/llOutside"
|
||||||
android:layout_height="match_parent"
|
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
tools:context=".activity_cates"
|
tools:context=".activity_cates"
|
||||||
tools:showIn="@layout/activity_cates">
|
tools:showIn="@layout/activity_cates">
|
||||||
|
|
|
@ -0,0 +1,125 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
style="@style/llOutside"
|
||||||
|
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
|
tools:context=".Activity_createShudan"
|
||||||
|
tools:showIn="@layout/activity_create_shudan">
|
||||||
|
|
||||||
|
<android.support.v4.widget.NestedScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_marginRight="@dimen/marginRight"
|
||||||
|
android:layout_marginLeft="@dimen/marginLeft"
|
||||||
|
>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:hint="书单标题"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LinearLayout style="@style/llGraySplit" />
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/txtDesc"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:lines="5"
|
||||||
|
android:maxLength="255"
|
||||||
|
android:hint="书单描述"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnAddFromShelf"
|
||||||
|
style="@style/buttonRound"
|
||||||
|
android:drawableLeft="@android:drawable/ic_menu_add"
|
||||||
|
android:text="从书架添加"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnAddFromSearch"
|
||||||
|
style="@style/buttonRound"
|
||||||
|
android:drawableLeft="@android:drawable/ic_menu_add"
|
||||||
|
android:text="从书库添加"
|
||||||
|
/>
|
||||||
|
<TextView style="@style/TextViewFill"/>
|
||||||
|
<RadioGroup
|
||||||
|
style="@style/radioGroup"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="right"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
>
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/radioButtonBoy"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:checked="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="男频"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<RadioButton
|
||||||
|
android:id="@+id/radioButtonGirl"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
|
||||||
|
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="女频"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</RadioGroup>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
<TextView
|
||||||
|
style="@style/TextViewDesc"
|
||||||
|
android:text="@string/shudanalert"
|
||||||
|
android:maxLines="2"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/recycleViewBookList"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
</android.support.v7.widget.RecyclerView>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</android.support.v4.widget.NestedScrollView>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</android.support.constraint.ConstraintLayout>
|
|
@ -2,8 +2,8 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
style="@style/llOutside"
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginTop="?attr/actionBarSize"
|
android:layout_marginTop="?attr/actionBarSize"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
>
|
>
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
style="@style/llOutside"
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_margin="5dp"
|
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
tools:context=".Activity_shudan"
|
tools:context=".Activity_shudan"
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
style="@style/llOutside"
|
||||||
|
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
|
tools:context=".Activity_cate_books"
|
||||||
|
tools:showIn="@layout/activity_cate_books"
|
||||||
|
android:orientation="vertical"
|
||||||
|
>
|
||||||
|
|
||||||
|
|
||||||
|
<com.flyco.tablayout.SlidingTabLayout
|
||||||
|
android:id="@+id/tab_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:background="@color/white"
|
||||||
|
app:tl_indicator_color="@color/crimson"
|
||||||
|
app:tl_indicator_corner_radius="1.5dp"
|
||||||
|
app:tl_indicator_height="2dp"
|
||||||
|
app:tl_indicator_width="45dp"
|
||||||
|
app:tl_textSelectColor="@color/crimson"
|
||||||
|
app:tl_textUnselectColor="@color/grey"
|
||||||
|
app:tl_tab_space_equal ="true"
|
||||||
|
|
||||||
|
/>
|
||||||
|
<android.support.v4.view.ViewPager
|
||||||
|
android:id="@+id/viewpager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
</android.support.v4.view.ViewPager>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -2,9 +2,8 @@
|
||||||
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
style="@style/llOutside"
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginBottom="3dp"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
tools:context=".BookActivity"
|
tools:context=".BookActivity"
|
||||||
|
|
|
@ -3,27 +3,62 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:layout_marginLeft="@dimen/marginLeft"
|
||||||
>
|
android:layout_marginRight="@dimen/marginRight"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<android.support.v4.widget.SwipeRefreshLayout
|
<android.support.v4.widget.SwipeRefreshLayout
|
||||||
|
android:id="@+id/swipeLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
|
||||||
android:id="@+id/swipeLayout" >
|
android:orientation="vertical">
|
||||||
<android.support.v7.widget.RecyclerView
|
|
||||||
android:id="@+id/id_recyclerview"
|
<LinearLayout
|
||||||
android:divider="#ffff0000"
|
android:layout_width="match_parent"
|
||||||
android:dividerHeight="10dp"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:orientation="vertical">
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:paddingBottom="40dp"
|
<android.support.v7.widget.RecyclerView
|
||||||
android:paddingTop="30dp"
|
android:id="@+id/id_recyclerview"
|
||||||
/>
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:divider="#ffff0000"
|
||||||
|
android:dividerHeight="10dp"
|
||||||
|
android:paddingTop="20dp"
|
||||||
|
android:paddingBottom="40dp" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/llShelfBottom"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:gravity="bottom"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:paddingBottom="0dp"
|
||||||
|
>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnSelect"
|
||||||
|
style="@style/buttonCates"
|
||||||
|
android:text="全选"
|
||||||
|
android:textColor="@color/colorAccent" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnDelete"
|
||||||
|
style="@style/buttonCates"
|
||||||
|
android:text="删除"
|
||||||
|
android:textColor="@color/colorAccent" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
</android.support.v4.widget.SwipeRefreshLayout>
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
<android.support.design.widget.TextInputEditText
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="1500dp" />
|
|
||||||
|
|
||||||
|
<android.support.design.widget.TextInputEditText
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="1500dp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -11,6 +11,6 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:nestedScrollingEnabled="false"
|
android:nestedScrollingEnabled="false"
|
||||||
android:paddingBottom="50dp"
|
|
||||||
/>
|
/>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:nestedScrollingEnabled="false"
|
android:nestedScrollingEnabled="false"
|
||||||
android:paddingBottom="5dp"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</android.support.v4.widget.SwipeRefreshLayout>
|
</android.support.v4.widget.SwipeRefreshLayout>
|
|
@ -3,32 +3,52 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
|
android:background="@color/white"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
<Button
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="5dp"
|
|
||||||
android:text="1"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="2" android:layout_marginBottom="5dp"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="3" android:layout_marginBottom="5dp"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="4" android:layout_marginBottom="5dp"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/btnZhengli"
|
||||||
android:layout_height="wrap_content"
|
style="@style/buttonCates"
|
||||||
android:text="5" android:layout_marginBottom="5dp"
|
android:text="整理书架"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<LinearLayout style="@style/llGraySplit.2dp"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style="@style/buttonCates"
|
||||||
|
android:text="切换视图"
|
||||||
|
/>
|
||||||
|
<LinearLayout style="@style/llGraySplit.2dp"/>
|
||||||
|
<Button
|
||||||
|
style="@style/buttonCates"
|
||||||
|
android:text="上传进度"
|
||||||
/>
|
/>
|
||||||
|
<LinearLayout style="@style/llGraySplit.2dp"/>
|
||||||
|
<Button
|
||||||
|
style="@style/buttonCates"
|
||||||
|
android:text="下载进度"
|
||||||
|
/>
|
||||||
|
<LinearLayout style="@style/llGraySplit.2dp"/>
|
||||||
|
<Button
|
||||||
|
style="@style/buttonCates"
|
||||||
|
android:text="WIFI传书"
|
||||||
|
/>
|
||||||
|
<LinearLayout style="@style/llGraySplit.2dp"/>
|
||||||
|
<Button
|
||||||
|
style="@style/buttonCates"
|
||||||
|
android:text="本地导入"
|
||||||
|
/>
|
||||||
|
<LinearLayout style="@style/llGraySplit.2dp"/>
|
||||||
|
<Button
|
||||||
|
style="@style/buttonCates"
|
||||||
|
android:text="TXT下载"
|
||||||
|
|
||||||
|
/>
|
||||||
|
<LinearLayout style="@style/llGraySplit"/>
|
||||||
|
<Button
|
||||||
|
style="@style/buttonCates"
|
||||||
|
android:text="取消"
|
||||||
|
android:textColor="@color/colorAccent"
|
||||||
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="2dp"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnSelect"
|
||||||
|
style="@style/buttonCates"
|
||||||
|
android:text="全选"
|
||||||
|
android:textColor="@color/colorAccent"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnDelete"
|
||||||
|
style="@style/buttonCates"
|
||||||
|
android:text="删除"
|
||||||
|
android:textColor="@color/colorAccent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -53,5 +53,5 @@
|
||||||
android:layout_gravity="bottom|end"
|
android:layout_gravity="bottom|end"
|
||||||
android:layout_marginRight="@dimen/fab_margin"
|
android:layout_marginRight="@dimen/fab_margin"
|
||||||
android:layout_marginBottom="60dp"
|
android:layout_marginBottom="60dp"
|
||||||
app:srcCompat="@android:drawable/ic_menu_add" />
|
app:srcCompat="@android:drawable/ic_input_add" />
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:background="@color/white"
|
||||||
|
>
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnCreateShudan"
|
||||||
|
style="@style/buttonCates"
|
||||||
|
android:drawableLeft="@drawable/ic_mood_black_24dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="创建书单"
|
||||||
|
android:layout_weight="0"
|
||||||
|
/>
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:text="|"
|
||||||
|
android:layout_marginLeft="20dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnMyShudan"
|
||||||
|
style="@style/buttonCates"
|
||||||
|
android:text="我的书单"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:drawableLeft="@drawable/ic_toys_black_24dp"
|
||||||
|
android:layout_weight="0"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnCancel"
|
||||||
|
style="@style/buttonCates"
|
||||||
|
android:text="取消"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
style="@style/llOutside"
|
||||||
android:layout_height="match_parent"
|
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
>
|
>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -2,12 +2,16 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="100dp"
|
android:layout_height="120dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:background="@drawable/item_selector"
|
android:background="@drawable/item_selector"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:padding="5dp">
|
android:padding="5dp">
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/imageView"
|
android:id="@+id/imageView"
|
||||||
android:layout_width="80dp"
|
android:layout_width="80dp"
|
||||||
|
@ -15,7 +19,15 @@
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:src="@drawable/googleg_standard_color_18" />
|
android:src="@drawable/googleg_standard_color_18" />
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/id_check_box"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="right"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:text=""/>
|
||||||
|
</FrameLayout>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -24,6 +36,7 @@
|
||||||
android:text="天龙八部"
|
android:text="天龙八部"
|
||||||
|
|
||||||
android:textColor="#212121" />
|
android:textColor="#212121" />
|
||||||
|
<!--
|
||||||
<TextView
|
<TextView
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:id="@+id/desc"
|
android:id="@+id/desc"
|
||||||
|
@ -48,4 +61,5 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="武侠小说"
|
android:text="武侠小说"
|
||||||
android:textColor="@color/colorAccent" />
|
android:textColor="@color/colorAccent" />
|
||||||
|
-->
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -61,4 +61,5 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:background="@drawable/item_selector"
|
||||||
|
android:clickable="true"
|
||||||
|
android:layout_weight="1">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/imageView"
|
||||||
|
android:layout_margin="10dp"
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:layout_height="80dp"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:gravity="left"
|
||||||
|
android:src="@drawable/googleg_standard_color_18" />
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_weight="1">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="30dp"
|
||||||
|
android:layout_gravity="left"
|
||||||
|
android:text="射雕英雄传"
|
||||||
|
android:textColor="#212121" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/desc"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="11sp"
|
||||||
|
android:text=" "
|
||||||
|
android:textColor="@color/common_google_signin_btn_text_light" />
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
>
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/author"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="金庸"
|
||||||
|
android:textColor="#212121" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/category"
|
||||||
|
android:layout_marginLeft="5dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="武侠小说"
|
||||||
|
android:textColor="@color/colorAccent" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
<Button
|
||||||
|
style="@style/buttonRightMore"
|
||||||
|
android:id="@+id/btnItemDelete"
|
||||||
|
android:layout_weight="0"
|
||||||
|
|
||||||
|
android:drawableLeft="@android:drawable/ic_delete"
|
||||||
|
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
|
@ -40,6 +40,12 @@
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
android:title="@string/fenlei"
|
android:title="@string/fenlei"
|
||||||
app:showAsAction="ifRoom" />
|
app:showAsAction="ifRoom" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/menuFinshi"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:title="@string/finish"
|
||||||
|
app:showAsAction="ifRoom" />
|
||||||
|
|
||||||
<!-- app:actionProviderClass="android.widget.ShareActionProvider" -->
|
<!-- app:actionProviderClass="android.widget.ShareActionProvider" -->
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
tools:context="com.deiniu.zhuike.BookActivity">
|
tools:context="com.deiniu.zhuike.BookActivity">
|
||||||
<item
|
<item
|
||||||
android:id="@+id/action_settings"
|
android:id="@+id/menuShelf"
|
||||||
android:orderInCategory="100"
|
android:orderInCategory="100"
|
||||||
android:title="@string/action_settings"
|
android:title="@string/shelf"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="always" />
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item
|
||||||
|
android:id="@+id/mnSave"
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:title="@string/save"
|
||||||
|
app:showAsAction="always" />
|
||||||
|
<item
|
||||||
|
android:orderInCategory="100"
|
||||||
|
android:id="@+id/mnPublish"
|
||||||
|
android:title="@string/fabu"
|
||||||
|
app:showAsAction="always" />
|
||||||
|
</menu>
|
|
@ -37,5 +37,9 @@
|
||||||
<dimen name="text_margin">16dp</dimen>
|
<dimen name="text_margin">16dp</dimen>
|
||||||
<dimen name="appbar_padding_top">8dp</dimen>
|
<dimen name="appbar_padding_top">8dp</dimen>
|
||||||
<dimen name="toolbarPadding">22dp</dimen>
|
<dimen name="toolbarPadding">22dp</dimen>
|
||||||
|
<!-- 屏幕右侧空出 -->
|
||||||
|
<dimen name="marginRight">5dp</dimen>
|
||||||
|
<!-- 屏幕左侧空出 -->
|
||||||
|
<dimen name="marginLeft">5dp</dimen>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -123,5 +123,12 @@
|
||||||
<string name="title_activity_cates">分类</string>
|
<string name="title_activity_cates">分类</string>
|
||||||
<string name="title_activity_cate_books">Activity_cate_books</string>
|
<string name="title_activity_cate_books">Activity_cate_books</string>
|
||||||
<string name="title_activity_shudan">书单详情</string>
|
<string name="title_activity_shudan">书单详情</string>
|
||||||
|
<string name="title_activity_create_shudan">Activity_createShudan</string>
|
||||||
|
<string name="shudanalert">(温馨提示:亲,您发布的书单将会经过我们严格的审核,杜绝垃圾书单,请您合理编辑)</string>
|
||||||
|
<string name="save">保存</string>
|
||||||
|
<string name="fabu">发布</string>
|
||||||
|
<string name="finish">完成</string>
|
||||||
|
<string name="shelf">书架</string>
|
||||||
|
<string name="title_activity_shudan_my">Activity_shudan_my</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -94,9 +94,11 @@
|
||||||
<item name="android:paddingTop">2dp</item>
|
<item name="android:paddingTop">2dp</item>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
<style name="buttonCates.big" >
|
|
||||||
|
<style name="buttonCates.big">
|
||||||
<item name="android:layout_height">match_parent</item>
|
<item name="android:layout_height">match_parent</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="llGraySplit">
|
<style name="llGraySplit">
|
||||||
<item name="android:layout_width">match_parent</item>
|
<item name="android:layout_width">match_parent</item>
|
||||||
<item name="android:layout_height">5dp</item>
|
<item name="android:layout_height">5dp</item>
|
||||||
|
@ -104,6 +106,11 @@
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="llGraySplit.2dp">
|
||||||
|
<item name="android:layout_height">2dp</item>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
<style name="TextViewTitle">
|
<style name="TextViewTitle">
|
||||||
<item name="android:paddingLeft">5dp</item>
|
<item name="android:paddingLeft">5dp</item>
|
||||||
<item name="android:textColor">@color/darkcyan</item>
|
<item name="android:textColor">@color/darkcyan</item>
|
||||||
|
@ -113,6 +120,9 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="TextViewDesc">
|
<style name="TextViewDesc">
|
||||||
|
<item name="android:layout_width">match_parent</item>
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
|
||||||
<item name="android:textColor">@color/lightgray</item>
|
<item name="android:textColor">@color/lightgray</item>
|
||||||
<item name="android:textSize">15sp</item>
|
<item name="android:textSize">15sp</item>
|
||||||
</style>
|
</style>
|
||||||
|
@ -143,5 +153,42 @@
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="buttonRound">
|
||||||
|
<item name="android:layout_width">wrap_content</item>
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
<item name="android:background">@drawable/item_selector</item>
|
||||||
|
<item name="android:layout_marginRight">3dp</item>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="radioGroup">
|
||||||
|
<item name="android:layout_width">wrap_content</item>
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TextViewFill">
|
||||||
|
<item name="android:layout_width">match_parent</item>
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
<item name="android:layout_weight">1</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="llOutside">
|
||||||
|
<item name="android:layout_width">match_parent</item>
|
||||||
|
<item name="android:layout_height">match_parent</item>
|
||||||
|
<item name="android:layout_marginRight">@dimen/marginRight</item>
|
||||||
|
<item name="android:layout_marginLeft">@dimen/marginLeft</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="barLayout">
|
||||||
|
<item name="android:layout_width">match_parent</item>
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
<item name="android:fitsSystemWindows">true</item>
|
||||||
|
<item name="android:paddingTop">@dimen/toolbarPadding</item>
|
||||||
|
<item name="android:theme">@style/ToolBarTheme.AppBarOverlay</item>
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in New Issue