Android Open Source - oidarSample Drawer List Item






From Project

Back to project page oidarSample.

License

The source code is released under:

GNU General Public License

If you think the Android project oidarSample 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.oidar.model;
/*  w  w w .  jav  a 2s .  co  m*/
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

/**
 * Object used for displaying various list items.
 */
public class DrawerListItem implements Parcelable {
    private final String mTitle;
    private final String mSubtitle;
    private final int mIconRes;
    private final ListItemType mType;

    /**
     * Constructor.
     */
    public DrawerListItem(ListItemType type, String title, String subtitle, int iconRes) {
        mType = type;
        mTitle = title;
        mSubtitle = subtitle;
        mIconRes = iconRes;
    }

    /**
     * Return the type.
     */
    public ListItemType getType() {
        return mType;
    }

    /**
     * Return the title.
     */
    public String getTitle() {
        return mTitle;
    }

    /**
     * Return the subtitle.
     */
    public String getSubtitle() {
        return mSubtitle;
    }

    /**
     * Return the icon resource.
     */
    public int getIconRes() {
        return mIconRes;
    }

    /**
     * Return if the item has a subtitle.
     */
    public boolean hasSubtitle() {
        return !TextUtils.isEmpty(mSubtitle);
    }

    /**
     * Used for parcelable.
     */
    protected DrawerListItem(Parcel in) {
        mTitle = in.readString();
        mSubtitle = in.readString();
        mIconRes = in.readInt();
        mType = (ListItemType) in.readValue(ListItemType.class.getClassLoader());
    }

    /**
     * Used for parcelable.
     */
    @Override
    public int describeContents() {
        return 0;
    }

    /**
     * Used for parcelable.
     */
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(mTitle);
        dest.writeString(mSubtitle);
        dest.writeInt(mIconRes);
        dest.writeValue(mType);
    }

    /**
     * Used for parcelable.
     */
    @SuppressWarnings("unused")
    public static final Parcelable.Creator<DrawerListItem>
            CREATOR = new Parcelable.Creator<DrawerListItem>() {
        @Override
        public DrawerListItem createFromParcel(Parcel in) {
            return new DrawerListItem(in);
        }

        @Override
        public DrawerListItem[] newArray(int size) {
            return new DrawerListItem[size];
        }
    };
}




Java Source Code List

com.oidar.ApplicationTest.java
com.oidar.activity.MainActivity.java
com.oidar.activity.SettingsActivity.java
com.oidar.activity.base.BaseActivity.java
com.oidar.adapter.DrawerAdapter.java
com.oidar.adapter.DrawerLiveNewsAdapter.java
com.oidar.adapter.DrawerTalkRadioAdapter.java
com.oidar.animation.CustomObjectAnimator.java
com.oidar.animation.DepthPageTransformer.java
com.oidar.animation.ZoomOutPageTransformer.java
com.oidar.fragment.AboutFragment.java
com.oidar.fragment.DrawerLiveNewsFragment.java
com.oidar.fragment.DrawerTalkRadioFragment.java
com.oidar.fragment.FeedbackFragment.java
com.oidar.fragment.LiveNewsFragment.java
com.oidar.fragment.SettingsFragment.java
com.oidar.fragment.TalkRadioFragment.java
com.oidar.fragment.base.DrawerFragment.java
com.oidar.fragment.base.RadioFragment.java
com.oidar.model.DrawerListItem.java
com.oidar.model.ListItemType.java
com.oidar.model.Radio.java
com.oidar.sql.SqlHandler.java
com.oidar.util.Constants.java
com.oidar.util.MathHelper.java
com.oidar.util.MyLog.java
com.oidar.util.OIDARConstants.java
com.oidar.util.PreferenceUtil.java
com.oidar.util.StringHelper.java
com.oidar.util.Util.java
com.oidar.view.CustomDrawerLayout.java