use of com.scwang.refreshlayout.adapter.SmartViewHolder in project SmartRefreshLayout by scwang90.
the class DropBoxStyleActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_style_dropbox);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
mRefreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout);
if (isFirstEnter) {
isFirstEnter = false;
// 第一次进入触发自动刷新,演示效果
mRefreshLayout.autoRefresh();
}
View view = findViewById(R.id.recyclerView);
if (view instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) view;
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.addItemDecoration(new DividerItemDecoration(this, VERTICAL));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(new BaseRecyclerAdapter<Item>(Arrays.asList(Item.values()), simple_list_item_2, this) {
@Override
protected void onBindViewHolder(SmartViewHolder holder, Item model, int position) {
holder.text(android.R.id.text1, model.name());
holder.text(android.R.id.text2, model.nameId);
holder.textColorId(android.R.id.text2, R.color.colorTextAssistant);
}
});
}
}
use of com.scwang.refreshlayout.adapter.SmartViewHolder in project SmartRefreshLayout by scwang90.
the class FunGameBattleCityStyleActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_style_fungame_battlecity);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
mRefreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout);
if (isFirstEnter) {
isFirstEnter = false;
// 第一次进入触发自动刷新,演示效果
mRefreshLayout.autoRefresh();
}
View view = findViewById(R.id.recyclerView);
if (view instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) view;
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.addItemDecoration(new DividerItemDecoration(this, VERTICAL));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(new BaseRecyclerAdapter<Item>(Arrays.asList(Item.values()), simple_list_item_2, this) {
@Override
protected void onBindViewHolder(SmartViewHolder holder, Item model, int position) {
holder.text(android.R.id.text1, model.name());
holder.text(android.R.id.text2, model.nameId);
holder.textColorId(android.R.id.text2, R.color.colorTextAssistant);
}
});
}
}
use of com.scwang.refreshlayout.adapter.SmartViewHolder in project SmartRefreshLayout by scwang90.
the class MaterialStyleActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_style_material);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
mRefreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout);
if (isFirstEnter) {
isFirstEnter = false;
// 第一次进入触发自动刷新,演示效果
mRefreshLayout.autoRefresh();
}
mMaterialHeader = (MaterialHeader) mRefreshLayout.getRefreshHeader();
View view = findViewById(R.id.recyclerView);
if (view instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) view;
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.addItemDecoration(new DividerItemDecoration(this, VERTICAL));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(new BaseRecyclerAdapter<Item>(Arrays.asList(Item.values()), simple_list_item_2, this) {
@Override
protected void onBindViewHolder(SmartViewHolder holder, Item model, int position) {
holder.text(android.R.id.text1, model.name());
holder.text(android.R.id.text2, model.nameId);
holder.textColorId(android.R.id.text2, R.color.colorTextAssistant);
}
});
}
}
use of com.scwang.refreshlayout.adapter.SmartViewHolder in project SmartRefreshLayout by scwang90.
the class StoreHouseStyleActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_style_storehouse);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
mRefreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout);
if (isFirstEnter) {
isFirstEnter = false;
// 第一次进入触发自动刷新,演示效果
mRefreshLayout.autoRefresh();
}
View view = findViewById(R.id.recyclerView);
if (view instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) view;
recyclerView.addItemDecoration(new DividerItemDecoration(this, VERTICAL));
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(new BaseRecyclerAdapter<Item>(Arrays.asList(Item.values()), simple_list_item_2, this) {
@Override
protected void onBindViewHolder(SmartViewHolder holder, Item model, int position) {
holder.text(android.R.id.text1, model.name());
holder.text(android.R.id.text2, model.nameId);
holder.textColorId(android.R.id.text2, R.color.colorTextAssistant);
}
});
}
}
use of com.scwang.refreshlayout.adapter.SmartViewHolder in project SmartRefreshLayout by scwang90.
the class TaurusStyleActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_style_taurus);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
mRefreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout);
if (isFirstEnter) {
isFirstEnter = false;
// 第一次进入触发自动刷新,演示效果
mRefreshLayout.autoRefresh();
}
mAppBarLayout = (AppBarLayout) findViewById(R.id.appbar);
mToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.toolbarLayout);
View view = findViewById(R.id.recyclerView);
if (view instanceof RecyclerView) {
RecyclerView recyclerView = (RecyclerView) view;
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.addItemDecoration(new DividerItemDecoration(this, VERTICAL));
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(new BaseRecyclerAdapter<Item>(Arrays.asList(Item.values()), simple_list_item_2, this) {
@Override
protected void onBindViewHolder(SmartViewHolder holder, Item model, int position) {
holder.text(android.R.id.text1, model.name());
holder.text(android.R.id.text2, model.nameId);
holder.textColorId(android.R.id.text2, R.color.colorTextAssistant);
}
});
mRecyclerView = recyclerView;
}
/*
* 监听 AppBarLayout 的关闭和开启 给 ActionButton 设置关闭隐藏动画
*/
mActionButton = (FloatingActionButton) findViewById(R.id.fab);
mAppBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
boolean misAppbarExpand = true;
View fab = findViewById(R.id.fab);
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
int scrollRange = appBarLayout.getTotalScrollRange();
float fraction = 1f * (scrollRange + verticalOffset) / scrollRange;
if (fraction < 0.1 && misAppbarExpand) {
misAppbarExpand = false;
fab.animate().scaleX(0).scaleY(0);
}
if (fraction > 0.8 && !misAppbarExpand) {
misAppbarExpand = true;
fab.animate().scaleX(1).scaleY(1);
}
}
});
}
Aggregations