@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { slidingDrawer.close(); currentClasstime = (Classtime) parent.getItemAtPosition(position); if (currentClasstime != null) { mode = parentAct.startActionMode(new ScheduleActionMode()); slidingDrawer.setVisibility(View.VISIBLE); String text = " "; text += currentClasstime.getCourseId() + " - " + currentClasstime.getName() + " "; String daytext = "\n\t"; String building = currentClasstime.getBuilding().getId() + " " + currentClasstime.getBuilding().getRoom(); String unique = currentClasstime.getUnique(); String time = currentClasstime.getStartTime(); String end = currentClasstime.getEndTime(); if (currentClasstime.getDay() == 'H') { daytext += "TH"; } else { daytext += currentClasstime.getDay(); } // TODO: stringbuilder text += (daytext + " from " + time + "-" + end + " in " + building) + "\n"; text += "\tUnique: " + unique + "\n"; classInfoImageView.setBackgroundColor(Color.parseColor("#" + currentClasstime.getColor())); classInfoImageView.setMinimumHeight(10); classInfoImageView.setMinimumWidth(10); classInfoTextView.setTextColor(Color.BLACK); classInfoTextView.setTextSize(14f); classInfoTextView.setBackgroundColor(TRANSLUCENT_GRAY); classInfoTextView.setText(text); slidingDrawer.open(); } // they clicked an empty cell else { if (mode != null) { mode.finish(); } slidingDrawer.setVisibility(View.INVISIBLE); } }
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View vg = inflater.inflate(R.layout.course_schedule_fragment_layout, container, false); slidingDrawer = (WrappingSlidingDrawer) vg.findViewById(R.id.drawer); classInfoImageView = (ImageView) vg.findViewById(R.id.class_info_color); classInfoTextView = (TextView) vg.findViewById(R.id.class_info_text); errorLayout = (LinearLayout) vg.findViewById(R.id.schedule_error); errorTextView = (TextView) vg.findViewById(R.id.tv_failure); progress = (LinearLayout) vg.findViewById(R.id.schedule_progressbar_ll); noCoursesTextView = (TextView) vg.findViewById(R.id.no_courses); scheduleGridView = (GridView) vg.findViewById(R.id.scheduleview); dayList = (LinearLayout) vg.findViewById(R.id.daylist); /* * if(savedInstanceState != null) classList = * savedInstanceState.getParcelableArrayList("classList"); */ slidingDrawer.setOnDrawerCloseListener(this); slidingDrawer.setOnDrawerOpenListener(this); slidingDrawer.setVisibility(View.INVISIBLE); OkHttpClient client = new OkHttpClient(); fetch = new parseTask(client); Utility.parallelExecute(fetch, false); return vg; }