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

The following examples show how to use android.widget.RelativeLayout#getLayoutParams() . 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: ExoVideoControlsMobile.java    From v9porn with MIT License 6 votes vote down vote up
protected void goFullScreen() {
    isFullScreen = true;
    fullScreenImageView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.discover_video_fs_exit_fullscr));
    setUiFlags(true);
    //hideSystemUI();
    ActivityUtils.setRequestedOrientation(getContext(), ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    ViewGroup viewGroup = ActivityUtils.getWindow(getContext()).getDecorView().findViewById(android.R.id.content);
    //就是这里了,有些statusbar库为了模拟状态栏,可能设置了padding,会在视频上方出现一条横幅,看上去好像状态栏没隐藏,其实已经隐藏了,这个是假的,错觉,所以重新设置padding为0即可
    viewGroup.setPadding(0, 0, 0, 0);
    //这里还可以写的更完美些,因为我这里知道我的视图的parent只有一个child,所以不用管其他的,只需add和removed即可,其他情况则要获取LayoutParams以及其他子view的属性
    parentViewGroup = (ViewGroup) videoView.getParent();
    parentViewGroup.removeView(videoView);
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

    viewGroup.addView(videoView, lp);

    RelativeLayout parent = (RelativeLayout) controlsContainer.getParent();
    ViewGroup.LayoutParams layoutParams = parent.getLayoutParams();
    //旋转之后有虚拟导航栏的话可能布局会铺不满,强制加长
    layoutParams.width = getWidth() + 1000;
    parent.setLayoutParams(layoutParams);
}
 
Example 2
Source File: LargeErrorStateAdapter.java    From Mysplash with GNU Lesser General Public License v3.0 6 votes vote down vote up
ViewHolder(Context context, View itemView) {
    super(itemView);
    ButterKnife.bind(this, itemView);

    RelativeLayout container = itemView.findViewById(R.id.item_multiple_state_error_large_container);
    RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) container.getLayoutParams();
    params.setMargins(0, 0, 0, (int) new DisplayUtils(context).dpToPx(marginBottomDp));
    container.setLayoutParams(params);

    if (showFeedbackText) {
        feedbackTxt.setVisibility(View.VISIBLE);
    } else {
        feedbackTxt.setVisibility(View.GONE);
    }

    if (showFeedbackButton) {
        feedbackBtn.setVisibility(View.VISIBLE);
    } else {
        feedbackBtn.setVisibility(View.GONE);
    }
}
 
Example 3
Source File: AccordionView.java    From Android_accordion_view with MIT License 6 votes vote down vote up
/***
 * This creates an accordion layout. This is called when the user programatically creates an accordion. 'Without Children' signifies that no UI elements
 * have been added to the body of the accordion yet.
 * @param context
 */
private void initializeViewWithoutChildren(Context context) {
    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout accordionLayout = (LinearLayout) inflater.inflate(R.layout.accordion, null);
    partition = accordionLayout.findViewById(R.id.partition);
    heading = (TextView) accordionLayout.findViewById(R.id.heading);
    paragraph = (RelativeLayout) accordionLayout.findViewById(R.id.paragraph_layout);
    dropdownImage = (ImageView) accordionLayout.findViewById(R.id.dropdown_image);
    dropupImage = (ImageView) accordionLayout.findViewById(R.id.dropup_image);
    headingLayout = (LinearLayout) accordionLayout.findViewById(R.id.heading_layout);
    paragraph.removeAllViews();
    removeAllViews();
    paragraphBottomMargin = ((LinearLayout.LayoutParams) paragraph.getLayoutParams()).bottomMargin;
    paragraphTopMargin = ((LinearLayout.LayoutParams) paragraph.getLayoutParams()).topMargin;
    addView(accordionLayout);

}
 
Example 4
Source File: AddToListPopup.java    From DMusic with Apache License 2.0 6 votes vote down vote up
@Override
protected void init() {
    RelativeLayout rlytList = (RelativeLayout) mRootView.findViewById(R.id.rlyt_add_to_list);
    ViewGroup.LayoutParams lp = rlytList.getLayoutParams();
    lp.height = (int) (Util.getScreenSize((Activity) mContext)[1] * 0.382f);
    rlytList.setLayoutParams(lp);

    ldlLoading = (LoadingLayout) mRootView.findViewById(R.id.ldl_loading);
    LRecyclerView lrvList = (LRecyclerView) mRootView.findViewById(R.id.lrv_list);
    adapter = new AddToListAdapter(mContext, new ArrayList<CustomListModel>(), R.layout.module_play_adapter_add_to_list);
    lrvList.setAdapter(adapter);

    mRootView.findViewById(R.id.tv_ok).setOnClickListener(this);
    mRootView.findViewById(R.id.quit).setOnClickListener(this);
    mRootView.findViewById(R.id.v_blank).setOnClickListener(this);
}
 
Example 5
Source File: BasicActivity.java    From letv with Apache License 2.0 6 votes vote down vote up
@SuppressLint({"NewApi"})
private void setStatusBarTransparent(String titleResId) {
    ViewGroup title = (ViewGroup) this.mRootView.findViewWithTag(titleResId);
    if (VERSION.SDK_INT >= 19) {
        getWindow().getDecorView().setSystemUiVisibility(1280);
        getWindow().addFlags(67108864);
        if (title != null) {
            LayoutParams lp = title.getLayoutParams();
            lp.height = dip2px(72.0f);
            title.setLayoutParams(lp);
            RelativeLayout back = (RelativeLayout) this.mRootView.findViewWithTag("umgr_title_back_layout");
            RelativeLayout.LayoutParams rlp = (RelativeLayout.LayoutParams) back.getLayoutParams();
            rlp.topMargin = dip2px(24.0f);
            back.setLayoutParams(rlp);
            RelativeLayout t = (RelativeLayout) this.mRootView.findViewWithTag("umgr_title_tv_layout");
            RelativeLayout.LayoutParams rrlp = (RelativeLayout.LayoutParams) t.getLayoutParams();
            rrlp.topMargin = dip2px(24.0f);
            t.setLayoutParams(rrlp);
        }
    }
}
 
Example 6
Source File: MyPlayRecordActivity.java    From letv with Apache License 2.0 6 votes vote down vote up
private void initNavigationBar() {
    RelativeLayout my_playrecrod_content = (RelativeLayout) findViewById(R.id.my_collect_content);
    LayoutParams params = (LayoutParams) my_playrecrod_content.getLayoutParams();
    params.bottomMargin = 0;
    my_playrecrod_content.setLayoutParams(params);
    this.mBackImageView = (ImageView) findViewById(2131362351);
    this.mEditView = (TextView) findViewById(2131362354);
    this.mEditView.setText(2131099788);
    this.mEditView.setTextColor(this.mContext.getResources().getColor(2131493261));
    this.mTitleView = (TextView) findViewById(2131362352);
    this.mLoginTip = (RelativeLayout) findViewById(R.id.my_collect_bottom_login_btn);
    this.mLoginTip.setVisibility(8);
    this.mTitleView.setText(getResources().getString(2131100479));
    this.mBackImageView.setOnClickListener(this.onClickEvent);
    this.mTitleView.setOnClickListener(this.onClickEvent);
    this.mEditView.setOnClickListener(this.onClickEvent);
}
 
Example 7
Source File: ImageViewerActivity.java    From titanium-imagepicker with Apache License 2.0 5 votes vote down vote up
PhotoHolder(View v) {
    super(v);

    layout = (RelativeLayout) v.findViewById(image_view_container);
    imView = (ImageView) v.findViewById(image_id);
    title = (TextView) v.findViewById(title_id);

    layout.getLayoutParams().height = Defaults.IMAGE_HEIGHT;

    if (isShapeCircle) {
    	int pad = Defaults.CIRCLE_PADDING;
    	imView.setPadding(pad, pad, pad, pad);
    }
}
 
Example 8
Source File: AccordionView.java    From Android_accordion_view with MIT License 5 votes vote down vote up
/***
 * This function is called when the accordion is added in the XML itself and is used to initialize the various components
 * of the accordion
 * @param context
 */
private void initializeViews(Context context) {

    inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout accordionLayout = (LinearLayout) inflater.inflate(R.layout.accordion, null);
    partition = accordionLayout.findViewById(R.id.partition);
    heading = (TextView) accordionLayout.findViewById(R.id.heading);
    paragraph = (RelativeLayout) accordionLayout.findViewById(R.id.paragraph_layout);
    dropdownImage = (ImageView) accordionLayout.findViewById(R.id.dropdown_image);
    dropupImage = (ImageView) accordionLayout.findViewById(R.id.dropup_image);
    headingLayout = (LinearLayout) accordionLayout.findViewById(R.id.heading_layout);
    paragraph.removeAllViews();

    int i;
    children = new View[getChildCount()];
    for (i = 0; i < getChildCount(); i++) {
        children[i] = getChildAt(i);
    }
    removeAllViews();
    for (i = 0; i < children.length; i++) {
        paragraph.addView(children[i]);
    }


    paragraphBottomMargin = ((LinearLayout.LayoutParams) paragraph.getLayoutParams()).bottomMargin;
    paragraphTopMargin = ((LinearLayout.LayoutParams) paragraph.getLayoutParams()).topMargin;

    addView(accordionLayout);


}
 
Example 9
Source File: FFmpegPreviewActivity.java    From FFmpegRecorder with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_ffmpeg_preview);

	cancelBtn = (Button) findViewById(R.id.play_cancel);
	cancelBtn.setOnClickListener(this);
	
	DisplayMetrics displaymetrics = new DisplayMetrics();
	getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
	surfaceView = (TextureView) findViewById(R.id.preview_video);
	
	RelativeLayout preview_video_parent = (RelativeLayout)findViewById(R.id.preview_video_parent);
	LayoutParams layoutParams = (LayoutParams) preview_video_parent
			.getLayoutParams();
	layoutParams.width = displaymetrics.widthPixels;
	layoutParams.height = displaymetrics.widthPixels;
	preview_video_parent.setLayoutParams(layoutParams);
	
	surfaceView.setSurfaceTextureListener(this);
	surfaceView.setOnClickListener(this);
	
	path = getIntent().getStringExtra("path");
	
	imagePlay = (ImageView) findViewById(R.id.previre_play);
	imagePlay.setOnClickListener(this);
	
	mediaPlayer = new MediaPlayer();
	mediaPlayer.setOnCompletionListener(this);
}
 
Example 10
Source File: EditPage.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
private void initView() {
	if(!dialogMode) {
		RelativeLayout mainRelLayout = (RelativeLayout)findViewByResName("mainRelLayout");
		RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) mainRelLayout.getLayoutParams();
		lp.setMargins(0,0,0,0);
		lp.height = RelativeLayout.LayoutParams.MATCH_PARENT;
		mainRelLayout.setLayoutParams(lp);
	}
	initTitleView();
	initBodyView();
	initImageListView();
}
 
Example 11
Source File: GosConfigCountdownActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
private void initView() {
	WindowManager wm = this.getWindowManager();
	int width = wm.getDefaultDisplay().getWidth();
	RelativeLayout cel_layout = (RelativeLayout) findViewById(R.id.layoutparms);
	LayoutParams params = cel_layout.getLayoutParams();
	params.height = width;
	params.width = width;
	cel_layout.setLayoutParams(params);
	tvTimer = (TextView) findViewById(R.id.tvTimer);
	rpbConfig = (RoundProgressBar) findViewById(R.id.rpbConfig);

	String softAPLoadingText = (String) getText(R.string.softap_loading);
	progressDialog.setMessage(softAPLoadingText);

}
 
Example 12
Source File: EditPage.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
private void initView() {
	if(!dialogMode) {
		RelativeLayout mainRelLayout = (RelativeLayout)findViewByResName("mainRelLayout");
		RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) mainRelLayout.getLayoutParams();
		lp.setMargins(0,0,0,0);
		lp.height = RelativeLayout.LayoutParams.MATCH_PARENT;
		mainRelLayout.setLayoutParams(lp);
	}
	initTitleView();
	initBodyView();
	initImageListView();
}
 
Example 13
Source File: MainActivity.java    From open-location-code with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_act);
    MyMapView myMapView = (MyMapView) findViewById(R.id.myMapView);
    mMapView = myMapView.getMapView();
    mMainPresenter =
            new MainPresenter(
                    this,
                    (SearchView) findViewById(R.id.searchView),
                    (DirectionView) findViewById(R.id.directionView),
                    (CodeView) findViewById(R.id.codeView),
                    myMapView);

    mMapView.onCreate(savedInstanceState);

    // Adjust the map controls and search box top margins to account for the translucent status
    // bar.
    int statusBarHeight = getStatusBarHeight(this);
    LinearLayout mapControl = (LinearLayout) findViewById(R.id.mapControls);
    FrameLayout.LayoutParams mapParams =
            (FrameLayout.LayoutParams) mapControl.getLayoutParams();
    mapParams.topMargin = mapParams.topMargin + statusBarHeight;
    mapControl.setLayoutParams(mapParams);

    RelativeLayout searchBox = (RelativeLayout) findViewById(R.id.searchBox);
    FrameLayout.LayoutParams searchParams =
            (FrameLayout.LayoutParams) searchBox.getLayoutParams();
    searchParams.topMargin = searchParams.topMargin + statusBarHeight;
    searchBox.setLayoutParams(searchParams);

    if (getIntent() != null && Intent.ACTION_VIEW.equals(getIntent().getAction())) {
        handleGeoIntent(getIntent());
    }
}
 
Example 14
Source File: CardEditActivity.java    From CreditCardView with Apache License 2.0 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    // Checks whether a hardware keyboard is available
    if (newConfig.hardKeyboardHidden == Configuration.HARDKEYBOARDHIDDEN_NO) {

        RelativeLayout parent = (RelativeLayout) findViewById(R.id.parent);
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) parent.getLayoutParams();
        layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, 0);
        parent.setLayoutParams(layoutParams);

    }
}
 
Example 15
Source File: BaseViewHolder.java    From UltimateRecyclerView with Apache License 2.0 4 votes vote down vote up
protected RelativeLayout.LayoutParams getParamsLayoutOffset(RelativeLayout layout, ExpandableItemData itemData) {
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
    params.leftMargin = itemMargin * itemData.getTreeDepth() + offsetMargin;
    return params;
}
 
Example 16
Source File: PlayerFragment.java    From edx-app-android with Apache License 2.0 4 votes vote down vote up
/**
 * This function sets the closed caption data on the TextView
 */
private void setClosedCaptionData(Caption text){
    try{
        RelativeLayout subTitlesLayout = (RelativeLayout) getActivity().findViewById(R.id.txtSubtitles);
        TextView subTitlesTv = (TextView) getActivity().findViewById(R.id.txtSubtitles_tv);
        if(subTitlesTv!=null ){
            if(text!=null){
                int margin_twenty_dp = (int) UiUtil.getParamsInDP(getResources(),20);
                int margin_ten_dp = (int) UiUtil.getParamsInDP(getResources(),10);
                if(player!=null){
                    LayoutParams lp = (LayoutParams) subTitlesLayout.getLayoutParams();
                    if (player.getController()!=null && player.getController().isShown()){
                        if(player.isFullScreen()){
                            lp.setMargins(margin_twenty_dp, 0,
                                    margin_twenty_dp, (int)UiUtil.getParamsInDP(getResources(),50));
                        }else{
                            lp.setMargins(margin_twenty_dp, 0,
                                    margin_twenty_dp,(int)UiUtil.getParamsInDP(getResources(),42));
                        }
                        subTitlesLayout.setLayoutParams(lp);
                    }else{
                        if(player.isFullScreen()){
                            lp.setMargins(margin_twenty_dp, 0,
                                    margin_twenty_dp, margin_ten_dp);
                        }else{
                            lp.setMargins(margin_twenty_dp, 0,
                                    margin_twenty_dp,(int)UiUtil.getParamsInDP(getResources(),5));
                        }
                        subTitlesLayout.setLayoutParams(lp);
                    }
                }
                subTitlesTv.setPadding(margin_ten_dp, (int)UiUtil.getParamsInDP(getResources(),2),
                        margin_ten_dp,(int)UiUtil.getParamsInDP(getResources(),2) );
                subTitlesTv.setText("");
                //This has been done because text.content contains <br />
                //in the end of each message
                String temp = text.content;
                if(temp.endsWith("<br />")){
                    temp = temp.substring(0, temp.length()-6);
                }
                if(temp.length()==0){
                    subTitlesTv.setVisibility(View.GONE);
                }else{
                    subTitlesTv.setText(TextUtils.formatHtml(temp));
                    subTitlesTv.setVisibility(View.VISIBLE);
                }
            }else{
                subTitlesTv.setVisibility(View.GONE);
            }
        }
    }catch(Exception e){
        logger.error(e);
    }
}
 
Example 17
Source File: TimeAttackActivity.java    From FixMath with Apache License 2.0 4 votes vote down vote up
private void setKeyboardPointerView(View clickOn, int pointerFigure) {

        int parentKeyboard = ((View) clickOn.getParent()).getId();
        View pointer;
        RelativeLayout keyboardLayout = (RelativeLayout) findViewById(R.id.t_keyboard);
        RelativeLayout.LayoutParams keyboardParams = (RelativeLayout.LayoutParams) keyboardLayout.getLayoutParams();
        RelativeLayout.LayoutParams pointerParams;

        pointer = findViewById(R.id.t_pointer);
        pointer.setVisibility(View.INVISIBLE);


        //SETTING POINTER

        pointer.setVisibility(View.VISIBLE);
        this.Pointer = pointer;

        //Pointer settings
        pointerParams = (RelativeLayout.LayoutParams) pointer.getLayoutParams();
        pointerParams.addRule(RelativeLayout.ALIGN_RIGHT, clickedFigureID);
        pointerParams.addRule(RelativeLayout.ALIGN_LEFT, clickedFigureID);
        pointerParams.addRule(RelativeLayout.BELOW, clickedFigureID);
        pointer.setLayoutParams(pointerParams);

        //Keyboard settings
        keyboardParams.addRule(RelativeLayout.BELOW, parentKeyboard);
        keyboardLayout.setLayoutParams(keyboardParams);


        switch (pointerFigure) {
            case 0:
                pointer.setBackgroundResource(R.drawable.pointer_kwadrat);
                break;
            case 1:
                pointer.setBackgroundResource(R.drawable.pointer_rombf);
                break;
            case 2:
                pointer.setBackgroundResource(R.drawable.pointer_okrag);
                break;
            case 3:
                pointer.setBackgroundResource(R.drawable.pointer_romb);
                break;
            case 4:
                pointer.setBackgroundResource(R.drawable.pointer_skat);
                break;
            case 5:
                pointer.setBackgroundResource(R.drawable.pointer_okat);
                break;
            case 6:
                pointer.setBackgroundResource(R.drawable.pointer_skat);
                break;
            case 7:
                pointer.setBackgroundResource(R.drawable.pointer_question);
                break;
            case 8:
                pointer.setBackgroundResource(R.drawable.pointer_romb_green);
                break;
            case 9:
                pointer.setBackgroundResource(R.drawable.pointer_kwadrat_blue);
                break;
            case 10:
                pointer.setBackgroundResource(R.drawable.pointer_kwadrat_f);
                break;

        }


        OpenPointerAnimation();
    }
 
Example 18
Source File: PlayRtspVideoView.java    From Viewer with Apache License 2.0 4 votes vote down vote up
private void initView()
	{
		cid = getIntent().getExtras().getString("avsCid");
		isCloudVideo = getIntent().getBooleanExtra("isCloudVideo", false);
		videodata = getIntent().getStringExtra("videodate");
		TextView title = (TextView) findViewById(R.id.video_title);
		title.setText(videodata);
		camera_title = (LinearLayout) findViewById(R.id.camera_title);
		wait_relayout = (RelativeLayout) findViewById(R.id.wait_relayout);
		progressBar_relayout = (RelativeLayout) findViewById(R.id.progressBar_relayout);
		progressBar_relayout_params = (MarginLayoutParams) progressBar_relayout.getLayoutParams();
		progressBar_relayout_params.height = CommUtil.getPixelsWidth(this) * 3 / 4;
		progressBar_relayout.setLayoutParams(progressBar_relayout_params);
		relayout_play_control = (RelativeLayout) findViewById(R.id.relayout_play_control);
		relayout_play_control_params = (MarginLayoutParams) relayout_play_control.getLayoutParams();

		relayout_play_control.setOnClickListener(this);
		pause = (ImageButton) findViewById(R.id.pause);
		pause.setOnClickListener(this);
		full_screen = (ImageButton) findViewById(R.id.full_screen);
		pause_image = (ImageButton) findViewById(R.id.pause_image);
		pause_image.setOnClickListener(this);
		play_time = (TextView) findViewById(R.id.play_time);
		total_time = (TextView) findViewById(R.id.total_time);
		video_seek = (SeekBar) findViewById(R.id.video_seek);
		relayout_camera_bg = (RelativeLayout) findViewById(R.id.relayout_camera_bg);
		camera_bg_params = (MarginLayoutParams) relayout_camera_bg.getLayoutParams();
		int totaltime = getIntent().getIntExtra("filetime", 0);
		video_seek.setMax(totaltime);
		showTime(totaltime, total_time);
		video_seek.setEnabled(false);
		pause.setEnabled(false);
		full_screen.setEnabled(false);
		full_screen.setOnClickListener(this);
		findViewById(R.id.back_linlayout).setOnClickListener(this);
		findViewById(R.id.ipc_warn_img).setOnClickListener(this);
		video_seek.setOnSeekBarChangeListener(this);
		surfaceViewLayout = (RelativeLayout) findViewById(R.id.glsurfaceviewlayout);
		connectUrl = "rtsp://127.0.01:554/record?recordtype=" + getIntent().getIntExtra("filetype", 0) + "&filename=" + videodata;
		animation_alpha_in = AnimationUtils.loadAnimation(this, R.anim.alpha_in);
//		adViewContent = (AdViewContent) findViewById(R.id.adView_layout);
		load_relayout = (RelativeLayout) findViewById(R.id.load_relayout);
	}
 
Example 19
Source File: TabDrawerMenu.java    From 4pdaClient-plus with Apache License 2.0 4 votes vote down vote up
TabDrawerMenu(Activity activity, SelectItemListener listener) {
    Resources resources = App.getInstance().getResources();
    DisplayMetrics displayMetrics = resources.getDisplayMetrics();
    float dpWidth = displayMetrics.widthPixels;
    if (dpWidth > displayMetrics.density * 400) {
        dpWidth = displayMetrics.density * 400;
    }
    dpWidth -= 80 * displayMetrics.density;
    mActivity = activity;
    mSelectItemListener = listener;
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    Button closeAll = (Button) findViewById(R.id.closeAll);
    closeAll.setOnClickListener(v -> {
        if (App.getInstance().getTabItems().size() > 1)
            closeAllTabs();
        else {
            closeDialog();
            toggleOpenState();
        }
    });
    closeAll.setOnLongClickListener(v -> {
        toggleOpenState();
        closeDialog();
        return false;
    });


    mDrawer = (RelativeLayout) findViewById(R.id.tab_drawer);
    mListView = (ListView) findViewById(R.id.tab_list);
    mListView.setOnItemClickListener(new TabOnClickListener());
    mListView.setStackFromBottom(App.getInstance().getPreferences().getBoolean("tabsBottom", false));

    DrawerLayout.LayoutParams params = (DrawerLayout.LayoutParams) mDrawer.getLayoutParams();
    params.width = (int) dpWidth;
    if ("right".equals(Preferences.System.getDrawerMenuPosition())) {
        params.gravity = Gravity.START;
        mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow_start, GravityCompat.START);
    } else {
        mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow_end, GravityCompat.END);
    }
    mDrawer.setLayoutParams(params);

    adapter = new TabAdapter(getContext(), R.layout.tab_drawer_item, App.getInstance().getTabItems());
    mListView.setAdapter(adapter);
}
 
Example 20
Source File: BaseViewHolder.java    From UltimateRecyclerView with Apache License 2.0 4 votes vote down vote up
protected RelativeLayout.LayoutParams getParamsLayout(RelativeLayout layout, T itemData) {
    RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) layout.getLayoutParams();
    params.leftMargin = itemMargin * itemData.getTreeDepth();
    return params;
}