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; // w w w .j a v a2 s .co m import java.io.File; import java.util.Arrays; import android.app.ActionBar; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.Environment; import android.os.storage.StorageManager; import android.view.KeyEvent; import android.view.MenuItem; import com.binkery.app.filemanager.utils.Logs; import com.binkery.app.filemanager.widget.SlidingMenuItem; import com.binkery.app.filemanager.widget.SlidingMenuView; import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; public class MainActivity extends Activity { private static final String TAG = MainActivity.class.getSimpleName(); private BaseFragment mCurrentFragment = null; private SlidingMenu mSlidingMenu = null; private SlidingMenuController mMenuControll = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.act_main); ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); mSlidingMenu = new SlidingMenu(this); mSlidingMenu.setMode(SlidingMenu.LEFT); mSlidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); mSlidingMenu.setShadowWidthRes(R.dimen.shadow_width); mSlidingMenu.setShadowDrawable(R.drawable.shadow); mSlidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset); mSlidingMenu.setFadeDegree(0.35f); mSlidingMenu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT); SlidingMenuView menu = new SlidingMenuView(this); mMenuControll = new SlidingMenuController(this, menu); menu.setMenuController(mMenuControll); mSlidingMenu.setMenu(menu); mMenuControll.initMenuView(); mMenuControll.setSelectedIndex(SlidingMenuItem.Menu.ENTER); } public SlidingMenu getSlidingMenu(){ return mSlidingMenu; } public void setOnKeyBackListener(BaseFragment fragment) { mCurrentFragment = fragment; } @Override public boolean onOptionsItemSelected(MenuItem item) { Logs.i(TAG, "onOptionsItemSelected"); switch (item.getItemId()) { case android.R.id.home: if (mSlidingMenu != null) { mSlidingMenu.toggle(); return true; } } return super.onOptionsItemSelected(item); } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (mCurrentFragment.onKeyBack()) { return true; } getFragmentManager().popBackStack(); int count = getFragmentManager().getBackStackEntryCount(); if (count == 0) { finish(); return true; } return false; } return super.onKeyUp(keyCode, event); } }