Back to project page filemanager.
The source code is released under:
MIT License
If you think the Android project filemanager listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.binkery.app.filemanager.widget; // w w w. ja va 2 s .co m import java.util.List; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.widget.ScrollView; import com.binkery.app.filemanager.R; import com.binkery.app.filemanager.SlidingMenuController; import com.binkery.app.filemanager.utils.Logs; public class SlidingMenuView extends ScrollView implements OnClickListener { private static final String TAG = SlidingMenuView.class.getSimpleName(); private SlidingMenuController mController = null; private View mSdcardView = null; private static final int[] ITEM_IDS = new int[] { R.id.sm_menu_about, R.id.sm_menu_device_info, R.id.sm_menu_enter, R.id.sm_menu_music, R.id.sm_menu_photo, R.id.sm_menu_sdcard, R.id.sm_menu_setting, R.id.sm_menu_video }; public SlidingMenuView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public SlidingMenuView(Context context, AttributeSet attrs) { super(context, attrs); LayoutInflater.from(context).inflate(R.layout.view_slidingmenu, this, true); Logs.i(TAG, "SlidingMenuView(,)"); for (int id : ITEM_IDS) { View view = findViewById(id); view.setOnClickListener(this); } mSdcardView = findViewById(R.id.sm_menu_sdcard); } public SlidingMenuView(Context context) { this(context, null); } public void setMenuController(SlidingMenuController controller) { mController = controller; } @Override public void onClick(View v) { if (mController == null) { return; } Logs.i(TAG, "view id = " + v.getId()); int id = v.getId(); switch (id) { case R.id.sm_menu_about: mController.setSelectedIndex(SlidingMenuItem.Menu.ABOUT); break; case R.id.sm_menu_device_info: mController.setSelectedIndex(SlidingMenuItem.Menu.DEVCIES); break; case R.id.sm_menu_enter: mController.setSelectedIndex(SlidingMenuItem.Menu.ENTER); break; case R.id.sm_menu_music: mController.setSelectedIndex(SlidingMenuItem.Menu.MUSIC); break; case R.id.sm_menu_photo: mController.setSelectedIndex(SlidingMenuItem.Menu.PHOTO); break; case R.id.sm_menu_sdcard: mController.setSelectedIndex(SlidingMenuItem.Menu.SDCARD); break; case R.id.sm_menu_setting: mController.setSelectedIndex(SlidingMenuItem.Menu.SETTING); break; case R.id.sm_menu_video: mController.setSelectedIndex(SlidingMenuItem.Menu.VIDEO); break; } } public void showSdcard(List<String> sdcards) { if (sdcards == null || sdcards.size() == 0) { mSdcardView.setVisibility(View.GONE); return; } mSdcardView.setVisibility(View.VISIBLE); } }