Java Code Examples for android.widget.FrameLayout#setBackgroundResource()

The following examples show how to use android.widget.FrameLayout#setBackgroundResource() . 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: ChatUnreadCell.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public ChatUnreadCell(Context context) {
    super(context);

    backgroundLayout = new FrameLayout(context);
    backgroundLayout.setBackgroundResource(R.drawable.newmsg_divider);
    backgroundLayout.getBackground().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_unreadMessagesStartBackground), PorterDuff.Mode.MULTIPLY));
    addView(backgroundLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 27, Gravity.LEFT | Gravity.TOP, 0, 7, 0, 0));

    imageView = new ImageView(context);
    imageView.setImageResource(R.drawable.ic_ab_new);
    imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_unreadMessagesStartArrowIcon), PorterDuff.Mode.MULTIPLY));
    imageView.setPadding(0, AndroidUtilities.dp(2), 0, 0);
    backgroundLayout.addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 10, 0));

    textView = new TextView(context);
    textView.setPadding(0, 0, 0, AndroidUtilities.dp(1));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView.setTextColor(Theme.getColor(Theme.key_chat_unreadMessagesStartText));
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));
}
 
Example 2
Source File: ChatUnreadCell.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
public ChatUnreadCell(Context context) {
    super(context);

    backgroundLayout = new FrameLayout(context);
    backgroundLayout.setBackgroundResource(R.drawable.newmsg_divider);
    backgroundLayout.getBackground().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_unreadMessagesStartBackground), PorterDuff.Mode.MULTIPLY));
    addView(backgroundLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 27, Gravity.LEFT | Gravity.TOP, 0, 7, 0, 0));

    imageView = new ImageView(context);
    imageView.setImageResource(R.drawable.ic_ab_new);
    imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_unreadMessagesStartArrowIcon), PorterDuff.Mode.MULTIPLY));
    imageView.setPadding(0, AndroidUtilities.dp(2), 0, 0);
    backgroundLayout.addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 10, 0));

    textView = new TextView(context);
    textView.setPadding(0, 0, 0, AndroidUtilities.dp(1));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView.setTextColor(Theme.getColor(Theme.key_chat_unreadMessagesStartText));
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));
}
 
Example 3
Source File: ChatUnreadCell.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
public ChatUnreadCell(Context context) {
    super(context);

    backgroundLayout = new FrameLayout(context);
    backgroundLayout.setBackgroundResource(R.drawable.newmsg_divider);
    backgroundLayout.getBackground().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_unreadMessagesStartBackground), PorterDuff.Mode.MULTIPLY));
    addView(backgroundLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 27, Gravity.LEFT | Gravity.TOP, 0, 7, 0, 0));

    imageView = new ImageView(context);
    imageView.setImageResource(R.drawable.ic_ab_new);
    imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_unreadMessagesStartArrowIcon), PorterDuff.Mode.MULTIPLY));
    imageView.setPadding(0, AndroidUtilities.dp(2), 0, 0);
    backgroundLayout.addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 10, 0));

    textView = new TextView(context);
    textView.setPadding(0, 0, 0, AndroidUtilities.dp(1));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView.setTextColor(Theme.getColor(Theme.key_chat_unreadMessagesStartText));
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));
}
 
Example 4
Source File: ChatUnreadCell.java    From TelePlus-Android with GNU General Public License v2.0 6 votes vote down vote up
public ChatUnreadCell(Context context) {
    super(context);

    backgroundLayout = new FrameLayout(context);
    backgroundLayout.setBackgroundResource(R.drawable.newmsg_divider);
    backgroundLayout.getBackground().setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_unreadMessagesStartBackground), PorterDuff.Mode.MULTIPLY));
    addView(backgroundLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 27, Gravity.LEFT | Gravity.TOP, 0, 7, 0, 0));

    imageView = new ImageView(context);
    imageView.setImageResource(R.drawable.ic_ab_new);
    imageView.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chat_unreadMessagesStartArrowIcon), PorterDuff.Mode.MULTIPLY));
    imageView.setPadding(0, AndroidUtilities.dp(2), 0, 0);
    backgroundLayout.addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 10, 0));

    textView = new TextView(context);
    textView.setPadding(0, 0, 0, AndroidUtilities.dp(1));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView.setTextColor(Theme.getColor(Theme.key_chat_unreadMessagesStartText));
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));
}
 
Example 5
Source File: PhotoAttachPhotoCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public PhotoAttachPhotoCell(Context context) {
    super(context);

    imageView = new BackupImageView(context);
    addView(imageView, LayoutHelper.createFrame(80, 80));
    checkFrame = new FrameLayout(context);
    addView(checkFrame, LayoutHelper.createFrame(42, 42, Gravity.LEFT | Gravity.TOP, 38, 0, 0, 0));

    videoInfoContainer = new FrameLayout(context);
    videoInfoContainer.setBackgroundResource(R.drawable.phototime);
    videoInfoContainer.setPadding(AndroidUtilities.dp(3), 0, AndroidUtilities.dp(3), 0);
    addView(videoInfoContainer, LayoutHelper.createFrame(80, 16, Gravity.BOTTOM | Gravity.LEFT));

    ImageView imageView1 = new ImageView(context);
    imageView1.setImageResource(R.drawable.ic_video);
    videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL));

    videoTextView = new TextView(context);
    videoTextView.setTextColor(0xffffffff);
    videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 18, -0.7f, 0, 0));

    checkBox = new CheckBox(context, R.drawable.checkbig);
    checkBox.setSize(30);
    checkBox.setCheckOffset(AndroidUtilities.dp(1));
    checkBox.setDrawBackground(true);
    checkBox.setColor(0xff3ccaef, 0xffffffff);
    addView(checkBox, LayoutHelper.createFrame(30, 30, Gravity.LEFT | Gravity.TOP, 46, 4, 0, 0));
    checkBox.setVisibility(VISIBLE);
}
 
Example 6
Source File: PhotoEditor.java    From PhotoEditor with MIT License 5 votes vote down vote up
/**
 * Remove all helper boxes from views
 */
@UiThread
public void clearHelperBox() {
    for (int i = 0; i < parentView.getChildCount(); i++) {
        View childAt = parentView.getChildAt(i);
        FrameLayout frmBorder = childAt.findViewById(R.id.frmBorder);
        if (frmBorder != null) {
            frmBorder.setBackgroundResource(0);
        }
        ImageView imgClose = childAt.findViewById(R.id.imgPhotoEditorClose);
        if (imgClose != null) {
            imgClose.setVisibility(View.GONE);
        }
    }
}
 
Example 7
Source File: PhotoPickerPhotoCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public PhotoPickerPhotoCell(Context context, boolean zoom) {
    super(context);

    zoomOnSelect = zoom;

    photoImage = new BackupImageView(context);
    addView(photoImage, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    checkFrame = new FrameLayout(context);
    addView(checkFrame, LayoutHelper.createFrame(42, 42, Gravity.RIGHT | Gravity.TOP));

    videoInfoContainer = new FrameLayout(context);
    videoInfoContainer.setBackgroundResource(R.drawable.phototime);
    videoInfoContainer.setPadding(AndroidUtilities.dp(3), 0, AndroidUtilities.dp(3), 0);
    addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 16, Gravity.BOTTOM | Gravity.LEFT));

    ImageView imageView1 = new ImageView(context);
    imageView1.setImageResource(R.drawable.ic_video);
    videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL));

    videoTextView = new TextView(context);
    videoTextView.setTextColor(0xffffffff);
    videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 18, -0.7f, 0, 0));

    checkBox = new CheckBox(context, R.drawable.checkbig);
    checkBox.setSize(zoom ? 30 : 26);
    checkBox.setCheckOffset(AndroidUtilities.dp(1));
    checkBox.setDrawBackground(true);
    checkBox.setColor(0xff66bffa, 0xffffffff);
    addView(checkBox, LayoutHelper.createFrame(zoom ? 30 : 26, zoom ? 30 : 26, Gravity.RIGHT | Gravity.TOP, 0, 4, 4, 0));
}
 
Example 8
Source File: ChatLoadingCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public ChatLoadingCell(Context context) {
    super(context);

    frameLayout = new FrameLayout(context);
    frameLayout.setBackgroundResource(R.drawable.system_loader);
    frameLayout.getBackground().setColorFilter(Theme.colorFilter);
    addView(frameLayout, LayoutHelper.createFrame(36, 36, Gravity.CENTER));

    progressBar = new RadialProgressView(context);
    progressBar.setSize(AndroidUtilities.dp(28));
    progressBar.setProgressColor(Theme.getColor(Theme.key_chat_serviceText));
    frameLayout.addView(progressBar, LayoutHelper.createFrame(32, 32, Gravity.CENTER));
}
 
Example 9
Source File: SharedPhotoVideoCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public PhotoVideoView(Context context) {
    super(context);

    container = new FrameLayout(context);
    addView(container, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    imageView = new BackupImageView(context);
    imageView.getImageReceiver().setNeedsQualityThumb(true);
    imageView.getImageReceiver().setShouldGenerateQualityThumb(true);
    container.addView(imageView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    videoInfoContainer = new FrameLayout(context);
    videoInfoContainer.setBackgroundResource(R.drawable.phototime);
    videoInfoContainer.setPadding(AndroidUtilities.dp(3), 0, AndroidUtilities.dp(3), 0);
    container.addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 16, Gravity.BOTTOM | Gravity.LEFT));

    ImageView imageView1 = new ImageView(context);
    imageView1.setImageResource(R.drawable.ic_video);
    videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL));

    videoTextView = new TextView(context);
    videoTextView.setTextColor(0xffffffff);
    videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 18, -0.7f, 0, 0));

    selector = new View(context);
    selector.setBackgroundDrawable(Theme.getSelectorDrawable(false));
    addView(selector, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    checkBox = new CheckBox(context, R.drawable.round_check2);
    checkBox.setVisibility(INVISIBLE);
    checkBox.setColor(Theme.getColor(Theme.key_checkbox), Theme.getColor(Theme.key_checkboxCheck));
    addView(checkBox, LayoutHelper.createFrame(22, 22, Gravity.RIGHT | Gravity.TOP, 0, 2, 2, 0));
}
 
Example 10
Source File: ChatLoadingCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public ChatLoadingCell(Context context) {
    super(context);

    frameLayout = new FrameLayout(context);
    frameLayout.setBackgroundResource(R.drawable.system_loader);
    frameLayout.getBackground().setColorFilter(Theme.colorFilter);
    addView(frameLayout, LayoutHelper.createFrame(36, 36, Gravity.CENTER));

    progressBar = new RadialProgressView(context);
    progressBar.setSize(AndroidUtilities.dp(28));
    progressBar.setProgressColor(Theme.getColor(Theme.key_chat_serviceText));
    frameLayout.addView(progressBar, LayoutHelper.createFrame(32, 32, Gravity.CENTER));
}
 
Example 11
Source File: PhotoAttachPhotoCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public PhotoAttachPhotoCell(Context context) {
    super(context);

    imageView = new BackupImageView(context);
    addView(imageView, LayoutHelper.createFrame(80, 80));
    checkFrame = new FrameLayout(context);
    addView(checkFrame, LayoutHelper.createFrame(42, 42, Gravity.LEFT | Gravity.TOP, 38, 0, 0, 0));

    videoInfoContainer = new FrameLayout(context);
    videoInfoContainer.setBackgroundResource(R.drawable.phototime);
    videoInfoContainer.setPadding(AndroidUtilities.dp(3), 0, AndroidUtilities.dp(3), 0);
    addView(videoInfoContainer, LayoutHelper.createFrame(80, 16, Gravity.BOTTOM | Gravity.LEFT));

    ImageView imageView1 = new ImageView(context);
    imageView1.setImageResource(R.drawable.ic_video);
    videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL));

    videoTextView = new TextView(context);
    videoTextView.setTextColor(0xffffffff);
    videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 18, -0.7f, 0, 0));

    checkBox = new CheckBox(context, R.drawable.checkbig);
    checkBox.setSize(30);
    checkBox.setCheckOffset(AndroidUtilities.dp(1));
    checkBox.setDrawBackground(true);
    checkBox.setColor(0xff3ccaef, 0xffffffff);
    addView(checkBox, LayoutHelper.createFrame(30, 30, Gravity.LEFT | Gravity.TOP, 46, 4, 0, 0));
    checkBox.setVisibility(VISIBLE);
}
 
Example 12
Source File: ColorChooser.java    From LaunchTime with GNU General Public License v3.0 5 votes vote down vote up
private void makeColorPresetButton(int color) {
        FrameLayout outframe = new FrameLayout(getContext());
        outframe.setBackgroundColor(Color.BLACK);
        outframe.setPadding(6,6,6,6);

        FrameLayout frame = new FrameLayout(getContext());
        //frame.setPadding(6,6,6,6);
        //frame.setBackgroundColor(Color.BLACK);
        frame.setBackgroundResource(R.drawable.bwg);

        TextView c = new TextView(getContext());
        c.setText("   ");
        c.setTextSize(22);
        c.setBackgroundColor(color);
//        if (color==Color.TRANSPARENT) {
//            c.setBackgroundResource(R.drawable.transparentgrid);
//        }
        c.setTag(color);
        c.setClickable(true);
        c.setOnClickListener(setColorListener);
        frame.addView(c);
        GridLayout.LayoutParams lp = new GridLayout.LayoutParams();
        lp.setMargins(24, 16, 24, 16);
        outframe.setPadding(6,6,6,6);
        outframe.addView(frame);
        colorPresets.addView(outframe, lp);
    }
 
Example 13
Source File: TDialog.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private void c()
{
    l = new ProgressBar((Context)c.get());
    android.widget.FrameLayout.LayoutParams layoutparams = new android.widget.FrameLayout.LayoutParams(-2, -2);
    layoutparams.gravity = 17;
    l.setLayoutParams(layoutparams);
    (new TextView((Context)c.get())).setText("test");
    k = new FrameLayout((Context)c.get());
    android.widget.FrameLayout.LayoutParams layoutparams1 = new android.widget.FrameLayout.LayoutParams(-1, -2);
    layoutparams1.bottomMargin = 40;
    layoutparams1.leftMargin = 80;
    layoutparams1.rightMargin = 80;
    layoutparams1.topMargin = 40;
    layoutparams1.gravity = 17;
    k.setLayoutParams(layoutparams1);
    k.setBackgroundResource(0x1080000);
    k.addView(l);
    android.widget.FrameLayout.LayoutParams layoutparams2 = new android.widget.FrameLayout.LayoutParams(-1, -1);
    j = new WebView((Context)c.get());
    j.setLayoutParams(layoutparams2);
    i = new FrameLayout((Context)c.get());
    layoutparams2.gravity = 17;
    i.setLayoutParams(layoutparams2);
    i.addView(j);
    i.addView(k);
    d = new WeakReference(k);
    setContentView(i);
}
 
Example 14
Source File: WelcomeActivity.java    From qingyang with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	final View view = View.inflate(this, R.layout.welcome_actvivity, null);
	setContentView(view);

	FrameLayout frameLayout = (FrameLayout) findViewById(R.id.welcome_frame);

	BaseApplication application = (BaseApplication) getApplication();

	if (application.isTablet()) {
		frameLayout
				.setBackgroundResource(R.drawable.wecome_tablet_background);
	} else {
		frameLayout.setBackgroundResource(R.drawable.wecome_background);
	}

	// 渐变启动 从x透明度到x透明度渐变启动
	AlphaAnimation alphaAnimation = new AlphaAnimation(0.1f, 1.0f);
	// 持续时间
	alphaAnimation.setDuration(2000);

	alphaAnimation.setAnimationListener(new MyAnimationListener());

	view.setAnimation(alphaAnimation);

}
 
Example 15
Source File: ChatLoadingCell.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public ChatLoadingCell(Context context) {
    super(context);

    frameLayout = new FrameLayout(context);
    frameLayout.setBackgroundResource(R.drawable.system_loader);
    frameLayout.getBackground().setColorFilter(Theme.colorFilter);
    addView(frameLayout, LayoutHelper.createFrame(36, 36, Gravity.CENTER));

    progressBar = new RadialProgressView(context);
    progressBar.setSize(AndroidUtilities.dp(28));
    progressBar.setProgressColor(Theme.getColor(Theme.key_chat_serviceText));
    frameLayout.addView(progressBar, LayoutHelper.createFrame(32, 32, Gravity.CENTER));
}
 
Example 16
Source File: ChatLoadingCell.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public ChatLoadingCell(Context context) {
    super(context);

    frameLayout = new FrameLayout(context);
    frameLayout.setBackgroundResource(R.drawable.system_loader);
    frameLayout.getBackground().setColorFilter(Theme.colorFilter);
    addView(frameLayout, LayoutHelper.createFrame(36, 36, Gravity.CENTER));

    progressBar = new RadialProgressView(context);
    progressBar.setSize(AndroidUtilities.dp(28));
    progressBar.setProgressColor(Theme.getColor(Theme.key_chat_serviceText));
    frameLayout.addView(progressBar, LayoutHelper.createFrame(32, 32, Gravity.CENTER));
}
 
Example 17
Source File: PhotoPickerPhotoCell.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public PhotoPickerPhotoCell(Context context, boolean zoom) {
    super(context);

    zoomOnSelect = zoom;

    photoImage = new BackupImageView(context);
    addView(photoImage, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));

    checkFrame = new FrameLayout(context);
    addView(checkFrame, LayoutHelper.createFrame(42, 42, Gravity.RIGHT | Gravity.TOP));

    videoInfoContainer = new FrameLayout(context);
    videoInfoContainer.setBackgroundResource(R.drawable.phototime);
    videoInfoContainer.setPadding(AndroidUtilities.dp(3), 0, AndroidUtilities.dp(3), 0);
    addView(videoInfoContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 16, Gravity.BOTTOM | Gravity.LEFT));

    ImageView imageView1 = new ImageView(context);
    imageView1.setImageResource(R.drawable.ic_video);
    videoInfoContainer.addView(imageView1, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL));

    videoTextView = new TextView(context);
    videoTextView.setTextColor(0xffffffff);
    videoTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    videoInfoContainer.addView(videoTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 18, -0.7f, 0, 0));

    checkBox = new CheckBox(context, R.drawable.checkbig);
    checkBox.setSize(zoom ? 30 : 26);
    checkBox.setCheckOffset(AndroidUtilities.dp(1));
    checkBox.setDrawBackground(true);
    checkBox.setColor(0xff66bffa, 0xffffffff);
    addView(checkBox, LayoutHelper.createFrame(zoom ? 30 : 26, zoom ? 30 : 26, Gravity.RIGHT | Gravity.TOP, 0, 4, 4, 0));
}
 
Example 18
Source File: PostsAdapter.java    From Hify with MIT License 4 votes vote down vote up
private void setmImageHolderBg(String color, FrameLayout mImageholder) {
    switch (Integer.parseInt(color)) {
        case 1:
            mImageholder.setBackgroundResource(R.drawable.gradient_1);
            break;
        case 2:
            mImageholder.setBackgroundResource(R.drawable.gradient_2);
            break;
        case 3:
            mImageholder.setBackgroundResource(R.drawable.gradient_3);
            break;
        case 4:
            mImageholder.setBackgroundResource(R.drawable.gradient_4);
            break;
        case 5:
            mImageholder.setBackgroundResource(R.drawable.gradient_5);
            break;
        case 6:
            mImageholder.setBackgroundResource(R.drawable.gradient_6);
            break;
        case 7:
            mImageholder.setBackgroundResource(R.drawable.gradient_7);
            break;
        case 8:
            mImageholder.setBackgroundResource(R.drawable.gradient_8);
            break;
        case 9:
            mImageholder.setBackgroundResource(R.drawable.gradient_9);
            break;
        case 10:
            mImageholder.setBackgroundResource(R.drawable.gradient_10);
            break;
        case 11:
            mImageholder.setBackgroundResource(R.drawable.gradient_11);
            break;
        case 12:
            mImageholder.setBackgroundResource(R.drawable.gradient_12);
            break;
        case 13:
            mImageholder.setBackgroundResource(R.drawable.gradient_13);
            break;
        case 14:
            mImageholder.setBackgroundResource(R.drawable.gradient_14);
            break;
        case 15:
            mImageholder.setBackgroundResource(R.drawable.gradient_15);
            break;
        case 16:
            mImageholder.setBackgroundResource(R.drawable.gradient_16);
            break;
        case 17:
            mImageholder.setBackgroundResource(R.drawable.gradient_17);
            break;
        case 18:
            mImageholder.setBackgroundResource(R.drawable.gradient_18);
            break;
        case 19:
            mImageholder.setBackgroundResource(R.drawable.gradient_19);
            break;
    }

}
 
Example 19
Source File: ActionBarActivity.java    From Yahala-Messenger with MIT License 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);

    try {
        openAnimation = AnimationUtils.loadAnimation(this, R.anim.scale_in);
        closeAnimation = AnimationUtils.loadAnimation(this, R.anim.scale_out);
    } catch (Exception e) {
        FileLog.e("tmessages", e);
    }

    setTheme(R.style.Theme_TMessages);
    getWindow().setBackgroundDrawableResource(R.drawable.transparent);

    contentView = new FrameLayoutTouch(this);
    setContentView(contentView, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));

    containerViewBack = new FrameLayout(this);
    contentView.addView(containerViewBack);

    containerView = new FrameLayout(this);
    contentView.addView(containerView);

    shadowView = new FrameLayout(this);
    contentView.addView(shadowView);
    shadowView.setBackgroundResource(R.drawable.shadow);
    ViewGroup.LayoutParams layoutParams = shadowView.getLayoutParams();
    layoutParams.width = OSUtilities.dp(2);
    layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
    shadowView.setLayoutParams(layoutParams);
    shadowView.setVisibility(View.INVISIBLE);

    actionBar = new ActionBar(this);
    contentView.addView(actionBar);
    layoutParams = actionBar.getLayoutParams();
    layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
    actionBar.setLayoutParams(layoutParams);

    for (BaseFragment fragment : fragmentsStack) {
        fragment.setParentActivity(this);
    }

    needLayout();
}
 
Example 20
Source File: AuthDialog.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
private void d()
{
    i = new ProgressBar((Context)a.get());
    android.widget.LinearLayout.LayoutParams layoutparams = new android.widget.LinearLayout.LayoutParams(-2, -2);
    i.setLayoutParams(layoutparams);
    g = new LinearLayout((Context)a.get());
    boolean flag = j.equals("action_login");
    TextView textview = null;
    if (flag)
    {
        android.widget.LinearLayout.LayoutParams layoutparams1 = new android.widget.LinearLayout.LayoutParams(-2, -2);
        layoutparams1.gravity = 16;
        layoutparams1.leftMargin = 5;
        TextView textview1 = new TextView((Context)a.get());
        android.widget.FrameLayout.LayoutParams layoutparams2;
        android.widget.FrameLayout.LayoutParams layoutparams3;
        if (Locale.getDefault().getLanguage().equals("zh"))
        {
            textview1.setText("\u767B\u5F55\u4E2D...");
        } else
        {
            textview1.setText("Logging in...");
        }
        textview1.setTextColor(Color.rgb(255, 255, 255));
        textview1.setTextSize(18F);
        textview1.setLayoutParams(layoutparams1);
        textview = textview1;
    }
    layoutparams2 = new android.widget.FrameLayout.LayoutParams(-2, -2);
    layoutparams2.gravity = 17;
    g.setLayoutParams(layoutparams2);
    g.addView(i);
    if (textview != null)
    {
        g.addView(textview);
    }
    h = new FrameLayout((Context)a.get());
    layoutparams3 = new android.widget.FrameLayout.LayoutParams(-1, -2);
    layoutparams3.leftMargin = 80;
    layoutparams3.rightMargin = 80;
    layoutparams3.topMargin = 40;
    layoutparams3.bottomMargin = 40;
    layoutparams3.gravity = 17;
    h.setLayoutParams(layoutparams3);
    h.setBackgroundResource(0x1080000);
    h.addView(g);
}