Java Code Examples for android.widget.RelativeLayout.LayoutParams

The following are top voted examples for showing how to use android.widget.RelativeLayout.LayoutParams. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: VideoRecorder-master   File: FFmpegPreviewActivity.java   View source code 8 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 previewVideoParent = (RelativeLayout)findViewById(R.id.preview_video_parent);
	LayoutParams layoutParams = (LayoutParams) previewVideoParent
			.getLayoutParams();
	layoutParams.width = displaymetrics.widthPixels;
	layoutParams.height = displaymetrics.widthPixels;
	previewVideoParent.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 2
Project: CCDownload   File: PopMenu.java   View source code 7 votes vote down vote up
@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			
			RelativeLayout layoutView = new RelativeLayout(context);
			TextView textView = new TextView(context);
			textView.setTextSize(13);
			textView.setText(itemList.get(position));
			
			textView.setTag(position);
			
			if (checkedPosition == position || itemList.size() == 1) {
//				layoutView.setBackgroundColor(0x8033B5E5);
				textView.setTextColor(context.getResources().getColor(R.color.rb_text_check));
			} else {
				textView.setTextColor(Color.WHITE);
			}
			
			LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
			params.addRule(RelativeLayout.CENTER_IN_PARENT);
			layoutView.addView(textView, params);
			layoutView.setMinimumHeight(ParamsUtil.dpToPx(context, 26));
			return layoutView;

		}
 
Example 3
Project: CCDownload   File: PopMenu.java   View source code 6 votes vote down vote up
public PopMenu(Context context, int resid, int checkedPosition, int height) {
		this.context = context;
		this.checkedPosition = checkedPosition;

		itemList = new ArrayList<String>();
		RelativeLayout view = new RelativeLayout(context);
//		view.setBackgroundResource(resid);

		listView = new ListView(context);
		listView.setPadding(0, ParamsUtil.dpToPx(context, 3), 0, ParamsUtil.dpToPx(context, 3));
		view.addView(listView, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
		listView.setAdapter(new PopAdapter());
		listView.setOnItemClickListener(this);

		popupWindow = new PopupWindow(view, context.getResources().getDimensionPixelSize(R.dimen.popmenu_width), height);
		popupWindow.setBackgroundDrawable(new ColorDrawable(Color.argb(178, 0, 0, 0)));
	}
 
Example 4
Project: CCDownload   File: InputInfoActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	service = new Intent(this, UploadService.class);
	inputLayout = new RelativeLayout(this);
	inputLayout.setBackgroundColor(Color.WHITE);
	inputLayout.setHorizontalGravity(Gravity.CENTER_HORIZONTAL);
	inputLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	getCategory();
	initView();
	
       bindService(service, serviceConnection, Context.BIND_AUTO_CREATE);
	
       String path = getIntent().getStringExtra("filePath");
       if (path != null) {
       	filePath = path;
	}
       
       getActionBar().setDisplayHomeAsUpEnabled(true);
       uploadButton.setOnClickListener(this);
       
       setContentView(inputLayout);
}
 
Example 5
Project: CCDownload   File: DownloadedFragment.java   View source code 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	activity = getActivity();
	context = activity.getApplicationContext();
	RelativeLayout downloadLayout = new RelativeLayout(activity.getApplicationContext());
	downloadLayout.setBackgroundColor(Color.WHITE);
	receiver = new DownloadedReceiver();
	activity.registerReceiver(receiver, new IntentFilter(ConfigUtil.ACTION_DOWNLOADED));
	
	downloadedListView = new ListView(context);
	downloadedListView.setPadding(10, 10, 10, 10);
	downloadedListView.setDivider(getResources().getDrawable(R.drawable.line));
	LayoutParams downloadedLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	downloadLayout.addView(downloadedListView, downloadedLayoutParams);
	
	initData();

	downloadedListView.setOnItemClickListener(onItemClickListener);
	downloadedListView.setOnCreateContextMenuListener(onCreateContextMenuListener);

	return downloadLayout;
}
 
Example 6
Project: letv   File: AdViewProxy.java   View source code 6 votes vote down vote up
private void init(Context context, AttributeSet attrs) {
    try {
        this.mJarClassLoader = JarLoader.getJarClassLoader(context, "Letv_Ads.apk", JarConstant.LETV_ADS_PACKAGENAME);
        this.mJarResources = JarResources.getResourceByCl(this.mJarClassLoader, context);
        mLoadClass = JarLoader.loadClass(context, "Letv_Ads.apk", JarConstant.LETV_ADS_PACKAGENAME, JarConstant.LETV_ADS_VIEW_CLASS);
        Constructor<?> localConstructor = mLoadClass.getConstructor(new Class[]{Context.class, AttributeSet.class, Resources.class});
        if (this.mJarResources != null) {
            updateConfiguration(this.mJarResources.getResources());
            this.mRemoteView = (RelativeLayout) localConstructor.newInstance(new Object[]{context, attrs, this.mJarResources.getResources()});
        }
    } catch (Exception e) {
        e.printStackTrace();
        LogInfo.log(TAG, "Exception e=" + e.toString());
    }
    if (this.mRemoteView != null) {
        LogInfo.log(TAG, "addView mRemoteView=" + this.mRemoteView);
        addView(this.mRemoteView, new LayoutParams(-1, -1));
    }
}
 
Example 7
Project: letv   File: MyPlayRecordFragment.java   View source code 6 votes vote down vote up
protected void showDeleteLayout() {
    if (getActivity() != null && this.mHeaderLayout != null) {
        LayoutParams params = (LayoutParams) this.mPullListView.getLayoutParams();
        if (!this.mIsDelete || this.mListAdapter == null || this.mListAdapter.getCount() <= 0) {
            params.bottomMargin = 0;
            this.mHeaderLayout.setVisibility(8);
            upDateLogin();
            return;
        }
        this.mHeaderLayout.setVisibility(0);
        if (this.mHeaderLayout.getHeight() == 0) {
            params.bottomMargin = ((UIs.zoomRealHeight(50) * 3) / 4) + 1;
        } else {
            params.bottomMargin = this.mHeaderLayout.getHeight();
        }
        this.mPullListView.setLayoutParams(params);
    }
}
 
Example 8
Project: ThunderMusic   File: ColorPickerPreference.java   View source code 6 votes vote down vote up
@Override
protected View onCreateDialogView() {

    RelativeLayout relativeLayout = new RelativeLayout(getContext());
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    layoutParams.addRule(RelativeLayout.BELOW, 2);


    LayoutParams layoutParamsText = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    layoutParamsText.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    layoutParamsText.addRule(RelativeLayout.CENTER_HORIZONTAL);

    colorPickerView = new ColorPicker(getContext());
    colorPickerView.setId(1);

    currentColor = new TextView(getContext());
    currentColor.setTextSize(16);
    currentColor.setId(2);

    relativeLayout.addView(colorPickerView, layoutParams);
    relativeLayout.addView(currentColor, layoutParamsText);

    return relativeLayout;

}
 
Example 9
Project: letv   File: ChannelTabPageIndicator.java   View source code 6 votes vote down vote up
protected void addTab(int index, CharSequence text, int iconResId) {
    TabView tabView = new TabView(this, getContext(), text);
    tabView.setIndex(index);
    tabView.setFocusable(true);
    tabView.setOnClickListener(this.mTabClickListener);
    if (iconResId != 0) {
        tabView.setCompoundDrawablesWithIntrinsicBounds(iconResId, 0, 0, 0);
    }
    int width = this.mMeanWidth == -1 ? getTabWidth(text) : this.mMeanWidth;
    if (this.mMeanWidth != -1) {
        tabView.setSize(this.mMeanWidth, UIsUtils.dipToPx(38.0f));
    } else {
        tabView.setSize(width, UIsUtils.dipToPx(38.0f));
    }
    RelativeLayout relativeLayout = new RelativeLayout(this.mContext);
    relativeLayout.setGravity(17);
    relativeLayout.setLayoutParams(new LayoutParams(-2, UIsUtils.dipToPx(38.0f)));
    LayoutParams params = new LayoutParams(-2, UIsUtils.dipToPx(38.0f));
    params.setMargins(TAB_MARGIN, 0, TAB_MARGIN, 0);
    tabView.setLayoutParams(params);
    relativeLayout.addView(tabView);
    if (this.mIsHome) {
        ThemeDataManager.getInstance(this.mContext).setContentTheme(tabView, ThemeDataManager.NAME_TOP_NAVIGATION_COLOR);
    }
    ImageView imageView = new ImageView(this.mContext);
    LayoutParams imageViewParams = new LayoutParams(width, UIsUtils.dipToPx(2.0f));
    imageViewParams.setMargins(TAB_MARGIN, UIsUtils.dipToPx(36.0f), TAB_MARGIN, 0);
    imageView.setLayoutParams(imageViewParams);
    relativeLayout.addView(imageView);
    imageView.setBackgroundDrawable(getResources().getDrawable(2130838177));
    if (this.mIsHome) {
        ThemeDataManager.getInstance(this.mContext).setShapeSelectorViewTheme(imageView, ThemeDataManager.NAME_TOP_NAVIGATION_COLOR, 2, true);
    }
    this.mTabLayout.addView(relativeLayout);
}
 
Example 10
Project: sctalk   File: MessageActivity.java   View source code 6 votes vote down vote up
@Override
public void onGlobalLayout() {
    Rect r = new Rect();
    baseRoot.getGlobalVisibleRect(r);
    // 进入Activity时会布局,第一次调用onGlobalLayout,先记录开始软键盘没有弹出时底部的位置
    if (rootBottom == Integer.MIN_VALUE) {
        rootBottom = r.bottom;
        return;
    }
    // adjustResize,软键盘弹出后高度会变小
    if (r.bottom < rootBottom) {
        //按照键盘高度设置表情框和发送图片按钮框的高度
        keyboardHeight = rootBottom - r.bottom;
        SystemConfigSp.instance().init(MessageActivity.this);
        SystemConfigSp.instance().setIntConfig(currentInputMethod, keyboardHeight);
        LayoutParams params = (LayoutParams) addOthersPanelView.getLayoutParams();
        params.height = keyboardHeight;
        LayoutParams params1 = (LayoutParams) emoLayout.getLayoutParams();
        params1.height = keyboardHeight;
    }
}
 
Example 11
Project: letv   File: AlbumPlayActivity.java   View source code 6 votes vote down vote up
private void initWebView() {
    if (this.mWebView == null) {
        this.mWebView = new WebView(this);
        this.mWebView.setBackgroundColor(-1);
        this.rootView.addView(this.mWebView, new LayoutParams(-1, -1));
        this.mWebView.getSettings().setUseWideViewPort(true);
        this.mWebView.getSettings().setSupportZoom(true);
        this.mWebView.getSettings().setBuiltInZoomControls(true);
        this.mWebView.setVerticalScrollBarEnabled(true);
        this.mWebView.setHorizontalScrollBarEnabled(true);
        this.mWebView.getSettings().setJavaScriptEnabled(true);
        this.mWebView.getSettings().setDomStorageEnabled(true);
        this.mWebView.setWebViewClient(new WebViewClient() {
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                AlbumPlayActivity.this.mWebView.loadUrl(url);
                return super.shouldOverrideUrlLoading(view, url);
            }
        });
        this.mWebView.setClickable(false);
    }
}
 
Example 12
Project: letv   File: ChannelFragmentAdapter.java   View source code 6 votes vote down vote up
private ImageView addMirrorView(ViewGroup parent, RecyclerView recyclerView, View view) {
    view.destroyDrawingCache();
    view.setDrawingCacheEnabled(true);
    ImageView mirrorView = new ImageView(recyclerView.getContext());
    Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache());
    mirrorView.setImageBitmap(bitmap);
    view.setDrawingCacheEnabled(false);
    int[] locations = new int[2];
    view.getLocationOnScreen(locations);
    int[] parenLocations = new int[2];
    recyclerView.getLocationOnScreen(parenLocations);
    LayoutParams params = new LayoutParams(bitmap.getWidth(), bitmap.getHeight());
    params.setMargins(locations[0], (locations[1] - parenLocations[1]) + UIsUtils.dipToPx(44.0f), 0, 0);
    parent.addView(mirrorView, params);
    return mirrorView;
}
 
Example 13
Project: letv   File: MyPlayRecordActivity.java   View source code 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 14
Project: letv   File: LiveFragment.java   View source code 6 votes vote down vote up
private void initHeaderView() {
    this.mHeaderView = (RelativeLayout) LayoutInflater.from(getContext()).inflate(R.layout.view_live_header, null);
    this.mViewpager = (ViewPager) this.mHeaderView.findViewById(R.id.view_live_header_viewpager);
    this.mRecyclerview = (RecyclerView) this.mHeaderView.findViewById(R.id.view_live_header_recyclerview);
    this.mIvSingle = (ImageView) this.mHeaderView.findViewById(R.id.view_live_header_iv_single);
    this.mIvDouble = (ImageView) this.mHeaderView.findViewById(R.id.view_live_header_iv_double);
    this.mHeaderView.setClipChildren(false);
    int width = UIsUtils.getScreenWidth() - UIsUtils.dipToPx(40.0f);
    this.mViewPagerHeight = (width * 240) / 320;
    LayoutParams params = (LayoutParams) this.mViewpager.getLayoutParams();
    params.width = width;
    params.height = this.mViewPagerHeight;
    this.mViewpager.setLayoutParams(params);
    initHeaderImageView();
    initViewPager();
    initRecyclerView();
    this.mListView.addHeaderView(this.mHeaderView);
}
 
Example 15
Project: letv   File: LivePlayerView.java   View source code 6 votes vote down vote up
private void initBarrageLayout() {
    this.mBarrageContainId = GenerateViewId.generateViewId();
    LayoutParams params = new LayoutParams(-1, -1);
    View view = LayoutInflater.from(this.mContext).inflate(R.layout.live_barrage_contain, null);
    view.setId(this.mBarrageContainId);
    addView(view, params);
}
 
Example 16
Project: letv   File: LivePlayerController.java   View source code 6 votes vote down vote up
private void qualityShow(boolean show) {
    this.qualityShowing = show;
    this.mTVSpreadLayout.setVisibility(4);
    if (show) {
        int[] locations = new int[2];
        this.mQuality.getLocationInWindow(locations);
        int x = locations[0];
        this.mBottomBar.getLocationOnScreen(locations);
        int y = locations[1];
        LayoutParams params = (LayoutParams) this.mQualityLayout.getLayoutParams();
        params.leftMargin = (((this.mQuality.getMeasuredWidth() >> 1) + x) - (this.mLevelBtnLayout.getMeasuredWidth() >> 1)) - this.mTVSpreadLayout.getMeasuredWidth();
        params.topMargin = (y - this.mQualityLayout.getMeasuredHeight()) - 10;
        this.mQualityLayout.setLayoutParams(params);
        this.mQualityLayout.requestLayout();
        this.mQualityLayout.setVisibility(0);
        this.mQuality.setBackgroundResource(2130837620);
        return;
    }
    this.mQualityLayout.setVisibility(8);
    this.mQuality.setBackgroundResource(2130837742);
    this.is4KClick = false;
    this.is1080pClick = false;
}
 
Example 17
Project: letv   File: PKDialog.java   View source code 6 votes vote down vote up
private void createViews() {
    this.mFlMain = new com.tencent.open.c.a((Context) this.mWeakContext.get());
    this.mFlMain.setBackgroundColor(1711276032);
    this.mFlMain.setLayoutParams(new LayoutParams(-1, -1));
    this.mWebView = new b((Context) this.mWeakContext.get());
    this.mWebView.setBackgroundColor(0);
    this.mWebView.setBackgroundDrawable(null);
    if (VERSION.SDK_INT >= 11) {
        try {
            View.class.getMethod("setLayerType", new Class[]{Integer.TYPE, Paint.class}).invoke(this.mWebView, new Object[]{Integer.valueOf(1), new Paint()});
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    ViewGroup.LayoutParams layoutParams = new LayoutParams(-1, this.mWebviewHeight);
    layoutParams.addRule(13, -1);
    this.mWebView.setLayoutParams(layoutParams);
    this.mFlMain.addView(this.mWebView);
    this.mFlMain.a(this);
    setContentView(this.mFlMain);
}
 
Example 18
Project: buildAPKsSamples   File: CurvedMotion.java   View source code 6 votes vote down vote up
/**
 * Toggles button location on click between top-left and bottom-right
 */
private void moveButton() {
    LayoutParams params = (LayoutParams) mButton.getLayoutParams();
    if (mTopLeft) {
        params.removeRule(RelativeLayout.ALIGN_PARENT_LEFT);
        params.removeRule(RelativeLayout.ALIGN_PARENT_TOP);
        params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    } else {
        params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
        params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        params.removeRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        params.removeRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    }
    mButton.setLayoutParams(params);
    mTopLeft = !mTopLeft;
}
 
Example 19
Project: CustomAndroidOneSheeld   File: SpeechRecognitionFragment.java   View source code 6 votes vote down vote up
@Override
public void doOnViewCreated(View v, @Nullable Bundle savedInstanceState) {
    statusCircle = v.findViewById(R.id.statusCircle);
    statusHint = (OneSheeldTextView) v.findViewById(R.id.statusHint);
    rmsIndicator = (TextView) v.findViewById(R.id.rmsLevelIndicator);
    recognizedResult = (OneSheeldTextView) v
            .findViewById(R.id.recognizedResult);
    params = (LayoutParams) rmsIndicator.getLayoutParams();
    statusCircle.getViewTreeObserver().addOnGlobalLayoutListener(
            new ViewTreeObserver.OnGlobalLayoutListener() {

                @Override
                public void onGlobalLayout() {
                    if (stepValue == 0)
                        stepValue = statusCircle.getHeight() / 10;
                }
            });
}
 
Example 20
Project: CustomAndroidOneSheeld   File: MicFragment.java   View source code 6 votes vote down vote up
@Override
public void doOnViewCreated(View v, @Nullable Bundle savedInstanceState) {
    soundLevelIndicator = (TextView) v
            .findViewById(R.id.soundLevelIndicator);
    micValue = (OneSheeldTextView) v.findViewById(R.id.micValue);
    micState = (OneSheeldTextView) v.findViewById(R.id.micState);
    params = (LayoutParams) soundLevelIndicator.getLayoutParams();
    soundLevelIndicator.getViewTreeObserver().addOnGlobalLayoutListener(
            new ViewTreeObserver.OnGlobalLayoutListener() {

                @Override
                public void onGlobalLayout() {
                    stepValue = soundLevelIndicator.getHeight() / 80;
                }
            });
}
 
Example 21
Project: boohee_v5.6   File: PKDialog.java   View source code 6 votes vote down vote up
private void createViews() {
    this.mFlMain = new com.tencent.open.c.a((Context) this.mWeakContext.get());
    this.mFlMain.setBackgroundColor(1711276032);
    this.mFlMain.setLayoutParams(new LayoutParams(-1, -1));
    this.mWebView = new b((Context) this.mWeakContext.get());
    this.mWebView.setBackgroundColor(0);
    this.mWebView.setBackgroundDrawable(null);
    if (VERSION.SDK_INT >= 11) {
        try {
            View.class.getMethod("setLayerType", new Class[]{Integer.TYPE, Paint.class})
                    .invoke(this.mWebView, new Object[]{Integer.valueOf(1), new Paint()});
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    ViewGroup.LayoutParams layoutParams = new LayoutParams(-1, this.mWebviewHeight);
    layoutParams.addRule(13, -1);
    this.mWebView.setLayoutParams(layoutParams);
    this.mFlMain.addView(this.mWebView);
    this.mFlMain.a(this);
    setContentView(this.mFlMain);
}
 
Example 22
Project: boohee_v5.6   File: ProgressWebView.java   View source code 6 votes vote down vote up
public ProgressWebView(Activity activity) {
    super(activity);
    this.g = activity;
    this.d = new ProgressBar(activity, null, 16842872);
    this.d.setLayoutParams(new LayoutParams(-1, o.a(activity, 5.0f)));
    addView(this.d);
    setDownloadListener(new p(this));
    setWebChromeClient(new t(this));
    setWebViewClient(new q(this));
    getSettings().setJavaScriptEnabled(true);
    getSettings().setUseWideViewPort(true);
    getSettings().setDomStorageEnabled(true);
    getSettings().setLoadWithOverviewMode(true);
    getSettings().setBuiltInZoomControls(false);
    getSettings().setUserAgentString(a(new StringBuilder(this.i)));
}
 
Example 23
Project: boohee_v5.6   File: EditPage.java   View source code 6 votes vote down vote up
private RelativeLayout getPageView() {
    this.rlPage = new RelativeLayout(getContext());
    this.rlPage.setBackgroundDrawable(this.background);
    if (this.dialogMode) {
        RelativeLayout rlDialog = new RelativeLayout(getContext());
        rlDialog.setBackgroundColor(-1070452174);
        int dp_8 = R.dipToPx(getContext(), 8);
        LayoutParams lpDialog = new LayoutParams(R.getScreenWidth(getContext()) - (dp_8 * 2), -2);
        lpDialog.topMargin = dp_8;
        lpDialog.bottomMargin = dp_8;
        lpDialog.addRule(13);
        rlDialog.setLayoutParams(lpDialog);
        this.rlPage.addView(rlDialog);
        rlDialog.addView(getPageTitle());
        rlDialog.addView(getPageBody());
        rlDialog.addView(getImagePin());
    } else {
        this.rlPage.addView(getPageTitle());
        this.rlPage.addView(getPageBody());
        this.rlPage.addView(getImagePin());
    }
    return this.rlPage;
}
 
Example 24
Project: boohee_v5.6   File: EditPage.java   View source code 6 votes vote down vote up
private TitleLayout getPageTitle() {
    this.llTitle = new TitleLayout(getContext());
    this.llTitle.setId(1);
    this.llTitle.getBtnBack().setOnClickListener(this);
    int resId = R.getStringRes(this.activity, "multi_share");
    if (resId > 0) {
        this.llTitle.getTvTitle().setText(resId);
    }
    this.llTitle.getBtnRight().setVisibility(0);
    resId = R.getStringRes(this.activity, "share");
    if (resId > 0) {
        this.llTitle.getBtnRight().setText(resId);
    }
    this.llTitle.getBtnRight().setOnClickListener(this);
    LayoutParams lp = new LayoutParams(-2, -2);
    lp.addRule(9);
    lp.addRule(10);
    lp.addRule(11);
    this.llTitle.setLayoutParams(lp);
    return this.llTitle;
}
 
Example 25
Project: boohee_v5.6   File: EditPage.java   View source code 6 votes vote down vote up
private LinearLayout getPageBody() {
    this.llBody = new LinearLayout(getContext());
    this.llBody.setId(2);
    int resId = R.getBitmapRes(this.activity, "edittext_back");
    if (resId > 0) {
        this.llBody.setBackgroundResource(resId);
    }
    this.llBody.setOrientation(1);
    LayoutParams lpBody = new LayoutParams(-2, -2);
    lpBody.addRule(5, this.llTitle.getId());
    lpBody.addRule(3, this.llTitle.getId());
    lpBody.addRule(7, this.llTitle.getId());
    if (!this.dialogMode) {
        lpBody.addRule(12);
    }
    int dp_3 = R.dipToPx(getContext(), 3);
    lpBody.setMargins(dp_3, dp_3, dp_3, dp_3);
    this.llBody.setLayoutParams(lpBody);
    this.llBody.addView(getMainBody());
    this.llBody.addView(getSep());
    this.llBody.addView(getPlatformList());
    return this.llBody;
}
 
Example 26
Project: boohee_v5.6   File: EditPage.java   View source code 6 votes vote down vote up
private LinearLayout getMainBody() {
    LinearLayout llMainBody = new LinearLayout(getContext());
    llMainBody.setOrientation(1);
    LinearLayout.LayoutParams lpMain = new LinearLayout.LayoutParams(-1, -2);
    lpMain.weight = 1.0f;
    int dp_4 = R.dipToPx(getContext(), 4);
    lpMain.setMargins(dp_4, dp_4, dp_4, dp_4);
    llMainBody.setLayoutParams(lpMain);
    LinearLayout llContent = new LinearLayout(getContext());
    LinearLayout.LayoutParams lpContent = new LinearLayout.LayoutParams(-1, -2);
    lpContent.weight = 1.0f;
    llMainBody.addView(llContent, lpContent);
    this.etContent = new EditText(getContext());
    this.etContent.setGravity(51);
    this.etContent.setBackgroundDrawable(null);
    this.etContent.setText(String.valueOf(this.shareParamMap.get("text")));
    this.etContent.addTextChangedListener(this);
    LinearLayout.LayoutParams lpEt = new LinearLayout.LayoutParams(-2, -2);
    lpEt.weight = 1.0f;
    this.etContent.setLayoutParams(lpEt);
    llContent.addView(this.etContent);
    llContent.addView(getThumbView());
    llMainBody.addView(getBodyBottom());
    return llMainBody;
}
 
Example 27
Project: CCDownload   File: PlayChangeVideoPopupWindow.java   View source code 5 votes vote down vote up
public PlayChangeVideoPopupWindow(Context context, int height) {
	this.context = context;
	
	RelativeLayout view = new RelativeLayout(context);

	listView = new ListView(context);
	listView.setPadding(0, ParamsUtil.dpToPx(context, 3), 0, ParamsUtil.dpToPx(context, 3));
	view.addView(listView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
	adapter = new VideosAdapter();
	listView.setAdapter(adapter);
	
	popupWindow = new PopupWindow(view, height * 2 / 3 , height);
	popupWindow.setBackgroundDrawable(new ColorDrawable(Color.argb(178, 0, 0, 0)));
}
 
Example 28
Project: CCDownload   File: UploadFragment.java   View source code 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	activity = getActivity();
	context = activity.getApplicationContext();
	receiver = new UploadReceiver();
	activity.registerReceiver(receiver, new IntentFilter(ConfigUtil.ACTION_UPLOAD));
	service = new Intent(context, UploadService.class);
	
	binderService();
	
	RelativeLayout view = new RelativeLayout(context);
	view.setBackgroundColor(Color.WHITE);
	LayoutParams uploadLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	uploadListView = new ListView(context);
	uploadListView.setDivider(getResources().getDrawable(R.drawable.line));
	view.addView(uploadListView, uploadLayoutParams);

	uploadListView.setOnItemClickListener(onItemClickListener);
	uploadListView.setOnCreateContextMenuListener(onCreateContextMenuListener);
	
	initUploadList();
	
	LayoutParams uploadButtonLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	uploadButtonLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
	uploadButtonLayoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
	
	uploadButton = new Button(context);
	view.addView(uploadButton, uploadButtonLayoutParams);
	uploadButton.setText("上传");
	uploadButton.setTextColor(0xFFFFFFFF);
	uploadButton.setOnClickListener(uploadOnClickListener);
	
	timer.schedule(timerTask, 0, 1000);
	return view;
}
 
Example 29
Project: CCDownload   File: AccountInfoActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	getActionBar().setDisplayHomeAsUpEnabled(true);
	RelativeLayout accountLayout = new RelativeLayout(this);
	accountLayout.setBackgroundColor(Color.WHITE);
	LayoutParams accountLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	accountLayout.setLayoutParams(accountLayoutParams);
	
	ListView accountListView = new ListView(this);
	accountListView.setPadding(10, 10, 10, 10);
	accountListView.setDivider(getResources().getDrawable(R.drawable.line));
	LayoutParams accountListViewParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	accountLayout.addView(accountListView, accountListViewParams);
	
	List<Pair<String, String>> pairs = new ArrayList<Pair<String,String>>();
	Pair<String, String> userIdPair = new Pair<String, String>("User ID",ConfigUtil.USERID);
	pairs.add(userIdPair);
	Pair<String, String> apiKeyPair = new Pair<String, String>("API Key", ConfigUtil.API_KEY);
	pairs.add(apiKeyPair);
	
	AccountViewAdapter accountViewAdapter = new AccountViewAdapter(this, pairs);
	accountListView.setAdapter(accountViewAdapter);
	
	setContentView(accountLayout);
	
	super.onCreate(savedInstanceState);
}
 
Example 30
Project: CCDownload   File: DownloadFragment.java   View source code 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	activity = getActivity();
	context = activity.getApplicationContext();
	receiver = new DownloadedReceiver();
	activity.registerReceiver(receiver, new IntentFilter(ConfigUtil.ACTION_DOWNLOADING));
	
	RelativeLayout downloadRelativeLayout = new RelativeLayout(context);
	downloadRelativeLayout.setBackgroundColor(Color.WHITE);
	downloadRelativeLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
	
	downloadListView = new ListView(context);
	downloadListView.setPadding(10, 10, 10, 10);
	downloadListView.setDivider(getResources().getDrawable(R.drawable.line));
	LayoutParams listViewLayout = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	downloadRelativeLayout.addView(downloadListView, listViewLayout);
	
	// 生成动态数组,加入数据
	pairs = new ArrayList<Pair<String,Integer>>();
	for (int i = 0; i < downloadVideoIds.length; i++) {
		Pair<String, Integer> pair = new Pair<String, Integer>(downloadVideoIds[i], R.drawable.download);
		pairs.add(pair);
	}

	downloadListViewAdapter = new DownloadListViewAdapter(context, pairs);
	downloadListView.setAdapter(downloadListViewAdapter);
	downloadListView.setOnItemClickListener(onItemClickListener);

	service = new Intent(context, DownloadService.class);
	activity.bindService(service, serviceConnection, Context.BIND_AUTO_CREATE);
	
	initDownloaderHashMap();
	
	return downloadRelativeLayout;
}
 
Example 31
Project: CCDownload   File: DownloadingFragment.java   View source code 5 votes vote down vote up
private void initView(RelativeLayout view ){
	view.setBackgroundColor(Color.WHITE);
	LayoutParams downloadingLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	downloadingListView = new ListView(context);
	downloadingListView.setPadding(10, 10, 10, 10);
	downloadingListView.setDivider(getResources().getDrawable(R.drawable.line));
	view.addView(downloadingListView, downloadingLayoutParams);
	
	downloadingListView.setOnItemClickListener(onItemClickListener);
	downloadingListView.setOnCreateContextMenuListener(onCreateContextMenuListener);
	
}
 
Example 32
Project: CCDownload   File: AccountViewAdapter.java   View source code 5 votes vote down vote up
private View getItemView(Pair<String, String> pair){
	RelativeLayout accountView = new RelativeLayout(context);
	TextView textView = new TextView(context);
	textView.setText(pair.first + " : " + pair.second);
	textView.setTextSize(16);
	textView.setPadding(10, 30, 0, 0);
	textView.setMinHeight(ParamsUtil.dpToPx(context, 48));
	LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	params.addRule(RelativeLayout.CENTER_VERTICAL);
	
	accountView.addView(textView, params);
	return accountView;
	
}
 
Example 33
Project: CCDownload   File: PlayerUtil.java   View source code 5 votes vote down vote up
public static void resizeAdView(Activity activity, WindowManager wm, final ImageView iv, int adWidth, int adHeight) {
	if (adWidth == 0 || adHeight == 0) {
		return;
	}
	int screenWidth = wm.getDefaultDisplay().getWidth();
	int screenHeight = wm.getDefaultDisplay().getHeight();

	if (PlayerUtil.isPortrait()) {
		screenHeight = screenHeight * 2 / 5;
	} else {
		// 全屏下,广告素材为屏幕60%
		screenWidth = screenWidth * 6 / 10;
		screenHeight = screenHeight * 6 / 10;
	}

	// 等比缩放比例计算
	float widthRatio = (float) screenWidth / (float) adWidth;
	float heightRatio = (float) screenHeight / (float) adHeight;

	if (widthRatio > heightRatio) {
		screenWidth = (int) ((float) adWidth * heightRatio);
	} else {
		screenHeight = (int) ((float) adHeight * widthRatio);
	}
	
	final LayoutParams ivAdLayoutParams = new LayoutParams(screenWidth,
			screenHeight);
	ivAdLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);

	activity.runOnUiThread(new Runnable() {

		@Override
		public void run() {
			iv.setLayoutParams(ivAdLayoutParams);
		}
	});
}
 
Example 34
Project: CCDownload   File: PlayFragment.java   View source code 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
	context = getActivity().getApplicationContext();
	RelativeLayout playLayout = new RelativeLayout(context);
	playLayout.setBackgroundColor(Color.WHITE);
	LayoutParams playLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	playLayout.setLayoutParams(playLayoutParams);
	
	playListView = new ListView(context);
	playListView.setDivider(getResources().getDrawable(R.drawable.line));
	playListView.setDividerHeight(2);
	playListView.setPadding(10, 10, 10, 10);
	LayoutParams playListLayoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
	playLayout.addView(playListView, playListLayoutParams);

	// 生成动态数组,加入数据
	pairs = new ArrayList<Pair<String,Integer>>();
	for (int i = 0; i < playVideoIds.length; i++) {
		Pair<String, Integer> pair = new Pair<String, Integer>(playVideoIds[i], R.drawable.play);
		pairs.add(pair);
	}

	videoListViewAdapter = new VideoListViewAdapter(context, pairs);
	playListView.setAdapter(videoListViewAdapter);
	playListView.setOnItemClickListener(onItemClickListener);

	return playLayout;
}
 
Example 35
Project: CCDownload   File: MediaPlayActivity.java   View source code 5 votes vote down vote up
@Override
public void onConfigurationChanged(Configuration newConfig) {
	
	super.onConfigurationChanged(newConfig);
	
	if (isPrepared) {
		// 刷新界面
		setLayoutVisibility(View.GONE, false);
		setLayoutVisibility(View.VISIBLE, true);
	}
	
	lockView.setSelected(false);
	
	if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
		getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
		rlBelow.setVisibility(View.VISIBLE);
		ivFullscreen.setImageResource(R.drawable.fullscreen_close);
		
		if (playChangeVideoPopupWindow != null) {
			playChangeVideoPopupWindow.dismiss();
		}
		
		if (playTopPopupWindow != null) {
			playTopPopupWindow.dismiss();
		}
		
	} else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE){
		getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
		rlBelow.setVisibility(View.GONE);
		ivFullscreen.setImageResource(R.drawable.fullscreen_open);
	}
	
	setSurfaceViewLayout();
}
 
Example 36
Project: Swface   File: BaseVideoActivity.java   View source code 5 votes vote down vote up
private void setSurfaceSize() {
    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);

    int width = metrics.widthPixels;
    int height = (int) (width * PREVIEW_WIDTH / (float)PREVIEW_HEIGHT);
    RelativeLayout.LayoutParams params = new LayoutParams(width, height);
    params.addRule(RelativeLayout.ALIGN_PARENT_TOP);

    mPreviewSurface.setLayoutParams(params);
    mFaceSurface.setLayoutParams(params);
}
 
Example 37
Project: WithYou   File: VideoVerify.java   View source code 5 votes vote down vote up
private void setSurfaceSize() {
	DisplayMetrics metrics = new DisplayMetrics();
	getWindowManager().getDefaultDisplay().getMetrics(metrics);
	
	int width = metrics.widthPixels;
	int height = (int) (width * PREVIEW_WIDTH / (float)PREVIEW_HEIGHT);
	RelativeLayout.LayoutParams params = new LayoutParams(width, height);
	params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
	
	mPreviewSurface.setLayoutParams(params);
	mFaceSurface.setLayoutParams(params);
}
 
Example 38
Project: NoticeDog   File: InboxViewManager.java   View source code 5 votes vote down vote up
private void createListenerView() {
    this.listenerView = new View(this.context) {
        protected boolean fitSystemWindows(Rect insets) {
            if (insets.top == 0) {
                InboxViewManager.this.logger.info("fitSystemWindows : 0");
                InboxViewManager.this.setTabVisibility(Boolean.valueOf(false), eVisibilityReason.FullScreenMode);
            } else {
                InboxViewManager.this.logger.info("fitSystemWindows : != 0");
                InboxViewManager.this.setTabVisibility(Boolean.valueOf(true), eVisibilityReason.FullScreenMode);
            }
            return super.fitSystemWindows(insets);
        }

        public boolean dispatchKeyEvent(KeyEvent event) {
            if (event.getKeyCode() == 4) {
            }
            return super.dispatchKeyEvent(event);
        }
    };
    this.listenerView.setOnSystemUiVisibilityChangeListener(new OnSystemUiVisibilityChangeListener() {
        public void onSystemUiVisibilityChange(int visibility) {
            if ((visibility & 4) == 0) {
                InboxViewManager.this.setTabVisibility(Boolean.valueOf(true), eVisibilityReason.FullScreenMode);
            } else {
                InboxViewManager.this.setTabVisibility(Boolean.valueOf(false), eVisibilityReason.FullScreenMode);
            }
        }
    });
    WindowManager.LayoutParams params = new WindowManager.LayoutParams(-2, -2, 2002, 65816, -3);
    params.width = 1;
    params.height = 1;
    params.gravity = 51;
    getWindowManager().addView(this.listenerView, params);
}
 
Example 39
Project: sctalk   File: MessageActivity.java   View source code 5 votes vote down vote up
private void initSoftInputMethod() {
    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
    inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

    receiver = new switchInputMethodReceiver();
    IntentFilter filter = new IntentFilter();
    filter.addAction("android.intent.action.INPUT_METHOD_CHANGED");
    registerReceiver(receiver, filter);

    SystemConfigSp.instance().init(this);
    currentInputMethod = Settings.Secure.getString(MessageActivity.this.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
    keyboardHeight = SystemConfigSp.instance().getIntConfig(currentInputMethod);
}
 
Example 40
Project: letv   File: MyPlayRecordFragment.java   View source code 5 votes vote down vote up
private void upDateLogin() {
    LayoutParams params = (LayoutParams) this.mPullListView.getLayoutParams();
    if (this.mIsLogin) {
        this.mBottomLogin.setVisibility(8);
        params.bottomMargin = 0;
    } else {
        this.mBottomLogin.setVisibility(0);
        params.bottomMargin = this.mBottomLogin.getHeight();
    }
    this.mPullListView.setLayoutParams(params);
}