package net.teerapap.whatnext;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Fragment for WhatNext page. It is the main fragment for the application.
 * Created by teerapap on 10/21/13.
 */
public class WhatNextFragment extends Fragment {

    /**
     * Static method to initialize the fragment
     * @return
     */
    public static WhatNextFragment newInstance() {
        WhatNextFragment f = new WhatNextFragment();
        return f;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_whatnext, container, false);
        return rootView;
    }
}

@@ -25,16 +25,45 @@
 tnext;%0A%0A
+import android.app.Activity;%0A
 import a
@@ -83,16 +83,16 @@
 agment;%0A
-
 import a
@@ -201,16 +201,82 @@
 ewGroup;
+%0Aimport android.widget.Button;%0Aimport android.widget.ToggleButton;
 %0A%0A/**%0A *
@@ -439,16 +439,231 @@
 ment %7B%0A%0A
+    private Button mClearBtn;%0A    private ToggleButton mWhenHomeToggleBtn;%0A    private ToggleButton mWhenFreeToggleBtn;%0A    private ToggleButton mWhenWorkToggleBtn;%0A    private ToggleButton mWhenShoppingToggleBtn;%0A%0A
     /**%0A
@@ -862,16 +862,211 @@
 %0A    %7D%0A%0A
+    @Override%0A    public void onActivityCreated(Bundle savedInstanceState) %7B%0A        super.onActivityCreated(savedInstanceState);%0A        initMemberViews();%0A        setUpEventListeners();%0A    %7D%0A%0A
     @Ove
@@ -1288,24 +1288,24 @@
 er, false);%0A
-
         retu
@@ -1322,11 +1322,1201 @@
 w;%0A    %7D
+%0A%0A    /**%0A     * Initialize member variables from children views.%0A     */%0A    private void initMemberViews() %7B%0A        Activity activity = getActivity();%0A        mClearBtn = (Button) activity.findViewById(R.id.clear_btn);%0A        mWhenHomeToggleBtn = (ToggleButton) activity.findViewById(R.id.when_home_toggle);%0A        mWhenFreeToggleBtn = (ToggleButton) activity.findViewById(R.id.when_free_toggle);%0A        mWhenWorkToggleBtn = (ToggleButton) activity.findViewById(R.id.when_work_toggle);%0A        mWhenShoppingToggleBtn = (ToggleButton) activity.findViewById(R.id.when_shopping_toggle);%0A    %7D%0A%0A    /**%0A     * Setup proper event listeners inside fragment%0A     */%0A    private void setUpEventListeners() %7B%0A        mClearBtn.setOnClickListener(new View.OnClickListener() %7B%0A            @Override%0A            public void onClick(View v) %7B%0A                resetWhenToggleBtns();%0A            %7D%0A        %7D);%0A    %7D%0A%0A    /**%0A     * Reset when toggle buttons%0A     */%0A    public void resetWhenToggleBtns() %7B%0A        mWhenHomeToggleBtn.setChecked(false);%0A        mWhenFreeToggleBtn.setChecked(false);%0A        mWhenWorkToggleBtn.setChecked(false);%0A        mWhenShoppingToggleBtn.setChecked(false);%0A    %7D
 %0A%7D%0A

Implement clear toggle button