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:cn.qingchengfit.widgets.AnimatedButton.java

private void init(Context context, AttributeSet attrs) {

    TintTypedArray a = TintTypedArray.obtainStyledAttributes(getContext(), attrs, R.styleable.AnimatedButton, 0,
            0);// w w w.j av a 2s.  com
    TintTypedArray b = TintTypedArray.obtainStyledAttributes(getContext(), attrs, mAttr, 0, 0);
    Resources r = context.getResources();
    final AppCompatDrawableManager drawableManager = AppCompatDrawableManager.get();
    final int idon = a.getResourceId(R.styleable.AnimatedButton_ab_drawable_on, -1);
    final int idoff = a.getResourceId(R.styleable.AnimatedButton_ab_drawable_off, -1);
    final int idbg = b.getResourceId(0, -1);
    if (idbg != -1) {
        setBackgroundDrawable(drawableManager.getDrawable(getContext(), idbg));
    } else {
        setBackgroundResource(R.color.transparent);
    }
    if (CompatUtils.less21()) {
        //            onDrawable = drawableManager.getDrawable(getContext(),R.drawable.ai_drawable_expand_less);
        //            offDrawable = drawableManager.getDrawable(getContext(),R.drawable.ai_drawable_expand_more);
    } else {
        offDrawable = drawableManager.getDrawable(getContext(), idoff);
        onDrawable = drawableManager.getDrawable(getContext(), idon);

    }
    int color = a.getColor(R.styleable.AnimatedButton_ab_color, Color.BLACK);
    DrawableCompat.setTint(offDrawable, color);
    DrawableCompat.setTint(onDrawable, color);
    a.recycle();
    b.recycle();

    setScaleType(ScaleType.CENTER_INSIDE);

    //        if (isLollipop()) {
    setImageDrawable(checked ? onDrawable : offDrawable);
    //        } else {
    //            setImageDrawable(checked ? onDrawable : offDrawable);
    //        }
}

From source file:cn.finalteam.galleryfinal.widget.FloatingActionButton.java

void init(Context context, AttributeSet attributeSet) {
    TypedArray attr = context.obtainStyledAttributes(attributeSet, R.styleable.GFFloatingActionButton, 0, 0);
    mColorNormal = attr.getColor(R.styleable.GFFloatingActionButton_fabColorNormal, Color.BLACK);
    mColorPressed = attr.getColor(R.styleable.GFFloatingActionButton_fabColorPressed, Color.BLACK);
    mIcon = attr.getResourceId(R.styleable.GFFloatingActionButton_fabIcon, 0);
    mTitle = attr.getString(R.styleable.GFFloatingActionButton_fabTitle);
    attr.recycle();// www. j  av  a2  s  . co m

    updateCircleSize();
    mShadowRadius = getDimension(R.dimen.fab_shadow_radius);
    mShadowOffset = getDimension(R.dimen.fab_shadow_offset);
    updateDrawableSize();

    updateBackground();
}

From source file:com.android.launcher3.dynamicui.ExtractionUtils.java

public static boolean isSuperDark(Palette p) {
    return !isLegibleOnWallpaper(Color.BLACK, p.getSwatches());
}

From source file:eu.operando.operandoapp.wifi.AccessPointsDetail.java

public void setView(@NonNull Resources resources, @NonNull View view, @NonNull final WiFiDetail wiFiDetail) {

    TextView ssidLabel = (TextView) view.findViewById(R.id.ssid);
    ssidLabel.setText(wiFiDetail.getTitle());
    TextView textLinkSpeed = (TextView) view.findViewById(R.id.linkSpeed);
    textLinkSpeed.setTextColor(Color.BLACK);
    String ipAddress = wiFiDetail.getWiFiAdditional().getIPAddress();
    boolean isConnected = StringUtils.isNotBlank(ipAddress);
    if (!isConnected) {
        textLinkSpeed.setVisibility(View.GONE);
        ssidLabel.setTextColor(resources.getColor(android.R.color.black));
    } else {//from w  w w .ja v a 2  s .  c  o m
        ssidLabel.setTextColor(resources.getColor(R.color.connected));

        int linkSpeed = wiFiDetail.getWiFiAdditional().getLinkSpeed();
        if (linkSpeed == WiFiConnection.LINK_SPEED_INVALID) {
            textLinkSpeed.setVisibility(View.GONE);
        } else {
            textLinkSpeed.setVisibility(View.VISIBLE);
            textLinkSpeed.setText(String.format("%d%s", linkSpeed, WifiInfo.LINK_SPEED_UNITS));
        }
    }

    WiFiSignal wiFiSignal = wiFiDetail.getWiFiSignal();
    Strength strength = wiFiSignal.getStrength();
    ImageView imageView = (ImageView) view.findViewById(R.id.levelImage);
    imageView.setImageResource(strength.imageResource());
    imageView.setColorFilter(resources.getColor(strength.colorResource()));

    Security security = wiFiDetail.getSecurity();
    ImageView securityImage = (ImageView) view.findViewById(R.id.securityImage);
    securityImage.setImageResource(security.imageResource());
    securityImage.setColorFilter(resources.getColor(R.color.icons_color));

    TextView textLevel = (TextView) view.findViewById(R.id.level);
    textLevel.setText(String.format("%ddBm", wiFiSignal.getLevel()));
    textLevel.setTextColor(Color.BLACK);
    //textLevel.setTextColor(resources.getColor(strength.colorResource()));

    ((TextView) view.findViewById(R.id.channel))
            .setText(String.format("%d", wiFiSignal.getWiFiChannel().getChannel()));
    ((TextView) view.findViewById(R.id.frequency))
            .setText(String.format("%d%s", wiFiSignal.getFrequency(), WifiInfo.FREQUENCY_UNITS));
    ((TextView) view.findViewById(R.id.distance)).setText(String.format("%.1fm", wiFiSignal.getDistance()));
    ((TextView) view.findViewById(R.id.capabilities)).setText(wiFiDetail.getCapabilities());

    LayoutInflater layoutInflater = mainContext.getLayoutInflater();

    final WiFiApConfig wiFiApConfig = wiFiDetail.getWiFiAdditional().getWiFiApConfig();
    ImageView configuredImage = (ImageView) view.findViewById(R.id.configuredImage);
    if (wiFiApConfig != null) {

        configuredImage.setVisibility(View.VISIBLE);

        if (isOperandoCompatible(wiFiApConfig)) {
            configuredImage.setColorFilter(resources.getColor(android.R.color.holo_green_light));
            view.setOnClickListener(
                    new ConfiguredClickListener(context, wiFiDetail, wiFiApConfig, isConnected));
        } else {
            configuredImage.setColorFilter(resources.getColor(android.R.color.holo_red_light));
            view.setOnClickListener(new ForgetClickListener(context, wiFiDetail));
        }

    } else {
        configuredImage.setVisibility(View.GONE);
        view.setOnClickListener(new ConnectClickListener(context, wiFiDetail, layoutInflater));
    }

}

From source file:com.owncloud.android.ui.activity.FirstRunActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.first_run_activity);

    boolean isProviderOrOwnInstallationVisible = getResources()
            .getBoolean(R.bool.show_provider_or_own_installation);

    setSlideshowSize(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE);

    Button loginButton = findViewById(R.id.login);
    loginButton.setBackgroundColor(Color.WHITE);
    loginButton.setTextColor(Color.BLACK);

    loginButton.setOnClickListener(v -> {
        if (getIntent().getBooleanExtra(EXTRA_ALLOW_CLOSE, false)) {
            Intent authenticatorActivityIntent = new Intent(this, AuthenticatorActivity.class);
            authenticatorActivityIntent.putExtra(AuthenticatorActivity.EXTRA_USE_PROVIDER_AS_WEBLOGIN, false);
            startActivityForResult(authenticatorActivityIntent, FIRST_RUN_RESULT_CODE);
        } else {//  w w w  . j  ava  2  s.  co m
            finish();
        }
    });

    Button providerButton = findViewById(R.id.signup);
    providerButton.setBackgroundColor(getResources().getColor(R.color.primary_dark));
    providerButton.setTextColor(getResources().getColor(R.color.login_text_color));
    providerButton.setVisibility(isProviderOrOwnInstallationVisible ? View.VISIBLE : View.GONE);
    providerButton.setOnClickListener(v -> {
        Intent authenticatorActivityIntent = new Intent(this, AuthenticatorActivity.class);
        authenticatorActivityIntent.putExtra(AuthenticatorActivity.EXTRA_USE_PROVIDER_AS_WEBLOGIN, true);

        if (getIntent().getBooleanExtra(EXTRA_ALLOW_CLOSE, false)) {
            startActivityForResult(authenticatorActivityIntent, FIRST_RUN_RESULT_CODE);
        } else {
            authenticatorActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(authenticatorActivityIntent);
        }
    });

    TextView hostOwnServerTextView = findViewById(R.id.host_own_server);
    hostOwnServerTextView.setTextColor(getResources().getColor(R.color.login_text_color));
    hostOwnServerTextView.setVisibility(isProviderOrOwnInstallationVisible ? View.VISIBLE : View.GONE);

    progressIndicator = findViewById(R.id.progressIndicator);
    ViewPager viewPager = findViewById(R.id.contentPanel);

    // Sometimes, accounts are not deleted when you uninstall the application so we'll do it now
    if (isFirstRun(this)) {
        AccountManager am = (AccountManager) getSystemService(ACCOUNT_SERVICE);
        if (am != null) {
            for (Account account : AccountUtils.getAccounts(this)) {
                am.removeAccount(account, null, null);
            }
        }
    }

    FeaturesViewAdapter featuresViewAdapter = new FeaturesViewAdapter(getSupportFragmentManager(),
            getFirstRun());
    progressIndicator.setNumberOfSteps(featuresViewAdapter.getCount());
    viewPager.setAdapter(featuresViewAdapter);

    viewPager.addOnPageChangeListener(this);
}

From source file:com.android.datetimepicker.date.TextViewWithCircularIndicator.java

/**
 * Programmatically set the color state list (see mdtp_date_picker_year_selector)
 * @param accentColor pressed state text color
 * @param darkMode current theme mode//  ww w. j  a va  2s  . c  om
 * @return ColorStateList with pressed state
 */
private ColorStateList createTextColor(int accentColor, boolean darkMode) {
    int[][] states = new int[][] { new int[] { android.R.attr.state_pressed }, // pressed
            new int[] { android.R.attr.state_selected }, // selected
            new int[] {} };
    int[] colors = new int[] { accentColor, Color.WHITE, darkMode ? Color.WHITE : Color.BLACK };
    return new ColorStateList(states, colors);
}

From source file:com.mifos.mifosxdroid.adapters.SavingsAccountTransactionsListAdapter.java

@Override
public View getView(int i, View view, ViewGroup viewGroup) {

    ReusableViewHolder reusableViewHolder;
    if (view == null) {

        view = layoutInflater.inflate(R.layout.row_savings_transaction_item, null);
        reusableViewHolder = new ReusableViewHolder(view);
        view.setTag(reusableViewHolder);

    } else {/*from   ww w  .j a  v a 2  s . co m*/
        reusableViewHolder = (ReusableViewHolder) view.getTag();
    }

    reusableViewHolder.tv_transactionDate
            .setText(DateHelper.getDateAsString(listOfTransactions.get(i).getDate()));
    reusableViewHolder.tv_transactionType.setText(listOfTransactions.get(i).getTransactionType().getValue());

    String transactionAmount = listOfTransactions.get(i).getCurrency().getDisplaySymbol()
            + mContext.getResources().getString(R.string.space) + listOfTransactions.get(i).getAmount();
    reusableViewHolder.tv_transactionAmount.setText(transactionAmount);

    if (listOfTransactions.get(i).getTransactionType().getDeposit()) {
        reusableViewHolder.tv_transactionAmount
                .setTextColor(ContextCompat.getColor(mContext, R.color.savings_account_status_active));
    } else if (listOfTransactions.get(i).getTransactionType().getWithdrawal()) {
        reusableViewHolder.tv_transactionAmount.setTextColor(Color.RED);
    } else {
        reusableViewHolder.tv_transactionAmount.setTextColor(Color.BLACK);
    }
    return view;
}

From source file:com.example.inmarsat.hellomap.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
    setUpMapIfNeeded();/*from  www .j a va2 s  .c  om*/
    // set the background of the text view showing the data from the API calls
    if (findViewById(R.id.detailsText) != null) {
        TextView view = (TextView) findViewById(R.id.detailsText);
        view.setBackgroundColor(Color.BLACK);
        view.setTextColor(Color.WHITE);
    }
}

From source file:com.pax.view.keyboard.CustomKeyboardView.java

@Override
public void onDraw(Canvas canvas) {
    List<Keyboard.Key> keys = getKeyboard().getKeys();
    for (Keyboard.Key key : keys) {
        canvas.save();/*from w ww  . j a  v  a2  s. c  o m*/

        int offsetY = 0;
        if (key.y == 0) {
            offsetY = 1;
        }
        int initDrawY = key.y + offsetY;
        Rect rect = new Rect(key.x, initDrawY, key.x + key.width, key.y + key.height);
        canvas.clipRect(rect);

        Drawable drawable = null;
        if (null != key.codes && key.codes.length != 0) {
            int primaryCode = key.codes[0];

            if (primaryCode < 0) {
                drawable = mOpKeyBgDrawable;
            } else {
                drawable = mKeyBgDrawable;
            }
        }

        if (null != drawable && null == key.icon) {
            int[] state = key.getCurrentDrawableState();
            drawable.setState(state);
            drawable.setBounds(rect);
            drawable.draw(canvas);
        }

        paint.setAntiAlias(true);
        paint.setTextAlign(Paint.Align.CENTER);
        paint.setTextSize(50);
        paint.setColor(Color.BLACK);

        if (key.icon != null) {
            int[] state = key.getCurrentDrawableState();
            key.icon.setState(state);
            key.icon.setBounds(rect);
            key.icon.draw(canvas);
        }

        if (key.label != null) {
            canvas.drawText(key.label.toString(), key.x + (key.width / 2),
                    initDrawY + (key.height + paint.getTextSize() - paint.descent()) / 2, paint);
        }
        canvas.restore();
    }
}

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

@Override
protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    PrefsUtility.applyTheme(this);

    OptionsMenuUtility.fixActionBar(AlbumListingActivity.this, getString(R.string.imgur_album));

    if (getActionBar() != null) {
        getActionBar().setHomeButtonEnabled(true);
        getActionBar().setDisplayHomeAsUpEnabled(true);
    }/* ww w .  j a  v a  2s .com*/

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

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

    final Intent intent = getIntent();

    mUrl = intent.getDataString();

    if (mUrl == null) {
        finish();
        return;
    }

    final Matcher matchImgur = LinkHandler.imgurAlbumPattern.matcher(mUrl);
    final String albumId;

    if (matchImgur.find()) {
        albumId = matchImgur.group(2);
    } else {
        Log.e("AlbumListingActivity", "URL match failed");
        revertToWeb();
        return;
    }

    Log.i("AlbumListingActivity", "Loading URL " + mUrl + ", album id " + albumId);

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

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

    ImgurAPI.getAlbumInfo(this, albumId, Constants.Priority.IMAGE_VIEW, 0, new GetAlbumInfoListener() {

        @Override
        public void onFailure(final RequestFailureType type, final Throwable t, final StatusLine status,
                final String readableMessage) {
            Log.e("AlbumListingActivity", "getAlbumInfo call failed: " + type);

            if (status != null)
                Log.e("AlbumListingActivity", "status was: " + status.toString());
            if (t != null)
                Log.e("AlbumListingActivity", "exception was: ", t);

            // It might be a single image, not an album

            if (status == null) {
                revertToWeb();
                return;
            }

            ImgurAPI.getImageInfo(AlbumListingActivity.this, albumId, Constants.Priority.IMAGE_VIEW, 0,
                    new GetImageInfoListener() {
                        @Override
                        public void onFailure(final RequestFailureType type, final Throwable t,
                                final StatusLine status, final String readableMessage) {
                            Log.e("AlbumListingActivity", "Image info request also failed: " + type);
                            revertToWeb();
                        }

                        @Override
                        public void onSuccess(final ImageInfo info) {
                            Log.i("AlbumListingActivity", "Link was actually an image.");
                            LinkHandler.onLinkClicked(AlbumListingActivity.this, info.urlOriginal);
                            finish();
                        }

                        @Override
                        public void onNotAnImage() {
                            Log.i("AlbumListingActivity", "Not an image either");
                            revertToWeb();
                        }
                    });
        }

        @Override
        public void onSuccess(final ImgurAPI.AlbumInfo info) {
            Log.i("AlbumListingActivity", "Got album, " + info.images.size() + " image(s)");

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

                    if (info.title != null && !info.title.trim().isEmpty()) {
                        OptionsMenuUtility.fixActionBar(AlbumListingActivity.this,
                                getString(R.string.imgur_album) + ": " + info.title);
                    }

                    layout.removeAllViews();

                    final ListView listView = new ListView(AlbumListingActivity.this);
                    listView.setAdapter(new AlbumAdapter(info));
                    layout.addView(listView);

                    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                        @Override
                        public void onItemClick(final AdapterView<?> parent, final View view,
                                final int position, final long id) {

                            LinkHandler.onLinkClicked(AlbumListingActivity.this,
                                    info.images.get(position).urlOriginal, false, null, info, position);
                        }
                    });
                }
            });
        }
    });

    setContentView(layout);
}