Example usage for android.graphics Color BLACK

List of usage examples for android.graphics Color BLACK

Introduction

In this page you can find the example usage for android.graphics Color BLACK.

Prototype

int BLACK

To view the source code for android.graphics Color BLACK.

Click Source Link

Usage

From source file:com.agenmate.lollipop.addedit.AddEditActivity.java

@SuppressLint("NewApi")
public void setBarColor(int color, boolean isWhiteText) {
    appBar.setBackgroundColor(ContextCompat.getColor(this, colorBarIds[color]));
    String title = taskId == null ? "New Task" : "Edit Task";
    toolbar.setTitleTextColor(isWhiteText ? Color.WHITE : Color.BLACK);
    toolbar.setTitle(title);//from w  w w .java 2  s  . c  o m
    final Drawable upArrow = ContextCompat.getDrawable(this, R.drawable.abc_ic_ab_back_material);
    upArrow.setColorFilter(isWhiteText ? Color.WHITE : Color.BLACK, PorterDuff.Mode.SRC_ATOP);
    getSupportActionBar().setHomeAsUpIndicator(upArrow);
    setStatusBarColor(color);

    if (menu != null) {
        for (int i = 0; i < menu.size(); i++) {
            Drawable drawable = menu.getItem(i).getIcon();
            if (drawable != null) {
                drawable.mutate();
                drawable.setColorFilter(isWhiteText ? Color.WHITE : Color.BLACK, PorterDuff.Mode.SRC_ATOP);
            }
        }
    }

}

From source file:com.github.xizzhu.simpletooltip.sample.MainActivity.java

private void showToolTipViewWithParent(final Button anchorView, int gravity) {
    showToolTipView(anchorView, (FrameLayout) findViewById(R.id.tool_tip_view_holder), gravity,
            "Tool tip for " + anchorView.getText(), Color.BLACK, 0L);
}

From source file:com.jdom.word.playdough.android.GamePackPlayerActivity.java

public void updateSourceLetters(List<ButtonConfiguration> buttons) {
    TableLayout availableLettersTable = (TableLayout) findViewById(R.id.source_letters_table);
    availableLettersTable.removeAllViews();
    TableRow row = new TableRow(this);

    for (int i = 0; i < buttons.size(); i++) {
        final ButtonConfiguration buttonConfiguration = buttons.get(i);
        final String displayText = buttonConfiguration.getDisplayText();
        final boolean shouldBeEnabled = buttonConfiguration.isEnabled();
        final Runnable clickAction = buttonConfiguration.getClickAction();

        if (i == 9 || i == 18) {
            availableLettersTable.addView(row);
            row = new TableRow(this);
        }//  w  w w  . j  ava  2s  . c  om

        final Button button = new Button(this);
        button.setText(displayText);
        button.setClickable(shouldBeEnabled);
        button.setEnabled(shouldBeEnabled);
        button.setBackgroundColor(Color.BLACK);
        button.setTextSize(20);
        int color = (shouldBeEnabled) ? Color.WHITE : Color.BLACK;
        button.setTextColor(color);

        if (clickAction != null) {
            button.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    clickAction.run();
                }
            });
        }

        row.addView(button);
    }
    availableLettersTable.addView(row);

}

From source file:com.dkstudio.icorrect.practice.speaking.ui.custom.MaterialProgressBar.java

private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MaterialProgressBar, defStyleAttr,
            0);/*from   w w w  .  j a  v  a 2  s . co m*/

    final float density = getContext().getResources().getDisplayMetrics().density;

    mBackGroundColor = a.getColor(R.styleable.MaterialProgressBar_background_color, DEFAULT_CIRCLE_BG_LIGHT);

    mProgressColor = a.getColor(R.styleable.MaterialProgressBar_progress_color, DEFAULT_CIRCLE_BG_LIGHT);

    mInnerRadius = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_inner_radius, -1);

    mProgressStokeWidth = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_progress_stoke_width,
            (int) (STROKE_WIDTH_LARGE * density));
    mArrowWidth = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_arrow_width, -1);
    mArrowHeight = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_arrow_height, -1);
    mTextSize = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_progress_text_size,
            (int) (DEFAULT_TEXT_SIZE * density));
    mTextColor = a.getColor(R.styleable.MaterialProgressBar_progress_text_color, Color.BLACK);

    mShowArrow = a.getBoolean(R.styleable.MaterialProgressBar_show_arrow, false);
    mCircleBackgroundEnabled = a.getBoolean(R.styleable.MaterialProgressBar_enable_circle_background, true);

    mProgress = a.getInt(R.styleable.MaterialProgressBar_progress, 0);
    mMax = a.getInt(R.styleable.MaterialProgressBar_max, 100);
    int textVisible = a.getInt(R.styleable.MaterialProgressBar_progress_text_visibility, 1);
    if (textVisible != 1) {
        mIfDrawText = true;
    }

    mTextPaint = new Paint();
    mTextPaint.setStyle(Paint.Style.FILL);
    mTextPaint.setColor(mTextColor);
    mTextPaint.setTextSize(mTextSize);
    mTextPaint.setAntiAlias(true);
    a.recycle();
    mProgressDrawable = new MaterialProgressDrawable(getContext(), this);
    super.setImageDrawable(mProgressDrawable);
}

From source file:com.g11x.checklistapp.ChecklistItemActivity.java

private void createUI() {
    TextView name = (TextView) findViewById(R.id.name);
    name.setText(checklistItem.getName(language));

    TextView description = (TextView) findViewById(R.id.description);
    description.setText(checklistItem.getDescription(language));

    Button getDirections = (Button) findViewById(R.id.directions);
    getDirections.setOnClickListener(new View.OnClickListener() {
        @Override//  www  . j  a  v  a2 s.c  om
        public void onClick(View view) {
            ChecklistItemActivity.this.onClickGetDirections();
        }
    });

    Button doneness = (Button) findViewById(R.id.doneness);
    if (checklistItem.isDone()) {
        doneness.setTextColor(ContextCompat.getColor(ChecklistItemActivity.this, R.color.primary));
        doneness.setPaintFlags(doneness.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
        doneness.setText(getResources().getString(R.string.complete));
        doneness.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_check_box_accent_24dp, 0, 0, 0);
    } else {
        doneness.setTextColor(Color.BLACK);
        doneness.setPaintFlags(doneness.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
        doneness.setText(getResources().getString(R.string.mark_as_done));
        doneness.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_check_box_outline_blank_black_24dp, 0, 0,
                0);
    }
    doneness.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ChecklistItemActivity.this.onClickIsDone();
        }
    });

    Button sendEmail = (Button) findViewById(R.id.send_email);
    if (checklistItem.getEmail() != null && !checklistItem.getEmail().equals("")) {
        sendEmail.setVisibility(View.VISIBLE);
        sendEmail.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Intent.ACTION_SENDTO);
                intent.setData(Uri.parse("mailto:"));
                intent.putExtra(Intent.EXTRA_EMAIL, checklistItem.getEmail());
                intent.putExtra(Intent.EXTRA_TEXT,
                        getResources().getString(R.string.sent_from_rst_checklist_app));
                if (intent.resolveActivity(getPackageManager()) != null) {
                    startActivity(Intent.createChooser(intent, "Send e-mail"));
                }
            }
        });
    } else {
        sendEmail.setVisibility(View.GONE);
    }

    Button call = (Button) findViewById(R.id.call);
    if (checklistItem.getPhone() != null && !checklistItem.getPhone().equals("")) {
        call.setVisibility(View.VISIBLE);
        call.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(Intent.ACTION_DIAL);
                intent.setData(Uri.parse("tel:" + checklistItem.getPhone()));
                if (intent.resolveActivity(getPackageManager()) != null) {
                    startActivity(intent);
                }
            }
        });
    } else {
        call.setVisibility(View.GONE);
    }
}

From source file:com.figo.campaignhelper.GenerateActivity.java

Bitmap encodeAsBitmap(String contents) throws WriterException {
    String contentsToEncode = contents;
    if (contentsToEncode == null) {
        return null;
    }//from w  w w .  j  av  a 2s .c  om
    Map<EncodeHintType, Object> hints = null;
    String encoding = guessAppropriateEncoding(contentsToEncode);
    if (encoding != null) {
        hints = new EnumMap<EncodeHintType, Object>(EncodeHintType.class);
        hints.put(EncodeHintType.CHARACTER_SET, encoding);
    }
    MultiFormatWriter writer = new MultiFormatWriter();

    WindowManager manager = (WindowManager) getSystemService(WINDOW_SERVICE);
    Display display = manager.getDefaultDisplay();
    int widthD = display.getWidth();
    int heightD = display.getHeight();
    int dimension = widthD < heightD ? widthD : heightD;
    dimension = dimension * 7 / 8;

    BitMatrix result = writer.encode(contentsToEncode, BarcodeFormat.QR_CODE, dimension, dimension, hints);
    int width = result.getWidth();
    int height = result.getHeight();
    int[] pixels = new int[width * height];
    for (int y = 0; y < height; y++) {
        int offset = y * width;
        for (int x = 0; x < width; x++) {
            pixels[offset + x] = result.get(x, y) ? Color.BLACK : Color.WHITE;
        }
    }

    Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
    return bitmap;
}

From source file:com.amitupadhyay.aboutexample.ui.widget.FabOverlapTextView.java

private void init(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    paint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.FabOverlapTextView);

    float defaultTextSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, DEFAULT_TEXT_SIZE_SP,
            getResources().getDisplayMetrics());

    setFabOverlapGravity(a.getInt(R.styleable.FabOverlapTextView_fabGravity, Gravity.BOTTOM | Gravity.RIGHT));
    setFabOverlapHeight(a.getDimensionPixelSize(R.styleable.FabOverlapTextView_fabOverlayHeight, 0));
    setFabOverlapWidth(a.getDimensionPixelSize(R.styleable.FabOverlapTextView_fabOverlayWidth, 0));

    if (a.hasValue(R.styleable.FabOverlapTextView_android_textAppearance)) {
        final int textAppearance = a.getResourceId(R.styleable.FabOverlapTextView_android_textAppearance,
                android.R.style.TextAppearance);
        TypedArray atp = getContext().obtainStyledAttributes(textAppearance, R.styleable.FontTextAppearance);
        paint.setColor(atp.getColor(R.styleable.FontTextAppearance_android_textColor, Color.BLACK));
        paint.setTextSize(atp.getDimensionPixelSize(R.styleable.FontTextAppearance_android_textSize,
                (int) defaultTextSize));
        if (atp.hasValue(R.styleable.FontTextAppearance_font)) {
            paint.setTypeface(FontUtil.get(getContext(), atp.getString(R.styleable.FontTextAppearance_font)));
        }// w ww. jav  a 2  s .  c  o m
        atp.recycle();
    }

    if (a.hasValue(R.styleable.FabOverlapTextView_font)) {
        setFont(a.getString(R.styleable.FabOverlapTextView_font));
    }

    if (a.hasValue(R.styleable.FabOverlapTextView_android_textColor)) {
        setTextColor(a.getColor(R.styleable.FabOverlapTextView_android_textColor, 0));
    }
    if (a.hasValue(R.styleable.FabOverlapTextView_android_textSize)) {
        setTextSize(a.getDimensionPixelSize(R.styleable.FabOverlapTextView_android_textSize,
                (int) defaultTextSize));
    }

    lineHeightHint = a.getDimensionPixelSize(R.styleable.FabOverlapTextView_lineHeightHint, 0);
    unalignedTopPadding = getPaddingTop();
    unalignedBottomPadding = getPaddingBottom();

    breakStrategy = a.getInt(R.styleable.FabOverlapTextView_android_breakStrategy,
            Layout.BREAK_STRATEGY_BALANCED);

    a.recycle();
}

From source file:org.quantumbadger.redreader.activities.ImageViewActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    final boolean solidblack = PrefsUtility.appearance_solidblack(this, sharedPreferences);

    if (solidblack)
        getWindow().setBackgroundDrawable(new ColorDrawable(Color.BLACK));

    final Intent intent = getIntent();

    mUrl = General.uriFromString(intent.getDataString());
    final RedditPost src_post = intent.getParcelableExtra("post");

    if (mUrl == null) {
        General.quickToast(this, "Invalid URL. Trying web browser.");
        revertToWeb();/*from  ww w .  j a va2  s.co m*/
        return;
    }

    Log.i("ImageViewActivity", "Loading URL " + mUrl.toString());

    final ProgressBar progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);

    final LinearLayout layout = new LinearLayout(this);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.addView(progressBar);

    CacheManager.getInstance(this)
            .makeRequest(mRequest = new CacheRequest(mUrl, RedditAccountManager.getAnon(), null,
                    Constants.Priority.IMAGE_VIEW, 0, CacheRequest.DownloadType.IF_NECESSARY,
                    Constants.FileType.IMAGE, false, false, false, this) {

                private void setContentView(View v) {
                    layout.removeAllViews();
                    layout.addView(v);
                    v.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
                    v.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
                }

                @Override
                protected void onCallbackException(Throwable t) {
                    BugReportActivity.handleGlobalError(context.getApplicationContext(),
                            new RRError(null, null, t));
                }

                @Override
                protected void onDownloadNecessary() {
                    AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                        @Override
                        public void run() {
                            progressBar.setVisibility(View.VISIBLE);
                            progressBar.setIndeterminate(true);
                        }
                    });
                }

                @Override
                protected void onDownloadStarted() {
                }

                @Override
                protected void onFailure(final RequestFailureType type, Throwable t, StatusLine status,
                        final String readableMessage) {

                    final RRError error = General.getGeneralErrorForFailure(context, type, t, status,
                            url.toString());

                    AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                        public void run() {
                            // TODO handle properly
                            mRequest = null;
                            progressBar.setVisibility(View.GONE);
                            layout.addView(new ErrorView(ImageViewActivity.this, error));
                        }
                    });
                }

                @Override
                protected void onProgress(final boolean authorizationInProgress, final long bytesRead,
                        final long totalBytes) {
                    AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                        @Override
                        public void run() {
                            progressBar.setVisibility(View.VISIBLE);
                            progressBar.setIndeterminate(authorizationInProgress);
                            progressBar.setProgress((int) ((100 * bytesRead) / totalBytes));
                        }
                    });
                }

                @Override
                protected void onSuccess(final CacheManager.ReadableCacheFile cacheFile, long timestamp,
                        UUID session, boolean fromCache, final String mimetype) {

                    if (mimetype == null
                            || (!Constants.Mime.isImage(mimetype) && !Constants.Mime.isVideo(mimetype))) {
                        revertToWeb();
                        return;
                    }

                    final InputStream cacheFileInputStream;
                    try {
                        cacheFileInputStream = cacheFile.getInputStream();
                    } catch (IOException e) {
                        notifyFailure(RequestFailureType.PARSE, e, null,
                                "Could not read existing cached image.");
                        return;
                    }

                    if (cacheFileInputStream == null) {
                        notifyFailure(RequestFailureType.CACHE_MISS, null, null, "Could not find cached image");
                        return;
                    }

                    if (Constants.Mime.isVideo(mimetype)) {

                        AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                            public void run() {

                                if (mIsDestroyed)
                                    return;
                                mRequest = null;

                                try {
                                    final RelativeLayout layout = new RelativeLayout(context);
                                    layout.setGravity(Gravity.CENTER);

                                    final VideoView videoView = new VideoView(ImageViewActivity.this);

                                    videoView.setVideoURI(cacheFile.getUri());
                                    layout.addView(videoView);
                                    setContentView(layout);

                                    layout.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
                                    layout.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
                                    videoView.setLayoutParams(
                                            new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                                                    ViewGroup.LayoutParams.MATCH_PARENT));

                                    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
                                        @Override
                                        public void onPrepared(MediaPlayer mp) {
                                            mp.setLooping(true);
                                            videoView.start();
                                        }
                                    });

                                    videoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
                                        @Override
                                        public boolean onError(final MediaPlayer mediaPlayer, final int i,
                                                final int i1) {
                                            revertToWeb();
                                            return true;
                                        }
                                    });

                                    videoView.setOnTouchListener(new View.OnTouchListener() {
                                        @Override
                                        public boolean onTouch(final View view, final MotionEvent motionEvent) {
                                            finish();
                                            return true;
                                        }
                                    });

                                } catch (OutOfMemoryError e) {
                                    General.quickToast(context, R.string.imageview_oom);
                                    revertToWeb();

                                } catch (Throwable e) {
                                    General.quickToast(context, R.string.imageview_invalid_video);
                                    revertToWeb();
                                }
                            }
                        });

                    } else if (Constants.Mime.isImageGif(mimetype)) {

                        final PrefsUtility.GifViewMode gifViewMode = PrefsUtility
                                .pref_behaviour_gifview_mode(context, sharedPreferences);

                        if (gifViewMode == PrefsUtility.GifViewMode.INTERNAL_BROWSER) {
                            revertToWeb();
                            return;

                        } else if (gifViewMode == PrefsUtility.GifViewMode.EXTERNAL_BROWSER) {
                            AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                                @Override
                                public void run() {
                                    LinkHandler.openWebBrowser(ImageViewActivity.this,
                                            Uri.parse(mUrl.toString()));
                                    finish();
                                }
                            });

                            return;
                        }

                        if (AndroidApi.isIceCreamSandwichOrLater()
                                && gifViewMode == PrefsUtility.GifViewMode.INTERNAL_MOVIE) {

                            AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                                public void run() {

                                    if (mIsDestroyed)
                                        return;
                                    mRequest = null;

                                    try {
                                        final GIFView gifView = new GIFView(ImageViewActivity.this,
                                                cacheFileInputStream);
                                        setContentView(gifView);
                                        gifView.setOnClickListener(new View.OnClickListener() {
                                            public void onClick(View v) {
                                                finish();
                                            }
                                        });

                                    } catch (OutOfMemoryError e) {
                                        General.quickToast(context, R.string.imageview_oom);
                                        revertToWeb();

                                    } catch (Throwable e) {
                                        General.quickToast(context, R.string.imageview_invalid_gif);
                                        revertToWeb();
                                    }
                                }
                            });

                        } else {

                            gifThread = new GifDecoderThread(cacheFileInputStream,
                                    new GifDecoderThread.OnGifLoadedListener() {

                                        public void onGifLoaded() {
                                            AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                                                public void run() {

                                                    if (mIsDestroyed)
                                                        return;
                                                    mRequest = null;

                                                    imageView = new ImageView(context);
                                                    imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
                                                    setContentView(imageView);
                                                    gifThread.setView(imageView);

                                                    imageView.setOnClickListener(new View.OnClickListener() {
                                                        public void onClick(View v) {
                                                            finish();
                                                        }
                                                    });
                                                }
                                            });
                                        }

                                        public void onOutOfMemory() {
                                            General.quickToast(context, R.string.imageview_oom);
                                            revertToWeb();
                                        }

                                        public void onGifInvalid() {
                                            General.quickToast(context, R.string.imageview_invalid_gif);
                                            revertToWeb();
                                        }
                                    });

                            gifThread.start();

                        }

                    } else {

                        final ImageTileSource imageTileSource;
                        try {

                            final long bytes = cacheFile.getSize();
                            final byte[] buf = new byte[(int) bytes];

                            try {
                                new DataInputStream(cacheFileInputStream).readFully(buf);
                            } catch (IOException e) {
                                throw new RuntimeException(e);
                            }

                            try {
                                imageTileSource = new ImageTileSourceWholeBitmap(buf);

                            } catch (Throwable t) {
                                Log.e("ImageViewActivity", "Exception when creating ImageTileSource", t);
                                General.quickToast(context, R.string.imageview_decode_failed);
                                revertToWeb();
                                return;
                            }

                        } catch (OutOfMemoryError e) {
                            General.quickToast(context, R.string.imageview_oom);
                            revertToWeb();
                            return;
                        }

                        AndroidApi.UI_THREAD_HANDLER.post(new Runnable() {
                            public void run() {

                                if (mIsDestroyed)
                                    return;
                                mRequest = null;
                                mImageViewDisplayerManager = new ImageViewDisplayListManager(imageTileSource,
                                        ImageViewActivity.this);
                                surfaceView = new RRGLSurfaceView(ImageViewActivity.this,
                                        mImageViewDisplayerManager);
                                setContentView(surfaceView);

                                surfaceView.setOnClickListener(new View.OnClickListener() {
                                    public void onClick(View v) {
                                        finish();
                                    }
                                });

                                if (mIsPaused) {
                                    surfaceView.onPause();
                                } else {
                                    surfaceView.onResume();
                                }
                            }
                        });
                    }
                }
            });

    final RedditPreparedPost post = src_post == null ? null
            : new RedditPreparedPost(this, CacheManager.getInstance(this), 0, src_post, -1, false, false, false,
                    false, RedditAccountManager.getInstance(this).getDefaultAccount(), false);

    final FrameLayout outerFrame = new FrameLayout(this);
    outerFrame.addView(layout);

    if (post != null) {

        final SideToolbarOverlay toolbarOverlay = new SideToolbarOverlay(this);

        final BezelSwipeOverlay bezelOverlay = new BezelSwipeOverlay(this,
                new BezelSwipeOverlay.BezelSwipeListener() {

                    public boolean onSwipe(BezelSwipeOverlay.SwipeEdge edge) {

                        toolbarOverlay.setContents(
                                post.generateToolbar(ImageViewActivity.this, false, toolbarOverlay));
                        toolbarOverlay.show(edge == BezelSwipeOverlay.SwipeEdge.LEFT
                                ? SideToolbarOverlay.SideToolbarPosition.LEFT
                                : SideToolbarOverlay.SideToolbarPosition.RIGHT);
                        return true;
                    }

                    public boolean onTap() {

                        if (toolbarOverlay.isShown()) {
                            toolbarOverlay.hide();
                            return true;
                        }

                        return false;
                    }
                });

        outerFrame.addView(bezelOverlay);
        outerFrame.addView(toolbarOverlay);

        bezelOverlay.getLayoutParams().width = android.widget.FrameLayout.LayoutParams.MATCH_PARENT;
        bezelOverlay.getLayoutParams().height = android.widget.FrameLayout.LayoutParams.MATCH_PARENT;

        toolbarOverlay.getLayoutParams().width = android.widget.FrameLayout.LayoutParams.MATCH_PARENT;
        toolbarOverlay.getLayoutParams().height = android.widget.FrameLayout.LayoutParams.MATCH_PARENT;

    }

    setContentView(outerFrame);
}

From source file:samsungsami.io.example.samiremotecontrol.DeviceActivity.java

/**
 * Fill the device status and info table
 *///  w ww  .  ja va 2  s  .  c o m
void fillTable() {

    TableRow row;
    TextView t1, t2, t3;
    for (int current = 0; current < fields.size(); current++) {
        row = new TableRow(this);
        t1 = new TextView(this);
        t1.setTextColor(Color.GRAY);
        t2 = new TextView(this);
        t2.setTextColor(Color.BLACK);
        t3 = new TextView(this);
        t3.setTextColor(Color.BLACK);

        t1.setText(fields.get(current));
        t2.setText(values.get(current));
        t3.setText(units.get(current));

        t1.setTextSize(15);
        t2.setTextSize(15);
        t3.setTextSize(15);

        row.addView(t1);

        if (fields.get(current).equals("state")) {
            Switch toggle = new Switch(this);
            toggle.setChecked(values.get(current).toLowerCase().equals("on"));
            toggle.setEnabled(false);
            row.addView(toggle);
        } else
            row.addView(t2);

        row.addView(t3);
        propertiesTableLayout.addView(row, new TableLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));

        // Adjust the view
        propertiesTableLayout.setColumnStretchable(0, true);
        propertiesTableLayout.setColumnStretchable(1, true);
        propertiesTableLayout.setColumnStretchable(2, true);
    }
}

From source file:com.chn.halo.view.progressbar.MaterialProgressBar.java

private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MaterialProgressBar, defStyleAttr,
            0);//w ww . j  a v  a 2s  . c  o  m

    final float density = getContext().getResources().getDisplayMetrics().density;

    mBackGroundColor = a.getColor(R.styleable.MaterialProgressBar_background_color, DEFAULT_CIRCLE_BG_LIGHT);

    mProgressColor = a.getColor(R.styleable.MaterialProgressBar_progress_color, DEFAULT_CIRCLE_BG_LIGHT);//ToDO 

    mInnerRadius = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_inner_radius, -1);

    mProgressStokeWidth = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_progress_stoke_width,
            (int) (STROKE_WIDTH_LARGE * density));
    mArrowWidth = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_arrow_width, -1);
    mArrowHeight = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_arrow_height, -1);
    mTextSize = a.getDimensionPixelOffset(R.styleable.MaterialProgressBar_progress_text_size,
            (int) (DEFAULT_TEXT_SIZE * density));
    mTextColor = a.getColor(R.styleable.MaterialProgressBar_progress_text_color, Color.BLACK);

    mShowArrow = a.getBoolean(R.styleable.MaterialProgressBar_show_arrow, false);
    mCircleBackgroundEnabled = a.getBoolean(R.styleable.MaterialProgressBar_enable_circle_background, true);

    mProgress = a.getInt(R.styleable.MaterialProgressBar_progress, 0);
    mMax = a.getInt(R.styleable.MaterialProgressBar_max, 100);
    int textVisible = a.getInt(R.styleable.MaterialProgressBar_progress_text_visibility, 1);
    if (textVisible != 1) {
        mIfDrawText = true;
    }

    mTextPaint = new Paint();
    mTextPaint.setStyle(Paint.Style.FILL);
    mTextPaint.setColor(mTextColor);
    mTextPaint.setTextSize(mTextSize);
    mTextPaint.setAntiAlias(true);
    a.recycle();
    mProgressDrawable = new MaterialProgressDrawable(getContext(), this);
    super.setImageDrawable(mProgressDrawable);
}