Java 类android.widget.SlidingDrawer 实例源码

项目:test_agent_android    文件:Setter.java   
/**
 * Sets the status of a given SlidingDrawer. Examples are Solo.CLOSED and Solo.OPENED.
 *
 * @param slidingDrawer the {@link SlidingDrawer}
 * @param status the status that the {@link SlidingDrawer} should be set to
 */

public void setSlidingDrawer(final SlidingDrawer slidingDrawer, final int status){
    if(slidingDrawer != null){
        Activity activity = activityUtils.getCurrentActivity(false);
        if(activity != null){
            activity.runOnUiThread(new Runnable()
            {
                public void run()
                {
                    try{
                        switch (status) {
                        case CLOSED:
                            slidingDrawer.close();
                            break;
                        case OPENED:
                            slidingDrawer.open();
                            break;
                        }
                    }catch (Exception ignored){}
                }
            });
        }
    }
}
项目:DoubanOnline    文件:PhotoDetailActivity.java   
private void iniComponent()
{
    zoomableViewPager = (ImageViewTouchViewPager) findViewById(R.id.zoomableViewPager);
    sdComments = (SlidingDrawer) findViewById(R.id.sdComments);
    tvDesc = (TextView) findViewById(R.id.tvDesc);
    tvAuthorAndDate = (TextView) findViewById(R.id.tvAuthorAndDate);
    tvCommentNum = (TextView) findViewById(R.id.tvCommentNum);
    lvComments = (PullToRefreshListViewWithFooter) findViewById(R.id.lvComments);
    lvComments.setEmptyView(getEmptyView());
    // etComment = (EditText) findViewById(R.id.etComment);
    // ivSendComment = (ImageView) findViewById(R.id.ivSendComment);
    mListViews = new ArrayList<View>();
    photos = new ArrayList<Photo>();
    photosAdapter = new ZoomablePagerAdapter();
    zoomableViewPager.setAdapter(photosAdapter);
    mInflater = getLayoutInflater();
    comments = new ArrayList<Comments>();
    commentsAdapter = new CommentsAdapter(this, comments);
    lvComments.setAdapter(commentsAdapter);
}
项目:robotium-tech    文件:Setter.java   
/**
 * Sets the status of a given SlidingDrawer. Examples are Solo.CLOSED and Solo.OPENED.
 *
 * @param slidingDrawer the {@link SlidingDrawer}
 * @param status the status that the {@link SlidingDrawer} should be set to
 */

public void setSlidingDrawer(final SlidingDrawer slidingDrawer, final int status){
    if(slidingDrawer != null){
        Activity activity = activityUtils.getCurrentActivity(false);
        if(activity != null){
            activity.runOnUiThread(new Runnable()
            {
                public void run()
                {
                    try{
                        switch (status) {
                        case CLOSED:
                            slidingDrawer.close();
                            break;
                        case OPENED:
                            slidingDrawer.open();
                            break;
                        }
                    }catch (Exception ignored){}
                }
            });
        }
    }
}
项目:voc    文件:SlidingDrawerActivity.java   
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sliding_drawer);
    slideButton = (Button) findViewById(R.id.slideButton);
    slidingDrawer = (SlidingDrawer) findViewById(R.id.SlidingDrawer);
    b1 = (Button) findViewById(R.id.Button01);
    b2 = (Button) findViewById(R.id.Button02);
    b3 = (Button) findViewById(R.id.Button03);
    b1.setOnClickListener(this);
    b2.setOnClickListener(this);
    b3.setOnClickListener(this);
    slidingDrawer.setOnDrawerOpenListener(new SlidingDrawer.OnDrawerOpenListener() {
        @Override
        public void onDrawerOpened() {
            slideButton.setText("V");
        }
    });
    slidingDrawer.setOnDrawerCloseListener(new SlidingDrawer.OnDrawerCloseListener() {
        @Override
        public void onDrawerClosed() {
            slideButton.setText("^");
        }
    });
}
项目:Exo-Launcher    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    widgets = new ArrayList<>();
    apps = new ArrayList<>();
    appShortcuts = new ArrayList<>();
    widgetShortcuts = new ArrayList<>();
    iconFiles = new ArrayList<>();

    drawerGrid = (GridView) findViewById(R.id.content);
    slidingDrawer = (SlidingDrawer) findViewById(R.id.drawer);
    homeView = (RelativeLayout) findViewById(R.id.home_view);
    panelIndicator = (TextView) findViewById(R.id.panelIndicator);

    getWidgetIDs();
    getPackages();
    drawerAdapterObject = new DrawerAdapter(this, apps);
    drawerGrid.setAdapter(drawerAdapterObject);
    vibration = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

    mAppWidgetManager = AppWidgetManager.getInstance(this);
    mAppWidgetHost = new LauncherAppWidgetHost(this, R.id.APPWIDGET_HOST_ID);

    dir = getFilesDir();

    setSwipeDetector();
    initTrashIcons();
    setDrawerListeners();
    setReceiver();
    setTabs();
    cleanStorage();
    loadPage(1);
}
项目:Exo-Launcher    文件:MainActivity.java   
public void setSlidingListeners(){

        final Button appTab = (Button) findViewById(R.id.apps);
        final Button widgetTab = (Button) findViewById(R.id.widgets);
        slidingDrawer.setOnDrawerScrollListener(new SlidingDrawer.OnDrawerScrollListener() {
            @Override
            public void onScrollStarted() {
                //disableTabs(apps, widgets);
            }

            @Override
            public void onScrollEnded() {
                if(slidingDrawer.isOpened() && (!(slidingDrawer.isMoving()) || slidingDrawer.isEnabled())){
                    enableTabs(appTab, widgetTab);
                }

            }
        });

        slidingDrawer.setOnDrawerOpenListener(new SlidingDrawer.OnDrawerOpenListener() {

            @Override
            public void onDrawerOpened() {
                enableTabs(appTab, widgetTab);
            }
        });

        slidingDrawer.setOnDrawerCloseListener(new SlidingDrawer.OnDrawerCloseListener() {

            @Override
            public void onDrawerClosed() {
                disableTabs(appTab, widgetTab);
            }
        });
    }
项目:truth-android    文件:SlidingDrawerSubject.java   
public static SubjectFactory<SlidingDrawerSubject, SlidingDrawer> type() {
  return new SubjectFactory<SlidingDrawerSubject, SlidingDrawer>() {
    @Override
    public SlidingDrawerSubject getSubject(FailureStrategy fs, SlidingDrawer that) {
      return new SlidingDrawerSubject(fs, that);
    }
  };
}
项目:test_agent_android    文件:Solo.java   
/**
 * Sets the status of a SlidingDrawer matching the specified index. Examples of status are: {@code Solo.CLOSED} and {@code Solo.OPENED}.
 *
 * @param index the index of the {@link SlidingDrawer}
 * @param status the status to set the {@link SlidingDrawer}
 */

public void setSlidingDrawer(int index, int status){
    if(config.commandLogging){
        Log.d(config.commandLoggingTag, "setSlidingDrawer("+index+", "+status+")");
    }

    setSlidingDrawer(waiter.waitForAndGetView(index, SlidingDrawer.class), status);
}
项目:robotium-tech    文件:Solo.java   
/**
 * Sets the status of a SlidingDrawer matching the specified index. Examples of status are: {@code Solo.CLOSED} and {@code Solo.OPENED}.
 *
 * @param index the index of the {@link SlidingDrawer}
 * @param status the status to set the {@link SlidingDrawer}
 */

public void setSlidingDrawer(int index, int status){
    if(config.commandLogging){
        Log.d(config.commandLoggingTag, "setSlidingDrawer("+index+", "+status+")");
    }

    setSlidingDrawer(waiter.waitForAndGetView(index, SlidingDrawer.class), status);
}
项目:like_googleplus_layout    文件:RightFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
    View view = inflater.inflate(R.layout.fragment_right, null);
    mListView = (PullToZoomListView) view.findViewById(R.id.ptzlv_list);
    mSlidingDrawer = (SlidingDrawer) view.findViewById(R.id.sliding_drawer);
    mBtnNotification = (Button) view.findViewById(R.id.btn_notification);
    return view;
}
项目:tomdroid    文件:EditNote.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Preferences.init(this, Tomdroid.CLEAR_PREFERENCES);

    setContentView(R.layout.note_edit);

    content = (EditText) findViewById(R.id.content);
    title = (EditText) findViewById(R.id.title);

    formatBar = (SlidingDrawer) findViewById(R.id.formatBar);

    content.setOnFocusChangeListener(new OnFocusChangeListener() {

        public void onFocusChange(View v, boolean hasFocus) {
            if(hasFocus && !xmlOn) {
                formatBar.setVisibility(View.VISIBLE);
            }
            else {
                formatBar.setVisibility(View.GONE);
            }
        }
    });

    neverSaved = getIntent().getBooleanExtra(Tomdroid.IS_NEW_NOTE_EXTRA, false);

       uri = getIntent().getData();
}
项目:utexas-utilities    文件:WrappingSlidingDrawer.java   
public WrappingSlidingDrawer(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    int orientation = attrs
            .getAttributeIntValue("android", "orientation", ORIENTATION_VERTICAL);
    mTopOffset = attrs.getAttributeIntValue("android", "topOffset", 0);
    mVertical = (orientation == SlidingDrawer.ORIENTATION_VERTICAL);
}
项目:utexas-utilities    文件:WrappingSlidingDrawer.java   
public WrappingSlidingDrawer(Context context, AttributeSet attrs) {
    super(context, attrs);

    int orientation = attrs
            .getAttributeIntValue("android", "orientation", ORIENTATION_VERTICAL);
    mTopOffset = attrs.getAttributeIntValue("android", "topOffset", 0);
    mVertical = (orientation == SlidingDrawer.ORIENTATION_VERTICAL);
}
项目:PalmCalc    文件:WrappingSlidingDrawer.java   
public WrappingSlidingDrawer(Context context, AttributeSet attrs,
        int defStyle) {
    super(context, attrs, defStyle);

    int orientation = attrs.getAttributeIntValue("android", "orientation",
            ORIENTATION_VERTICAL);
    mTopOffset = attrs.getAttributeIntValue("android", "topOffset", 0);
    mVertical = (orientation == SlidingDrawer.ORIENTATION_VERTICAL);
}
项目:PalmCalc    文件:WrappingSlidingDrawer.java   
public WrappingSlidingDrawer(Context context, AttributeSet attrs) {
    super(context, attrs);

    int orientation = attrs.getAttributeIntValue("android", "orientation",
            ORIENTATION_VERTICAL);
    mTopOffset = attrs.getAttributeIntValue("android", "topOffset", 0);
    mVertical = (orientation == SlidingDrawer.ORIENTATION_VERTICAL);
}
项目:kidsm_for_android    文件:WrappingSlidingDrawer.java   
public WrappingSlidingDrawer(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    int orientation = attrs.getAttributeIntValue("android", "orientation", ORIENTATION_VERTICAL);
    mTopOffset = attrs.getAttributeIntValue("android", "topOffset", 0);
    mVertical = (orientation == SlidingDrawer.ORIENTATION_VERTICAL);
}
项目:kidsm_for_android    文件:WrappingSlidingDrawer.java   
public WrappingSlidingDrawer(Context context, AttributeSet attrs) {
    super(context, attrs);

    int orientation = attrs.getAttributeIntValue("android", "orientation", ORIENTATION_VERTICAL);
    mTopOffset = attrs.getAttributeIntValue("android", "topOffset", 0);
    mVertical = (orientation == SlidingDrawer.ORIENTATION_VERTICAL);
}
项目:AndroidTutorial    文件:Slider.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.sliding);
  Button handle0 = (Button) findViewById(R.id.handle0);
  Button button1 = (Button) findViewById(R.id.button1);
  Button button2 = (Button) findViewById(R.id.button2);
  Button button3 = (Button) findViewById(R.id.button3);
  Button button4 = (Button) findViewById(R.id.button4);
  CheckBox checkbox = (CheckBox) findViewById(R.id.cb_slidable);
  sd = (SlidingDrawer) findViewById(R.id.d_sliding);
  sd.setOnDrawerOpenListener(this);
}
项目:truth-android    文件:SlidingDrawerSubject.java   
protected SlidingDrawerSubject(FailureStrategy failureStrategy, SlidingDrawer subject) {
  super(failureStrategy, subject);
}
项目:cInterphone    文件:InCallScreen.java   
public void initInCallScreen() {
    mInCallPanel = (ViewGroup) findViewById(R.id.inCallPanel);
    mMainFrame = (ViewGroup) findViewById(R.id.mainFrame);
    // 动态载入界面,此处就已经实例化了CallCard
    View callCardLayout = getLayoutInflater().inflate(
            R.layout.call_card_popup, mInCallPanel);
    mCallCard = (CallCard) callCardLayout.findViewById(R.id.callCard);
    mCallCard.reset();

    mSlidingCardManager = new SlidingCardManager();
    mSlidingCardManager.init(ccPhone, this, mMainFrame);
    SlidingCardManager.WindowAttachNotifierView wanv = new SlidingCardManager.WindowAttachNotifierView(
            this);
    wanv.setSlidingCardManager(mSlidingCardManager);
    wanv.setVisibility(View.GONE);
    RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(0, 0);
    mMainFrame.addView(wanv, lp);

    mStats = (TextView) findViewById(R.id.stats);
    mCodec = (TextView) findViewById(R.id.codec);
    mDialerDrawer = (SlidingDrawer) findViewById(R.id.dialer_container);
    mCallCard.displayOnHoldCallStatus(ccPhone, null);
    mCallCard.displayOngoingCallStatus(ccPhone, null);
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
        mCallCard.updateForLandscapeMode();

    // Have the WindowManager filter out touch events that are "too fat".
    getWindow().addFlags(
            WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES);

    mDigits = (EditText) findViewById(R.id.digits);
    mDisplayMap.put(R.id.one, '1');
    mDisplayMap.put(R.id.two, '2');
    mDisplayMap.put(R.id.three, '3');
    mDisplayMap.put(R.id.four, '4');
    mDisplayMap.put(R.id.five, '5');
    mDisplayMap.put(R.id.six, '6');
    mDisplayMap.put(R.id.seven, '7');
    mDisplayMap.put(R.id.eight, '8');
    mDisplayMap.put(R.id.nine, '9');
    mDisplayMap.put(R.id.zero, '0');
    mDisplayMap.put(R.id.pound, '#');
    mDisplayMap.put(R.id.star, '*');

    mToneMap.put('1', ToneGenerator.TONE_DTMF_1);
    mToneMap.put('2', ToneGenerator.TONE_DTMF_2);
    mToneMap.put('3', ToneGenerator.TONE_DTMF_3);
    mToneMap.put('4', ToneGenerator.TONE_DTMF_4);
    mToneMap.put('5', ToneGenerator.TONE_DTMF_5);
    mToneMap.put('6', ToneGenerator.TONE_DTMF_6);
    mToneMap.put('7', ToneGenerator.TONE_DTMF_7);
    mToneMap.put('8', ToneGenerator.TONE_DTMF_8);
    mToneMap.put('9', ToneGenerator.TONE_DTMF_9);
    mToneMap.put('0', ToneGenerator.TONE_DTMF_0);
    mToneMap.put('#', ToneGenerator.TONE_DTMF_P);
    mToneMap.put('*', ToneGenerator.TONE_DTMF_S);

    View button;
    for (int viewId : mDisplayMap.keySet()) {
        button = findViewById(viewId);
        button.setOnClickListener(this);
    }
}
项目:LemonBlog    文件:ShakeActivity.java   
@Override
public void initViews() {
    mImgUp = (RelativeLayout) findViewById(R.id.shakeImgUp);
    mImgDn = (RelativeLayout) findViewById(R.id.shakeImgDown);
    mTitle = (RelativeLayout) findViewById(R.id.shake_title_bar);

    mDrawer = (SlidingDrawer) findViewById(R.id.slidingDrawer1);
    mDrawerBtn = (Button) findViewById(R.id.handle);
    mDrawer.setOnDrawerOpenListener(new OnDrawerOpenListener()
    {
        public void onDrawerOpened()
        {
            mDrawerBtn.setBackgroundDrawable(getResources().getDrawable(
                    R.drawable.shake_report_dragger_down));
            TranslateAnimation titleup = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f,
                    Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, 0f,
                    Animation.RELATIVE_TO_SELF, -1.0f);
            titleup.setDuration(200);
            titleup.setFillAfter(true);
            mTitle.startAnimation(titleup);
        }
    });
    /* 设定SlidingDrawer被关闭的事件处理 */
    mDrawer.setOnDrawerCloseListener(new OnDrawerCloseListener()
    {
        public void onDrawerClosed()
        {
            mDrawerBtn.setBackgroundDrawable(getResources().getDrawable(
                    R.drawable.shake_report_dragger_up));
            TranslateAnimation titledn = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0f,
                    Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF, -1.0f,
                    Animation.RELATIVE_TO_SELF, 0f);
            titledn.setDuration(200);
            titledn.setFillAfter(false);
            mTitle.startAnimation(titledn);
        }
    });

    mShakeListener = new ShakeListener(this);
    mShakeListener.setOnShakeListener(new OnShakeListener() {
        public void onShake() {
            // Toast.makeText(getApplicationContext(),
            // "抱歉,暂时没有找到在同一时刻摇一摇的人。\n再试一次吧!", Toast.LENGTH_SHORT).show();
            startAnim(); // 开始 摇一摇手掌动画
            mShakeListener.stop();
            startVibrato(); // 开始 震动
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    // Toast.makeText(getApplicationContext(),
                    // "抱歉,暂时没有找到\n在同一时刻摇一摇的人。\n再试一次吧!",
                    // 500).setGravity(Gravity.CENTER,0,0).show();
                    Toast mtoast;
                    mtoast = Toast.makeText(getApplicationContext(),
                            "抱歉,暂时没有找到\n在同一时刻摇一摇的人。\n再试一次吧!", 10);
                    // mtoast.setGravity(Gravity.CENTER, 0, 0);
                    mtoast.show();
                    mVibrator.cancel();
                    mShakeListener.start();
                }
            }, 2000);
        }
    });

    findViewById(R.id.back).setOnClickListener(this);
    findViewById(R.id.done).setOnClickListener(this);
}
项目:android-vlc-remote    文件:BrowseDrawerListener.java   
public BrowseDrawerListener(Activity activity, SlidingDrawer drawer, BrowseFragment browse) {
    mActivity = activity;
    mDrawer = drawer;
    mBrowse = browse;
}
项目:phonty    文件:InCallScreen.java   
public void initInCallScreen() {
    mInCallPanel = (ViewGroup) findViewById(R.id.inCallPanel);
    mMainFrame = (ViewGroup) findViewById(R.id.mainFrame);
    View callCardLayout = getLayoutInflater().inflate(
                R.layout.call_card_popup,
                mInCallPanel);
    mCallCard = (CallCard) callCardLayout.findViewById(R.id.callCard);
    mCallCard.reset();

    mSlidingCardManager = new SlidingCardManager();
    mSlidingCardManager.init(ccPhone, this, mMainFrame);
    SlidingCardManager.WindowAttachNotifierView wanv =
        new SlidingCardManager.WindowAttachNotifierView(this);
 wanv.setSlidingCardManager(mSlidingCardManager);
 wanv.setVisibility(View.GONE);
 RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(0, 0);
 mMainFrame.addView(wanv, lp);

 mStats = (TextView) findViewById(R.id.stats);
 mCodec = (TextView) findViewById(R.id.codec);
    mDialerDrawer = (SlidingDrawer) findViewById(R.id.dialer_container);
    mCallCard.displayOnHoldCallStatus(ccPhone,null);
    mCallCard.displayOngoingCallStatus(ccPhone,null);
    if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE)
        mCallCard.updateForLandscapeMode();

    // Have the WindowManager filter out touch events that are "too fat".
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES);

 mDigits = (EditText) findViewById(R.id.digits);
    mDisplayMap.put(R.id.one, '1');
    mDisplayMap.put(R.id.two, '2');
    mDisplayMap.put(R.id.three, '3');
    mDisplayMap.put(R.id.four, '4');
    mDisplayMap.put(R.id.five, '5');
    mDisplayMap.put(R.id.six, '6');
    mDisplayMap.put(R.id.seven, '7');
    mDisplayMap.put(R.id.eight, '8');
    mDisplayMap.put(R.id.nine, '9');
    mDisplayMap.put(R.id.zero, '0');
    mDisplayMap.put(R.id.pound, '#');
    mDisplayMap.put(R.id.star, '*');

    mToneMap.put('1', ToneGenerator.TONE_DTMF_1);
    mToneMap.put('2', ToneGenerator.TONE_DTMF_2);
    mToneMap.put('3', ToneGenerator.TONE_DTMF_3);
    mToneMap.put('4', ToneGenerator.TONE_DTMF_4);
    mToneMap.put('5', ToneGenerator.TONE_DTMF_5);
    mToneMap.put('6', ToneGenerator.TONE_DTMF_6);
    mToneMap.put('7', ToneGenerator.TONE_DTMF_7);
    mToneMap.put('8', ToneGenerator.TONE_DTMF_8);
    mToneMap.put('9', ToneGenerator.TONE_DTMF_9);
    mToneMap.put('0', ToneGenerator.TONE_DTMF_0);
    mToneMap.put('#', ToneGenerator.TONE_DTMF_P);
    mToneMap.put('*', ToneGenerator.TONE_DTMF_S);

    View button;
    for (int viewId : mDisplayMap.keySet()) {
        button = findViewById(viewId);
        button.setOnClickListener(this);
    }
}
项目:assertj-android    文件:SlidingDrawerAssert.java   
public SlidingDrawerAssert(SlidingDrawer actual) {
  super(actual, SlidingDrawerAssert.class);
}