android.support.v4.widget.SlidingPaneLayout Java Examples

The following examples show how to use android.support.v4.widget.SlidingPaneLayout. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SlidingPaneLayoutActivity.java    From V.FlyoutTest with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.sliding_pane_layout);

    mSlidingLayout = (SlidingPaneLayout) findViewById(R.id.sliding_pane_layout);
    mList = (ListView) findViewById(R.id.left_pane);
    mContent = (TextView) findViewById(R.id.content_text);

    mSlidingLayout.setPanelSlideListener(new SliderListener());
    mSlidingLayout.openPane();

    mList.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
            Shakespeare.TITLES));
    mList.setOnItemClickListener(new ListItemClickListener());

    mActionBar = createActionBarHelper();
    mActionBar.init();

    mSlidingLayout.getViewTreeObserver().addOnGlobalLayoutListener(new FirstLayoutListener());
}
 
Example #2
Source File: MainActivity.java    From KlyphMessenger with MIT License 6 votes vote down vote up
private void setPortraitMode()
{
	SlidingPaneLayout.LayoutParams params = (SlidingPaneLayout.LayoutParams) rightContainer.getLayoutParams();
	params.width = KlyphDevice.getDeviceWidth();// rightContainerWidth;
	// params.leftMargin = paddingLeft;
	params.rightMargin = 0;
	rightContainer.setLayoutParams(params);

	params = (SlidingPaneLayout.LayoutParams) leftContainer.getLayoutParams();
	params.width = leftContainerWidth;
	params.leftMargin = 0;
	params.rightMargin = 0;
	leftContainer.setLayoutParams(params);

	slidingPane.requestLayout();
}
 
Example #3
Source File: UserActivity.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
private void initViews(Bundle savedInstanceState) {
    mSlidingPane = (SlidingPaneLayout) findViewById(R.id.sliding_pane);
    mSlidingPane.setShadowResource(R.drawable.drawer_shadow);
    if (savedInstanceState == null) {

        getSupportFragmentManager().beginTransaction().add(R.id.pane1, UserFragment.newInstance(mUsername), "pane1").commit();
        getSupportFragmentManager().beginTransaction().add(R.id.pane2, UserActionsFragment.newInstance(mUsername, UserActionsFragment.TYPE_ALL), "pane1").commit();
    }
    mSlidingPane.openPane();
}
 
Example #4
Source File: ComposeTweetActivity.java    From catnut with MIT License 5 votes vote down vote up
private void injectLayout() {
	// for panel
	mSlidingPaneLayout = (SlidingPaneLayout) findViewById(R.id.sliding_pane_layout);
	mEmotions = (GridView) findViewById(R.id.emotions);
	mEmotions.setAdapter(new EmotionsAdapter(this));
	mEmotions.setOnItemClickListener(this);
	mSlidingPaneLayout.setPanelSlideListener(new SliderListener());
	mSlidingPaneLayout.openPane();
	mSlidingPaneLayout.getViewTreeObserver().addOnGlobalLayoutListener(new FirstLayoutListener());
	// for tweet
	mAvatar = (ImageView) findViewById(R.id.avatar);
	mScreenName = (TextView) findViewById(R.id.screen_name);
	mText = (EditText) findViewById(R.id.text);
	mLocationMarker = findViewById(R.id.location_marker);
	// set data to layout...
	new AsyncQueryHandler(getContentResolver()) {
		@Override
		protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
			if (cursor.moveToNext()) {
				Picasso.with(ComposeTweetActivity.this)
						.load(cursor.getString(cursor.getColumnIndex(User.avatar_large)))
						.placeholder(R.drawable.error)
						.error(R.drawable.error)
						.into(mAvatar);
				mScreenName.setText("@" + cursor.getString(cursor.getColumnIndex(User.screen_name)));
			}
			cursor.close();
		}
	}.startQuery(0, null,
			CatnutProvider.parse(User.MULTIPLE, mApp.getAccessToken().uid),
			new String[]{User.avatar_large, User.screen_name}, null, null, null);
	// other stuffs...
	mText.addTextChangedListener(this);
}
 
Example #5
Source File: SupportCoreUiDSL.java    From anvil with MIT License 4 votes vote down vote up
public static BaseDSL.ViewClassResult slidingPaneLayout() {
  return BaseDSL.v(SlidingPaneLayout.class);
}
 
Example #6
Source File: SupportCoreUiDSL.java    From anvil with MIT License 4 votes vote down vote up
public static Void slidingPaneLayout(Anvil.Renderable r) {
  return BaseDSL.v(SlidingPaneLayout.class, r);
}
 
Example #7
Source File: SupportCoreUiDSL.java    From anvil with MIT License 4 votes vote down vote up
public static Void panelSlideListener(SlidingPaneLayout.PanelSlideListener arg) {
  return BaseDSL.attr("panelSlideListener", arg);
}
 
Example #8
Source File: ParallaxSwipeBackActivity.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    //通过反射来改变SlidingPanelayout的值
    try {
        slidingPaneLayout = new SlidingPaneLayout(this);
        Field f_overHang = SlidingPaneLayout.class.getDeclaredField("mOverhangSize");
        f_overHang.setAccessible(true);
        f_overHang.set(slidingPaneLayout, 0);
        slidingPaneLayout.setPanelSlideListener(this);
        slidingPaneLayout.setSliderFadeColor(getResources().getColor(android.R.color.transparent));
    } catch (Exception e) {
        e.printStackTrace();
    }
    super.onCreate(savedInstanceState);
    mFileTemp = new File(getCacheDir(), WINDOWBITMAP);
    defaultTranslationX = dip2px(defaultTranslationX);
    shadowWidth = dip2px(shadowWidth);
    //behindframeLayout
    FrameLayout behindframeLayout = new FrameLayout(this);
    behindImageView = new ImageView(this);
    behindImageView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
    behindframeLayout.addView(behindImageView, 0);

    //containerLayout
    LinearLayout containerLayout = new LinearLayout(this);
    containerLayout.setOrientation(LinearLayout.HORIZONTAL);
    containerLayout.setBackgroundColor(getResources().getColor(android.R.color.transparent));
    containerLayout.setLayoutParams(new ViewGroup.LayoutParams(getWindowManager().getDefaultDisplay().getWidth() + shadowWidth, ViewGroup.LayoutParams.MATCH_PARENT));
    //you view container
    frameLayout = new FrameLayout(this);
    frameLayout.setBackgroundColor(getResources().getColor(android.R.color.white));
    frameLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT));

    //add shadow
    shadowImageView = new ImageView(this);
    shadowImageView.setBackgroundResource(R.drawable.parallax_swipe_back_shadow);
    shadowImageView.setLayoutParams(new LinearLayout.LayoutParams(shadowWidth, LinearLayout.LayoutParams.MATCH_PARENT));
    containerLayout.addView(shadowImageView);
    containerLayout.addView(frameLayout);
    containerLayout.setTranslationX(-shadowWidth);
    //添加两个view
    slidingPaneLayout.addView(behindframeLayout, 0);
    slidingPaneLayout.addView(containerLayout, 1);
}
 
Example #9
Source File: SlidingPaneLayoutAssert.java    From assertj-android with Apache License 2.0 4 votes vote down vote up
public SlidingPaneLayoutAssert(SlidingPaneLayout actual) {
  super(actual, SlidingPaneLayoutAssert.class);
}