use of com.manan.dev.ec2018app.Adapters.TicketLayoutAdapter in project EC2018App by Manan-YMCA.
the class Tickets method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tickets);
SharedPreferences preferences = getSharedPreferences(getResources().getString(R.string.sharedPrefName), MODE_PRIVATE);
phoneNumber = preferences.getString("Phone", null);
mProgress = new ProgressDialog(this);
mProgress.setMessage("Showing your ticket.");
mProgress.setTitle("Loading...");
mProgress.setCanceledOnTouchOutside(false);
noTickets = (TextView) findViewById(R.id.tv_no_tickets);
userTicketsView = (RecyclerView) findViewById(R.id.gl_user_tickets);
userTicketsView.setLayoutManager(new LinearLayoutManager(Tickets.this));
userTickets = new ArrayList<>();
mIncomingHandler = new IncomingHandler(Tickets.this);
databaseController = new DatabaseController(Tickets.this);
mAdapter = new TicketLayoutAdapter(Tickets.this, userTickets);
if (userTickets.size() > 0) {
noTickets.setVisibility(View.GONE);
}
userTicketsView.setAdapter(mAdapter);
tickback = findViewById(R.id.tic_back_button);
s = findViewById(R.id.swipe_refresh_layout);
s.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
if (isNetworkAvailable())
new LoadTickets().execute(phoneNumber);
else
MDToast.makeText(Tickets.this, "No Internet Connection", Toast.LENGTH_SHORT, MDToast.TYPE_ERROR).show();
s.setRefreshing(false);
}
});
if (phoneNumber == null) {
} else {
new DisplayTickets().execute(phoneNumber);
}
tickback.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
}
use of com.manan.dev.ec2018app.Adapters.TicketLayoutAdapter in project EC2018App by Manan-YMCA.
the class Tickets method displayTickets.
private void displayTickets(String phoneNumber) {
userTickets = databaseController.retrieveAllTickets();
if (userTickets.size() > 0) {
noTickets.setVisibility(View.GONE);
mProgress.dismiss();
mAdapter = new TicketLayoutAdapter(Tickets.this, userTickets);
userTicketsView.setAdapter(mAdapter);
}
// mAdapter.notifyDataSetChanged();
}
Aggregations