Java Code Examples for android.widget.RelativeLayout.setOnTouchListener()

The following are Jave code examples for showing how to use setOnTouchListener() of the android.widget.RelativeLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: MyFire   File: JCVideoPlayer.java   Source Code and License Vote up 6 votes
public void init(Context context) {
    View.inflate(context, getLayoutId(), this);
    startButton = (ImageView) findViewById(R.id.start);
    fullscreenButton = (ImageView) findViewById(R.id.fullscreen);
    progressBar = (SeekBar) findViewById(R.id.progress);
    currentTimeTextView = (TextView) findViewById(R.id.current);
    totalTimeTextView = (TextView) findViewById(R.id.total);
    bottomContainer = (ViewGroup) findViewById(R.id.layout_bottom);
    textureViewContainer = (RelativeLayout) findViewById(R.id.surface_container);
    topContainer = (ViewGroup) findViewById(R.id.layout_top);

    startButton.setOnClickListener(this);
    fullscreenButton.setOnClickListener(this);
    progressBar.setOnSeekBarChangeListener(this);
    bottomContainer.setOnClickListener(this);
    textureViewContainer.setOnClickListener(this);

    textureViewContainer.setOnTouchListener(this);
    mScreenWidth = getContext().getResources().getDisplayMetrics().widthPixels;
    mScreenHeight = getContext().getResources().getDisplayMetrics().heightPixels;
    mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
    mHandler = new Handler();
}
 
Example 2
Project: yphoto   File: StatusDetailView.java   Source Code and License Vote up 6 votes
private void initView(final Context context) {
    final View root = LayoutInflater.from(context).inflate(R.layout.view_status_detail, this, true);

    ViewPager pager = (ViewPager) root.findViewById(R.id.photo_collection);
    PhotoDetailViewPagerAdapter adapter = new PhotoDetailViewPagerAdapter(getContext(), getPhotos());
    pager.setAdapter(adapter);

    adapter.setItemClickListener(this);

    ViewPagerIndicator indicator = (ViewPagerIndicator) findViewById(R.id.view_pager_indicator);
    indicator.setGravity(3);

    ImageView more_btn = (ImageView) findViewById(R.id.for_detail_btn);

    RelativeLayout detail_container = (RelativeLayout) findViewById(R.id.detail_container);
    detail_container.setOnTouchListener(new OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return true;
        }
    });
}
 
Example 3
Project: ElAhorcado   File: MainActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    tvPulsa = (TextView) findViewById(R.id.tvPulsa);
    rl = (RelativeLayout) findViewById(R.id.activity_main);
    animation = AnimationUtils.loadAnimation(this, R.anim.fadeinout);

    tvPulsa.startAnimation(animation);

    rl.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {

            Intent intent = new Intent(MainActivity.this, MenuActivity.class);
            startActivity(intent);

            return true;
        }
    });
}
 
Example 4
Project: AliZhiBoHao   File: LiveCameraActivity.java   Source Code and License Vote up 6 votes
private void initView() {
    mRelativeLayout = (RelativeLayout) findViewById(R.id.rl_main);
    push_state_ll = (LinearLayout) findViewById(R.id.push_state_ll);
    settings = (ImageView) findViewById(R.id.iv_settings);
    settings.setOnClickListener(this);
    wx_user_name = (TextView) findViewById(R.id.wx_user_name_tv);
    wx_user_icon = (CircleImageView) findViewById(R.id.wx_user_icon_iv);
    mCountTimeView = (CountTimeView) findViewById(R.id.count_time_view);
    mRecorderButton = (ImageView) findViewById(R.id.iv_push);
    mRecorderButton.setOnClickListener(this);
    btn_pop_pro = (ImageView) findViewById(R.id.btn_pro);
    btn_pop_pro.setOnClickListener(this);
    btn_pop_talk = (ImageView) findViewById(R.id.btn_talk);
    btn_pop_talk.setOnClickListener(this);
    mTv_watch_person = (TextView) findViewById(R.id.tv_watch_person);
    mRelativeLayout.setOnTouchListener(this);
}
 
Example 5
Project: prismoji-android   File: PrismojiView.java   Source Code and License Vote up 6 votes
private void handleOnClicks(final ViewPager emojisPager) {
    for (int i = 0; i < emojiTabs.length - 1; i++) {
        final RelativeLayout categoryLayout = (RelativeLayout) emojiTabs[i].findViewById(R.id.category_layout);
        categoryLayout.setOnClickListener(new EmojiTabsClickListener(emojisPager, i));
    }

    final RelativeLayout backspaceLayout = (RelativeLayout) emojiTabs[emojiTabs.length - 1].findViewById(R.id.category_layout);
    backspaceLayout.setOnTouchListener(
            new RepeatListener(INITIAL_INTERVAL, NORMAL_INTERVAL, new OnClickListener() {
                @Override
                public void onClick(final View view) {
                    if (onEmojiBackspaceClickListener != null) {
                        onEmojiBackspaceClickListener.onEmojiBackspaceClicked(view);
                    }
                }
            }));
}
 
Example 6
Project: Bigbang   File: ArcTipViewController.java   Source Code and License Vote up 5 votes
private void initView() {
    showBigBang = SPHelper.getBoolean(ConstantUtil.TOTAL_SWITCH, true);
    isStick=SPHelper.getBoolean(ConstantUtil.FLOATVIEW_IS_STICK,false);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
        Point point = new Point();
        mWindowManager.getDefaultDisplay().getSize(point);
        mScreenWidth = point.x;
        mScreenHeight = point.y;
    } else {
        mScreenWidth = mWindowManager.getDefaultDisplay().getWidth();
        mScreenHeight = mWindowManager.getDefaultDisplay().getHeight();
    }
    if (showBigBang) {
        mCurrentIconAlpha =  SPHelper.getInt(ConstantUtil.FLOATVIEW_ALPHA, 70) / 100f;
    } else {
        mCurrentIconAlpha = 0.6f * SPHelper.getInt(ConstantUtil.FLOATVIEW_ALPHA, 70) / 100f;
    }

    iconFloatView = (LinearLayout) View.inflate(mContext, R.layout.arc_float_icon, null);
    floatImageView = ((ImageView) iconFloatView.findViewById(R.id.float_image));
    acrFloatView = (RelativeLayout) View.inflate(mContext, R.layout.arc_view_float, null);
    archMenu = (ArcMenu) acrFloatView.findViewById(R.id.arc_menu);
    initIcon();
    archMenu.setOnModeSeletedListener(new ArcMenu.OnModeSeletedListener() {
        @Override
        public void onModeSelected() {
            showFloatImageView();
        }

        @Override
        public void onNothing() {

        }
    });
    // event listeners
    acrFloatView.setOnTouchListener(this);
    iconFloatView.setOnTouchListener(this);
}
 
Example 7
Project: TestChat   File: UserDetailActivity.java   Source Code and License Vote up 4 votes
@Override
        public void initView() {
//                toolbar = (Toolbar) findViewById(R.id.tb_toolbar);
//                collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.ctl_layout);
//                floatingActionButton = (FloatingActionButton) findViewById(R.id.fab_avatar);
                floatingActionButton = (FloatingActionButton) findViewById(R.id.fab_activity_user_detail_button);
                floatingActionButton.setImageResource(R.drawable.ic_mode_edit_blue_grey_900_24dp);
//                display = (RecyclerView) findViewById(R.id.rcl_content);
                display = (RecyclerView) findViewById(R.id.rcv_activity_user_detail_display);
                refresh = (SwipeRefreshLayout) findViewById(R.id.refresh_activity_user_detail_refresh);
//                bgCover = (ImageView) findViewById(R.id.iv_background_cover);
//                appBarLayout = (AppBarLayout) findViewById(R.id.al_appbar_layout);
                bottomInput = (LinearLayout) findViewById(R.id.ll_user_detail_bottom);
                input = (EditText) findViewById(R.id.et_user_detail_input);
                send = (ImageView) findViewById(R.id.iv_user_detail_send);
                rootContainer = (RelativeLayout) findViewById(R.id.rl_activity_user_detail_container);
                rootContainer.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                        @Override
                        public void onGlobalLayout() {
                                Rect rect = new Rect();
                                rootContainer.getWindowVisibleDisplayFrame(rect);
                                screenHeight = rootContainer.getRootView().getHeight();
                                int keyBoardHeight = screenHeight - rect.bottom;
                                int status = getStatusHeight();
                                if (keyBoardHeight != mKeyBoardHeight) {
                                        if (keyBoardHeight > mKeyBoardHeight) {
                                                bottomInput.setVisibility(View.VISIBLE);
                                                RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) bottomInput.getLayoutParams();
                                                int realHeight = screenHeight - status - bottomInput.getHeight() - keyBoardHeight;
                                                layoutParams.setMargins(0, realHeight, 0, 0);
                                                bottomInput.setLayoutParams(layoutParams);
                                                mKeyBoardHeight = keyBoardHeight;
                                                floatingActionButton.setVisibility(View.GONE);
                                                mLinearLayoutManager.scrollToPositionWithOffset(currentPosition, getListOffset());
                                        } else {
                                                floatingActionButton.setVisibility(View.VISIBLE);
                                                mKeyBoardHeight = keyBoardHeight;
                                                bottomInput.setVisibility(View.GONE);
                                        }
                                }
                        }
                });
//                appBarLayout.addOnOffsetChangedListener(this);
                send.setOnClickListener(this);
                refresh.setOnRefreshListener(this);
                floatingActionButton.setOnClickListener(this);
                rootContainer.setOnTouchListener(new View.OnTouchListener() {
                        @Override
                        public boolean onTouch(View v, MotionEvent event) {
                                if (mCommentPopupWindow != null && mCommentPopupWindow.isShowing()) {
                                        mCommentPopupWindow.dismiss();
                                }

//                                这里进行点击关闭编辑框
                                if (bottomInput.getVisibility() == View.VISIBLE) {
                                        LogUtil.e("触摸界面点击关闭输入法");
                                        dealBottomView(false);
                                        return true;
                                }
                                return false;
                        }
                });
        }
 
Example 8
Project: OddLauncher   File: HomeActivity.java   Source Code and License Vote up 4 votes
public void initUI() {
        db = new DatabaseHelper(this);
        rlHome = (RelativeLayout) findViewById(R.id.layout_home);
        rlHome.setOnClickListener(this);
        menu = findViewById(R.id.my_fragment);
        centralView = findViewById(R.id.center_view);
        menu.setVisibility(View.GONE);
        //search
        searchText = (EditText) findViewById(R.id.search_bar_text);
        flSearch = (FrameLayout) findViewById(R.id.frame_search);
        rvSearch = (RecyclerView) findViewById(R.id.rl_search);
        btnCancelSearch = (ImageButton) findViewById(R.id.btn_cancel_search);
        btnCancelSearch.setOnClickListener(this);
        btnDecSearch = (ImageButton) findViewById(R.id.btn_dec_search);
        btnSearch = (ImageButton) findViewById(R.id.btn_search);
        btnSearch.setOnClickListener(this);

        searchBar = (LinearLayout) findViewById(R.id.search_bar_home);
        rvRight = (RecyclerView) findViewById(R.id.list_view_right);
        rvLeft = (RecyclerView) findViewById(R.id.list_view_left);
        frameRight = (FrameLayout) findViewById(R.id.frame_right);
        frameLeft = (FrameLayout) findViewById(R.id.frame_left);
        btnTheme = (ImageButton) findViewById(R.id.btn_theme);
        btnTheme.setOnClickListener(this);
        btnSettings = (ImageButton) findViewById(R.id.btn_settings);
        btnSettings.setOnClickListener(this);
        btnAddLeft = (ImageButton) findViewById(R.id.btn_add_left);
        btnAddLeft.setOnClickListener(this);
        btnAddRight = (ImageButton) findViewById(R.id.btn_add_right);
        btnAddRight.setOnClickListener(this);
        btnLeftElem = (ImageButton) findViewById(R.id.left);
        btnLeftElem.setOnClickListener(this);
        btnRightElem = (ImageButton) findViewById(R.id.right);
        btnRightElem.setOnClickListener(this);
        LinearLayoutManager managerRight =
                new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        LinearLayoutManager managerLeft =
                new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        managerSearch =
                new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
        rvRight.setLayoutManager(managerRight);
        rvLeft.setLayoutManager(managerLeft);
        rvSearch.setLayoutManager(managerSearch);

        settingsHelper = new SettingsHelper(this);
        settingsHelperSearch = new SettingsHelper(this);

        //handling swipe action
        new RecyclerItemSwiper(0, LEFT | RIGHT, this,
                adapterLeft, arrayListLeft, db, "left", rvLeft);

        new RecyclerItemSwiper(0, LEFT | RIGHT, this,
                adapterRight, arrayListRight, db, "right", rvRight);

        setupSharedPreferences();
//        setupSharedPreferencesNew();
//        rlHome.setOnTouchListener(new RelativeLayoutTouchListener(this));
        mainElemsTouchListener = new MainElemsTouchListener(this, centralMenu, menu, rlHome);
        rlHome.setOnTouchListener(mainElemsTouchListener);
    }