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

The following examples show how to use android.widget.RelativeLayout#setOnTouchListener() . 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: FullScreenViewFragment.java    From CameraV with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("deprecation")
@Override
public View onCreateView(LayoutInflater li, ViewGroup container, Bundle savedInstanceState)
{
	super.onCreateView(li, container, savedInstanceState);

	Display display =getActivity().getWindowManager().getDefaultDisplay();
	dims = new int[] { display.getWidth(), display.getHeight() };

	rootView = li.inflate(R.layout.fragment_editor_media_view, null);

	DEFAULT_REGION_WIDTH = (int) (dims[0] * 0.15);
	DEFAULT_REGION_HEIGHT = (int) (dims[1] * 0.1);

	mediaHolder = (RelativeLayout) rootView.findViewById(R.id.media_holder);
	mediaHolder.setOnTouchListener(this);

	initLayout();

	return rootView;
}
 
Example 2
Source File: JCVideoPlayer.java    From JieCaoVideoPlayer-develop with MIT License 6 votes vote down vote up
protected 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);
    progressBar.setOnTouchListener(this);

    textureViewContainer.setOnTouchListener(this);
    mScreenWidth = getContext().getResources().getDisplayMetrics().widthPixels;
    mScreenHeight = getContext().getResources().getDisplayMetrics().heightPixels;
    mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
}
 
Example 3
Source File: JCVideoPlayer.java    From SprintNBA with Apache License 2.0 6 votes vote down vote up
protected 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);
    progressBar.setOnTouchListener(this);

    textureViewContainer.setOnTouchListener(this);
    mScreenWidth = getContext().getResources().getDisplayMetrics().widthPixels;
    mScreenHeight = getContext().getResources().getDisplayMetrics().heightPixels;
    mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
}
 
Example 4
Source File: JCVideoPlayer.java    From JCVideoPlayer with MIT License 6 votes vote down vote up
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 5
Source File: ProgressDialog.java    From MaterialDesignLibrary with Apache License 2.0 5 votes vote down vote up
@Override
  protected void onCreate(Bundle savedInstanceState) {
	requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.progress_dialog);
    
	view = (RelativeLayout)findViewById(R.id.contentDialog);
	backView = (RelativeLayout)findViewById(R.id.dialog_rootView);
	backView.setOnTouchListener(new OnTouchListener() {
		
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			if (event.getX() < view.getLeft() 
					|| event.getX() >view.getRight()
					|| event.getY() > view.getBottom() 
					|| event.getY() < view.getTop()) {
				dismiss();
			}
			return false;
		}
	});
	
    this.titleTextView = (TextView) findViewById(R.id.title);
    setTitle(title);
    if(progressColor != -1){
    	ProgressBarCircularIndeterminate progressBarCircularIndeterminate = (ProgressBarCircularIndeterminate) findViewById(R.id.progressBarCircularIndetermininate);
    	progressBarCircularIndeterminate.setBackgroundColor(progressColor);
    }
    
    
}
 
Example 6
Source File: ExplosionFragment.java    From Backboard with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
	mRootView = (RelativeLayout) inflater.inflate(R.layout.fragment_bloom, container, false);

	mCircles = getResources().obtainTypedArray(R.array.circles);
	mRunnable = new CircleSpawn();

	mRootView.setOnTouchListener(new View.OnTouchListener() {
		@Override
		@SuppressLint("ClickableViewAccessibility")
		public boolean onTouch(View v, MotionEvent event) {
			switch (event.getAction()) {
			case MotionEvent.ACTION_DOWN:

				// create circles as long as the user is holding down
				mTouching = true;
				mHandler.post(mRunnable);

				break;
			case MotionEvent.ACTION_UP:
				mTouching = false;

				break;
			}

			return true;
		}
	});

	return mRootView;
}
 
Example 7
Source File: ArcTipViewController.java    From timecat with Apache License 2.0 5 votes vote down vote up
private void initView() {
    showTimeCat = SPHelper.getBoolean(Constants.TOTAL_SWITCH, true);
    isStick = SPHelper.getBoolean(Constants.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 (showTimeCat) {
        mCurrentIconAlpha = SPHelper.getInt(Constants.FLOATVIEW_ALPHA, 70) / 100f;
    } else {
        mCurrentIconAlpha = 0.6f * SPHelper.getInt(Constants.FLOATVIEW_ALPHA, 70) / 100f;
    }

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

        @Override
        public void onNothing() {

        }
    });
    // event listeners
    acrFloatView.setOnTouchListener(this);
    iconFloatView.setOnTouchListener(this);
}
 
Example 8
Source File: LockscreenViewService.java    From Android-LockScreenSample-DisableHomeButtonKey with Apache License 2.0 5 votes vote down vote up
private void settingLockView() {
    mBackgroundLayout = (RelativeLayout) mLockscreenView.findViewById(R.id.lockscreen_background_layout);
    mBackgroundInLayout = (RelativeLayout) mLockscreenView.findViewById(R.id.lockscreen_background_in_layout);
    mBackgroundLockImageView = (ImageView) mLockscreenView.findViewById(R.id.lockscreen_background_image);
    mForgroundLayout = (RelativeLayout) mLockscreenView.findViewById(R.id.lockscreen_forground_layout);
    mShimmerTextView = (ShimmerTextView) mLockscreenView.findViewById(R.id.shimmer_tv);
    (new Shimmer()).start(mShimmerTextView);
    mForgroundLayout.setOnTouchListener(mViewTouchListener);

    mStatusBackgruondDummyView = (RelativeLayout) mLockscreenView.findViewById(R.id.lockscreen_background_status_dummy);
    mStatusForgruondDummyView = (RelativeLayout) mLockscreenView.findViewById(R.id.lockscreen_forground_status_dummy);
    setBackGroundLockView();

    DisplayMetrics displayMetrics = mContext.getResources().getDisplayMetrics();
    mDeviceWidth = displayMetrics.widthPixels;
    mDevideDeviceWidth = (mDeviceWidth / 2);
    mBackgroundLockImageView.setX((int) (((mDevideDeviceWidth) * -1)));

    //kitkat
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        int val = LockscreenUtil.getInstance(mContext).getStatusBarHeight();
        RelativeLayout.LayoutParams forgroundParam = (RelativeLayout.LayoutParams) mStatusForgruondDummyView.getLayoutParams();
        forgroundParam.height = val;
        mStatusForgruondDummyView.setLayoutParams(forgroundParam);
        AlphaAnimation alpha = new AlphaAnimation(0.5F, 0.5F);
        alpha.setDuration(0); // Make animation instant
        alpha.setFillAfter(true); // Tell it to persist after the animation ends
        mStatusForgruondDummyView.startAnimation(alpha);
        RelativeLayout.LayoutParams backgroundParam = (RelativeLayout.LayoutParams) mStatusBackgruondDummyView.getLayoutParams();
        backgroundParam.height = val;
        mStatusBackgruondDummyView.setLayoutParams(backgroundParam);
    }
}
 
Example 9
Source File: ProgressDialog.java    From MoeGallery with GNU General Public License v3.0 5 votes vote down vote up
@Override
  protected void onCreate(Bundle savedInstanceState) {
	requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.progress_dialog);
    
	view = (RelativeLayout)findViewById(R.id.contentDialog);
	backView = (RelativeLayout)findViewById(R.id.dialog_rootView);
	backView.setOnTouchListener(new OnTouchListener() {
		
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			if (event.getX() < view.getLeft() 
					|| event.getX() >view.getRight()
					|| event.getY() > view.getBottom() 
					|| event.getY() < view.getTop()) {
				dismiss();
			}
			return false;
		}
	});
	
    this.titleTextView = (TextView) findViewById(R.id.title);
    setTitle(title);
    if(progressColor != -1){
    	ProgressBarCircularIndeterminate progressBarCircularIndeterminate = (ProgressBarCircularIndeterminate) findViewById(R.id.progressBarCircularIndetermininate);
    	progressBarCircularIndeterminate.setBackgroundColor(progressColor);
    }
    
    
}
 
Example 10
Source File: ProgressDialog.java    From meiShi with Apache License 2.0 5 votes vote down vote up
@Override
  protected void onCreate(Bundle savedInstanceState) {
	requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.progress_dialog);
    
	view = (RelativeLayout)findViewById(R.id.contentDialog);
	backView = (RelativeLayout)findViewById(R.id.dialog_rootView);
	backView.setOnTouchListener(new OnTouchListener() {
		
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			if (event.getX() < view.getLeft() 
					|| event.getX() >view.getRight()
					|| event.getY() > view.getBottom() 
					|| event.getY() < view.getTop()) {
				dismiss();
			}
			return false;
		}
	});
	
    this.titleTextView = (TextView) findViewById(R.id.title);
    setTitle(title);
    if(progressColor != -1){
    	ProgressBarCircularIndeterminate progressBarCircularIndeterminate = (ProgressBarCircularIndeterminate) findViewById(R.id.progressBarCircularIndetermininate);
    	progressBarCircularIndeterminate.setBackgroundColor(progressColor);
    }
    
    
}
 
Example 11
Source File: BloomFragment.java    From Backboard with Apache License 2.0 4 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
	mRootView = (RelativeLayout) inflater.inflate(R.layout.fragment_bloom, container, false);

	mCircles = new View[6];

	float diameter = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, DIAMETER,
			getResources().getDisplayMetrics());

	final TypedArray circles = getResources().obtainTypedArray(R.array.circles);

	// layout params
	RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams((int) diameter,
			(int) diameter);
	params.addRule(RelativeLayout.CENTER_IN_PARENT);

	// create the circle views
	int colorIndex = 0;
	for (int i = 0; i < mCircles.length; i++) {
		mCircles[i] = new View(getActivity());

		mCircles[i].setLayoutParams(params);

		mCircles[i].setBackgroundDrawable(getResources().getDrawable(circles
				.getResourceId(colorIndex, -1)));

		colorIndex++;
		if (colorIndex >= circles.length()) {
			colorIndex = 0;
		}

		mRootView.addView(mCircles[i]);
	}

	circles.recycle();

	/* Animations! */

	final SpringSystem springSystem = SpringSystem.create();

	// create spring
	final Spring spring = springSystem.createSpring();

	// add listeners along arc
	double arc = 2 * Math.PI / mCircles.length;

	for (int i = 0; i < mCircles.length; i++) {
		View view = mCircles[i];

		// map spring to a line segment from the center to the edge of the ring
		spring.addListener(new MapPerformer(view, View.TRANSLATION_X, 0, 1,
				0, (float) (RING_DIAMETER * Math.cos(i * arc))));

		spring.addListener(new MapPerformer(view, View.TRANSLATION_Y, 0, 1,
				0, (float) (RING_DIAMETER * Math.sin(i * arc))));

		spring.setEndValue(CLOSED);
	}

	mRootView.setOnTouchListener(new ToggleImitator(spring, CLOSED, OPEN));

	return mRootView;
}
 
Example 12
Source File: ColorSelector.java    From MaterialDesignLibrary with Apache License 2.0 4 votes vote down vote up
@Override
  protected void onCreate(Bundle savedInstanceState) {
	requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.color_selector);
    
    view = (LinearLayout)findViewById(R.id.contentSelector);
	backView = (RelativeLayout)findViewById(R.id.rootSelector);
	backView.setOnTouchListener(new OnTouchListener() {
		
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			if (event.getX() < view.getLeft() || event.getX() >view.getRight()
					|| event.getY() > view.getBottom() || event.getY() < view.getTop()) {
				dismiss();
			}
			return false;
		}
	});

    colorView = findViewById(R.id.viewColor);
    colorView.setBackgroundColor(color);
    // Resize ColorView
    colorView.post(new Runnable() {
		
		@Override
		public void run() {
			LayoutParams params = (LayoutParams) colorView.getLayoutParams();
			params.height = colorView.getWidth();
			colorView.setLayoutParams(params);
		}
	});
    
    
    // Configure Sliders
    red = (Slider) findViewById(R.id.red);
    green = (Slider) findViewById(R.id.green);
    blue = (Slider) findViewById(R.id.blue);
    
    int r = (this.color >> 16) & 0xFF;
	int g = (this.color >> 8) & 0xFF;
	int b = (this.color >> 0) & 0xFF;
	
	red.setValue(r);
	green.setValue(g);
	blue.setValue(b);
	
	red.setOnValueChangedListener(this);
	green.setOnValueChangedListener(this);
	blue.setOnValueChangedListener(this);
}
 
Example 13
Source File: MainActivity.java    From AndroidPlayground with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mContainer = (RelativeLayout) findViewById(R.id.mRlContainer);
    mTextView = (TextView) findViewById(R.id.mTv);
    mTextView2 = (TextView) findViewById(R.id.mTv2);
    mTextView3 = (TextView) findViewById(R.id.mTv3);

    final MoveGestureDetector moveGestureDetector =
            new MoveGestureDetector(this, new SimpleOnMoveGestureListener() {
                @Override
                public boolean onMove(MoveGestureDetector detector) {
                    Log.d("MainActivity", "" + mIsShowing + ", " + detector.getFocusDelta().y);
                    if (mIsShowing) {
                        mMoveUpY += detector.getFocusDelta().y;
                        if (mMoveUpY > 0) {
                            mMoveUpY = 0;
                        }
                        if (mMoveUpY < -TRIGGER_MOVED_Y) {
                            hidePanel();
                        }
                    } else {
                        mMoveDownY += detector.getFocusDelta().y;
                        if (mMoveDownY < 0) {
                            mMoveDownY = 0;
                        }
                        if (mMoveDownY > TRIGGER_MOVED_Y) {
                            showPanel();
                        }
                    }
                    return true;
                }
            });

    mContainer.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return moveGestureDetector.onTouchEvent(event);
        }
    });

    mTextView.postDelayed(mHidingRunnable, 2000);
}
 
Example 14
Source File: ColorSelector.java    From meiShi with Apache License 2.0 4 votes vote down vote up
@Override
  protected void onCreate(Bundle savedInstanceState) {
	requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.color_selector);
    
    view = (LinearLayout)findViewById(R.id.contentSelector);
	backView = (RelativeLayout)findViewById(R.id.rootSelector);
	backView.setOnTouchListener(new OnTouchListener() {
		
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			if (event.getX() < view.getLeft() || event.getX() >view.getRight()
					|| event.getY() > view.getBottom() || event.getY() < view.getTop()) {
				dismiss();
			}
			return false;
		}
	});

    colorView = findViewById(R.id.viewColor);
    colorView.setBackgroundColor(color);
    // Resize ColorView
    colorView.post(new Runnable() {
		
		@Override
		public void run() {
			LayoutParams params = (LayoutParams) colorView.getLayoutParams();
			params.height = colorView.getWidth();
			colorView.setLayoutParams(params);
		}
	});
    
    
    // Configure Sliders
    red = (Slider) findViewById(R.id.red);
    green = (Slider) findViewById(R.id.green);
    blue = (Slider) findViewById(R.id.blue);
    
    int r = (this.color >> 16) & 0xFF;
	int g = (this.color >> 8) & 0xFF;
	int b = (this.color >> 0) & 0xFF;
	
	red.setValue(r);
	green.setValue(g);
	blue.setValue(b);
	
	red.setOnValueChangedListener(this);
	green.setOnValueChangedListener(this);
	blue.setOnValueChangedListener(this);
}
 
Example 15
Source File: ColorSelector.java    From MoeGallery with GNU General Public License v3.0 4 votes vote down vote up
@Override
  protected void onCreate(Bundle savedInstanceState) {
	requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.color_selector);
    
    view = (LinearLayout)findViewById(R.id.contentSelector);
	backView = (RelativeLayout)findViewById(R.id.rootSelector);
	backView.setOnTouchListener(new OnTouchListener() {
		
		@Override
		public boolean onTouch(View v, MotionEvent event) {
			if (event.getX() < view.getLeft() || event.getX() >view.getRight()
					|| event.getY() > view.getBottom() || event.getY() < view.getTop()) {
				dismiss();
			}
			return false;
		}
	});

    colorView = findViewById(R.id.viewColor);
    colorView.setBackgroundColor(color);
    // Resize ColorView
    colorView.post(new Runnable() {
		
		@Override
		public void run() {
			LinearLayout.LayoutParams params = (LayoutParams) colorView.getLayoutParams();
			params.height = colorView.getWidth();
			colorView.setLayoutParams(params);
		}
	});
    
    
    // Configure Sliders
    red = (Slider) findViewById(R.id.red);
    green = (Slider) findViewById(R.id.green);
    blue = (Slider) findViewById(R.id.blue);
    
    int r = (this.color >> 16) & 0xFF;
	int g = (this.color >> 8) & 0xFF;
	int b = (this.color >> 0) & 0xFF;
	
	red.setValue(r);
	green.setValue(g);
	blue.setValue(b);
	
	red.setOnValueChangedListener(this);
	green.setOnValueChangedListener(this);
	blue.setOnValueChangedListener(this);
}
 
Example 16
Source File: RealTimeLocationActivity.java    From sealtalk-android with MIT License 4 votes vote down vote up
@Override
    protected MapView initView(Bundle savedInstanceState) {

        MapView mapView = (MapView) findViewById(R.id.map);
        horizontalScrollView = (RealTimeLocationHorizontalScrollView) findViewById(R.id.scroll_view);

        mExitImageView = (ImageView) findViewById(android.R.id.icon);
        mCloseImageView = (ImageView) findViewById(android.R.id.icon1);

        mExitImageView.setOnClickListener(this);
        mCloseImageView.setOnClickListener(this);

        mParticipantTextView = (TextView) findViewById(android.R.id.text1);

        mLayout = (RelativeLayout) findViewById(R.id.layout);
        mLayout.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
//                Log.d("RealTimeLocation", "--onTouch-------------");
                return true;
            }
        });

        EventBus.getDefault().register(this);

        int type = getIntent().getIntExtra("conversationType", 0);
        targetId = getIntent().getStringExtra("targetId");

        conversationType = Conversation.ConversationType.setValue(type);

        list = DBManager.getInstance(this).getDaoSession().getFriendDao().loadAll();
        sp = getSharedPreferences("config", MODE_PRIVATE);
        UserInfoEngine.getInstance(this).setListener(new UserInfoEngine.UserInfoListener() {
            @Override
            public void onResult(UserInfo info) {
                if (info != null) {
                    if (TextUtils.isEmpty(info.getPortraitUri().toString())) {
                        info.setPortraitUri(Uri.parse(RongGenerate.generateDefaultAvatar(info.getName(), info.getUserId())));
                    }
                    horizontalScrollView.addUserToView(info);
                    setParticipantTextView(-1);
                }
            }
        });

        return mapView;
    }
 
Example 17
Source File: FragmentMediaItemDetails.java    From uPods-android with Apache License 2.0 4 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    View view = inflater.inflate(R.layout.fragment_media_details, container, false);
    lnInternetError = (LinearLayout) view.findViewById(R.id.lnInternetError);
    rlDetailedContent = (RelativeLayout) view.findViewById(R.id.rlDetailedContent);
    viewStatusBar = view.findViewById(R.id.viewStatusBar);
    tvDetailedDescription = (TextView) view.findViewById(R.id.tvDetailedDescription);
    tvDetailedHeader = (TextView) view.findViewById(R.id.tvDetailedHeader);
    tvDetailedSubHeader = (TextView) view.findViewById(R.id.tvDetailedSubHeader);
    tvDetailedDesHeader = (TextView) view.findViewById(R.id.tvDetailedDesHeader);
    tvBottomHeader = (TextView) view.findViewById(R.id.tvDetailedBottomHeader);
    viewDetailedHeader = view.findViewById(R.id.viewDetailedHeader);
    btnSubscribe = (Button) view.findViewById(R.id.btnSubscribe);
    btnMediaMore = (ImageButton) view.findViewById(R.id.btnMediaMore);
    imgDetailedTopCover = (ImageView) view.findViewById(R.id.imgDetailedCover);
    imgBluredCover = (ImageView) view.findViewById(R.id.imgBluredCover);
    fbDetailsPlay = (FloatingActionButton) view.findViewById(R.id.fbDetailsPlay);
    svDetails = (DetailsScrollView) view.findViewById(R.id.svDetails);
    rvTracks = (RecyclerView) view.findViewById(R.id.rvTracks);
    pbTracks = (ProgressBar) view.findViewById(R.id.pbTracks);
    moveDeltaY = 0;

    if (playableItem != null) {
        initImagesColors();
        tvDetailedHeader.setText(playableItem.getName());
        tvDetailedSubHeader.setText(playableItem.getSubHeader());
        tvBottomHeader.setText(playableItem.getBottomHeader());
        btnSubscribe.setText(playableItem.isSubscribed ? getString(R.string.unsubscribe) : getString(R.string.subscribe));
        initSubscribeBtn();

        if (playableItem.hasTracks()) {
            initTrackable();
        } else {
            initNotTrackable();
        }
    }

    rlDetailedContent.setOnTouchListener(this);
    view.setOnClickListener(frgamentCloseClickListener);
    initFragmentScrollConstants();

    return view;
}
 
Example 18
Source File: SettingFragment.java    From Social with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.setting_fragment_layout,container,false);
    ll_modify_user_data = (LinearLayout)view.findViewById(R.id.id_setting_fg_ll_modify_user_data);
    ll_modify_user_data.setOnClickListener(this);
    ll_modify_user_data.setOnTouchListener(this);
    rl_general_setting = (RelativeLayout)view.findViewById(R.id.id_setting_fg_rl_gegeral_setting);
    rl_general_setting.setOnClickListener(this);
    rl_general_setting.setOnTouchListener(this);
    rl_private = (RelativeLayout)view.findViewById(R.id.id_setting_fg_rl_private);
    rl_private.setOnClickListener(this);
    rl_private.setOnTouchListener(this);
    rl_feedback = (RelativeLayout)view.findViewById(R.id.id_setting_fg_rl_feedback);
    rl_feedback.setOnClickListener(this);
    rl_feedback.setOnTouchListener(this);
    rl_about = (RelativeLayout)view.findViewById(R.id.id_setting_fg_rl_about);
    rl_about.setOnClickListener(this);
    rl_about.setOnTouchListener(this);


    rv_account_and_secure = (RippleView)view.findViewById(R.id.id_setting_fg_rv_account_and_souce);
    rv_account_and_secure.setOnRippleCompleteListener(this);

    iv_head = (CircleImageView)view.findViewById(R.id.id_setting_fg_iv_head);
    tv_nickname = (TextView)view.findViewById(R.id.id_setting_fg_tv_nickname);
    tv_username = (TextView)view.findViewById(R.id.id_setting_fg_tv_username);
    if (OkhttpUtil.checkLogin()){
        tv_username.setText("账号:" + SharedPreferenceUtil.getUserName());
        tv_nickname.setText(SharedPreferenceUtil.getNickname());
        //Picasso.with(getActivity()).load(WebUtil.HTTP_ADDRESS + SharedPreferenceUtil.getHeadpath()).into(iv_head);
    }

    intentFilter = new IntentFilter();
    intentFilter.addAction("com.allever.modifyUserHead");
    intentFilter.addAction("com.allever.modifyUserData");
    intentFilter.addAction("com.allever.afterlogin");
    afterModifyUserDataReceiver = new AfterModifyUserDataReceiver();
    afterLoginReceiver = new AfterLoginaReceiver();
    getActivity().registerReceiver(afterLoginReceiver,intentFilter);
    getActivity().registerReceiver(afterModifyUserDataReceiver,intentFilter);

    handler = new Handler(){
        @Override
        public void handleMessage(Message msg) {
            //super.handleMessage(msg);
            switch (msg.what){
                case OkhttpUtil.MESSAGE_AUTO_LOGIN:
                    handleAutoLogin(msg);
                    break;
                case OkhttpUtil.MESSAGE_LOGOUT:
                    handleLogout(msg);
                    break;
            }
        }
    };

    btn_logout = (ButtonRectangle)view.findViewById(R.id.id_setting_fg_btn_logout);
    btn_logout.setOnClickListener(this);

    if (OkhttpUtil.checkLogin()){
        btn_logout.setVisibility(View.VISIBLE);
    }else{
        btn_logout.setVisibility(View.INVISIBLE);
    }

    return view;
}
 
Example 19
Source File: UserDetailActivity.java    From TestChat with Apache License 2.0 4 votes vote down vote up
@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;
                        }
                });
        }