Android Open Source - iPhoroidUI-demo Options Menu Util






From Project

Back to project page iPhoroidUI-demo.

License

The source code is released under:

Apache License

If you think the Android project iPhoroidUI-demo 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

/*
 * Copyright (c) 2011 by KLab Inc., All rights reserved.
 *//w  w  w.j a  va 2  s.  c  o m
 * Programmed by iphoroid team
 */

package org.klab.ui_demo;

import org.klab.iphoroid.R;

import android.content.Context;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;


/**
 * OptionsMenuUtil. 
 *
 * @author <a href="mailto:kodama-t@klab.jp">Takuya KODAMA</a> (kodamta-t)
 * @author <a href="mailto:sano-n@klab.jp">Naohide Sano</a> (sano-n)
 */
public abstract class OptionsMenuUtil {

    public static interface OnReloadMenuItemCkickListener {
        void onReloadMenuItemCkick();
    }

    /** */
    public static void createOptionsMenu(final Context context, Menu menu) {
        OnMenuItemClickListener listener = new OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
                switch (item.getItemId()) {
                case 0:
                    Intent i = new Intent(context, ListViewActivity.class);
                    context.startActivity(i);
                    break;
                case 1:
                    Intent j = new Intent(context, GridViewActivity.class);
                    context.startActivity(j);
                    break;
                case 2:
                    Intent k = new Intent(context, FlowViewAndCoverFlowActivity.class);
                    context.startActivity(k);
                    break;
                case 3:
                    Intent l = new Intent(context, FlowViewAndCoverFlowActivity.class);
                    context.startActivity(l);
                    break;
                }
                return false;
            }
        };
        menu.add(0, 0, 0, context.getResources().getString(R.string.activity_listview)).setIcon(R.drawable.menu_icon_list).setOnMenuItemClickListener(listener);
        menu.add(0, 1, 0, context.getResources().getString(R.string.activity_gridview)).setIcon(R.drawable.menu_icon_grid).setOnMenuItemClickListener(listener);
        menu.add(0, 2, 0, context.getResources().getString(R.string.activity_flowview)).setIcon(R.drawable.menu_icon_slaidshow).setOnMenuItemClickListener(listener);
        menu.add(0, 3, 0, context.getResources().getString(R.string.activity_coverflow)).setIcon(R.drawable.menu_icon_coverflow).setOnMenuItemClickListener(listener);
    }
}




Java Source Code List

org.klab.ui_demo.CoverFlowImageAdapter.java
org.klab.ui_demo.FlowViewAndCoverFlowActivity.java
org.klab.ui_demo.FlowViewItemAdapter.java
org.klab.ui_demo.GridViewActivity.java
org.klab.ui_demo.GridViewItemAdapter.java
org.klab.ui_demo.ListViewActivity.java
org.klab.ui_demo.ListViewItemAdapter.java
org.klab.ui_demo.OptionsMenuUtil.java
org.klab.ui_demo.dao.ItemDao.java
org.klab.ui_demo.dao.ListViewItemDao.java
org.klab.ui_demo.model.Item.java
org.klab.ui_demo.net.HTTPClient.java