use of android.support.v4.widget.SwipeRefreshLayout in project weiui by kuaifan.
the class Tabbar method addPageView.
/**
* 添加页面
* @param barBean
*/
private void addPageView(TabbarBean barBean) {
View view = ((Activity) getContext()).getLayoutInflater().inflate(R.layout.layout_weiui_tabbar_page, null);
SwipeRefreshLayout v_swipeRefresh = view.findViewById(R.id.v_swipeRefresh);
FrameLayout v_container = view.findViewById(R.id.v_container);
ProgressBar v_progress = view.findViewById(R.id.v_progress);
//
WXSDKBean sdkBean = new WXSDKBean();
sdkBean.setSwipeRefresh(v_swipeRefresh);
sdkBean.setContainer(v_container);
sdkBean.setProgress(v_progress);
sdkBean.setView(barBean.getView());
if (barBean.getView() instanceof String) {
sdkBean.setType("urlView");
WXSDKList.put(barBean.getTabName(), sdkBean);
addWXSDKView(barBean.getTabName());
} else if (barBean.getView() instanceof TabbarPageView) {
sdkBean.setType("pageView");
WXSDKList.put(barBean.getTabName(), sdkBean);
addWXPageView(barBean.getTabName());
}
//
if (getDomObject().getEvents().contains(weiuiConstants.Event.REFRESH_LISTENER)) {
sdkBean.getSwipeRefresh().setColorSchemeResources(android.R.color.holo_blue_light, android.R.color.holo_red_light, android.R.color.holo_orange_light, android.R.color.holo_green_light);
sdkBean.getSwipeRefresh().setOnRefreshListener(() -> {
Map<String, Object> data = new HashMap<>();
data.put("tabName", barBean.getTabName());
data.put("position", getTabPosition(barBean.getTabName()));
fireEvent(weiuiConstants.Event.REFRESH_LISTENER, data);
});
sdkBean.setSwipeRefreshEnable(true);
} else {
sdkBean.setSwipeRefreshEnable(false);
sdkBean.getSwipeRefresh().setEnabled(false);
}
//
mTabEntity.add(new TabbarEntity(barBean));
mViewList.add(view);
mTabPagerAdapter.setListViews(mViewList);
mTabPagerAdapter.notifyDataSetChanged();
}
use of android.support.v4.widget.SwipeRefreshLayout in project CoordinatorLayoutDemo by JamFF.
the class ItemFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_item_list, container, false);
View list = view.findViewById(R.id.list);
if (view instanceof SwipeRefreshLayout) {
mRefreshLayout = (SwipeRefreshLayout) view;
mRefreshLayout.setOnRefreshListener(this);
mRefreshLayout.setColorSchemeColors(Color.BLUE, Color.GREEN, Color.BLACK);
}
if (list instanceof RecyclerView) {
// Set RecyclerView adapter
Context context = view.getContext();
RecyclerView recyclerView = (RecyclerView) list;
List<DataBean> beanList = new ArrayList<>();
if (mOrientation != LinearLayout.VERTICAL && mOrientation != LinearLayout.HORIZONTAL) {
mOrientation = LinearLayout.VERTICAL;
}
if (mColumnCount <= 1) {
mColumnCount = 1;
recyclerView.setLayoutManager(new LinearLayoutManager(context, mOrientation, mReverseLayout));
for (int i = 0; i < DATAS.ICONS.length; i++) {
DataBean bean = new DataBean();
bean.setIcon(DATAS.ICONS[i]);
bean.setName("图片-" + i);
beanList.add(bean);
}
} else {
if (mStaggered) {
StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(mColumnCount, mOrientation);
layoutManager.setReverseLayout(mReverseLayout);
recyclerView.setLayoutManager(layoutManager);
for (int i = 0; i < DATAS.PICS.length; i++) {
DataBean bean = new DataBean();
bean.setIcon(DATAS.PICS[i]);
bean.setName("图片-" + i);
beanList.add(bean);
}
} else {
recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount, mOrientation, mReverseLayout));
for (int i = 0; i < DATAS.ICONS.length; i++) {
DataBean bean = new DataBean();
bean.setIcon(DATAS.ICONS[i]);
bean.setName("图片-" + i);
beanList.add(bean);
}
}
}
recyclerView.setAdapter(new MyItemRecyclerViewAdapter(beanList, mColumnCount, mListener));
}
return view;
}
use of android.support.v4.widget.SwipeRefreshLayout in project TamTime by flyingrub.
the class LineRouteFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.view_swype_refresh, container, false);
recyclerView = (RecyclerView) view.findViewById(R.id.my_recycler_view);
circularIndeterminate = (ProgressBarCircularIndeterminate) view.findViewById(R.id.progressBarCircularIndeterminate);
refreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refresh_layout);
recyclerView.setHasFixedSize(true);
layoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
RecyclerView.ItemDecoration itemDecoration = new DividerItemDecoration(getActivity());
recyclerView.addItemDecoration(itemDecoration);
direction = Data.getData().getMap().getLine(linePosition).getDirections().get(routePosition);
adapter = new OneRouteAdapter(direction.getStops(), getContext(), isTheoritical);
recyclerView.setAdapter(adapter);
adapter.SetOnItemClickListener(new OneRouteAdapter.OnItemClickListener() {
@Override
public void onItemClick(View v, int position) {
selectitem(position);
}
});
if (isTheoritical) {
getActivity().setTitle("Théorique : Ligne " + Data.getData().getMap().getLine(linePosition).getShortName());
} else {
getActivity().setTitle("Ligne " + Data.getData().getMap().getLine(linePosition).getShortName());
}
circularIndeterminate.setVisibility(View.GONE);
refreshLayout.setVisibility(View.VISIBLE);
refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
Data.getData().update();
}
});
refreshLayout.setColorSchemeResources(R.color.primaryColor);
setHasOptionsMenu(true);
return view;
}
use of android.support.v4.widget.SwipeRefreshLayout in project TamTime by flyingrub.
the class StopLineFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.view_swype_refresh, container, false);
recyclerView = (RecyclerView) view.findViewById(R.id.my_recycler_view);
circularIndeterminate = (ProgressBarCircularIndeterminate) view.findViewById(R.id.progressBarCircularIndeterminate);
refreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.refresh_layout);
recyclerView.setHasFixedSize(true);
recyclerView.setBackgroundColor(getResources().getColor(R.color.windowBackgroundCard));
layoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
adapter = new OneStopAdapter(stopZone.getStops(line));
recyclerView.setAdapter(adapter);
adapter.SetOnItemClickListener(new OneStopAdapter.OnItemClickListener() {
@Override
public void onItemClick(View v, int position) {
// Unneeded ?
}
});
circularIndeterminate.setVisibility(View.GONE);
refreshLayout.setVisibility(View.VISIBLE);
refreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
Data.getData().update();
}
});
refreshLayout.setColorSchemeResources(R.color.primaryColor);
return view;
}
use of android.support.v4.widget.SwipeRefreshLayout in project samourai-wallet-android by Samourai-Wallet.
the class BalanceActivity method onCreate.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_balance);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
if (SamouraiWallet.getInstance().isTestNet()) {
setTitle(getText(R.string.app_name) + ":" + "TestNet");
}
LayoutInflater inflator = BalanceActivity.this.getLayoutInflater();
tvBalanceBar = (LinearLayout) inflator.inflate(R.layout.balance_layout, null);
tvBalanceBar.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (isBTC) {
isBTC = false;
} else {
isBTC = true;
}
displayBalance();
txAdapter.notifyDataSetChanged();
return false;
}
});
tvBalanceAmount = (TextView) tvBalanceBar.findViewById(R.id.BalanceAmount);
tvBalanceUnits = (TextView) tvBalanceBar.findViewById(R.id.BalanceUnits);
ibQuickSend = (FloatingActionsMenu) findViewById(R.id.wallet_menu);
actionSend = (FloatingActionButton) findViewById(R.id.send);
actionSend.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(BalanceActivity.this, SendActivity.class);
intent.putExtra("via_menu", true);
startActivity(intent);
}
});
actionReceive = (FloatingActionButton) findViewById(R.id.receive);
actionReceive.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
try {
HD_Wallet hdw = HD_WalletFactory.getInstance(BalanceActivity.this).get();
if (hdw != null) {
Intent intent = new Intent(BalanceActivity.this, ReceiveActivity.class);
startActivity(intent);
}
} catch (IOException | MnemonicException.MnemonicLengthException e) {
;
}
}
});
actionBIP47 = (FloatingActionButton) findViewById(R.id.bip47);
actionBIP47.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent intent = new Intent(BalanceActivity.this, com.samourai.wallet.bip47.BIP47Activity.class);
startActivity(intent);
}
});
txs = new ArrayList<Tx>();
txStates = new HashMap<String, Boolean>();
txList = (ListView) findViewById(R.id.txList);
txAdapter = new TransactionAdapter();
txList.setAdapter(txAdapter);
txList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
if (position == 0) {
return;
}
long viewId = view.getId();
View v = (View) view.getParent();
final Tx tx = txs.get(position - 1);
ImageView ivTxStatus = (ImageView) v.findViewById(R.id.TransactionStatus);
TextView tvConfirmationCount = (TextView) v.findViewById(R.id.ConfirmationCount);
if (viewId == R.id.ConfirmationCount || viewId == R.id.TransactionStatus) {
if (txStates.containsKey(tx.getHash()) && txStates.get(tx.getHash()) == true) {
txStates.put(tx.getHash(), false);
displayTxStatus(false, tx.getConfirmations(), tvConfirmationCount, ivTxStatus);
} else {
txStates.put(tx.getHash(), true);
displayTxStatus(true, tx.getConfirmations(), tvConfirmationCount, ivTxStatus);
}
} else {
String message = getString(R.string.options_unconfirmed_tx);
// RBF
if (tx.getConfirmations() < 1 && tx.getAmount() < 0.0 && RBFUtil.getInstance().contains(tx.getHash())) {
AlertDialog.Builder builder = new AlertDialog.Builder(BalanceActivity.this);
builder.setTitle(R.string.app_name);
builder.setMessage(message);
builder.setCancelable(true);
builder.setPositiveButton(R.string.options_bump_fee, new DialogInterface.OnClickListener() {
public void onClick(final DialogInterface dialog, int whichButton) {
if (rbfTask == null || rbfTask.getStatus().equals(AsyncTask.Status.FINISHED)) {
rbfTask = new RBFTask();
rbfTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, tx.getHash());
}
}
});
builder.setNegativeButton(R.string.options_block_explorer, new DialogInterface.OnClickListener() {
public void onClick(final DialogInterface dialog, int whichButton) {
doExplorerView(tx.getHash());
}
});
AlertDialog alert = builder.create();
alert.show();
} else // CPFP receive
if (tx.getConfirmations() < 1 && tx.getAmount() >= 0.0) {
AlertDialog.Builder builder = new AlertDialog.Builder(BalanceActivity.this);
builder.setTitle(R.string.app_name);
builder.setMessage(message);
builder.setCancelable(true);
builder.setPositiveButton(R.string.options_bump_fee, new DialogInterface.OnClickListener() {
public void onClick(final DialogInterface dialog, int whichButton) {
if (cpfpTask == null || cpfpTask.getStatus().equals(AsyncTask.Status.FINISHED)) {
cpfpTask = new CPFPTask();
cpfpTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, tx.getHash());
}
}
});
builder.setNegativeButton(R.string.options_block_explorer, new DialogInterface.OnClickListener() {
public void onClick(final DialogInterface dialog, int whichButton) {
doExplorerView(tx.getHash());
}
});
AlertDialog alert = builder.create();
alert.show();
} else // CPFP spend
if (tx.getConfirmations() < 1 && tx.getAmount() < 0.0) {
AlertDialog.Builder builder = new AlertDialog.Builder(BalanceActivity.this);
builder.setTitle(R.string.app_name);
builder.setMessage(message);
builder.setCancelable(true);
builder.setPositiveButton(R.string.options_bump_fee, new DialogInterface.OnClickListener() {
public void onClick(final DialogInterface dialog, int whichButton) {
if (cpfpTask == null || cpfpTask.getStatus().equals(AsyncTask.Status.FINISHED)) {
cpfpTask = new CPFPTask();
cpfpTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, tx.getHash());
}
}
});
builder.setNegativeButton(R.string.options_block_explorer, new DialogInterface.OnClickListener() {
public void onClick(final DialogInterface dialog, int whichButton) {
doExplorerView(tx.getHash());
}
});
AlertDialog alert = builder.create();
alert.show();
} else {
doExplorerView(tx.getHash());
return;
}
}
}
});
swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swiperefresh);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
new Handler().post(new Runnable() {
@Override
public void run() {
refreshTx(false, true, true, false);
}
});
}
});
swipeRefreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light);
IntentFilter filter = new IntentFilter(ACTION_INTENT);
LocalBroadcastManager.getInstance(BalanceActivity.this).registerReceiver(receiver, filter);
// TorUtil.getInstance(BalanceActivity.this).setStatusFromBroadcast(false);
registerReceiver(torStatusReceiver, new IntentFilter(OrbotHelper.ACTION_STATUS));
boolean notifTx = false;
boolean fetch = false;
Bundle extras = getIntent().getExtras();
if (extras != null && extras.containsKey("notifTx")) {
notifTx = extras.getBoolean("notifTx");
}
if (extras != null && extras.containsKey("uri")) {
fetch = extras.getBoolean("fetch");
}
refreshTx(notifTx, fetch, false, true);
if (PrefsUtil.getInstance(BalanceActivity.this).getValue(PrefsUtil.PAYNYM_CLAIMED, false) == false && PrefsUtil.getInstance(BalanceActivity.this).getValue(PrefsUtil.PAYNYM_REFUSED, false) == false) {
doClaimPayNym();
}
if (!AppUtil.getInstance(BalanceActivity.this).isClipboardSeen()) {
doClipboardCheck();
}
}
Aggregations