use of com.scwang.smartrefresh.layout.listener.OnRefreshListener in project SmartRefreshLayout by scwang90.
the class WebViewPracticeActivity method onCreate.
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_practice_webview);
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
final WebView webView = (WebView) findViewById(R.id.webView);
final RefreshLayout refreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout);
refreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
webView.loadUrl("https://github.com/scwang90/SmartRefreshLayout");
}
});
refreshLayout.autoRefresh();
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
refreshLayout.finishRefresh();
view.loadUrl(String.format(Locale.CHINA, "javascript:document.body.style.paddingTop='%fpx'; void 0", DensityUtil.px2dp(webView.getPaddingTop())));
}
});
// 状态栏透明和间距处理
StatusBarUtil.immersive(this);
StatusBarUtil.setPaddingSmart(this, webView);
StatusBarUtil.setPaddingSmart(this, toolbar);
StatusBarUtil.setMargin(this, findViewById(R.id.header));
StatusBarUtil.setPaddingSmart(this, findViewById(R.id.blurView));
}
use of com.scwang.smartrefresh.layout.listener.OnRefreshListener in project SmartRefreshLayout by scwang90.
the class ThreeLevelExampleFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().finish();
}
});
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
if (recyclerView != null) {
recyclerView.setAdapter(new BaseRecyclerAdapter<Void>(initData(), simple_list_item_2) {
@Override
protected void onBindViewHolder(SmartViewHolder holder, Void model, int position) {
holder.text(android.R.id.text1, getString(R.string.item_example_number_title, position));
holder.text(android.R.id.text2, getString(R.string.item_example_number_abstract, position));
holder.textColorId(android.R.id.text1, android.R.color.white);
holder.textColorId(android.R.id.text2, android.R.color.white);
}
});
}
RefreshLayout refreshLayout1 = (RefreshLayout) view.findViewById(R.id.refreshLayout1);
if (refreshLayout1 != null) {
refreshLayout1.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
refreshLayout.finishRefresh(1000);
}
});
}
RefreshLayout refreshLayout2 = (RefreshLayout) view.findViewById(R.id.refreshLayout2);
if (refreshLayout2 != null) {
refreshLayout2.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
refreshLayout.finishRefresh(2000);
}
});
}
}
use of com.scwang.smartrefresh.layout.listener.OnRefreshListener in project AgentWeb by Justson.
the class SmartRefreshWebFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final SmartRefreshLayout mSmartRefreshLayout = (SmartRefreshLayout) this.mSmartRefreshWebLayout.getLayout();
final WebView mWebView = this.mSmartRefreshWebLayout.getWebView();
mSmartRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
mAgentWeb.getUrlLoader().reload();
mSmartRefreshLayout.postDelayed(new Runnable() {
@Override
public void run() {
mSmartRefreshLayout.finishRefresh();
}
}, 2000);
}
});
mSmartRefreshLayout.autoRefresh();
}
use of com.scwang.smartrefresh.layout.listener.OnRefreshListener in project weibo by dingdangmao123.
the class TitleFG method CreateView.
@Override
public void CreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState, View v) {
adapter = new TitleAdapter(data, getActivity());
tl.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
tl.setAdapter(adapter);
rf.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
Refresh();
}
});
rf.setOnLoadmoreListener(new OnLoadmoreListener() {
@Override
public void onLoadmore(RefreshLayout refreshlayout) {
rf.finishLoadmore();
}
});
search.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
Intent i = new Intent(getActivity(), Title.class);
i.putExtra("title", s);
getActivity().startActivity(i);
return false;
}
@Override
public boolean onQueryTextChange(String s) {
return false;
}
});
}
use of com.scwang.smartrefresh.layout.listener.OnRefreshListener in project weibo by dingdangmao123.
the class AtFG method CreateView.
@Override
public void CreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState, View v) {
adapter = new AtAdapter(data, getActivity());
tl.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
tl.setAdapter(adapter);
rf.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
Refresh(1);
}
});
rf.setOnLoadmoreListener(new OnLoadmoreListener() {
@Override
public void onLoadmore(RefreshLayout refreshlayout) {
Refresh(0);
}
});
}
Aggregations