Example usage for android.graphics Color parseColor

List of usage examples for android.graphics Color parseColor

Introduction

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

Prototype

@ColorInt
public static int parseColor(@Size(min = 1) String colorString) 

Source Link

Document

Parse the color string, and return the corresponding color-int.

Usage

From source file:com.amaze.filemanager.utils.Futils.java

public void showSMBHelpDialog(Context m, String acc) {

    MaterialDialog.Builder b = new MaterialDialog.Builder(m);
    b.content(Html.fromHtml("<html>\n" + "<body>\n" + "<center>\n"
            + "<h1>How to access shared windows folder on android (smb)</h1>\n" + "</center>\n" + "<ol>\n"
            + "<li>\n" + "<b>Enable File Sharing</b>\n"
            + "<br>Open the Control Panel, click Choose homegroup and sharing options under Network and Internet, and click Change advanced sharing settings. Enable the file and printer sharing feature.\n"
            + "</li><br><li><b>Additional File Sharing settings</b><br>You may also want to configure the other advanced sharing settings here. \n"
            + "For example, you could enable access to your files without a password if you trust all the devices on your local network.Once file and printer sharing is enabled, you can open File Explorer or Windows Explorer, right-click a folder you want to share, and select Properties. \n"
            + "Click the Share button and make the folder available on the network.\n"
            + "</li><li><br><b>Make sure both devices are on same Wifi</b><br> \n"
            + "This feature makes files available on the local network, so your PC and mobile devices have to be on the same local network. You cant access a shared Windows folder over the Internet or when your smartphone is connected to its mobile data  it has to be connected to Wi-Fi.</li><li>\n"
            + "<br><b>Find IP Address</b>\n"
            + "<br>Open Command Prompt. Type 'ipconfig' and press Enter. Look for Default Gateway under your network adapter for your router's IP address. Look for \\\"IPv4 Address\\\" under the same adapter section to find your computer's IP address.</li><li><br>\n"
            + "<b>Enter details in smb dialog box</b>\n" + "<br>\n" + "</ol>\n" + "</body>\n" + "</html>"));
    b.positiveText(R.string.doit);/*from  w  w w . j a  va 2s .  c om*/
    b.positiveColor(Color.parseColor(acc));
    b.build().show();
}

From source file:com.amaze.filemanager.utils.Futils.java

public void showPackageDialog(final File f, final MainActivity m) {
    MaterialDialog.Builder mat = new MaterialDialog.Builder(m);
    mat.title(R.string.packageinstaller).content(R.string.pitext).positiveText(R.string.install)
            .negativeText(R.string.view).neutralText(R.string.cancel).positiveColor(Color.parseColor(m.fabskin))
            .negativeColor(Color.parseColor(m.fabskin)).neutralColor(Color.parseColor(m.fabskin))
            .callback(new MaterialDialog.ButtonCallback() {
                @Override/*w ww .j  ava 2s .c o m*/
                public void onPositive(MaterialDialog materialDialog) {
                    openunknown(f, m, false);
                }

                @Override
                public void onNegative(MaterialDialog materialDialog) {
                    m.openZip(f.getPath());
                }
            });
    if (m.theme1 == 1)
        mat.theme(Theme.DARK);
    mat.build().show();

}

From source file:it.feio.android.omninotes.DetailFragment.java

/**
 * Colors tag marker in note's title and content elements
 *//*from w w  w . j a v  a  2  s .c o m*/
private void setTagMarkerColor(Category tag) {

    String colorsPref = prefs.getString("settings_colors_app", Constants.PREF_COLORS_APP_DEFAULT);

    // Checking preference
    if (!"disabled".equals(colorsPref)) {

        // Choosing target view depending on another preference
        ArrayList<View> target = new ArrayList<>();
        if ("complete".equals(colorsPref)) {
            target.add(titleWrapperView);
            target.add(scrollView);
        } else {
            target.add(tagMarkerView);
        }

        // Coloring the target
        if (tag != null && tag.getColor() != null) {
            for (View view : target) {
                view.setBackgroundColor(Integer.parseInt(tag.getColor()));
            }
        } else {
            for (View view : target) {
                view.setBackgroundColor(Color.parseColor("#00000000"));
            }
        }
    }
}

From source file:com.amaze.filemanager.utils.Futils.java

public void showArchiveDialog(final File f, final MainActivity m) {
    MaterialDialog.Builder mat = new MaterialDialog.Builder(m);
    mat.title(R.string.archive).content(R.string.archtext).positiveText(R.string.extract)
            .negativeText(R.string.view).neutralText(R.string.cancel).positiveColor(Color.parseColor(m.fabskin))
            .negativeColor(Color.parseColor(m.fabskin)).neutralColor(Color.parseColor(m.fabskin))
            .callback(new MaterialDialog.ButtonCallback() {
                @Override/*from w ww .ja  va  2  s .  c  o  m*/
                public void onPositive(MaterialDialog materialDialog) {
                    m.mainActivityHelper.extractFile(f);
                }

                @Override
                public void onNegative(MaterialDialog materialDialog) {
                    //m.addZipViewTab(f.getPath());
                    if (f.getName().toLowerCase().endsWith(".rar"))
                        m.openRar(Uri.fromFile(f).toString());
                    else
                        m.openZip(Uri.fromFile(f).toString());
                }
            });
    if (m.theme1 == 1)
        mat.theme(Theme.DARK);
    MaterialDialog b = mat.build();

    if (!f.getName().toLowerCase().endsWith(".rar") && !f.getName().toLowerCase().endsWith(".jar")
            && !f.getName().toLowerCase().endsWith(".apk") && !f.getName().toLowerCase().endsWith(".zip"))
        b.getActionButton(DialogAction.NEGATIVE).setEnabled(false);
    b.show();

}

From source file:com.filemanager.free.utils.Futils.java

public void showPackageDialog(final File f, final MainActivity m) {
    MaterialDialog.Builder mat = new MaterialDialog.Builder(m);
    mat.title(R.string.packageinstaller).content(R.string.pitext).positiveText(R.string.install)
            .negativeText(R.string.view).neutralText(R.string.cancel).positiveColor(Color.parseColor(m.fabskin))
            .negativeColor(Color.parseColor(m.fabskin)).neutralColor(Color.parseColor(m.fabskin))
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override/*from  www  .  j  a v a 2 s  . co m*/
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    openunknown(f, m, false);
                }
            }).onNegative(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    m.openZip(f.getPath());
                }
            });
    if (m.theme1 == 1)
        mat.theme(Theme.DARK);
    mat.build().show();

}

From source file:com.dycody.android.idealnote.DetailFragment.java

/**
 * Colors tag marker in note's title and content elements
 *//*from w w w.  ja  va 2  s.  co  m*/
private void setTagMarkerColor(Category tag) {

    String colorsPref = prefs.getString("settings_colors_app", Constants.PREF_COLORS_APP_DEFAULT);

    // Checking preference
    if (!"disabled".equals(colorsPref)) {

        // Choosing target view depending on another preference
        ArrayList<View> target = new ArrayList<>();
        if ("complete".equals(colorsPref)) {
            target.add(titleWrapperView);
            target.add(scrollView);
        } else {
            target.add(tagMarkerView);
        }

        // Coloring the target
        if (tag != null && tag.getColor() != null) {
            for (View view : target) {
                view.setBackgroundColor(parseInt(tag.getColor()));
            }
        } else {
            for (View view : target) {
                view.setBackgroundColor(Color.parseColor("#00000000"));
            }
        }
    }
}

From source file:com.filemanager.free.utils.Futils.java

public void showArchiveDialog(final File f, final MainActivity m) {
    MaterialDialog.Builder mat = new MaterialDialog.Builder(m);
    mat.title(R.string.archive).content(R.string.archtext).positiveText(R.string.extract)
            .negativeText(R.string.view).neutralText(R.string.cancel).positiveColor(Color.parseColor(m.fabskin))
            .negativeColor(Color.parseColor(m.fabskin)).neutralColor(Color.parseColor(m.fabskin))
            .onPositive(new MaterialDialog.SingleButtonCallback() {
                @Override// w ww . j a v a  2s .c om
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    m.mainActivityHelper.extractFile(f);
                }
            }).onNeutral(new MaterialDialog.SingleButtonCallback() {
                @Override
                public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                    if (f.getName().toLowerCase().endsWith(".rar"))
                        m.openRar(Uri.fromFile(f).toString());
                    else
                        m.openZip(Uri.fromFile(f).toString());
                }
            });
    if (m.theme1 == 1)
        mat.theme(Theme.DARK);
    MaterialDialog b = mat.build();

    if (!f.getName().toLowerCase().endsWith(".rar") && !f.getName().toLowerCase().endsWith(".jar")
            && !f.getName().toLowerCase().endsWith(".apk") && !f.getName().toLowerCase().endsWith(".zip"))
        b.getActionButton(DialogAction.NEGATIVE).setEnabled(false);
    b.show();

}

From source file:com.amaze.filemanager.utils.Futils.java

public void showCompressDialog(final MainActivity m, final ArrayList<BaseFile> b, final String current) {
    MaterialDialog.Builder a = new MaterialDialog.Builder(m);
    a.input(getString(m, R.string.enterzipname), ".zip", false, new MaterialDialog.InputCallback() {
        @Override//from   w w  w  .  j av a  2s . co m
        public void onInput(MaterialDialog materialDialog, CharSequence charSequence) {

        }
    });
    a.widgetColor(Color.parseColor(m.fabskin));
    if (m.theme1 == 1)
        a.theme(Theme.DARK);
    a.title(getString(m, R.string.enterzipname));
    a.positiveText(R.string.create);
    a.positiveColor(Color.parseColor(m.fabskin));
    a.onPositive(new MaterialDialog.SingleButtonCallback() {
        @Override
        public void onClick(MaterialDialog materialDialog, DialogAction dialogAction) {
            if (materialDialog.getInputEditText().getText().toString().equals(".zip"))
                Toast.makeText(m, "File should have a name", Toast.LENGTH_SHORT).show();
            else {
                String name = current + "/" + materialDialog.getInputEditText().getText().toString();
                m.mainActivityHelper.compressFiles(new File(name), b);
            }
        }
    });
    a.negativeText(getString(m, R.string.cancel));
    a.negativeColor(Color.parseColor(m.fabskin));
    a.build().show();
}

From source file:com.VVTeam.ManHood.Fragment.HistogramFragment.java

private void refreshDataText() {

    thicknessTopLB.setText("");
    thicknessBottomLB.setText("");
    lengthTopLB.setText("");
    lengthBottomLB.setText("");
    girthTopLB.setText("");
    girthBottomLB.setText("");

    if (histogramSelected && yourButtonSelected) {
        if (thicknessHisto.highlightedBinText != null) {
            thicknessMiddleLB.setText(thicknessHisto.highlightedBinText);
            thicknessMiddleLB.setTextColor(Color.parseColor("#00ff00"));
        }//from   w  w w  . ja va 2  s. co m
        if (girthHisto.highlightedBinText != null) {
            girthMiddleLB.setText(girthHisto.highlightedBinText);
            girthMiddleLB.setTextColor(Color.parseColor("#00ff00"));
        }
        if (lengthHisto.highlightedBinText != null) {
            lengthMiddleLB.setText(lengthHisto.highlightedBinText);
            lengthMiddleLB.setTextColor(Color.parseColor("#00ff00"));
        }

        if (selfUserData != null) {
            // length
            int unit = ETUnitConverter.typeFromString(AppData.getInstance().getUnitsType().toString());

            String lengthStr = String.format("%.1f %s",
                    ETUnitConverter.convertCMValue(selfUserData.getLength(), unit),
                    ETUnitConverter.nameForUnitType(unit));

            if (lengthHisto.value < selfUserData.getLength()) {
                lengthTopLB.setText(lengthStr);
                lengthBottomLB.setText("");
            } else {
                lengthTopLB.setText("");
                lengthBottomLB.setText(lengthStr);
            }

            String girthStr = String.format("%.1f %s",
                    ETUnitConverter.convertCMValue(selfUserData.getGirth(), unit),
                    ETUnitConverter.nameForUnitType(unit));

            if (girthHisto.value < selfUserData.getGirth()) {
                girthTopLB.setText(girthStr);
                girthBottomLB.setText("");
            } else {
                girthTopLB.setText("");
                girthBottomLB.setText(girthStr);
            }

            String thicknessStr = ETUnitConverter.fractionForValue(selfUserData.getThickness());
            if (thicknessHisto.value < selfUserData.getThickness()) {
                thicknessTopLB.setText(thicknessStr);
                thicknessBottomLB.setText("");
            } else {
                thicknessTopLB.setText("");
                thicknessBottomLB.setText(thicknessStr);
            }
        }
    } else if (yourButtonSelected) {
        if (thicknessHisto.secondHighlightedBinText != null) {
            thicknessMiddleLB.setText(thicknessHisto.secondHighlightedBinText);
            thicknessMiddleLB.setTextColor(Color.parseColor("#4eb4e3"));
        }
        if (girthHisto.secondHighlightedBinText != null) {
            girthMiddleLB.setText(girthHisto.secondHighlightedBinText);
            girthMiddleLB.setTextColor(Color.parseColor("#4eb4e3"));
        }
        if (lengthHisto.secondHighlightedBinText != null) {
            lengthMiddleLB.setText(lengthHisto.secondHighlightedBinText);
            lengthMiddleLB.setTextColor(Color.parseColor("#4eb4e3"));
        }
    } else {
        if (thicknessHisto.highlightedBinText != null) {
            thicknessMiddleLB.setText(thicknessHisto.highlightedBinText);
            thicknessMiddleLB.setTextColor(Color.parseColor("#00ff00"));
        }
        if (girthHisto.highlightedBinText != null) {
            girthMiddleLB.setText(girthHisto.highlightedBinText);
            girthMiddleLB.setTextColor(Color.parseColor("#00ff00"));
        }
        if (lengthHisto.highlightedBinText != null) {
            lengthMiddleLB.setText(lengthHisto.highlightedBinText);
            lengthMiddleLB.setTextColor(Color.parseColor("#00ff00"));
        }
    }

}

From source file:com.amaze.filemanager.utils.Futils.java

public void showSortDialog(final Main m) {
    String[] sort = m.getResources().getStringArray(R.array.sortby);
    int current = Integer.parseInt(m.Sp.getString("sortby", "0"));
    MaterialDialog.Builder a = new MaterialDialog.Builder(m.getActivity());
    if (m.theme1 == 1)
        a.theme(Theme.DARK);/*from  w  w w  .  j av a  2 s  .  co m*/
    a.items(sort).itemsCallbackSingleChoice(current > 3 ? current - 4 : current,
            new MaterialDialog.ListCallbackSingleChoice() {
                @Override
                public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {

                    return true;
                }
            });
    a.positiveText(R.string.ascending).positiveColor(Color.parseColor(m.fabSkin));
    a.negativeText(R.string.descending).negativeColor(Color.parseColor(m.fabSkin));
    a.callback(new MaterialDialog.ButtonCallback() {
        @Override
        public void onPositive(MaterialDialog dialog) {
            super.onPositive(dialog);
            int which = dialog.getSelectedIndex();
            m.Sp.edit().putString("sortby", "" + which).commit();
            m.getSortModes();
            m.updateList();
            dialog.dismiss();

        }

        @Override
        public void onNegative(MaterialDialog dialog) {
            super.onNegative(dialog);
            int which = 4 + dialog.getSelectedIndex();
            m.Sp.edit().putString("sortby", "" + which).commit();
            m.getSortModes();
            m.updateList();
            dialog.dismiss();
        }
    });
    a.title(R.string.sortby);
    a.build().show();
}