Example usage for android.graphics Color WHITE

List of usage examples for android.graphics Color WHITE

Introduction

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

Prototype

int WHITE

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

Click Source Link

Usage

From source file:alexander.martinz.sample.webserver.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);

    // enable debugging
    Config.DEBUG = true;//from  w  w w .  j  a  v a2  s.  c  om

    final CustomTabsHelper customTabsHelper = new CustomTabsHelper(getApplicationContext());
    customTabsHelper.warmup();

    tvIpAddress.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            customTabsHelper.launchUrl(MainActivity.this, buildUrl());
        }
    });
    tvIpAddress.setEnabled(false);

    etPort.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            boolean valid;

            final String portString = ((s != null) ? s.toString() : null);
            if (TextUtils.isEmpty(portString)) {
                fabToggle.setEnabled(false);
                return;
            }

            try {
                final int port = Integer.parseInt(portString);
                valid = ((port <= 65535) && (port >= 1));
            } catch (Exception exc) {
                valid = false;
            }
            fabToggle.setEnabled(valid);
        }
    });
    etPort.setEnabled(true);

    fabToggle.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (webServer == null) {
                final int port = Integer.parseInt(etPort.getText().toString());
                webServer = new DefaultRouter(MainActivity.this, port);
            }

            if (webServer.isAlive()) {
                webServer.stop();

                fabToggle.setImageResource(R.drawable.ic_portable_wifi_off_black_24dp);
                fabToggle.setBackgroundTintList(
                        ContextCompat.getColorStateList(MainActivity.this, R.color.button_off));

                tvIpAddress.setTextColor(Color.WHITE);
                tvIpAddress.setEnabled(false);
                etPort.setTextColor(Color.WHITE);
                etPort.setEnabled(true);
            } else {
                try {
                    webServer.start();
                } catch (IOException ioe) {
                    Log.e(TAG, "Could not start web server!", ioe);
                    return;
                }

                fabToggle.setImageResource(R.drawable.ic_wifi_tethering_black_24dp);
                fabToggle.setBackgroundTintList(
                        ContextCompat.getColorStateList(MainActivity.this, R.color.button_on));

                final int color = ContextCompat.getColor(MainActivity.this, R.color.button_on);
                tvIpAddress.setTextColor(color);
                tvIpAddress.setEnabled(true);
                etPort.setTextColor(color);
                etPort.setEnabled(false);

                customTabsHelper.mayLaunchUrl(buildUrl());
            }
        }
    });
}

From source file:com.armtimes.fragments.FragmentAdapter.java

@Override
public void bindView(View view, Context context, Cursor cursor) {
    ViewHolder viewHolder = (ViewHolder) view.getTag();
    final String title = cursor.getString(viewHolder.titleIndex);
    final String description = cursor.getString(viewHolder.shortDescriptionIndex);
    final int isRead = cursor.getInt(viewHolder.isRead);
    viewHolder.textViewInfo.setText(Html.fromHtml(String.format("<b>%s</b> %s", title, description)));

    final String imagePath = cursor.getString(viewHolder.imagePathIndex);
    if (imagePath != null && !imagePath.isEmpty()) {
        // Read image from storage.
        InputStream is = null;/*from   w w  w .  j av a  2s . c  o  m*/
        try {
            is = new FileInputStream(new File(imagePath));
            // Set Bitmap to Image View.
            viewHolder.imageViewThumbnail.setImageBitmap(BitmapFactory.decodeStream(is));
            // Set visibility of Image view to VISIBLE.
            viewHolder.imageViewThumbnail.setVisibility(View.VISIBLE);
            // In the case if Image was successfully set to the
            // image view change layout_weight parameter of image
            // view to (=2) and layout_width to (=0) in order to
            // show text and image view in a right way.
            viewHolder.textViewInfo.setLayoutParams(params2f);
        } catch (IOException ignore) {
            viewHolder.textViewInfo.setLayoutParams(params3f);
            // In the case if exception occurs and image can't be set.
            // Hide Thumbnail image.
            viewHolder.imageViewThumbnail.setVisibility(View.GONE);
        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (IOException ignore) {
                }
            }
        }
    } else {
        viewHolder.imageViewThumbnail.setVisibility(View.GONE);
        viewHolder.textViewInfo.setLayoutParams(params3f);
    }

    view.setBackgroundColor(isRead != 1 ? Color.parseColor("#EEEEEE") : Color.WHITE);
}

From source file:com.iStudy.Study.Renren.View.RenrenDialog.java

private void setUpTitle() {
    Drawable icon = getContext().getResources().getDrawable(R.drawable.renren_sdk_android_title_logo);
    title = new TextView(getContext());
    title.setText("");
    title.setTextColor(Color.WHITE);
    title.setGravity(Gravity.CENTER_VERTICAL);
    title.setTypeface(Typeface.DEFAULT_BOLD);
    title.setBackgroundColor(RENREN_BLUE);
    title.setBackgroundResource(R.drawable.renren_sdk_android_title_bg);
    title.setCompoundDrawablePadding(6);
    title.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
    content.addView(title);//from   w w w . ja v a 2  s.c  o  m
}

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);
        }/*from w w  w  .j a va 2s. co  m*/

        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:ch.dbrgn.android.simplerepost.activities.RepostActivity.java

/*** Menu ***/

@Override//  ww w  .  j a v  a  2 s.co  m
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_repost, menu);

    // Get spinner
    MenuItem item = menu.findItem(R.id.spinner_style);
    Spinner spinner = (Spinner) MenuItemCompat.getActionView(item);

    // Prepare data
    String[] spinnerArray = new String[Config.REPOST_STYLES.size()];
    Iterator<String> styleIterator = Config.REPOST_STYLES.keySet().iterator();
    for (int i = 0; i < Config.REPOST_STYLES.size(); i++) {
        spinnerArray[i] = styleIterator.next();
    }

    // Set adapter
    ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item,
            spinnerArray);
    spinner.setAdapter(adapter);

    // Handle clicks
    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            // Fix text color
            CheckedTextView textView = (CheckedTextView) view;
            textView.setTextColor(Color.WHITE);

            // Update watermark
            int style = (int) Config.REPOST_STYLES.values().toArray()[position];
            updateWatermark(style);
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });

    return true;
}

From source file:com.abcvoipsip.ui.prefs.CodecsFragment.java

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    prefsWrapper = new PreferencesWrapper(getActivity());
    initDatas();/*  w  w  w . j a v a 2  s  .  com*/
    setHasOptionsMenu(true);

    // Adapter
    mAdapter = new SimpleAdapter(getActivity(), codecsList, R.layout.codecs_list_item,
            new String[] { CODEC_NAME, CODEC_PRIORITY }, new int[] { R.id.line1, R.id.entiere_line });

    mAdapter.setViewBinder(new ViewBinder() {
        @Override
        public boolean setViewValue(View view, Object data, String textRepresentation) {
            if (view.getId() == R.id.entiere_line) {
                Log.d(THIS_FILE, "Entiere line is binded ");
                TextView tv = (TextView) view.findViewById(R.id.line1);
                ImageView grabber = (ImageView) view.findViewById(R.id.icon);
                if ((Short) data == 0) {
                    tv.setTextColor(Color.GRAY);
                    grabber.setImageResource(R.drawable.ic_mp_disabled);
                } else {
                    tv.setTextColor(Color.WHITE);
                    grabber.setImageResource(R.drawable.ic_mp_move);
                }
                return true;
            }
            return false;
        }

    });

    setListAdapter(mAdapter);
    registerForContextMenu(getListView());
}

From source file:app.sunstreak.yourpisd.ClassSwipeActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    //      requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.activity_class_swipe);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    if (toolbar != null) {
        setSupportActionBar(toolbar);//w ww . ja va2  s  . com
    }
    ProgressBar spinner = new ProgressBar(this);
    spinner.setIndeterminate(true);
    spinner.setId(R.id.action_bar_spinner);
    spinner.getIndeterminateDrawable().setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN);
    toolbar.addView(spinner);
    receivedClassIndex = getIntent().getExtras().getInt("classIndex");
    classCount = getIntent().getExtras().getInt("classCount");
    termIndex = getIntent().getExtras().getInt("termIndex");
    studentIndex = getIntent().getExtras().getInt("studentIndex");

    setTitle(TermFinder.Term.values()[termIndex].name);

    session = ((YPApplication) getApplication()).session;

    session.studentIndex = studentIndex;
    student = session.getCurrentStudent();
    classesForTerm = student.getClassesForTerm(termIndex);

    System.out.println(classesForTerm);

    mFragments = new ArrayList<Fragment>();
    for (int i = 0; i < classesForTerm.size(); i++) {
        Bundle args = new Bundle();
        args.putInt(DescriptionFragment.ARG_SECTION_NUMBER, i);
        Fragment fragment = new DescriptionFragment();
        fragment.setArguments(args);
        mFragments.add(fragment);
    }

    // Create the adapter that will return a fragment for each of the 
    // primary sections of the app.

    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager(), mFragments);

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.pager);
    mViewPager.setAdapter(mSectionsPagerAdapter);

    //      final ActionBar actionBar = getActionBar();
    //      actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);

    /*
    for(int i = 0; i< classCount; i++)
    {
       actionBar.addTab(actionBar.newTab()
       .setText(session.getCurrentStudent()
             .getClassName(session.getCurrentStudent().getClassMatch()[i]))
             .setTabListener(this));
    }
     */

    //      for (int classIndex : classesForTerm)
    //         actionBar.addTab(actionBar.newTab().setText(student.getClassName(student.getClassMatch()[classIndex]))
    //               .setTabListener(this));
    ArrayList<String> temp = new ArrayList<>();
    for (int classIndex : classesForTerm) {
        temp.add(student.getClassName(student.getClassMatch()[classIndex]));
    }

    setUpMaterialTabs(temp);
    //      mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
    //
    //         @Override
    //         public void onPageSelected(int position) {
    //            // on changing the page
    //            // make respected tab selected
    //            actionBar.setSelectedNavigationItem(position);
    //         }
    //
    //         @Override
    //         public void onPageScrolled(int arg0, float arg1, int arg2) {
    //         }
    //
    //         @Override
    //         public void onPageScrollStateChanged(int arg0) {
    //         }
    //      });
    //
    System.out.println("received class index = " + receivedClassIndex);
    if (receivedClassIndex > 0 && receivedClassIndex < classesForTerm.size())
        mViewPager.setCurrentItem(receivedClassIndex);
    // otherwise, current item is defaulted to 0

    //      mViewPager.setOffscreenPageLimit(5);

}

From source file:com.nextgis.maplibui.formcontrol.Sign.java

protected void init() {
    //1. get clean
    int[] attrs = new int[] { R.attr.ic_clear };
    TypedArray ta = getContext().obtainStyledAttributes(attrs);
    mCleanImage = ta.getDrawable(0);// w ww .  ja va2 s  .co  m
    ta.recycle();

    mClearBuff = (int) (getContext().getResources().getDisplayMetrics().density * CLEAR_BUFF_DP);
    mClearImageSize = (int) (getContext().getResources().getDisplayMetrics().density * CLEAR_IMAGE_SIZE_DP);

    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeWidth(3);
    mPaint.setDither(true);
    mPaint.setStrokeJoin(Paint.Join.ROUND);
    mPaint.setStrokeCap(Paint.Cap.ROUND);

    boolean bDark = PreferenceManager.getDefaultSharedPreferences(getContext())
            .getString(SettingsConstantsUI.KEY_PREF_THEME, "light").equals("dark");
    if (bDark)
        mPaint.setColor(Color.WHITE);
    else
        mPaint.setColor(Color.BLACK);

    mPath = new Path();
    mPaths.add(mPath);
}

From source file:com.chrslee.csgopedia.app.ImageAndPriceActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    //same as in MainActivity
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
    boolean isLightTheme = prefs.getString("theme", "light").equals("light");
    if (isLightTheme) {
        setTheme(R.style.AppThemeLight);
    } else {//w w w .j av  a2  s  .  c  o  m
        setTheme(R.style.AppThemeDark);
    }

    //setting the layout
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_image_and_price);

    //Here in this activity we have a ViewPager this is basically
    //tabbed layout, each tab will contain a Fragment, a Fragment is like a
    //sub activity (a portion of an activity) and has its own view, it has also a lifecycle
    //You can read more about it here http://developer.android.com/guide/components/fragments.html
    PagerSlidingTabStrip tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);//the tabs of the viewpager casted to a Library custom tab class
    //The Viepager pulled from the XML to the pager var
    ViewPager pager = (ViewPager) findViewById(R.id.pager);
    //The Viewpager adapter, like the Listviews the viewpagers also need
    //An adapter to know which fragment will be in each tab
    //Here we pass the supporFragmentManager as we are dealing with fragments
    MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager());

    pager.setAdapter(adapter);// setting the adapter to the viewpager

    //adding a little space between the tabs
    final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4,
            getResources().getDisplayMetrics());
    pager.setPageMargin(pageMargin);

    // TODO: Bug - Black tab background completely overlaps indicator on dark theme
    if (!isLightTheme) {//Hack to change the bg of the tab
        tabs.setTabBackground(R.color.tab_background_black);
        tabs.setTextColor(Color.WHITE);
    }

    tabs.setViewPager(pager);//the tab layout must contain an instance of the viewpager to know which View will present with each tab
    tabs.setIndicatorColorResource(R.color.tab_indicator_cyan);//just the press action color

    // Navigation drawer
    //Same as in MainActivity
    final String[] values = getResources().getStringArray(R.array.nav_drawer_items);
    ((ListView) findViewById(R.id.left_drawer3))
            .setAdapter(new ArrayAdapter<String>(this, R.layout.drawer_list_item, values));
    NavigationDrawerSetup nds = new NavigationDrawerSetup((ListView) findViewById(R.id.left_drawer3),
            (DrawerLayout) findViewById(R.id.drawer_layout), values, getSupportActionBar(), this);
    nds.configureDrawer();

    //Changing the title of the actionbar dinamically
    ActionBar bar = getSupportActionBar();
    String title = getIntent().getExtras().getString("searchQuery");
    if (!title.equals("-1")) {
        bar.setTitle(title);
    } else {
        bar.setTitle(getIntent().getExtras().getString("regularName"));
    }
}

From source file:arun.com.chameleonskinforkwlp.MainActivity.java

private void initToolbar(Bundle savedInstanceState) {
    setSupportActionBar(binding.toolbar);
    Glide.with(this).load(R.drawable.backdrop).centerCrop().into(binding.backdrop);
    AccountHeader header = new AccountHeaderBuilder().withActivity(this).withCompactStyle(true)
            .withSelectionFirstLine(getResources().getString(R.string.app_name))
            .withSelectionSecondLine(getResources().getString(R.string.app_tagline))
            .withProfileImagesClickable(false).withSelectionListEnabled(false)
            .withProfiles(new ArrayList<IProfile>() {
                {//from  w ww .j a  v  a 2 s.  c om
                    add(new ProfileDrawerItem().withIcon(
                            new IconicsDrawable(MainActivity.this).icon(GoogleMaterial.Icon.gmd_local_florist)
                                    .color(Color.WHITE).sizeDp(20).paddingDp(5)));
                }
            }).withHeaderBackground(new ColorDrawable(ContextCompat.getColor(this, R.color.primary_dark)))
            .withSelectionListEnabledForSingleProfile(false).withSavedInstance(savedInstanceState).build();
    new DrawerBuilder().withActivity(this).withToolbar(binding.toolbar).withAccountHeader(header)
            .withSelectedItem(-1)
            .addDrawerItems(
                    new PrimaryDrawerItem().withName(R.string.set_as_system_wallpaper).withIdentifier(1)
                            .withSelectable(false).withIcon(GoogleMaterial.Icon.gmd_wallpaper),
                    new PrimaryDrawerItem().withName(R.string.use_with_kustom).withSelectable(false)
                            .withIcon(GoogleMaterial.Icon.gmd_palette).withIdentifier(2),
                    new DividerDrawerItem(),
                    new SecondaryDrawerItem().withName(R.string.rate_this_app).withSelectable(false)
                            .withIdentifier(3).withIcon(GoogleMaterial.Icon.gmd_star),
                    new SecondaryDrawerItem().withName(R.string.privacy_policy)
                            .withIcon(GoogleMaterial.Icon.gmd_insert_drive_file).withSelectable(false)
                            .withIdentifier(4),
                    new SecondaryDrawerItem().withName(R.string.more_apps)
                            .withIcon(GoogleMaterial.Icon.gmd_account_circle).withSelectable(false)
                            .withIdentifier(5))
            .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
                @Override
                public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
                    if (drawerItem != null) {
                        switch ((int) drawerItem.getIdentifier()) {
                        case 1:
                            launchSetWallpaperScreen();
                            break;
                        case 2:
                            if (Util.isPackageInstalled(MainActivity.this, "org.kustom.wallpaper")) {
                                Util.openApp(MainActivity.this, "org.kustom.wallpaper");
                            } else {
                                Snackbar.make(binding.coordinatorLayout, R.string.kustom_not_found,
                                        Snackbar.LENGTH_SHORT).show();
                            }
                            break;
                        case 3:
                            Util.openPlayStore(MainActivity.this, getPackageName());
                            break;
                        case 4:
                            Intent licenses = new Intent(Intent.ACTION_VIEW, Uri.parse(
                                    "http://htmlpreview.github.com/?https://github.com/arunkumar9t2/chameleon-live-wallpaper/blob/master/privacy_policy.html"));
                            startActivity(licenses);
                            break;
                        case 5:
                            try {
                                startActivity(new Intent(Intent.ACTION_VIEW,
                                        Uri.parse("market://search?q=pub:Arunkumar")));
                            } catch (android.content.ActivityNotFoundException anfe) {
                                startActivity(new Intent(Intent.ACTION_VIEW,
                                        Uri.parse("http://play.google.com/store/search?q=pub:Arunkumar")));
                            }
                            break;
                        }
                    }
                    return false;
                }
            }).build();
}