Android Open Source - slidingdebugmenu Module Spinner Property






From Project

Back to project page slidingdebugmenu.

License

The source code is released under:

Apache License

If you think the Android project slidingdebugmenu 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 co.lemonlabs.android.slidingdebugmenu.views;
/*  www  . ja  va2  s . c o  m*/
import android.content.Context;
import android.view.LayoutInflater;
import android.widget.AdapterView;
import android.widget.FrameLayout;
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.TextView;

import co.lemonlabs.android.slidingdebugmenu.R;

/**
 * A ModuleProperty containing a TextView label
 * and a Spinner
 * <p/>
 * Created by balysv on 13/01/14.
 * www.lemonlabs.co
 */
public class ModuleSpinnerProperty extends FrameLayout {

    private TextView mPropertyName;
    private Spinner mPropertySpinner;

    public ModuleSpinnerProperty(Context context, String propertyName) {
        this(context);
        setPropertyName(propertyName);
    }

    public ModuleSpinnerProperty(Context context, int propertyResId) {
        this(context);
        setPropertyName(propertyResId);
    }

    public ModuleSpinnerProperty(Context context) {
        super(context);
        inflate();
    }

    private void inflate() {
        LayoutInflater.from(getContext()).inflate(R.layout.sdm__module_property_spinner, this, true);
        mPropertyName = (TextView) findViewById(R.id.sdm__module_property_name);
        mPropertySpinner = (Spinner) findViewById(R.id.sdm__module_property_spinner);
    }

    /**
     * Set name of property
     *
     * @param name
     */
    public void setPropertyName(String name) {
        mPropertyName.setText(name);
    }

    /**
     * Set name of property
     *
     * @param resId
     */
    public void setPropertyName(int resId) {
        mPropertyName.setText(resId);
    }

    /**
     * Set Adapter for Spinner
     *
     * @param adapter
     */
    public void setSpinnerAdapter(SpinnerAdapter adapter) {
        mPropertySpinner.setAdapter(adapter);
    }

    /**
     * Set Spinner Item Selected callback
     *
     * @param listener
     */
    public void setOnSpinnerItemSelectedListener(AdapterView.OnItemSelectedListener listener) {
        mPropertySpinner.setOnItemSelectedListener(listener);
    }

    /**
     * Get the Spinner associated with this property
     *
     * @return
     */
    public Spinner getPropertySpinner() {
        return mPropertySpinner;
    }
}




Java Source Code List

co.lemonlabs.android.slidingdebugmenu.SlidingDebugMenuModule.java
co.lemonlabs.android.slidingdebugmenu.SlidingDebugMenu.java
co.lemonlabs.android.slidingdebugmenu.controllers.LocationController.java
co.lemonlabs.android.slidingdebugmenu.controllers.NetworkController.java
co.lemonlabs.android.slidingdebugmenu.demo.DemoActivity.java
co.lemonlabs.android.slidingdebugmenu.demo.DemoModule.java
co.lemonlabs.android.slidingdebugmenu.demo.LocaleModule.java
co.lemonlabs.android.slidingdebugmenu.modules.BuildModule.java
co.lemonlabs.android.slidingdebugmenu.modules.LocationModule.java
co.lemonlabs.android.slidingdebugmenu.modules.LogModule.java
co.lemonlabs.android.slidingdebugmenu.modules.MenuModule.java
co.lemonlabs.android.slidingdebugmenu.modules.NetworkModule.java
co.lemonlabs.android.slidingdebugmenu.modules.events.LocationEvent.java
co.lemonlabs.android.slidingdebugmenu.modules.events.NetworkChangeEvent.java
co.lemonlabs.android.slidingdebugmenu.receivers.NetworkReceiver.java
co.lemonlabs.android.slidingdebugmenu.util.Log.java
co.lemonlabs.android.slidingdebugmenu.views.ModuleSimpleProperty.java
co.lemonlabs.android.slidingdebugmenu.views.ModuleSpinnerProperty.java
co.lemonlabs.android.slidingdebugmenu.views.ModuleTitle.java