@SuppressLint("ValidFragment")
public final class DeleteEventDialog extends DialogFragment {
- Event e; Activity a;
-
+ private final Event event;
+ private final Activity activity;
+
+ public DeleteEventDialog(final Event event, final Activity activity) {
+ super();
+ this.event=event;
+ this.activity=activity;
+ }
+
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int id) {
- // Nothing happens here yet
- e.delete(getActivity());
- a.finish();
+ event.delete(getActivity());
+ activity.finish();
}
})
.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
});
return builder.create();
}
- public DeleteEventDialog(Event e,Activity a) {
- this.e=e;
- this.a=a;
- }
}
public class DisplayEventActivity extends Activity {
public static final String EXTRA_EVENT = "event";
- Event e;
+ private Event event;
public static void displayEvent(final Context context, final Event event){
final Intent i=new Intent(context,DisplayEventActivity.class);
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- e=getIntent().getParcelableExtra(EXTRA_EVENT);
+ event=getIntent().getParcelableExtra(EXTRA_EVENT);
setContentView(R.layout.event_view);
- setTitle(e.title);
+ setTitle(event.title);
final TextView startDay= (TextView) findViewById(R.id.startday);
final TextView endDay= (TextView) findViewById(R.id.endday);
final TextView endTime= (TextView) findViewById(R.id.endtime);
final TextView description= (TextView) findViewById(R.id.event_view_description);
- final Date start=new Date(e.dtstart);
- final Date end=new Date(e.dtend);
+ final Date start=new Date(event.dtstart);
+ final Date end=new Date(event.dtend);
final SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy", Locale.UK);
final SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss", Locale.UK);
final SimpleDateFormat dayOfWeekFormat = new SimpleDateFormat("EEEEEEE", Locale.UK);
startDate.setText(dateFormat.format(start));
startTime.setText(timeFormat.format(start));
endTime.setText(timeFormat.format(end));
- description.setText(e.description);
+ description.setText(event.description);
}
@Override
startActivity(i);
return true;
case R.id.deleteevent:
- final DeleteEventDialog d=new DeleteEventDialog(e,this);
+ final DeleteEventDialog d=new DeleteEventDialog(event,this);
d.show(getFragmentManager(), "Delete");
return true;
case R.id.eventlist:
public final class TrivialFragment extends Fragment {
private static class OnItemSelectedListener implements android.widget.AdapterView.OnItemSelectedListener{
- final View repeatCount;
+ private final View repeatCount;
public OnItemSelectedListener(final View repeatCount) {
this.repeatCount=repeatCount;
}