Android Open Source - Android_Yellow_Pages_App_TDD Home Fragment






From Project

Back to project page Android_Yellow_Pages_App_TDD.

License

The source code is released under:

Apache License

If you think the Android project Android_Yellow_Pages_App_TDD 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 com.tddrampup.fragments;
// www. j  a va  2s .  co  m
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;

import com.tddrampup.R;

import roboguice.fragment.RoboFragment;

/**
 * Created by WX009-PC on 2/19/14.
 */
public class HomeFragment extends RoboFragment {

    public onItemClickedListener mListener;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

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

        final Button listButton = (Button) rootView.findViewById(R.id.list_button);
        final Button mapButton = (Button) rootView.findViewById(R.id.map_button);
        final Button searchButton = (Button) rootView.findViewById(R.id.search_button);
        final EditText what = (EditText) rootView.findViewById(R.id.what_editText);
        final EditText where = (EditText) rootView.findViewById(R.id.where_editText);

        listButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                mListener.onListButtonClicked();
            }
        });
        mapButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                mListener.onMapButtonClicked();
            }
        });
        searchButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                mListener.onSearchButtonClicked();
            }
        });
        searchButton.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
                what.setText("Restaurants");
                where.setText("Toronto");
                return false;
            }
        });

        return rootView;
    }

    public interface onItemClickedListener {
        public void onListButtonClicked();
        public void onMapButtonClicked();
        public void onSearchButtonClicked();
     }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        if (activity instanceof onItemClickedListener) {
            mListener = (onItemClickedListener) activity;
        }
    }

    @Override
    public void onDetach() {
        super.onDetach();
        mListener = null;
    }
}




Java Source Code List

android.UnusedStub.java
com.tddrampup.ApplicationModule.java
com.tddrampup.YellowApplication.java
com.tddrampup.activities.MainActivity.java
com.tddrampup.adapters.ListingAdapter.java
com.tddrampup.factories.CameraUpdateFactoryWrapperInterface.java
com.tddrampup.factories.CameraUpdateFactoryWrapper.java
com.tddrampup.factories.MarkerOptionsFactoryWrapperInterface.java
com.tddrampup.factories.MarkerOptionsFactoryWrapper.java
com.tddrampup.fragments.DetailFragment.java
com.tddrampup.fragments.GoogleMapFragment.java
com.tddrampup.fragments.HomeFragment.java
com.tddrampup.fragments.ListFragment.java
com.tddrampup.models.Address.java
com.tddrampup.models.GeoCode.java
com.tddrampup.models.Keywords.java
com.tddrampup.models.Listing.java
com.tddrampup.models.Phone.java
com.tddrampup.models.Products.java
com.tddrampup.models.Profile.java
com.tddrampup.models.Summary.java
com.tddrampup.models.YellowResponse.java
com.tddrampup.serviceLayers.VolleyServiceLayerCallback.java
com.tddrampup.serviceLayers.VolleyServiceLayer.java
com.tddrampup.singletons.ListingsInterface.java
com.tddrampup.singletons.Listings.java
com.tddrampup.views.MapView.java