本文整理汇总了Java中android.support.v4.widget.SlidingPaneLayout.setPanelSlideListener方法的典型用法代码示例。如果您正苦于以下问题:Java SlidingPaneLayout.setPanelSlideListener方法的具体用法?Java SlidingPaneLayout.setPanelSlideListener怎么用?Java SlidingPaneLayout.setPanelSlideListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.widget.SlidingPaneLayout
的用法示例。
在下文中一共展示了SlidingPaneLayout.setPanelSlideListener方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import android.support.v4.widget.SlidingPaneLayout; //导入方法依赖的package包/类
@Override
protected void onCreateView(final Bundle savedInstanceState) {
setContentView(R.layout.activity_feature_uart);
// Setup the sliding pane if it exists
final SlidingPaneLayout slidingPane = mSlider = (SlidingPaneLayout) findViewById(R.id.sliding_pane);
if (slidingPane != null) {
slidingPane.setSliderFadeColor(Color.TRANSPARENT);
slidingPane.setShadowResourceLeft(R.drawable.shadow_r);
slidingPane.setPanelSlideListener(new SlidingPaneLayout.SimplePanelSlideListener() {
@Override
public void onPanelClosed(final View panel) {
// Close the keyboard
final UARTLogFragment logFragment = (UARTLogFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_log);
logFragment.onFragmentHidden();
}
});
}
}
示例2: onCreateView
import android.support.v4.widget.SlidingPaneLayout; //导入方法依赖的package包/类
@Override
protected void onCreateView(final Bundle savedInstanceState) {
setContentView(R.layout.activity_feature_uart);
mContainer = findViewById(R.id.container);
// Setup the sliding pane if it exists
final SlidingPaneLayout slidingPane = mSlider = findViewById(R.id.sliding_pane);
if (slidingPane != null) {
slidingPane.setSliderFadeColor(Color.TRANSPARENT);
slidingPane.setShadowResourceLeft(R.drawable.shadow_r);
slidingPane.setPanelSlideListener(new SlidingPaneLayout.SimplePanelSlideListener() {
@Override
public void onPanelClosed(final View panel) {
// Close the keyboard
final UARTLogFragment logFragment = (UARTLogFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_log);
logFragment.onFragmentHidden();
}
});
}
}
示例3: onCreateView
import android.support.v4.widget.SlidingPaneLayout; //导入方法依赖的package包/类
@Override
protected void onCreateView(final Bundle savedInstanceState) {
setContentView(R.layout.activity_feature_uart);
// Setup the sliding pane if it exists
final SlidingPaneLayout slidingPane = mSlider = (SlidingPaneLayout) findViewById(R.id.sliding_pane);
if (slidingPane != null) {
slidingPane.setSliderFadeColor(Color.TRANSPARENT);
slidingPane.setShadowResourceLeft(R.drawable.shadow_r);
slidingPane.setPanelSlideListener(new SlidingPaneLayout.SimplePanelSlideListener() {
@Override
public void onPanelClosed(final View panel) {
// Close the keyboard
final UARTLogFragment logFragment = (UARTLogFragment) getFragmentManager().findFragmentById(R.id.fragment_log);
logFragment.onFragmentHidden();
}
});
}
}
示例4: onCreate
import android.support.v4.widget.SlidingPaneLayout; //导入方法依赖的package包/类
@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());
}
示例5: initSwipeBackFinish
import android.support.v4.widget.SlidingPaneLayout; //导入方法依赖的package包/类
/**
* 初始化滑动返回
*/
private void initSwipeBackFinish() {
if (isSupportSwipeBack) {
SlidingPaneLayout slidingPaneLayout = new SlidingPaneLayout(this);
//通过反射改变mOverhangSize的值为0,这个mOverhangSize值为菜单到右边屏幕的最短距离,默认
//是32dp,现在给它改成0
try {
//属性
Field f_overHang = SlidingPaneLayout.class.getDeclaredField("mOverhangSize");
f_overHang.setAccessible(true);
f_overHang.set(slidingPaneLayout, 0);
} catch (Exception e) {
e.printStackTrace();
}
slidingPaneLayout.setPanelSlideListener(BaseActivityWithSlidingPaneLayout.this);
slidingPaneLayout.setSliderFadeColor(getResources().getColor(android.R.color.transparent));
//slidingPaneLayout.setLayoutParams(new SlidingPaneLayout.LayoutParams(100,SlidingPaneLayout.LayoutParams.MATCH_PARENT));
View leftView = new View(this);
leftView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
slidingPaneLayout.addView(leftView, 0);
ViewGroup decor = (ViewGroup) getWindow().getDecorView();
ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
//decorChild.setBackgroundColor(getResources().getColor(android.R.color.white));
decor.removeView(decorChild);
decor.addView(slidingPaneLayout);
slidingPaneLayout.addView(decorChild, 1);
}
}
示例6: initSwipeBackFinish
import android.support.v4.widget.SlidingPaneLayout; //导入方法依赖的package包/类
/**
* 初始化滑动返回
*/
private void initSwipeBackFinish() {
if (isSupportSwipeBack()) {
SlidingPaneLayout slidingPaneLayout = new SlidingPaneLayout(this);
//通过反射改变mOverhangSize的值为0,这个mOverhangSize值为菜单到右边屏幕的最短距离,默认
//是32dp,现在给它改成0
try {
//属性
Field f_overHang = SlidingPaneLayout.class.getDeclaredField("mOverhangSize");
f_overHang.setAccessible(true);
f_overHang.set(slidingPaneLayout, 0);
} catch (Exception e) {
e.printStackTrace();
}
slidingPaneLayout.setPanelSlideListener(this);
slidingPaneLayout.setSliderFadeColor(getResources().getColor(android.R.color.transparent));
View leftView = new View(this);
leftView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
slidingPaneLayout.addView(leftView, 0);
ViewGroup decor = (ViewGroup) getWindow().getDecorView();
ViewGroup decorChild = (ViewGroup) decor.getChildAt(0);
decorChild.setBackgroundColor(getResources().getColor(android.R.color.white));
decor.removeView(decorChild);
decor.addView(slidingPaneLayout);
slidingPaneLayout.addView(decorChild, 1);
}
}
示例7: injectLayout
import android.support.v4.widget.SlidingPaneLayout; //导入方法依赖的package包/类
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);
}
示例8: onCreate
import android.support.v4.widget.SlidingPaneLayout; //导入方法依赖的package包/类
@Override
protected void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
setContentView( R.layout.activity_drawer );
//actionBar = this.getActionBar();
//actionBar.setDisplayShowTitleEnabled( false );
//actionBar.setDisplayHomeAsUpEnabled( true );
spl = ( SlidingPaneLayout ) this.findViewById( R.id.slidingpanellayout );
spl.setPanelSlideListener( new SlidingPaneLayout.PanelSlideListener()
{
@Override
public void onPanelClosed( View view )
{
DrawerActivity.this.getFragmentManager().findFragmentById( R.id.leftfragment ).setHasOptionsMenu( false );
}
@Override
public void onPanelOpened( View viw )
{
DrawerActivity.this.getFragmentManager().findFragmentById( R.id.leftfragment ).setHasOptionsMenu( true );
}
@Override
public void onPanelSlide( View arg0, float arg1 )
{
}
} );
}
示例9: onCreate
import android.support.v4.widget.SlidingPaneLayout; //导入方法依赖的package包/类
@Override protected void onCreate(Bundle state) {
super.onCreate(state);
setContentView(R.layout.activity_settings);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
slidingPane = (SlidingPaneLayout) findViewById(R.id.sliding_pane);
slidingPane.setSliderFadeColor(getResources().getColor(R.color.preference_background));
slidingPane.setShadowResourceLeft(R.drawable.pane_shadow);
slidingPane.setPanelSlideListener(new SlidingPaneLayout.SimplePanelSlideListener() {
@Override
public void onPanelOpened(View panel) {
if (isPreferencesOpen()) {
resetPreferencePane();
}
}
});
slidingPane.openPane();
profileAdapter = new ProfileAdapter(this);
RecyclerView profileList = (RecyclerView) findViewById(R.id.profile_list);
profileList.setLayoutManager(new LinearLayoutManager(this));
profileList.setAdapter(profileAdapter);
fillPreferences();
getSupportLoaderManager().initLoader(G.PROFILES_LOADER_ID, null, profileLoaderCallbacks);
boolean showNewProfile = getIntent().getBooleanExtra(G.ARG_NEW_PROFILE, false);
if (state == null) {
TransmissionProfile.cleanTemporaryPreferences();
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
prefs.registerOnSharedPreferenceChangeListener(defaultPrefListener);
prefs = getSharedPreferences(TransmissionProfile.getPreferencesName(),
Activity.MODE_PRIVATE);
prefs.registerOnSharedPreferenceChangeListener(profilesPrefListener);
} else {
showNewProfile = false;
}
if (showNewProfile) {
addFragment("new-profile", Type.PROFILE, null);
slidingPane.closePane();
}
}
示例10: onCreate
import android.support.v4.widget.SlidingPaneLayout; //导入方法依赖的package包/类
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Crashlytics.start(this);
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
setTheme(Themes.get(this).getCurrentTheme());
sqlHelper = StacksDatabaseHelper.get(this);
QuizletCommunicator.init(this);
StudyStackCommunicator.init(this);
setContentView(R.layout.main_activity);
progressBar = (ProgressBar) findViewById(R.id.progressBar);
adFrameLayout = (FrameLayout) findViewById(R.id.ad_frameLayout);
slidingPane = (SlidingPaneLayout) findViewById(R.id.slidingPane);
if (slidingPane == null) {
isMultiPane = true;
} else {
isMultiPane = false;
slidingPane.setCoveredFadeColor(getResources().getColor(android.R.color.transparent));
slidingPane.setSliderFadeColor(getResources().getColor(android.R.color.transparent));
slidingPane.setPanelSlideListener(this);
}
progressBar.setVisibility(View.GONE);
stackFragment = (StackFragment) getFragmentManager().findFragmentById(R.id.stackFragment);
cardFragment = (CardFragment) getFragmentManager().findFragmentById(R.id.right_button);
configureAdView();
setupUncaughtExceptionHandler();
if (savedInstanceState != null) {
dataLoaded = savedInstanceState.getBoolean("dataLoaded", false);
if (savedInstanceState.containsKey("stack") && StackManager.get().getStack(savedInstanceState.getString("stack")) != null) {
cardFragment.setStack(StackManager.get().getStack(savedInstanceState.getString("stack")));
}
if (savedInstanceState.getBoolean("stacksOpened")) {
showStacks();
onPanelOpened(null);
} else {
showCards();
onPanelClosed(null);
}
} else {
showStacks();
onPanelOpened(null);
}
if ((StackManager.get().getArchivedStackList().size() == 0 &&
StackManager.get().getStackList().size() == 0)) {
loadSQLData();
}
//new ReleaseNotes(this).showReleaseNotesWithoutRepeat();
getSharedPreferences("properties", MODE_PRIVATE).edit().putInt("version", VERSION).apply();
}
示例11: onCreate
import android.support.v4.widget.SlidingPaneLayout; //导入方法依赖的package包/类
@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);
}