Example usage for android.graphics Color DKGRAY

List of usage examples for android.graphics Color DKGRAY

Introduction

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

Prototype

int DKGRAY

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

Click Source Link

Usage

From source file:Main.java

public static int updateColor() {
    return Color.DKGRAY;
}

From source file:Main.java

public static Bitmap drawTextToBitmap(Context mContext, int resourceId, String mText) {
    try {/* www . j  a  v a  2 s . c o  m*/
        Resources resources = mContext.getResources();
        float scale = resources.getDisplayMetrics().density;
        Bitmap bitmap = BitmapFactory.decodeResource(resources, resourceId);

        android.graphics.Bitmap.Config bitmapConfig = bitmap.getConfig();
        // set default bitmap config if none
        if (bitmapConfig == null) {
            bitmapConfig = android.graphics.Bitmap.Config.ARGB_8888;
        }
        // resource bitmaps are imutable,
        // so we need to convert it to mutable one
        bitmap = bitmap.copy(bitmapConfig, true);

        Canvas canvas = new Canvas(bitmap);
        // new antialised Paint
        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        // text color - #3D3D3D
        paint.setColor(Color.rgb(77, 77, 77));
        // text size in pixels
        paint.setTextSize((int) (13 * scale));
        // text shadow
        paint.setShadowLayer(1f, 0f, 1f, Color.DKGRAY);

        // draw text to the Canvas center
        Rect bounds = new Rect();
        paint.getTextBounds(mText, 0, mText.length(), bounds);
        int x = (int) ((bitmap.getWidth() - bounds.width()) / 4);
        int y = (int) ((bitmap.getHeight() + bounds.height()) / 4);

        canvas.drawText(mText, x * scale, y * scale, paint);

        return bitmap;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;

}

From source file:org.amahi.anywhere.activity.IntroductionActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addSlide(SampleSlide.newInstance(R.layout.intro_first_layout));
    addSlide(AppIntroFragment.newInstance(getString(R.string.intro_title_2), getString(R.string.intro_desc_2),
            R.drawable.network, ContextCompat.getColor(this, R.color.intro_2)));
    addSlide(AppIntroFragment.newInstance(getString(R.string.intro_title_3),
            getString(R.string.intro_desc_phone_3), R.drawable.photos, Color.DKGRAY));
    addSlide(AppIntroFragment.newInstance(getString(R.string.intro_title_4),
            getString(R.string.intro_desc_phone_4), R.drawable.music,
            ContextCompat.getColor(this, R.color.intro_4)));
    addSlide(AppIntroFragment.newInstance(getString(R.string.intro_title_5),
            getString(R.string.intro_desc_phone_5), R.drawable.movies,
            ContextCompat.getColor(this, R.color.intro_5)));
    addSlide(AppIntroFragment.newInstance(getString(R.string.intro_title_6), getString(R.string.intro_desc_6),
            R.drawable.tick, ContextCompat.getColor(this, R.color.intro_6)));
    setFlowAnimation();/*from w  w  w.ja  v a2s.co  m*/
}

From source file:org.amahi.anywhere.tv.fragment.IntroFragment.java

@Override
public void onAttach(Context context) {
    super.onAttach(context);

    mTitles = new ArrayList<>();
    mDescriptions = new ArrayList<>();

    mColors = new ArrayList<>();
    mColors.add(ContextCompat.getColor(context, R.color.intro_1));
    mColors.add(ContextCompat.getColor(context, R.color.intro_2));
    mColors.add(Color.DKGRAY);
    mColors.add(ContextCompat.getColor(context, R.color.intro_4));
    mColors.add(ContextCompat.getColor(context, R.color.intro_5));
    mColors.add(ContextCompat.getColor(context, R.color.intro_6));

    mTitles.add(getString(R.string.app_title));
    mDescriptions.add(getString(R.string.intro_tv_1));

    mTitles.add(getString(R.string.intro_title_2));
    mDescriptions.add(getString(R.string.intro_desc_2));

    mTitles.add(getString(R.string.intro_title_3));
    mDescriptions.add(getString(R.string.intro_desc_tv_3));

    mTitles.add(getString(R.string.intro_title_4));
    mDescriptions.add(getString(R.string.intro_desc_tv_4));

    mTitles.add(getString(R.string.intro_title_5));
    mDescriptions.add(getString(R.string.intro_desc_tv_5));

    mTitles.add(getString(R.string.intro_title_6));
    mDescriptions.add(getString(R.string.intro_desc_6));

    setLogoResourceId(R.drawable.ic_app_logo);
}

From source file:info.tongrenlu.MediaNotificationManager.java

public MediaNotificationManager(MusicService service) {
    mService = service;//www .jav a  2 s.c o m

    mNotificationColor = Color.DKGRAY;
    mNotificationManager = (NotificationManager) mService.getSystemService(Context.NOTIFICATION_SERVICE);

    Intent togglePlaybackIntent = new Intent(mService, MusicService.class);
    togglePlaybackIntent.setAction(MusicService.CMD_TOGGLE_PLAYBACK);
    mTogglePlaybackPendingIntent = PendingIntent.getService(mService, REQUEST_CODE, togglePlaybackIntent,
            PendingIntent.FLAG_CANCEL_CURRENT);

    Intent previousIntent = new Intent(mService, MusicService.class);
    previousIntent.setAction(MusicService.CMD_PREV);
    mPreviousPendingIntent = PendingIntent.getService(mService, REQUEST_CODE, previousIntent,
            PendingIntent.FLAG_CANCEL_CURRENT);

    Intent nextIntent = new Intent(mService, MusicService.class);
    nextIntent.setAction(MusicService.CMD_NEXT);
    mNextPendingIntent = PendingIntent.getService(mService, REQUEST_CODE, nextIntent,
            PendingIntent.FLAG_CANCEL_CURRENT);

    Intent deleteIntent = new Intent(mService, MusicService.class);
    nextIntent.setAction(MusicService.CMD_STOP);
    mDeletePendingIntent = PendingIntent.getBroadcast(mService, REQUEST_CODE, deleteIntent,
            PendingIntent.FLAG_CANCEL_CURRENT);

    // Cancel all notifications to handle the case where the Service was killed and
    // restarted by the system.
    mNotificationManager.cancelAll();

}

From source file:com.example.android.movies.app.MainActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    menu.clear();/*from w  w  w  .  j av a 2  s.c  om*/
    //getMenuInflater().inflate(R.menu.main, menu);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main, menu);
    MenuItem searchItem = menu.findItem(R.id.search);
    android.support.v7.widget.SearchView searchView = (android.support.v7.widget.SearchView) MenuItemCompat
            .getActionView(searchItem);
    searchView.setQueryHint("Find movies...");
    int searchPlateId = searchView.getContext().getResources().getIdentifier("android:id/search_plate", null,
            null);
    View searchPlate = searchView.findViewById(searchPlateId);
    if (searchPlate != null) {
        searchPlate.setBackgroundColor(Color.DKGRAY);
        int searchTextId = searchPlate.getContext().getResources().getIdentifier("android:id/search_src_text",
                null, null);
        TextView searchText = (TextView) searchPlate.findViewById(searchTextId);
        if (searchText != null) {
            searchText.setTextColor(Color.WHITE);
            searchText.setHintTextColor(Color.WHITE);
        }
    }
    SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() {
        public boolean onQueryTextChange(String newText) {
            return true;
        }

        public boolean onQueryTextSubmit(String query) {

            SearchFragment fragmentS1 = new SearchFragment();
            Bundle bundle = new Bundle();

            bundle.putString("search", query);

            fragmentS1.setArguments(bundle);
            getSupportFragmentManager().beginTransaction().replace(R.id.container, fragmentS1).commit();

            return true;

        }
    };
    searchView.setOnQueryTextListener(queryTextListener);
    searchView.setIconifiedByDefault(false);

    return true;
}

From source file:org.odk.collect.android.activities.FileManagerTabs.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.file_manager_layout);
    initToolbar();// w  w  w . ja  v  a 2 s .c  om

    String[] tabNames = { getString(R.string.data), getString(R.string.forms) };
    // Get the ViewPager and set its PagerAdapter so that it can display items
    ViewPager viewPager = (ViewPager) findViewById(R.id.pager);

    ArrayList<Fragment> fragments = new ArrayList<>();
    fragments.add(dataManagerList);
    fragments.add(formManagerList);

    viewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), tabNames, fragments));

    // Give the SlidingTabLayout the ViewPager
    SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.tabs);
    // Attach the view pager to the tab strip
    slidingTabLayout.setDistributeEvenly(true);
    slidingTabLayout.setFontColor(android.R.color.white);
    slidingTabLayout.setBackgroundColor(Color.DKGRAY);
    slidingTabLayout.setViewPager(viewPager);
}

From source file:com.cssweb.android.quote.QHSCGridActivity.java

public QHSCGridActivity() {
    int[] arrayOfInt1 = new int[3];
    this.residTitleScrollCol = arrayOfInt1;
    this.residTitleCol = 0;
    this.residCol = 0;
    int[] arrayOfInt2 = new int[3];
    this.residScrollCol = arrayOfInt2;
    this.residSelColor = Color.DKGRAY;
}

From source file:com.money.manager.ex.assetallocation.full.FullAssetAllocationAdapter.java

@Override
public void onBindViewHolder(FullAssetClassViewHolder holder, int position) {
    AssetClassViewModel item = this.model.get(position);

    // color the background, depending on the level.
    switch (item.assetClass.getType()) {
    case Allocation:
        // reset bg color
        holder.listItem.setBackgroundColor(Color.TRANSPARENT);
        break;/*from  w w  w. j a v  a2s  .c o  m*/

    case Footer:
        holder.listItem.setBackgroundColor(Color.DKGRAY);
        break;

    default:
        int colorDepth = 50 * item.level;
        holder.listItem.setBackgroundColor(Color.argb(225, 0, 100 + colorDepth, 0));
        break;
    }

    holder.assetClassTextView.setText(item.assetClass.getName());
    holder.setAllocationTextView.setText(item.assetClass.getAllocation().toString());

    // Current Allocation
    Money currentAllocation = item.assetClass.getCurrentAllocation();
    String currentAllocationString = currentAllocation == null ? "" : currentAllocation.toString();
    holder.currentAllocationTextView.setText(currentAllocationString);

    // % diff
    Money diff = item.assetClass.getDiffAsPercentOfSet();
    DecimalFormat df = new DecimalFormat("0.00");
    String diffString = df.format(diff.toDouble());
    holder.allocationDiffTextView.setText(diffString);

    // color red/green if under/over the threshold.
    if (diff.toDouble() >= this.differenceThreshold.toDouble()) {
        holder.allocationDiffTextView.setTextColor(Color.GREEN);
    }
    if (diff.toDouble() <= this.differenceThreshold.multiply(-1).toDouble()) {
        holder.allocationDiffTextView.setTextColor(Color.RED);
    }

    holder.setValueTextView.setText(mFormatter.getValueFormattedInBaseCurrency(item.assetClass.getValue()));
    holder.currentValueTextView
            .setText(mFormatter.getValueFormattedInBaseCurrency(item.assetClass.getCurrentValue()));
    holder.valueDiffTextView
            .setText(mFormatter.getValueFormattedInBaseCurrency(item.assetClass.getDifference()));

    holder.setLevel(item.level, this.context);

    //        if (position == expandedPosition) {
    //            holder.valuetPanel.setVisibility(View.VISIBLE);
    //        } else {
    //            holder.valuetPanel.setVisibility(View.GONE);
    //        }
}

From source file:com.ruesga.rview.widget.MergedStatusChart.java

public MergedStatusChart(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setLayerType(View.LAYER_TYPE_SOFTWARE, null);

    final Resources res = getResources();
    mHeightBarPadding = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, res.getDisplayMetrics());
    mMinBarWidth = 0f;/*from ww w  .  j a va2 s .c o m*/
    int openColor = Color.DKGRAY;
    int mergedColor = Color.DKGRAY;
    int abandonedColor = Color.DKGRAY;
    int textColor = Color.WHITE;

    Resources.Theme theme = context.getTheme();
    TypedArray a = theme.obtainStyledAttributes(attrs, R.styleable.MergedStatusChart, defStyleAttr, 0);
    int n = a.getIndexCount();
    for (int i = 0; i < n; i++) {
        int attr = a.getIndex(i);
        switch (attr) {
        case R.styleable.MergedStatusChart_heightBarPadding:
            mHeightBarPadding = a.getDimension(attr, mHeightBarPadding);
            break;

        case R.styleable.MergedStatusChart_minBarWidth:
            mMinBarWidth = a.getDimension(attr, mMinBarWidth);
            break;

        case R.styleable.MergedStatusChart_openColor:
            openColor = a.getColor(attr, openColor);
            break;

        case R.styleable.MergedStatusChart_mergedColor:
            mergedColor = a.getColor(attr, mergedColor);
            break;

        case R.styleable.MergedStatusChart_abandonedColor:
            abandonedColor = a.getColor(attr, abandonedColor);
            break;

        case R.styleable.MergedStatusChart_statusLabelTextColor:
            textColor = a.getColor(attr, textColor);
            break;
        }
    }
    a.recycle();

    mOpenPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mOpenPaint.setStyle(Paint.Style.FILL);
    mMergedPaint = new Paint(mOpenPaint);
    mAbandonedPaint = new Paint(mOpenPaint);
    mOpenPaint.setColor(openColor);
    mMergedPaint.setColor(mergedColor);
    mAbandonedPaint.setColor(abandonedColor);

    mLabelPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG | Paint.LINEAR_TEXT_FLAG);
    mLabelPaint.setTextAlign(Paint.Align.LEFT);
    mLabelPaint.setFakeBoldText(true);
    mLabelPaint.setColor(textColor);
    mLabelPaint
            .setTextSize(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 10f, res.getDisplayMetrics()));
    mLabelPadding = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 2f, res.getDisplayMetrics());
    Rect bounds = new Rect();
    mLabelPaint.getTextBounds("0", 0, 1, bounds);
    mLabelHeight = bounds.height();

    if (getBackground() == null) {
        setBackgroundColor(Color.TRANSPARENT);
    }
}