本文整理汇总了Java中com.slidingmenu.lib.SlidingMenu类的典型用法代码示例。如果您正苦于以下问题:Java SlidingMenu类的具体用法?Java SlidingMenu怎么用?Java SlidingMenu使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SlidingMenu类属于com.slidingmenu.lib包,在下文中一共展示了SlidingMenu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configSlidingMenu
import com.slidingmenu.lib.SlidingMenu; //导入依赖的package包/类
private void configSlidingMenu(boolean phone) {
SlidingMenu slidingMenu = getSlidingMenu();
slidingMenu.setShadowWidthRes(R.dimen.shadow_width);
slidingMenu.setShadowDrawable(R.drawable.shadow);
if (phone)
slidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
else
slidingMenu.setBehindOffset(Utility.getScreenWidth());
slidingMenu.setFadeDegree(0.35f);
slidingMenu.setOnPageScrollListener(new SlidingMenu.OnPageScrollListener() {
@Override
public void onPageScroll() {
LongClickableLinkMovementMethod.getInstance().setLongClickable(false);
(getFriendsTimeLineFragment()).clearActionMode();
}
});
slidingMenu.setOnClosedListener(new SlidingMenu.OnClosedListener() {
@Override
public void onClosed() {
LongClickableLinkMovementMethod.getInstance().setLongClickable(true);
LocalBroadcastManager.getInstance(MainTimeLineActivity.this).sendBroadcast(new Intent(AppEventAction.SLIDING_MENU_CLOSED_BROADCAST));
}
});
}
示例2: showMentionPage
import com.slidingmenu.lib.SlidingMenu; //导入依赖的package包/类
private boolean showMentionPage(boolean reset) {
if (currentIndex == MENTIONS_INDEX && !reset) {
((MainTimeLineActivity) getActivity()).getSlidingMenu().showContent();
return true;
}
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
currentIndex = MENTIONS_INDEX;
if (Utility.isDevicePort() && !reset) {
BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
LocalBroadcastManager.getInstance(getActivity()).unregisterReceiver(this);
if (currentIndex == MENTIONS_INDEX)
showMentionPageImp();
}
};
LocalBroadcastManager.getInstance(getActivity()).registerReceiver(receiver, new IntentFilter(AppEventAction.SLIDING_MENU_CLOSED_BROADCAST));
} else {
showMentionPageImp();
}
((MainTimeLineActivity) getActivity()).getSlidingMenu().showContent();
return false;
}
示例3: onCreate
import com.slidingmenu.lib.SlidingMenu; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSlidingMenu().setMode(SlidingMenu.LEFT_RIGHT);
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
setContentView(R.layout.content_frame);
getSupportFragmentManager().beginTransaction()
.replace(R.id.content_frame, new SampleListFragment()).commit();
getSlidingMenu().setSecondaryMenu(R.layout.properties);
getSlidingMenu().setSecondaryShadowDrawable(R.drawable.shadowright);
getSupportFragmentManager().beginTransaction()
.replace(R.id.menu_frame_two, new SampleListFragment())
.commit();
}
示例4: onCreate
import com.slidingmenu.lib.SlidingMenu; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set the Above View
if (savedInstanceState != null)
mContent = getSupportFragmentManager().getFragment(
savedInstanceState, "mContent");
if (mContent == null)
mContent = new ColorFragment(R.color.red);
// set the Above View
setContentView(R.layout.content_frame);
getSupportFragmentManager().beginTransaction()
.replace(R.id.content_frame, mContent).commit();
// set the Behind View
setBehindContentView(R.layout.menu_frame);
getSupportFragmentManager().beginTransaction()
.replace(R.id.menu_frame, new ColorMenuFragment()).commit();
// customize the SlidingMenu
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
}
示例5: onCreate
import com.slidingmenu.lib.SlidingMenu; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(R.string.attach);
// set the Above View
setContentView(R.layout.content_frame);
getSupportFragmentManager().beginTransaction()
.replace(R.id.content_frame, new SampleListFragment()).commit();
// configure the SlidingMenu
menu = new SlidingMenu(this);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidthRes(R.dimen.shadow_width);
menu.setShadowDrawable(R.drawable.shadow);
menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
menu.setFadeDegree(0.35f);
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setMenu(R.layout.menu_frame);
getSupportFragmentManager().beginTransaction()
.replace(R.id.menu_frame, new SampleListFragment()).commit();
}
示例6: onCreate
import com.slidingmenu.lib.SlidingMenu; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(mTitleRes);
// set the Behind View
setBehindContentView(R.layout.menu_frame);
FragmentTransaction t = this.getSupportFragmentManager().beginTransaction();
mFrag = new SampleListFragment();
t.replace(R.id.menu_frame, mFrag);
t.commit();
// customize the SlidingMenu
SlidingMenu sm = getSlidingMenu();
// Test
sm.setSecondaryMenu(R.layout.properties);
sm.setShadowWidthRes(R.dimen.shadow_width);
sm.setShadowDrawable(R.drawable.shadow);
sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
sm.setFadeDegree(0.35f);
sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
示例7: onKeyUp
import com.slidingmenu.lib.SlidingMenu; //导入依赖的package包/类
/**
* 监听返回--是否退出程序
*/
public boolean onKeyUp(int keyCode, KeyEvent event) {
SlidingMenu sm = getSlidingMenu();
if (keyCode == KeyEvent.KEYCODE_BACK
&& !sm.isMenuShowing()) {
showMenu();
// if(cur_selected == R.id.toHome){
// AppTool.showDialog(MainActivity2.this,
// new ExitButtonClickListener(), "您确定要退出吗?");
// } else {
//
// }
} else if (keyCode == KeyEvent.KEYCODE_BACK && sm.isMenuShowing()) {
showContent();
}
return true;
}
示例8: onCreate
import com.slidingmenu.lib.SlidingMenu; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set the Behind View
setBehindContentView(R.layout.menu_frame);
FragmentTransaction t = this.getSupportFragmentManager()
.beginTransaction();
mFrag = new LeftMenuFragment();
t.replace(R.id.menu_frame, mFrag);
t.commit();
// customize the SlidingMenu
SlidingMenu sm = getSlidingMenu();
sm.setShadowWidthRes(R.dimen.shadow_width);
sm.setShadowDrawable(R.drawable.shadow);
sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
sm.setFadeDegree(0.35f);
sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
}
示例9: onCreate
import com.slidingmenu.lib.SlidingMenu; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set the Above View
if ( savedInstanceState != null )
mainFg = getSupportFragmentManager().getFragment(savedInstanceState, "mContent");
if ( mainFg == null )
mainFg = Fragment.instantiate(getBaseContext(), MainHomeFragment.class.getName(), null);
// set the Above View
getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, mainFg).commit();
// set the Behind View
setBehindContentView(R.layout.menu_frame);
getSupportFragmentManager().beginTransaction().replace(R.id.menu_frame, new LeftMenuFragment()).commit();
// customize the SlidingMenu
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
getSlidingMenu().setFadeDegree(1.0f);
}
示例10: onCreate
import com.slidingmenu.lib.SlidingMenu; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getSlidingMenu().setMode(SlidingMenu.LEFT_RIGHT);
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
setContentView(R.layout.content_frame);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_frame, new SampleListFragment())
.commit();
getSlidingMenu().setSecondaryMenu(R.layout.menu_frame_two);
getSlidingMenu().setSecondaryShadowDrawable(R.drawable.shadowright);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.menu_frame_two, new SampleListFragment())
.commit();
}
示例11: onCreate
import com.slidingmenu.lib.SlidingMenu; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// set the Above View
if (savedInstanceState != null)
mContent = getSupportFragmentManager().getFragment(savedInstanceState, "mContent");
if (mContent == null)
mContent = new ColorFragment(R.color.red);
// set the Above View
setContentView(R.layout.content_frame);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_frame, mContent)
.commit();
// set the Behind View
setBehindContentView(R.layout.menu_frame);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.menu_frame, new ColorMenuFragment())
.commit();
// customize the SlidingMenu
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
}
示例12: onPostCreate
import com.slidingmenu.lib.SlidingMenu; //导入依赖的package包/类
/**
* Further SlidingMenu initialization. Should be called within the activitiy's onPostCreate()
*
* @param savedInstanceState the saved instance state (unused)
*/
public void onPostCreate(Bundle savedInstanceState) {
if (mViewBehind == null || mViewAbove == null) {
throw new IllegalStateException("Both setBehindContentView must be called " +
"in onCreate in addition to setContentView.");
}
mOnPostCreateCalled = true;
mSlidingMenu.attachToActivity(mActivity,
mEnableSlide ? SlidingMenu.SLIDING_WINDOW : SlidingMenu.SLIDING_CONTENT);
final boolean open;
final boolean secondary;
if (savedInstanceState != null) {
open = savedInstanceState.getBoolean("SlidingActivityHelper.open");
secondary = savedInstanceState.getBoolean("SlidingActivityHelper.secondary");
} else {
open = false;
secondary = false;
}
new Handler().post(new Runnable() {
public void run() {
if (open) {
if (secondary) {
mSlidingMenu.showSecondaryMenu(false);
} else {
mSlidingMenu.showMenu(false);
}
} else {
mSlidingMenu.showContent(false);
}
}
});
}
示例13: onPostCreate
import com.slidingmenu.lib.SlidingMenu; //导入依赖的package包/类
/**
* Further SlidingMenu initialization. Should be called within the activitiy's onPostCreate()
*
* @param savedInstanceState the saved instance state (unused)
*/
public void onPostCreate(Bundle savedInstanceState) {
if (mViewBehind == null || mViewAbove == null) {
throw new IllegalStateException("Both setBehindContentView must be called " +
"in onCreate in addition to setContentView.");
}
mOnPostCreateCalled = true;
mSlidingMenu.attachToActivity(mActivity,
mEnableSlide ? SlidingMenu.SLIDING_WINDOW : SlidingMenu.SLIDING_CONTENT);
final boolean open;
final boolean secondary;
if (savedInstanceState != null) {
open = savedInstanceState.getBoolean("SlidingActivityHelper.open");
secondary = savedInstanceState.getBoolean("SlidingActivityHelper.secondary");
} else {
open = false;
secondary = false;
}
new Handler().post(new Runnable() {
public void run() {
if (open) {
if (secondary) {
mSlidingMenu.showSecondaryMenu(false);
} else {
mSlidingMenu.showMenu(false);
}
} else {
mSlidingMenu.showContent(false);
}
}
});
}
示例14: buildPhoneInterface
import com.slidingmenu.lib.SlidingMenu; //导入依赖的package包/类
private void buildPhoneInterface(Bundle savedInstanceState) {
setBehindContentView(R.layout.menu_frame);
getSlidingMenu().setSlidingEnabled(true);
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
getActionBar().setDisplayHomeAsUpEnabled(true);
getSlidingMenu().setMode(SlidingMenu.LEFT);
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
}
示例15: showHomePage
import com.slidingmenu.lib.SlidingMenu; //导入依赖的package包/类
private boolean showHomePage(boolean reset) {
if (currentIndex == HOME_INDEX && !reset) {
((MainTimeLineActivity) getActivity()).getSlidingMenu().showContent();
return true;
}
getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
currentIndex = HOME_INDEX;
if (Utility.isDevicePort() && !reset) {
BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
LocalBroadcastManager.getInstance(getActivity()).unregisterReceiver(this);
if (currentIndex == HOME_INDEX)
showHomePageImp();
}
};
LocalBroadcastManager.getInstance(getActivity()).registerReceiver(receiver, new IntentFilter(AppEventAction.SLIDING_MENU_CLOSED_BROADCAST));
} else {
showHomePageImp();
}
((MainTimeLineActivity) getActivity()).getSlidingMenu().showContent();
return false;
}