Commit e4059299 by Kunj Gupta

UOFLMA-38: Added dialog with complete description.

parent 7ae70cfd
package com.vsoft.uofl_catalogue.ui;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
......@@ -17,6 +19,7 @@ import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnItemClick;
/**
* Created by kunj on 30/8/16.
......@@ -27,6 +30,7 @@ public class MyIncidentScreen extends AppCompatActivity {
@BindView(R.id.my_incidents_screen_list_view) ListView mIncidentListView;
private CatalogueApplication mApplication;
private List<Incident> mIncidentList;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -49,18 +53,43 @@ public class MyIncidentScreen extends AppCompatActivity {
}
MyIncidentsAdapter adapter = new MyIncidentsAdapter(MyIncidentScreen.this);
List<Incident> incidentList = new ArrayList<>(5);
mIncidentList = new ArrayList<>(5);
for (int i = 0; i < 5 ; i++) {
Incident incident = new Incident();
incident.setNumber("INC000010");
incident.setShortDescription("short description");
incident.setOpenedAt("23 Aug 2016, 15.30PM");
incidentList.add(incident);
mIncidentList.add(incident);
}
adapter.setIncidentList(incidentList);
adapter.setIncidentList(mIncidentList);
mIncidentListView.setAdapter(adapter);
}
@OnItemClick(R.id.my_incidents_screen_list_view)
void listViewOnClicked(int position) {
Incident incident = mIncidentList.get(position);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Number: ");
stringBuilder.append(incident.getNumber());
stringBuilder.append("\n\n");
stringBuilder.append("Opened At: ");
stringBuilder.append(incident.getOpenedAt());
stringBuilder.append("\n\n");
stringBuilder.append("Short Description: ");
stringBuilder.append(incident.getShortDescription());
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(stringBuilder.toString())
.setCancelable(false)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == android.R.id.home) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment