com.sothree.slidinguppanel.SlidingUpPanelLayout Java Examples

The following examples show how to use com.sothree.slidinguppanel.SlidingUpPanelLayout. 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: MainActivity.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
private void updateUiStartCompile() {
    if (mActionRun != null) mActionRun.setEnabled(false);
    if (mCompileProgress != null) mCompileProgress.setVisibility(View.VISIBLE);
    hideKeyboard();
    openDrawer(GravityCompat.START);

    mMessagePresenter.resume((JavaApplication) getApplication());
    mMessagePresenter.clear();
    mMessagePresenter.append("Compiling...\n");

    mContainerOutput.setPanelState(SlidingUpPanelLayout.PanelState.EXPANDED);
    mDiagnosticPresenter.clear();

    mBottomPage.setCurrentItem(0);

}
 
Example #2
Source File: MainActivity.java    From Musync with MIT License 6 votes vote down vote up
@Override
public void onBackPressed(){
    if(isSlidePanelOpen1==true){
        System.out.println("slidepanel back");
        isSlidePanelOpen1=false;
        slidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
    }
    else{
        if(currentPage==0){

        }
        else{
            viewPager.setCurrentItem(0,true);
        }
    }
}
 
Example #3
Source File: ScannerActivity.java    From attendee-checkin with Apache License 2.0 6 votes vote down vote up
@Override
public void onGlobalLayout() {
    SlidingUpPanelLayout.PanelState state = mPanelLayout.getPanelState();
    if (state == SlidingUpPanelLayout.PanelState.COLLAPSED) {
        for (int i = 1; i < mTabs.length; i++) {
            mTabs[i].setAlpha(0.f);
        }
        mTabs[0].setTextColor(mColorTabSelected);
        mTabs[0].setTranslationX(TIMELINE_TRANSLATION_X);
        ViewCompat.setTranslationZ(mTabLayout, 0);
        mTabLayout.setEnabled(false);
        mTabLayout.setTabIndicatorColor(Color.TRANSPARENT);
    } else if (state == SlidingUpPanelLayout.PanelState.EXPANDED) {
        for (int i = 1; i < mTabs.length; i++) {
            mTabs[i].setAlpha(1.f);
        }
        mTabs[0].setTranslationX(0.f);
        ViewCompat.setTranslationZ(mTabLayout, mToolbarElevation);
        mTabLayout.setEnabled(true);
        mTabLayout.setTabIndicatorColor(mColorTabIndicator);
    }
    mTabLayout.getViewTreeObserver().removeGlobalOnLayoutListener(this);
}
 
Example #4
Source File: LauncherActivity.java    From HgLauncher with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Listeners for touch receivers.
 */
private void addGestureListener() {
    // Handle touch events in touchReceiver.
    touchReceiver.setOnTouchListener(new GestureListener(this) {
        @Override
        public void onGesture(int direction) {
            if (slidingHome.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
                Utils.handleGestureActions(LauncherActivity.this, direction);
            }
        }

        @Override
        public void onLongPress() {
            // Show context menu when touchReceiver is long pressed when the panel is expanded.
            if (slidingHome.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
                touchReceiver.showContextMenu();
            }
        }
    });
}
 
Example #5
Source File: BaseActivity.java    From SkyTube with GNU General Public License v3.0 6 votes vote down vote up
private SlidingUpPanelLayout.PanelSlideListener getOnPanelDisplayed(final int position, final int duration) {
	return new SlidingUpPanelLayout.PanelSlideListener() {
		@Override
		public void onPanelSlide(View view, float v) {

		}

		@Override
		public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) {
			if (newState == SlidingUpPanelLayout.PanelState.COLLAPSED) {
				chromecastMiniControllerFragment.setDuration(duration);
				chromecastMiniControllerFragment.setProgress(position);
				chromecastControllerFragment.setDuration(duration);
				chromecastControllerFragment.setProgress(position);
				slidingLayout.removePanelSlideListener(this);
			}
		}
	};
}
 
Example #6
Source File: MainActivity.java    From Music-Player with GNU General Public License v3.0 6 votes vote down vote up
private void updateNavigationDrawerHeader() {
    if (!MusicPlayerRemote.getPlayingQueue().isEmpty()) {
        Song song = MusicPlayerRemote.getCurrentSong();
        if (navigationDrawerHeader == null) {
            navigationDrawerHeader = navigationView.inflateHeaderView(R.layout.navigation_drawer_header);
            //noinspection ConstantConditions
            navigationDrawerHeader.setOnClickListener(v -> {
                drawerLayout.closeDrawers();
                if (getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
                    expandPanel();
                }
            });
        }
        ((TextView) navigationDrawerHeader.findViewById(R.id.title)).setText(song.title);
        ((TextView) navigationDrawerHeader.findViewById(R.id.text)).setText(MusicUtil.getSongInfoString(song));
        SongGlideRequest.Builder.from(Glide.with(this), song)
                .checkIgnoreMediaStore(this).build()
                .into(((ImageView) navigationDrawerHeader.findViewById(R.id.image)));
    } else {
        if (navigationDrawerHeader != null) {
            navigationView.removeHeaderView(navigationDrawerHeader);
            navigationDrawerHeader = null;
        }
    }
}
 
Example #7
Source File: PictureFragment.java    From Tweetin with Apache License 2.0 6 votes vote down vote up
public void showProfile(String screenName) {
    if (screenName == null) {
        return;
    }

    if (profileTask != null && profileTask.getStatus() == AsyncTask.Status.RUNNING) {
        profileTask.cancel(true);
    }

    profile.findViewById(R.id.profile_progress_bar).setVisibility(View.VISIBLE);
    profile.findViewById(R.id.profile_all).setVisibility(View.GONE);

    slidingUpPanelLayout.setShadowHeight((int) ViewUnit.getElevation(getActivity(), 2));
    slidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.EXPANDED);

    profileTask = new ProfileTask(getActivity(), profile, screenName);
    profileTask.execute();
}
 
Example #8
Source File: SlidingUpPanelRotateActivity.java    From android-transition with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_slideup_actionbar_transparent);
    findViewById(R.id.content_bg).setVisibility(View.VISIBLE);
    findViewById(R.id.content_bg2).setVisibility(View.VISIBLE);

    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    final SlidingUpPanelLayout supl=((SlidingUpPanelLayout)findViewById(R.id.sliding_layout));

    //code to transit view
    mSlidingUpPanelLayoutAdapter = new SlidingUpPanelLayoutAdapter();
    ViewTransitionBuilder.transit(findViewById(R.id.content_bg)).rotationY(90).endRange(0.25f).id("BG").buildFor(mSlidingUpPanelLayoutAdapter);
    ViewTransitionBuilder.transit(findViewById(R.id.content_bg2)).rotationY(270, 360).range(0.25f, 0.5f).id("BG_2").buildFor(mSlidingUpPanelLayoutAdapter);
    ViewTransitionBuilder.transit(findViewById(R.id.toolbar)).alpha(0f).buildFor(mSlidingUpPanelLayoutAdapter);
    supl.addPanelSlideListener(mSlidingUpPanelLayoutAdapter);

    mSlidingUpPanelLayoutAdapter.setPanelSlideListener(new DialogPanelSlideListener(this));
}
 
Example #9
Source File: MainActivity.java    From Phonograph with GNU General Public License v3.0 6 votes vote down vote up
private void updateNavigationDrawerHeader() {
    if (!MusicPlayerRemote.getPlayingQueue().isEmpty()) {
        Song song = MusicPlayerRemote.getCurrentSong();
        if (navigationDrawerHeader == null) {
            navigationDrawerHeader = navigationView.inflateHeaderView(R.layout.navigation_drawer_header);
            //noinspection ConstantConditions
            navigationDrawerHeader.setOnClickListener(v -> {
                drawerLayout.closeDrawers();
                if (getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
                    expandPanel();
                }
            });
        }
        ((TextView) navigationDrawerHeader.findViewById(R.id.title)).setText(song.title);
        ((TextView) navigationDrawerHeader.findViewById(R.id.text)).setText(MusicUtil.getSongInfoString(song));
        SongGlideRequest.Builder.from(Glide.with(this), song)
                .checkIgnoreMediaStore(this).build()
                .into(((ImageView) navigationDrawerHeader.findViewById(R.id.image)));
    } else {
        if (navigationDrawerHeader != null) {
            navigationView.removeHeaderView(navigationDrawerHeader);
            navigationDrawerHeader = null;
        }
    }
}
 
Example #10
Source File: AbsSlidingMusicPanelActivity.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setTaskDescriptionColor(@ColorInt int color) {
    this.taskColor = color;
    if (getPanelState() == null || getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
        super.setTaskDescriptionColor(color);
    }
}
 
Example #11
Source File: MainActivity.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
private void updateNavigationDrawerHeader() {
    if (!MusicPlayerRemote.getPlayingQueue().isEmpty()) {
        Song song = MusicPlayerRemote.getCurrentSong();
        if (navigationDrawerHeader == null) {
            navigationDrawerHeader = navigationView.inflateHeaderView(R.layout.navigation_drawer_header);
            //noinspection ConstantConditions
            navigationDrawerHeader.setOnClickListener(v -> {
                drawerLayout.closeDrawers();
                if (getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
                    expandPanel();
                }
            });
        }
        ((TextView) navigationDrawerHeader.findViewById(R.id.title)).setText(song.title);
        ((TextView) navigationDrawerHeader.findViewById(R.id.text)).setText(MusicUtil.getSongInfoString(song));
        GlideApp.with(this)
                .asDrawable()
                .load(VinylGlideExtension.getSongModel(song))
                .transition(VinylGlideExtension.getDefaultTransition())
                .songOptions(song)
                .into(((ImageView) navigationDrawerHeader.findViewById(R.id.image)));
    } else {
        if (navigationDrawerHeader != null) {
            navigationView.removeHeaderView(navigationDrawerHeader);
            navigationDrawerHeader = null;
        }
    }
}
 
Example #12
Source File: WallpaperBoardPreviewActivity.java    From wallpaperboard with Apache License 2.0 5 votes vote down vote up
@Override
public void onPaletteGenerated(ColorPalette palette) {
    mPalette = palette;
    if (mRecyclerView.getAdapter() != null && mSlidingLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
        WallpaperDetailsAdapter adapter = (WallpaperDetailsAdapter) mRecyclerView.getAdapter();
        adapter.setColorPalette(mPalette);
    }
}
 
Example #13
Source File: LauncherActivity.java    From paper-launcher with MIT License 5 votes vote down vote up
@Override
public void onHomePressed() {
    if (isAppDrawerOpened()) {
        mSlidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
    } else {
        mSlidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.EXPANDED);
    }

    if (mBottomSheetBehavior.getState() == BottomSheetBehaviorV2.STATE_EXPANDED) {
        mBottomSheetBehavior.setState(BottomSheetBehaviorV2.STATE_COLLAPSED);
    }
}
 
Example #14
Source File: SubsonicFragmentActivity.java    From Popeens-DSub with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void drawerItemSelected(String fragmentType) {
	super.drawerItemSelected(fragmentType);

	if(slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
		slideUpPanel.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
	}
}
 
Example #15
Source File: SubsonicFragmentActivity.java    From Popeens-DSub with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setTitle(CharSequence title) {
	if(slideUpPanel.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
		getSupportActionBar().setTitle(title);
	} else {
		super.setTitle(title);
	}
}
 
Example #16
Source File: AbsSlidingMusicPanelActivity.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setNavigationbarColor(int color) {
    this.navigationbarColor = color;
    if (getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
        if (navigationBarColorAnimator != null) navigationBarColorAnimator.cancel();
        super.setNavigationbarColor(color);
    }
}
 
Example #17
Source File: SlidingUpPanelLayoutAdapter.java    From android-transition with Apache License 2.0 5 votes vote down vote up
@Override
public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) {
    if (newState == SlidingUpPanelLayout.PanelState.COLLAPSED) {
        getAdapterState().setState(AdapterState.CLOSE);
    } else if (newState == SlidingUpPanelLayout.PanelState.EXPANDED) {
        getAdapterState().setState(AdapterState.OPEN);
    }
    stopTransition();
    mListener.onPanelStateChanged(panel, previousState, newState);
}
 
Example #18
Source File: BaseActivity.java    From SkyTube with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onSaveInstanceState(Bundle outState) {
	super.onSaveInstanceState(outState);
	if(chromecastMiniControllerFragment != null && chromecastControllerFragment != null) {
		getSupportFragmentManager().putFragment(outState, ChromecastMiniControllerFragment.CHROMECAST_MINI_CONTROLLER_FRAGMENT, chromecastMiniControllerFragment);
		getSupportFragmentManager().putFragment(outState, ChromecastControllerFragment.CHROMECAST_CONTROLLER_FRAGMENT, chromecastControllerFragment);
		outState.putBoolean(PANEL_EXPANDED, slidingLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED);
	}
}
 
Example #19
Source File: FlatPlayerFragment.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
private void updateQueue() {
    playingQueueAdapter.swapDataSet(MusicPlayerRemote.getPlayingQueue(), MusicPlayerRemote.getPosition());
    playerQueueSubHeader.setText(getUpNextAndQueueTime());
    if (slidingUpPanelLayout == null || slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
        resetToCurrentPosition();
    }
}
 
Example #20
Source File: FlatPlayerFragment.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
private void updateQueuePosition() {
    playingQueueAdapter.setCurrent(MusicPlayerRemote.getPosition());
    playerQueueSubHeader.setText(getUpNextAndQueueTime());
    if (slidingUpPanelLayout == null || slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
        resetToCurrentPosition();
    }
}
 
Example #21
Source File: CardPlayerFragment.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
private void updateQueue() {
    playingQueueAdapter.swapDataSet(MusicPlayerRemote.getPlayingQueue(), MusicPlayerRemote.getPosition());
    playerQueueSubHeader.setText(getUpNextAndQueueTime());
    if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
        resetToCurrentPosition();
    }
}
 
Example #22
Source File: CardPlayerFragment.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
private void updateQueue() {
    playingQueueAdapter.swapDataSet(MusicPlayerRemote.getPlayingQueue(), MusicPlayerRemote.getPosition());
    playerQueueSubHeader.setText(getUpNextAndQueueTime());
    if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
        resetToCurrentPosition();
    }
}
 
Example #23
Source File: CardPlayerFragment.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onBackPressed() {
    boolean wasExpanded = false;
    if (slidingUpPanelLayout != null) {
        wasExpanded = slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED;
        slidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
    }

    return wasExpanded;
}
 
Example #24
Source File: AbsSlidingMusicPanelActivity.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setNavigationbarColor(int color) {
    this.navigationbarColor = color;
    if (getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
        if (navigationBarColorAnimator != null) navigationBarColorAnimator.cancel();
        super.setNavigationbarColor(color);
    }
}
 
Example #25
Source File: MainActivity.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
private void updateNavigationDrawerHeader() {
    if (!MusicPlayerRemote.getPlayingQueue().isEmpty()) {
        Song song = MusicPlayerRemote.getCurrentSong();
        if (navigationDrawerHeader == null) {
            navigationDrawerHeader = navigationView.inflateHeaderView(R.layout.navigation_drawer_header);
            //noinspection ConstantConditions
            navigationDrawerHeader.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    drawerLayout.closeDrawers();
                    if (getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
                        expandPanel();
                    }
                }
            });
        }
        ((TextView) navigationDrawerHeader.findViewById(R.id.title)).setText(song.title);
        ((TextView) navigationDrawerHeader.findViewById(R.id.text)).setText(song.artistName);
        SongGlideRequest.Builder.from(Glide.with(this), song)
                .checkIgnoreMediaStore(this).build()
                .into(((ImageView) navigationDrawerHeader.findViewById(R.id.image)));
    } else {
        if (navigationDrawerHeader != null) {
            navigationView.removeHeaderView(navigationDrawerHeader);
            navigationDrawerHeader = null;
        }
    }
}
 
Example #26
Source File: AbsSlidingMusicPanelActivity.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState, SlidingUpPanelLayout.PanelState newState) {
    switch (newState) {
        case COLLAPSED:
            onPanelCollapsed(panel);
            break;
        case EXPANDED:
            onPanelExpanded(panel);
            break;
        case ANCHORED:
            collapsePanel(); // this fixes a bug where the panel would get stuck for some reason
            break;
    }
}
 
Example #27
Source File: ChromecastMiniControllerFragment.java    From SkyTube with GNU General Public License v3.0 5 votes vote down vote up
public void setSlidingLayout(SlidingUpPanelLayout layout) {
	slidingLayout = layout;
	slidingLayout.addPanelSlideListener(panelSlideListener);
	if(slidingLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
		chromecastPlaybackProgressBar.setVisibility(View.INVISIBLE);
		chromecastMiniControllerShareButton.setVisibility(View.VISIBLE);

		chromecastMiniControllerLeftContainer.setAlpha(0);
		chromecastMiniControllerRightContainer.setAlpha(0);
	}
}
 
Example #28
Source File: AbsSlidingMusicPanelActivity.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
public boolean handleBackPress() {
    if (slidingUpPanelLayout.getPanelHeight() != 0 && playerFragment.onBackPressed())
        return true;
    if (getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
        collapsePanel();
        return true;
    }
    return false;
}
 
Example #29
Source File: FlatPlayerFragment.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onBackPressed() {
    boolean wasExpanded = false;
    if (slidingUpPanelLayout != null) {
        wasExpanded = slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED;
        slidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
    }

    return wasExpanded;
}
 
Example #30
Source File: LocalSongsFragment.java    From ting with Apache License 2.0 5 votes vote down vote up
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
    if(scrollState == 1){ //当用户向上滑时,隐藏SlidingUpPanelLayout
        slidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.HIDDEN);
    }else if(scrollState == 2){//当用户向下滑时,显示SlidingUpPanelLayout
        slidingUpPanelLayout.setPanelState(SlidingUpPanelLayout.PanelState.COLLAPSED);
    }
}