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:com.duy.pascal.ui.view.console.ConsoleView.java

private void write(String c, boolean isMaskBuffer) {
    int index = mScreenBufferData.firstIndex + mCursor.y * mConsoleScreen.consoleColumn + mCursor.x;
    if (index >= mConsoleScreen.getScreenSize()) {
        index -= mConsoleScreen.getScreenSize();
    }//from   w  w  w. ja v  a2  s  . com
    switch (c) {
    case "\n":
        mScreenBufferData.textConsole[index].setText("\n");
        mScreenBufferData.textConsole[index].setTextBackground(mTextRenderer.getBackgroundColor());
        mScreenBufferData.textConsole[index].setTextColor(mTextRenderer.getTextColor());
        mScreenBufferData.textConsole[index].setAlpha(mTextRenderer.getAlpha());
        nextLine();
        break;
    case "\177":
    case THE_DELETE_COMMAND:
        backspace(index);
        break;
    default:
        makeCursorVisible();
        if (isGreaterEqual(c, " ")) {
            mScreenBufferData.textConsole[index].setText(c);
            mScreenBufferData.textConsole[index]
                    .setTextBackground(isMaskBuffer ? Color.DKGRAY : mTextRenderer.getBackgroundColor());
            mScreenBufferData.textConsole[index].setTextColor(mTextRenderer.getTextColor());
            mScreenBufferData.textConsole[index].setAlpha(mTextRenderer.getAlpha());
            mCursor.x++;
            if (mCursor.x >= mConsoleScreen.consoleColumn) {
                nextLine();
            }
        }
    }

    postInvalidate();
}

From source file:com.nextgis.mobile.MapFragment.java

protected void addMapButtons(RelativeLayout rl) {
    mivZoomIn = new ImageView(getActivity());
    mivZoomIn.setImageResource(R.drawable.ic_plus);
    //mivZoomIn.setId(R.drawable.ic_plus);

    mivZoomOut = new ImageView(getActivity());
    mivZoomOut.setImageResource(R.drawable.ic_minus);
    //mivZoomOut.setId(R.drawable.ic_minus);

    final ImageView ivMark = new ImageView(getActivity());
    ivMark.setImageResource(R.drawable.ic_mark);
    //ivMark.setId(R.drawable.ic_mark);

    //show zoom level between plus and minus
    mivZoomLevel = new TextView(getActivity());
    //ivZoomLevel.setAlpha(150);
    mivZoomLevel.setId(R.drawable.ic_zoomlevel);

    final float scale = getResources().getDisplayMetrics().density;
    int pixels = (int) (48 * scale + 0.5f);

    mivZoomLevel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
    //ivZoomLevel.setTextAppearance(this, android.R.attr.textAppearanceLarge);

    mivZoomLevel.setWidth(pixels);/*from  w ww .java 2 s. com*/
    mivZoomLevel.setHeight(pixels);
    mivZoomLevel.setTextColor(Color.DKGRAY);
    mivZoomLevel.setBackgroundColor(Color.argb(50, 128, 128, 128)); //Color.LTGRAY R.drawable.ic_zoomlevel);
    mivZoomLevel.setGravity(Gravity.CENTER);
    mivZoomLevel.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    mivZoomLevel.setText("" + (int) Math.floor(mMap.getZoomLevel()));

    mivZoomIn.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            mMap.zoomIn();
        }
    });

    mivZoomOut.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            mMap.zoomOut();
        }
    });

    ivMark.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            //TODO: onMark();
        }
    });

    final RelativeLayout.LayoutParams RightParams1 = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    RightParams1.setMargins(mMargings + 5, mMargings - 5, mMargings + 5, mMargings - 5);
    RightParams1.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    RightParams1.addRule(RelativeLayout.CENTER_IN_PARENT);//ALIGN_PARENT_TOP
    rl.addView(mivZoomLevel, RightParams1);

    final RelativeLayout.LayoutParams RightParams4 = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    RightParams4.setMargins(mMargings + 5, mMargings - 5, mMargings + 5, mMargings - 5);
    RightParams4.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    RightParams4.addRule(RelativeLayout.ABOVE, R.drawable.ic_zoomlevel);//ALIGN_PARENT_TOP
    rl.addView(mivZoomIn, RightParams4);

    final RelativeLayout.LayoutParams RightParams3 = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    RightParams3.setMargins(mMargings + 5, mMargings - 5, mMargings + 5, mMargings - 5);
    RightParams3.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    RightParams3.addRule(RelativeLayout.CENTER_IN_PARENT);//ALIGN_PARENT_TOP
    rl.addView(ivMark, RightParams3);

    final RelativeLayout.LayoutParams RightParams2 = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    RightParams2.setMargins(mMargings + 5, mMargings - 5, mMargings + 5, mMargings - 5);
    RightParams2.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    RightParams2.addRule(RelativeLayout.BELOW, R.drawable.ic_zoomlevel);//R.drawable.ic_plus);
    rl.addView(mivZoomOut, RightParams2);

    setZoomInEnabled(mMap.canZoomIn());
    setZoomOutEnabled(mMap.canZoomOut());
}

From source file:terse.a1.TerseActivity.java

@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    glSurfaceView = null; // Forget gl on new activity.

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

    if (savedInstanceState != null && savedInstanceState.containsKey("TerseActivity")) {
        taSaveMe = savedInstanceState.getString("TerseActivity");
    } else {//  www . j av a  2  s  . c  o m
        taSaveMe = null;
    }

    Runnable bg = new Runnable() {
        @Override
        public void run() {
            resetTerp();
        }
    };

    Runnable fg = new Runnable() {
        @Override
        public void run() {
            Intent intent = getIntent();
            Uri uri = intent.getData();
            Bundle extras = intent.getExtras();
            String path = uri == null ? "/" : uri.getPath();
            String query = uri == null ? "" : uri.getQuery();

            viewPath(path, query, extras, savedInstanceState);
        }
    };
    if (terp == null) {
        TextView tv = new TextView(TerseActivity.this);
        tv.setText(Static.fmt("Building new TerseTalk VM for world <%s>...", world));
        tv.setTextAppearance(this, R.style.teletype);
        tv.setBackgroundColor(Color.BLACK);
        tv.setTextColor(Color.DKGRAY);
        tv.setTextSize(24);
        setContentView(tv);
        setContentViewThenBgThenFg("ResetSplash", tv, bg, fg);
    } else {
        fg.run();
    }
}

From source file:com.normalexception.app.rx8club.view.threadpost.PostView.java

/**
 * Setup our view here.  After the view has been inflated and all of the
 * view objects have been initialized, we can inflate our view here
 * @param post      The model we are going to use to populate the view
 * @param position   Get the position of this view on the window
 * @param listener  The listener object to attach to the view
 *///from w  w w.  ja  va  2s  .  c  om
public void setPost(final PostModel post, final int position, final OnClickListener listener) {
    username.setText(post.getUserName());
    userTitle.setText(post.getUserTitle());
    userPosts.setText(post.getUserPostCount());
    userJoin.setText(post.getJoinDate());
    postDate.setText(post.getPostDate());
    reportbutton.setVisibility(View.VISIBLE);

    if (PreferenceHelper.isShowLikes(getContext())) {
        if (post.getLikes().size() > 0) {
            String delim = "", likes = "Liked by: ";
            for (String like : post.getLikes()) {
                likes += delim + like;
                delim = ", ";
            }
            likeText.setText(likes);
        } else {
            likeText.setVisibility(View.GONE);
        }
    } else {
        likeText.setVisibility(View.GONE);
    }

    // Lets make sure we remove any font formatting that was done within
    // the text
    String trimmedPost = post.getUserPost().replaceAll("(?i)<(/*)font(.*?)>", "");

    // Show attachments if the preference allows it
    if (PreferenceHelper.isShowAttachments(getContext()))
        trimmedPost = appendAttachments(trimmedPost, post.getAttachments());

    // Show signatures if the preference allows it
    if (PreferenceHelper.isShowSignatures(getContext()) && post.getUserSignature() != null)
        trimmedPost = appendSignature(trimmedPost, post.getUserSignature());

    // Set html Font color
    trimmedPost = Utils.postFormatter(trimmedPost, getContext());
    postText.setBackgroundColor(Color.DKGRAY);
    postText.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
    postText.getSettings().setAppCachePath(Cache.getExternalCacheDir(getContext()).getAbsolutePath());
    postText.getSettings().setAllowFileAccess(false);
    postText.getSettings().setAppCacheEnabled(true);
    postText.getSettings().setJavaScriptEnabled(false);
    postText.getSettings().setSupportZoom(false);
    postText.getSettings().setSupportMultipleWindows(false);
    postText.getSettings().setUserAgentString(WebUrls.USER_AGENT);
    postText.getSettings().setDatabaseEnabled(false);
    postText.getSettings().setDomStorageEnabled(false);
    postText.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
    postText.setOnTouchListener(new View.OnTouchListener() {
        @SuppressLint("ClickableViewAccessibility")
        public boolean onTouch(View v, MotionEvent event) {
            return (event.getAction() == MotionEvent.ACTION_MOVE);
        }
    });
    postText.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            // Check if the URL for the site, and if it is a thread or a category
            Log.d(TAG, "User Clicked Embedded url");
            boolean isThread = false;
            if (url.contains("rx8club.com")) {
                isThread = url.matches(".*\\-\\d+\\/$");
                Log.d(TAG, String.format("The Link (%s) is %sa thread", url, (isThread) ? "" : "NOT "));

                Bundle args = new Bundle();
                args.putString("link", url);

                if (isThread) {
                    FragmentUtils.fragmentTransaction((FragmentActivity) view.getContext(),
                            ThreadFragment.newInstance(), false, true, args);
                    return true;
                }
            }

            // Otherwise, the link is not for a page on my site, so launch another Activity that handles URLs
            Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            MainApplication.getAppContext().startActivity(intent);
            return true;
        }
    });

    postText.loadDataWithBaseURL(WebUrls.rootUrl, trimmedPost, "text/html", "utf-8", "");

    // Load up the avatar of hte user, but remember to remove
    // the dateline at the end of the file so that we aren't
    // creating multiple images for a user.  The image still
    // gets returned without a date
    if (PreferenceHelper.isShowAvatars(getContext())) {
        String nodate_avatar = post.getUserImageUrl().indexOf('?') == -1 ? post.getUserImageUrl()
                : post.getUserImageUrl().substring(0, post.getUserImageUrl().indexOf('?'));

        if (!nodate_avatar.isEmpty()) {
            imageLoader.DisplayImage(nodate_avatar, avatar);
        } else {
            avatar.setImageResource(R.drawable.rotor_icon);
        }
    }

    // Display the right items if the user is logged in
    setUserIcons(this, post.isLoggedInUser());

    downButton.setOnClickListener(listener);

    // Set click listeners if we are logged in, hide the buttons
    // if we are not logged in
    if (LoginFactory.getInstance().isGuestMode()) {
        quoteButton.setVisibility(View.GONE);
        editButton.setVisibility(View.GONE);
        pmButton.setVisibility(View.GONE);
        deleteButton.setVisibility(View.GONE);
        reportbutton.setVisibility(View.GONE);
    } else {
        quoteButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                Log.d(TAG, "Quote Clicked");
                String txt = Html.fromHtml(post.getUserPost()).toString();
                String finalText = String.format("[quote=%s]%s[/quote]", post.getUserName(), txt);
                postBox.setText(finalText);
                postBox.requestFocus();
            }
        });

        editButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                Log.d(TAG, "Edit Clicked");

                // Create new fragment and transaction
                Bundle args = new Bundle();
                args.putString("postid", post.getPostId());
                args.putString("securitytoken", post.getToken());
                Fragment newFragment = new EditPostFragment();

                FragmentUtils.fragmentTransaction((FragmentActivity) getContext(), newFragment, true, true,
                        args);
            }
        });

        reportbutton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                Log.d(TAG, "Report Clicked");
                new ReportPostDialog(getContext(), post.getToken(), post.getPostId()).show();
            }
        });

        linkbutton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                Log.d(TAG, "Link Clicked");
                ClipboardManager clipboard = (android.content.ClipboardManager) getContext()
                        .getSystemService(Context.CLIPBOARD_SERVICE);
                android.content.ClipData clip = android.content.ClipData.newPlainText("thread link",
                        post.getRootThreadUrl());
                clipboard.setPrimaryClip(clip);
                Toast.makeText(getContext(), "Thread Link Copied To Clipboard", Toast.LENGTH_LONG).show();
            }
        });

        pmButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                Log.d(TAG, "PM Clicked");

                // Create new fragment and transaction
                Bundle args = new Bundle();
                args.putString("user", post.getUserName());
                Fragment newFragment = new NewPrivateMessageFragment();
                FragmentUtils.fragmentTransaction((FragmentActivity) getContext(), newFragment, false, true,
                        args);
            }
        });

        final boolean isFirstPost = (position == 0);
        deleteButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        switch (which) {
                        case DialogInterface.BUTTON_POSITIVE:
                            // Create new fragment and transaction
                            Bundle args = new Bundle();
                            args.putString("postid", post.getPostId());
                            args.putString("securitytoken", post.getToken());
                            args.putBoolean("delete", true);
                            args.putBoolean("deleteThread", isFirstPost && post.isLoggedInUser());
                            Fragment newFragment = new EditPostFragment();
                            FragmentUtils.fragmentTransaction((FragmentActivity) getContext(), newFragment,
                                    false, true, args);
                            break;
                        }
                    }
                };

                AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
                builder.setMessage("Are you sure you want to delete your post?")
                        .setPositiveButton("Yes", dialogClickListener)
                        .setNegativeButton("No", dialogClickListener).show();
            }
        });
    }
}

From source file:com.master.metehan.filtereagle.AdapterRule.java

public AdapterRule(Activity context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);

    this.context = context;
    this.filter = prefs.getBoolean("filter", false);

    if (prefs.getBoolean("dark_theme", false))
        colorChanged = Color.argb(128, Color.red(Color.DKGRAY), Color.green(Color.DKGRAY),
                Color.blue(Color.DKGRAY));
    else/*from w ww .  j a  va  2 s.  co  m*/
        colorChanged = Color.argb(128, Color.red(Color.LTGRAY), Color.green(Color.LTGRAY),
                Color.blue(Color.LTGRAY));

    TypedArray ta = context.getTheme().obtainStyledAttributes(new int[] { android.R.attr.textColorSecondary });
    try {
        colorText = ta.getColor(0, 0);
    } finally {
        ta.recycle();
    }

    TypedValue tv = new TypedValue();
    context.getTheme().resolveAttribute(R.attr.colorOn, tv, true);
    colorOn = tv.data;
    context.getTheme().resolveAttribute(R.attr.colorOff, tv, true);
    colorOff = tv.data;

    colorGrayed = ContextCompat.getColor(context, R.color.colorGrayed);

    iconSize = Util.dips2pixels(48, context);
}

From source file:com.hezaijin.advance.widgets.view.progress.DiscreteSeekBar.java

public DiscreteSeekBar(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    setFocusable(true);/*from  ww  w  . j a va 2 s  . co m*/
    setWillNotDraw(false);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    float density = context.getResources().getDisplayMetrics().density;
    mTrackHeight = (int) (1 * density);
    mScrubberHeight = (int) (4 * density);
    int thumbSize = (int) (density * ThumbDrawable.DEFAULT_SIZE_DP);

    //Extra pixels for a touch area of 48dp
    int touchBounds = (int) (density * 32);
    mAddedTouchBounds = (touchBounds - thumbSize) / 2;

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscreteSeekBar,
            R.attr.discreteSeekBarStyle, defStyle);

    int max = 100;
    int min = 0;
    int value = 0;
    mMirrorForRtl = a.getBoolean(R.styleable.DiscreteSeekBar_dsb_mirrorForRtl, mMirrorForRtl);
    mAllowTrackClick = a.getBoolean(R.styleable.DiscreteSeekBar_dsb_allowTrackClickToDrag, mAllowTrackClick);

    int indexMax = R.styleable.DiscreteSeekBar_dsb_max;
    int indexMin = R.styleable.DiscreteSeekBar_dsb_min;
    int indexValue = R.styleable.DiscreteSeekBar_dsb_value;
    final TypedValue out = new TypedValue();
    //Not sure why, but we wanted to be able to use dimensions here...
    if (a.getValue(indexMax, out)) {
        if (out.type == TypedValue.TYPE_DIMENSION) {
            max = a.getDimensionPixelSize(indexMax, max);
        } else {
            max = a.getInteger(indexMax, max);
        }
    }
    if (a.getValue(indexMin, out)) {
        if (out.type == TypedValue.TYPE_DIMENSION) {
            min = a.getDimensionPixelSize(indexMin, min);
        } else {
            min = a.getInteger(indexMin, min);
        }
    }
    if (a.getValue(indexValue, out)) {
        if (out.type == TypedValue.TYPE_DIMENSION) {
            value = a.getDimensionPixelSize(indexValue, value);
        } else {
            value = a.getInteger(indexValue, value);
        }
    }

    mMin = min;
    mMax = Math.max(min + 1, max);
    mValue = Math.max(min, Math.min(max, value));
    updateKeyboardRange();

    mIndicatorFormatter = a.getString(R.styleable.DiscreteSeekBar_dsb_indicatorFormatter);

    ColorStateList trackColor = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_trackColor);
    ColorStateList progressColor = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_progressColor);
    ColorStateList rippleColor = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_rippleColor);
    boolean editMode = isInEditMode();
    if (editMode && rippleColor == null) {
        rippleColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { Color.DKGRAY });
    }
    if (editMode && trackColor == null) {
        trackColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { Color.GRAY });
    }
    if (editMode && progressColor == null) {
        progressColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { 0xff009688 });
    }
    mRipple = SeekBarCompat.getRipple(rippleColor);
    if (isLollipopOrGreater) {
        SeekBarCompat.setBackground(this, mRipple);
    } else {
        mRipple.setCallback(this);
    }

    TrackRectDrawable shapeDrawable = new TrackRectDrawable(trackColor);
    mTrack = shapeDrawable;
    mTrack.setCallback(this);

    shapeDrawable = new TrackRectDrawable(progressColor);
    mScrubber = shapeDrawable;
    mScrubber.setCallback(this);

    ThumbDrawable thumbDrawable = new ThumbDrawable(progressColor, thumbSize);
    mThumb = thumbDrawable;
    mThumb.setCallback(this);
    mThumb.setBounds(0, 0, mThumb.getIntrinsicWidth(), mThumb.getIntrinsicHeight());

    if (!editMode) {
        mIndicator = new PopupIndicator(context, attrs, defStyle, convertValueToMessage(mMax));
        mIndicator.setValue(convertValueToMessage(mValue));
        mIndicator.setListener(mFloaterListener);
    }
    a.recycle();

    setNumericTransformer(new DefaultNumericTransformer());

}

From source file:com.acious.android.paginationseekbar.PaginationSeekBar.java

public PaginationSeekBar(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    setFocusable(true);//w  w  w.  j a  v a2  s .c o  m
    setWillNotDraw(false);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    float density = context.getResources().getDisplayMetrics().density;
    mTrackHeight = (int) (1 * density);
    mScrubberHeight = (int) (4 * density);
    int thumbSize = (int) (density * ThumbDrawable.DEFAULT_SIZE_DP);

    //Extra pixels for a touch area of 48dp
    int touchBounds = (int) (density * 32);
    mAddedTouchBounds = (touchBounds - thumbSize) / 2;

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PaginationSeekBar,
            R.attr.paginationSeekBarStyle, defStyle);

    int max = 100;
    int min = 0;
    int value = 1;
    mMirrorForRtl = a.getBoolean(R.styleable.PaginationSeekBar_psb_mirrorForRtl, mMirrorForRtl);
    mAllowTrackClick = a.getBoolean(R.styleable.PaginationSeekBar_psb_allowTrackClickToDrag, mAllowTrackClick);

    int indexMax = R.styleable.PaginationSeekBar_psb_max;
    int indexMin = R.styleable.PaginationSeekBar_psb_min;
    int indexValue = R.styleable.PaginationSeekBar_psb_value;
    pageCountPerOneBoard = R.styleable.PaginationSeekBar_psb_pageCountPerOneBoard;
    final TypedValue out = new TypedValue();
    //Not sure why, but we wanted to be able to use dimensions here...
    if (a.getValue(indexMax, out)) {
        if (out.type == TypedValue.TYPE_DIMENSION) {
            max = a.getDimensionPixelSize(indexMax, max);
        } else {
            max = a.getInteger(indexMax, max);
        }
    }
    if (a.getValue(indexMin, out)) {
        if (out.type == TypedValue.TYPE_DIMENSION) {
            min = a.getDimensionPixelSize(indexMin, min);
        } else {
            min = a.getInteger(indexMin, min);
        }
    }
    if (a.getValue(indexValue, out)) {
        if (out.type == TypedValue.TYPE_DIMENSION) {
            value = a.getDimensionPixelSize(indexValue, value);
        } else {
            value = a.getInteger(indexValue, value);
        }
    }
    if (a.getValue(pageCountPerOneBoard, out)) {
        pageCountPerOneBoard = a.getInteger(pageCountPerOneBoard, pageCountPerOneBoard);
    }
    mMin = min;
    mMax = Math.max(min + 1, max);
    mValue = Math.max(min, Math.min(max, value));
    updateKeyboardRange();

    mPrevPageText = a.getString(R.styleable.PaginationSeekBar_psb_indicatorPrevPageText);
    mNextPageText = a.getString(R.styleable.PaginationSeekBar_psb_indicatorNextPageText);
    mIndicatorFormatter = a.getString(R.styleable.PaginationSeekBar_psb_indicatorFormatter);

    ColorStateList trackColor = a.getColorStateList(R.styleable.PaginationSeekBar_psb_trackColor);
    ColorStateList progressColor = a.getColorStateList(R.styleable.PaginationSeekBar_psb_progressColor);
    ColorStateList rippleColor = a.getColorStateList(R.styleable.PaginationSeekBar_psb_rippleColor);
    int thumbTextColor = a.getColor(R.styleable.PaginationSeekBar_psb_thumbTextColor, Color.WHITE);
    boolean editMode = isInEditMode();
    if (editMode && rippleColor == null) {
        rippleColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { Color.DKGRAY });
    }
    if (editMode && trackColor == null) {
        trackColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { Color.GRAY });
    }
    if (editMode && progressColor == null) {
        progressColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { 0xff009688 });
    }
    if (editMode && thumbTextColor == 0) {
        thumbTextColor = Color.WHITE;
    }
    mRipple = SeekBarCompat.getRipple(rippleColor);
    if (isLollipopOrGreater) {
        SeekBarCompat.setBackground(this, mRipple);
    } else {
        mRipple.setCallback(this);
    }

    TrackRectDrawable shapeDrawable = new TrackRectDrawable(trackColor);
    mTrack = shapeDrawable;
    mTrack.setCallback(this);

    shapeDrawable = new TrackRectDrawable(progressColor);
    mScrubber = shapeDrawable;
    mScrubber.setCallback(this);

    ThumbDrawable thumbDrawable = new ThumbDrawable(progressColor, thumbTextColor, thumbSize, mValue);
    mThumb = thumbDrawable;
    mThumb.setCallback(this);
    mThumb.setBounds(0, 0, mThumb.getIntrinsicWidth(), mThumb.getIntrinsicHeight());

    if (!editMode) {
        mIndicator = new PopupIndicator(context, attrs, defStyle, convertValueToMessage(mMax), mPrevPageText,
                mNextPageText);
        mIndicator.setListener(mFloaterListener);
    }
    a.recycle();

    setNumericTransformer(new DefaultNumericTransformer());

    initPagecountPerOneboard(pageCountPerOneBoard);

}

From source file:org.openremote.android.console.AppSettingsActivity.java

/**
 * Creates the image cache text view./*from w  w  w .j a  va  2s .com*/
 * 
 * @return the text view
 */
private TextView createCacheText() {
    TextView cacheText = new TextView(this);
    cacheText.setPadding(10, 5, 0, 5);
    cacheText.setText("Image Cache:");
    cacheText.setBackgroundColor(Color.DKGRAY);
    return cacheText;
}

From source file:android_network.hetnet.vpn_service.AdapterRule.java

public AdapterRule(Activity context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);

    this.context = context;
    this.inflater = LayoutInflater.from(context);

    if (prefs.getBoolean("dark_theme", false))
        colorChanged = Color.argb(128, Color.red(Color.DKGRAY), Color.green(Color.DKGRAY),
                Color.blue(Color.DKGRAY));
    else//  w  w  w.  j a v a 2 s .  c o  m
        colorChanged = Color.argb(128, Color.red(Color.LTGRAY), Color.green(Color.LTGRAY),
                Color.blue(Color.LTGRAY));

    TypedArray ta = context.getTheme().obtainStyledAttributes(new int[] { android.R.attr.textColorPrimary });
    try {
        colorText = ta.getColor(0, 0);
    } finally {
        ta.recycle();
    }

    TypedValue tv = new TypedValue();
    context.getTheme().resolveAttribute(R.attr.colorOn, tv, true);
    colorOn = tv.data;
    context.getTheme().resolveAttribute(R.attr.colorOff, tv, true);
    colorOff = tv.data;

    colorGrayed = ContextCompat.getColor(context, R.color.colorGrayed);

    iconSize = Util.dips2pixels(48, context);
}

From source file:eu.faircode.netguard.AdapterRule.java

public AdapterRule(Activity context) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);

    this.context = context;

    if (prefs.getBoolean("dark_theme", false))
        colorChanged = Color.argb(128, Color.red(Color.DKGRAY), Color.green(Color.DKGRAY),
                Color.blue(Color.DKGRAY));
    else//  w ww  . j  a  v  a2 s  . c  o m
        colorChanged = Color.argb(128, Color.red(Color.LTGRAY), Color.green(Color.LTGRAY),
                Color.blue(Color.LTGRAY));

    TypedArray ta = context.getTheme().obtainStyledAttributes(new int[] { android.R.attr.textColorSecondary });
    try {
        colorText = ta.getColor(0, 0);
    } finally {
        ta.recycle();
    }

    TypedValue tv = new TypedValue();
    context.getTheme().resolveAttribute(R.attr.colorOn, tv, true);
    colorOn = tv.data;
    context.getTheme().resolveAttribute(R.attr.colorOff, tv, true);
    colorOff = tv.data;

    colorGrayed = ContextCompat.getColor(context, R.color.colorGrayed);

    iconSize = Util.dips2pixels(48, context);
}