// Path: app/src/main/java/com/YC2010/MyClass/ui/adapters/FinalsListAdapter.java
// public class FinalsListAdapter extends BaseAdapter {
//     ArrayList<FinalObject> mArrayList;
//     Context mContext;
//     LayoutInflater mLayoutInflater;
// 
//     public FinalsListAdapter(Context context, int textViewResourceId, Bundle bundle) {
//         mLayoutInflater = LayoutInflater.from(context);
//         mArrayList = bundle.getParcelableArrayList(Constants.finalObjectListKey);
//         mContext = context;
//         Log.d("SectionListAdapter", "Course name is " + bundle.getString("courseName"));
//     }
// 
//     @Override
//     public FinalObject getItem(int i) {
//         return mArrayList.get(i);
//     }
// 
//     @Override
//     public int getCount() {
//         return mArrayList != null ? mArrayList.size() : 0;
//     }
// 
//     @Override
//     public long getItemId(int arg0) {
//         return 0;
//     }
// 
//     @Override
//     public View getView(int position, View convertView, ViewGroup parent) {
//         //Log.d("SectionListAdapter", "enter getView");
//         View v = convertView;
// 
//         v = mLayoutInflater.inflate(R.layout.section_item, null);
// 
// 
//         Log.d("SectionListAdapter", "position is " + position);
// 
//         TextView date = (TextView) v.findViewById(R.id.section_item_capacity);
//         TextView sec = (TextView) v.findViewById(R.id.section_item_lec);
//         TextView loc = (TextView) v.findViewById(R.id.section_item_loc);
//         TextView time = (TextView) v.findViewById(R.id.section_item_time);
// 
//         FinalObject finalInfo = getItem(position);
// 
//         sec.setText(finalInfo.getSection());
// 
//         if (!finalInfo.isOnline()) {
//             time.setText(finalInfo.getTime());
//             loc.setText(finalInfo.getLocation());
//             date.setText(finalInfo.getDate());
//         }
// 
//         return v;
//     }
// 
// }


import android.app.Activity;
import android.app.Fragment;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.YC2010.MyClass.R;
import com.YC2010.MyClass.ui.adapters.FinalsListAdapter;
package com.YC2010.MyClass.ui.fragments;



/**
 * Created by Danny on 2015/12/26.
 */
public class SearchExamFragment extends Fragment {
    private Activity mActivity;
    private View mView;
    private Bundle mFetchedResult;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.mActivity = getActivity();
        this.mFetchedResult = this.getArguments();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        mView = inflater.inflate(R.layout.fragment_search_exam, container, false);

        if (mFetchedResult.getBoolean("has_finals", false)) {
            TextView finals = (TextView) mView.findViewById(R.id.final_exams);
            if (finals != null) {
                finals.setVisibility(View.VISIBLE);
            }
            updateView();
        }

        return mView;
    }

    public void updateView() {
        // get default divider
        int[] attrs = {android.R.attr.listDivider};
        TypedArray ta = mActivity.obtainStyledAttributes(attrs);
        Drawable divider = ta.getDrawable(0);
        ta.recycle();

        LinearLayout mFinalLinearLayout = (LinearLayout) mView.findViewById(R.id.finals_list);
// Path: app/src/main/java/com/YC2010/MyClass/ui/adapters/FinalsListAdapter.java
// public class FinalsListAdapter extends BaseAdapter {
//     ArrayList<FinalObject> mArrayList;
//     Context mContext;
//     LayoutInflater mLayoutInflater;
// 
//     public FinalsListAdapter(Context context, int textViewResourceId, Bundle bundle) {
//         mLayoutInflater = LayoutInflater.from(context);
//         mArrayList = bundle.getParcelableArrayList(Constants.finalObjectListKey);
//         mContext = context;
//         Log.d("SectionListAdapter", "Course name is " + bundle.getString("courseName"));
//     }
// 
//     @Override
//     public FinalObject getItem(int i) {
//         return mArrayList.get(i);
//     }
// 
//     @Override
//     public int getCount() {
//         return mArrayList != null ? mArrayList.size() : 0;
//     }
// 
//     @Override
//     public long getItemId(int arg0) {
//         return 0;
//     }
// 
//     @Override
//     public View getView(int position, View convertView, ViewGroup parent) {
//         //Log.d("SectionListAdapter", "enter getView");
//         View v = convertView;
// 
//         v = mLayoutInflater.inflate(R.layout.section_item, null);
// 
// 
//         Log.d("SectionListAdapter", "position is " + position);
// 
//         TextView date = (TextView) v.findViewById(R.id.section_item_capacity);
//         TextView sec = (TextView) v.findViewById(R.id.section_item_lec);
//         TextView loc = (TextView) v.findViewById(R.id.section_item_loc);
//         TextView time = (TextView) v.findViewById(R.id.section_item_time);
// 
//         FinalObject finalInfo = getItem(position);
// 
//         sec.setText(finalInfo.getSection());
// 
//         if (!finalInfo.isOnline()) {
//             time.setText(finalInfo.getTime());
//             loc.setText(finalInfo.getLocation());
//             date.setText(finalInfo.getDate());
//         }
// 
//         return v;
//     }
// 
// }


// Path: app/src/main/java/com/YC2010/MyClass/ui/fragments/SearchExamFragment.java
import android.app.Activity;
import android.app.Fragment;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.YC2010.MyClass.R;
import com.YC2010.MyClass.ui.adapters.FinalsListAdapter;

package com.YC2010.MyClass.ui.fragments;



/**
 * Created by Danny on 2015/12/26.
 */
public class SearchExamFragment extends Fragment {
    private Activity mActivity;
    private View mView;
    private Bundle mFetchedResult;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.mActivity = getActivity();
        this.mFetchedResult = this.getArguments();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        mView = inflater.inflate(R.layout.fragment_search_exam, container, false);

        if (mFetchedResult.getBoolean("has_finals", false)) {
            TextView finals = (TextView) mView.findViewById(R.id.final_exams);
            if (finals != null) {
                finals.setVisibility(View.VISIBLE);
            }
            updateView();
        }

        return mView;
    }

    public void updateView() {
        // get default divider
        int[] attrs = {android.R.attr.listDivider};
        TypedArray ta = mActivity.obtainStyledAttributes(attrs);
        Drawable divider = ta.getDrawable(0);
        ta.recycle();

        LinearLayout mFinalLinearLayout = (LinearLayout) mView.findViewById(R.id.finals_list);
        FinalsListAdapter FinalsAdapter = new FinalsListAdapter(mActivity, R.layout.section_item, mFetchedResult);