Android Open Source - ScoponeDaPolso Menu Fragment






From Project

Back to project page ScoponeDaPolso.

License

The source code is released under:

GNU General Public License

If you think the Android project ScoponeDaPolso listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.gdg.bari.scopone.fragment;
//www .  j a  v  a2s  .c om
import android.app.Activity;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.google.android.gms.common.api.GoogleApiClient;

import org.gdg.bari.scopone.activity.MobileMainActivity;
import org.gdg.bari.scopone.R;
import org.gdg.bari.scopone.util.GoogleApiClientManager;
import org.gdg.bari.scopone.util.LogUtil;


public class MenuFragment extends Fragment implements View.OnClickListener {

    private static final String TAG = MenuFragment.class.getSimpleName();

    private Button signOutButton, startMatchButton, checkGamesButton, quickMatchButton;
    private MobileMainActivity mActivity;

    private OnMenuFragmentInteractionListener mListener;

    // Client used to interact with Google APIs
    private GoogleApiClient mGoogleApiClient;

    @Override
    public void onAttach(Activity activity) {

        super.onAttach(activity);

        mActivity = (MobileMainActivity) activity;

        try {
            mListener = (OnMenuFragmentInteractionListener) mActivity;

        } catch (ClassCastException ex) {

            LogUtil.w(TAG, TAG + " ClassCastException");
            LogUtil.e(TAG, Log.getStackTraceString(ex));

            throw new ClassCastException(activity.toString() + " must implement OnFragmentInteractionListener");
        }

            // Get the Google API Client instance
        mGoogleApiClient = GoogleApiClientManager.getInstance(mActivity);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        Log.d(TAG,  TAG + " onCreateView() method");

        View v = inflater.inflate(R.layout.fragment_menu, container, false);

        signOutButton = (Button) v.findViewById(R.id.sign_out_button);
        startMatchButton = (Button) v.findViewById(R.id.start_match_button);
        checkGamesButton = (Button) v.findViewById(R.id.check_games_button);
        quickMatchButton = (Button) v.findViewById(R.id.quick_match_button);
        signOutButton.setOnClickListener(this);
        startMatchButton.setOnClickListener(this);
        checkGamesButton.setOnClickListener(this);
        quickMatchButton.setOnClickListener(this);
        return v;
    }

    @Override
    public void onClick(View v) {

        switch (v.getId()) {

            case(R.id.start_match_button): {

                mListener.onStartMatchClicked();

            } break;

            case(R.id.sign_out_button): {

                mListener.onSignOutClicked();

            } break;

            case(R.id.check_games_button): {

                mListener.onCheckGamesClicked();

            } break;
        }
    }

    /**
     * This interface must be implemented by activities that contain this
     * fragment to allow an interaction in this fragment to be communicated
     * to the activity and potentially other fragments contained in that
     * activity.
     */
    public interface OnMenuFragmentInteractionListener {

        public void onSignOutClicked();
        public void onStartMatchClicked();
        public void onCheckGamesClicked();
    }

}




Java Source Code List

com.google.example.games.basegameutils.BaseGameActivity.java
com.google.example.games.basegameutils.BaseGameUtils.java
com.google.example.games.basegameutils.GameHelperUtils.java
com.google.example.games.basegameutils.GameHelper.java
com.mariux.teleport.lib.ApplicationTest.java
com.mariux.teleport.lib.TeleportClient.java
com.mariux.teleport.lib.TeleportService.java
org.gdg.bari.entities.ApplicationTest.java
org.gdg.bari.entities.Card.java
org.gdg.bari.entities.Constants.java
org.gdg.bari.entities.Deck.java
org.gdg.bari.entities.Score.java
org.gdg.bari.entities.TableTurn.java
org.gdg.bari.entities.Table.java
org.gdg.bari.entities.TeleportClientManager.java
org.gdg.bari.scopone.ApplicationTest.java
org.gdg.bari.scopone.activity.MobileGameActivity.java
org.gdg.bari.scopone.activity.MobileMainActivity.java
org.gdg.bari.scopone.activity.WearConfirmationActivity.java
org.gdg.bari.scopone.activity.WearMainActivity.java
org.gdg.bari.scopone.fragment.CardListFragment.java
org.gdg.bari.scopone.fragment.GameFragment.java
org.gdg.bari.scopone.fragment.LoginFragment.java
org.gdg.bari.scopone.fragment.MenuFragment.java
org.gdg.bari.scopone.service.MobileTeleportService.java
org.gdg.bari.scopone.services.WearTeleportService.java
org.gdg.bari.scopone.util.GoogleApiClientManager.java
org.gdg.bari.scopone.util.LogUtil.java