当前位置: 首页>>代码示例>>Java>>正文


Java SlidingPaneLayout.setPanelSlideListener方法代码示例

本文整理汇总了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();
			}
		});
	}
}
 
开发者ID:runtimeco,项目名称:Android-DFU-App,代码行数:20,代码来源:UARTActivity.java

示例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();
			}
		});
	}
}
 
开发者ID:NordicSemiconductor,项目名称:Android-nRF-Toolbox,代码行数:21,代码来源:UARTActivity.java

示例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();
			}
		});
	}
}
 
开发者ID:frostmournex,项目名称:nRFToolbox,代码行数:20,代码来源:UARTActivity.java

示例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());
}
 
开发者ID:reknih,项目名称:informant-droid,代码行数:23,代码来源:SlidingPaneLayoutActivity.java

示例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);
    }
}
 
开发者ID:hkq325800,项目名称:YellowNote,代码行数:33,代码来源:BaseActivityWithSlidingPaneLayout.java

示例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);
    }
}
 
开发者ID:paradoxie,项目名称:SwipBackDemo,代码行数:32,代码来源:BaseActivity.java

示例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);
}
 
开发者ID:missmisslonely,项目名称:fakeweibo,代码行数:35,代码来源:ComposeTweetActivity.java

示例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 )
        {

        }
    } );
}
 
开发者ID:amar19860330,项目名称:amar-android-demo,代码行数:31,代码来源:DrawerActivity.java

示例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();
    }
}
 
开发者ID:urandom,项目名称:gearshift,代码行数:58,代码来源:SettingsActivity.java

示例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();
}
 
开发者ID:PhaniGaddipati,项目名称:Stacks-Flashcards,代码行数:59,代码来源:MainActivity.java

示例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);
}
 
开发者ID:cymcsg,项目名称:UltimateAndroid,代码行数:45,代码来源:ParallaxSwipeBackActivity.java


注:本文中的android.support.v4.widget.SlidingPaneLayout.setPanelSlideListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。