Example usage for android.widget TextView setTextColor

List of usage examples for android.widget TextView setTextColor

Introduction

In this page you can find the example usage for android.widget TextView setTextColor.

Prototype

@android.view.RemotableViewMethod
public void setTextColor(ColorStateList colors) 

Source Link

Document

Sets the text color.

Usage

From source file:brostore.maquillage.custom.PagerSlidingTabStrip.java

private void addCustomTextTab(final int position, String title) {
    LinearLayout conteneur = new LinearLayout(getContext());
    LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
            LinearLayout.LayoutParams.WRAP_CONTENT);
    conteneur.setOrientation(LinearLayout.HORIZONTAL);
    conteneur.setGravity(Gravity.CENTER);
    TextView tab = new TextView(getContext());
    TextView tabCust = new TextView(getContext());
    //tabCust.setBackgroundResource(R.drawable.live_nombre);
    tabCust.setGravity(Gravity.CENTER);//w  w w . j  a  v  a 2s.  c o m
    tabCust.setTextColor(Color.WHITE);
    tabCust.setTypeface(tabTypeface);
    tabCust.setTextSize(11);
    tabCust.setVisibility(View.GONE);
    int fiveDip = Utils.convertDpToPixel(5, getResources());
    tabCust.setPadding(fiveDip, 0, fiveDip, 0);
    tabCust.setText("0");
    tab.setText(title);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();

    conteneur.addView(tab, param);
    param.leftMargin = Utils.convertDpToPixel(10, getResources());
    conteneur.addView(tabCust, param);
    addTab(position, conteneur);
}

From source file:com.bigfat.lmusicplayer.view.widget.PagerSlidingTabStrip.java

private void updateTabTextStyles(float positionOffset) {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        if (v instanceof TextView) {
            TextView tab = (TextView) v;
            if ((i == currentPosition && positionOffset <= 0.5)
                    || (i == currentPosition + 1 && positionOffset > 0.5)) {
                tab.setTextColor(tabTextSelectColor);
            } else {
                tab.setTextColor(tabTextColor);
            }//from   w  ww .j a v  a2s.  c  om
        }
    }

}

From source file:de.baumann.hhsmoodle.activities.Activity_count.java

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

    PreferenceManager.setDefaultValues(this, R.xml.user_settings, false);
    sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
    toDo_title = sharedPref.getString("count_title", "");
    String count_title = sharedPref.getString("count_content", "");
    toDo_icon = sharedPref.getString("count_icon", "");
    toDo_create = sharedPref.getString("count_create", "");
    String todo_attachment = sharedPref.getString("count_attachment", "");
    if (!sharedPref.getString("count_seqno", "").isEmpty()) {
        toDo_seqno = Integer.parseInt(sharedPref.getString("count_seqno", ""));
    }/*from ww w.  j  a v a  2 s  . c om*/

    setContentView(R.layout.activity_count);
    setTitle(toDo_title);

    final EditText etNewItem = (EditText) findViewById(R.id.etNewItem);
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            String itemText = etNewItem.getText().toString();

            if (itemText.isEmpty()) {
                Snackbar.make(lvItems, R.string.todo_enter, Snackbar.LENGTH_LONG).show();
            } else {
                itemsTitle.add(0, itemText);
                itemsCount.add(0, "0");
                etNewItem.setText("");
                writeItemsTitle();
                writeItemsCount();
                lvItems.post(new Runnable() {
                    public void run() {
                        lvItems.setSelection(lvItems.getCount() - 1);
                    }
                });
                adapter.notifyDataSetChanged();
            }
        }
    });

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    helper_main.onStart(Activity_count.this);

    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    try {
        FileOutputStream fOut = new FileOutputStream(newFileTitle());
        OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
        myOutWriter.append(count_title);
        myOutWriter.close();

        fOut.flush();
        fOut.close();
    } catch (IOException e) {
        Log.e("Exception", "File write failed: " + e.toString());
    }

    try {
        FileOutputStream fOut = new FileOutputStream(newFileCount());
        OutputStreamWriter myOutWriter = new OutputStreamWriter(fOut);
        myOutWriter.append(todo_attachment);
        myOutWriter.close();

        fOut.flush();
        fOut.close();
    } catch (IOException e) {
        Log.e("Exception", "File write failed: " + e.toString());
    }

    lvItems = (ListView) findViewById(R.id.lvItems);
    itemsTitle = new ArrayList<>();
    readItemsTitle();
    readItemsCount();

    adapter = new CustomListAdapter(Activity_count.this, itemsTitle, itemsCount) {
        @NonNull
        @Override
        public View getView(final int position, View convertView, @NonNull ViewGroup parent) {

            View v = super.getView(position, convertView, parent);
            ImageButton ib_plus = (ImageButton) v.findViewById(R.id.but_plus);
            ImageButton ib_minus = (ImageButton) v.findViewById(R.id.but_minus);
            TextView tv = (TextView) v.findViewById(R.id.count_count);

            int count = Integer.parseInt(itemsCount.get(position));

            if (count < 0) {
                tv.setTextColor(ContextCompat.getColor(Activity_count.this, R.color.color_red));
            } else if (count > 0) {
                tv.setTextColor(ContextCompat.getColor(Activity_count.this, R.color.color_green));
            } else if (count == 0) {
                tv.setTextColor(ContextCompat.getColor(Activity_count.this, R.color.color_grey));
            }

            ib_plus.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View arg0) {

                    int a = Integer.parseInt(itemsCount.get(position)) + 1;
                    String plus = String.valueOf(a);

                    itemsCount.remove(position);
                    itemsCount.add(position, plus);
                    // Refresh the adapter
                    adapter.notifyDataSetChanged();
                    // Return true consumes the long click event (marks it handled)
                    writeItemsTitle();
                    writeItemsCount();

                }
            });

            ib_minus.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View arg0) {

                    int a = Integer.parseInt(itemsCount.get(position)) - 1;
                    String minus = String.valueOf(a);

                    itemsCount.remove(position);
                    itemsCount.add(position, minus);
                    // Refresh the adapter
                    adapter.notifyDataSetChanged();
                    // Return true consumes the long click event (marks it handled)
                    writeItemsTitle();
                    writeItemsCount();
                }
            });

            return v;
        }
    };

    lvItems.setAdapter(adapter);

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

            final String title = itemsTitle.get(position);
            final String count = itemsCount.get(position);

            AlertDialog.Builder builder = new AlertDialog.Builder(Activity_count.this);
            View dialogView = View.inflate(Activity_count.this, R.layout.dialog_edit_text_singleline_count,
                    null);

            final EditText edit_title = (EditText) dialogView.findViewById(R.id.pass_title);
            edit_title.setText(title);

            builder.setView(dialogView);
            builder.setTitle(R.string.number_edit_entry);
            builder.setPositiveButton(R.string.toast_yes, new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int whichButton) {

                    String inputTag = edit_title.getText().toString().trim();
                    // Remove the item within array at position
                    itemsTitle.remove(position);
                    itemsCount.remove(position);

                    itemsTitle.add(position, inputTag);
                    itemsCount.add(position, count);

                    // Refresh the adapter
                    adapter.notifyDataSetChanged();
                    // Return true consumes the long click event (marks it handled)
                    writeItemsTitle();
                    writeItemsCount();
                }
            });
            builder.setNegativeButton(R.string.toast_cancel, new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int whichButton) {
                    dialog.cancel();
                }
            });

            final AlertDialog dialog2 = builder.create();
            // Display the custom alert dialog on interface
            dialog2.show();
            helper_main.showKeyboard(Activity_count.this, edit_title);
        }
    });

    lvItems.setOnItemLongClickListener(new android.widget.AdapterView.OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(android.widget.AdapterView<?> parent, View view, final int position,
                long id) {

            final String title = itemsTitle.get(position);
            final String count = itemsCount.get(position);

            // Remove the item within array at position
            itemsTitle.remove(position);
            itemsCount.remove(position);
            // Refresh the adapter
            adapter.notifyDataSetChanged();
            // Return true consumes the long click event (marks it handled)
            writeItemsTitle();
            writeItemsCount();

            Snackbar snackbar = Snackbar.make(lvItems, R.string.todo_removed, Snackbar.LENGTH_LONG)
                    .setAction(R.string.todo_removed_back, new View.OnClickListener() {
                        @Override
                        public void onClick(View view) {
                            itemsTitle.add(position, title);
                            itemsCount.add(position, count);
                            // Refresh the adapter
                            adapter.notifyDataSetChanged();
                            // Return true consumes the long click event (marks it handled)
                            writeItemsTitle();
                            writeItemsCount();
                        }
                    });
            snackbar.show();

            return true;
        }
    });
}

From source file:cn.ieclipse.af.view.PagerSlidingTabStrip.java

private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {
        View v = tabsContainer.getChildAt(i);
        // set tabs background
        if (tabBackgroundResId > 0) {
            v.setBackgroundResource(tabBackgroundResId);
        }//w  w  w .  j av a 2 s  .co m
        if (v instanceof TextView) {
            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }
            }
        }
    }
    setCurrentTabTextColor(selectedPosition);
}

From source file:com.anniu.shandiandaojia.view.PagerSlidingTabStrip.java

private void updateTabStyles() {
    for (int i = 0; i < tabCount; i++) {
        View v = tabsContainer.getChildAt(i);
        v.setBackgroundResource(tabBackgroundResId);
        if (v instanceof TextView) {
            TextView tab = (TextView) v;
            //TODO tab?   ????
            tab.setTextSize(TypedValue.COMPLEX_UNIT_SP, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            if (i == currentPosition) {
                tab.setTextColor(tabTextColorSelected);
            } else {
                tab.setTextColor(tabTextColor);
            }/*from  w  ww  .j  a  va  2  s. c o m*/

            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }
            }
        }
    }
}

From source file:com.cmax.bodysheild.widget.PagerSlidingTabStripExtends.java

/**
 * ?/* w w w  .  ja v a 2s  .  c om*/
 */
private void updateTabStyles() {

    for (int i = 0; i < tabCount; i++) {

        View v = tabsContainer.getChildAt(i);

        v.setBackgroundResource(tabBackgroundResId);

        if (v instanceof TextView) {

            TextView tab = (TextView) v;
            tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
            tab.setTypeface(tabTypeface, tabTypefaceStyle);
            tab.setTextColor(tabTextColor);

            // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
            // pre-ICS-build
            if (textAllCaps) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                    tab.setAllCaps(true);
                } else {
                    tab.setText(tab.getText().toString().toUpperCase(locale));
                }
            }
            // 
            if (mSelectedPostion == i) {
                tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, selectedTabTextSize);
                tab.setTextColor(selectedTabTextColor);
            }
        }
    }

}

From source file:com.frostwire.android.gui.adapters.menu.FileListAdapter.java

private void setNormalTextColors(View v) {
    TextView title = findView(v, R.id.view_browse_peer_list_item_file_title);
    TextView text = findView(v, R.id.view_browse_peer_list_item_extra_text);
    TextView size = findView(v, R.id.view_browse_peer_list_item_file_size);

    Resources res = getContext().getResources();

    title.setTextColor(res.getColor(R.color.app_text_primary));
    text.setTextColor(res.getColor(R.color.app_text_primary));
    size.setTextColor(res.getColor(R.color.basic_blue_darker_highlight));
}

From source file:com.frostwire.android.gui.adapters.menu.FileListAdapter.java

private void setInactiveTextColors(View v) {
    TextView title = findView(v, R.id.view_browse_peer_list_item_file_title);
    TextView text = findView(v, R.id.view_browse_peer_list_item_extra_text);
    TextView size = findView(v, R.id.view_browse_peer_list_item_file_size);

    Resources res = getContext().getResources();

    title.setTextColor(res.getColor(R.color.browse_peer_listview_item_inactive_foreground));
    text.setTextColor(res.getColor(R.color.browse_peer_listview_item_inactive_foreground));
    size.setTextColor(res.getColor(R.color.browse_peer_listview_item_inactive_foreground));
}

From source file:com.example.android.wearable.quiz.MainActivity.java

/**
 * Marks a question as "left blank" when its corresponding question notification is deleted.
 *//*www .ja va 2  s  .  co m*/
private void markQuestionLeftBlank(int index) {
    LinearLayout questionStatusElement = (LinearLayout) questionsContainer.getChildAt(index);
    if (questionStatusElement != null) {
        TextView questionText = (TextView) questionStatusElement.findViewById(R.id.question);
        TextView questionStatus = (TextView) questionStatusElement.findViewById(R.id.status);
        if (questionStatus.getText().equals(getString(R.string.question_unanswered))) {
            questionText.setTextColor(Color.YELLOW);
            questionStatus.setText(R.string.question_left_blank);
            mNumSkipped++;
        }
    }
}

From source file:com.amaze.filemanager.fragments.preference_fragments.Preffrag.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PreferenceUtils.reset();/*from w  w  w.  j  av a 2  s .c o m*/
    // Load the preferences from an XML resource
    addPreferencesFromResource(R.xml.preferences);

    sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity());

    final int th1 = Integer.parseInt(sharedPref.getString("theme", "0"));
    theme = th1 == 2 ? PreferenceUtils.hourOfDay() : th1;
    findPreference("donate").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            ((com.amaze.filemanager.activities.Preferences) getActivity()).donate();
            return false;
        }
    });
    findPreference("columns").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            final String[] sort = getResources().getStringArray(R.array.columns);
            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            if (theme == 1)
                a.theme(Theme.DARK);
            a.title(R.string.gridcolumnno);
            int current = Integer.parseInt(sharedPref.getString("columns", "-1"));
            current = current == -1 ? 0 : current;
            if (current != 0)
                current = current - 1;
            a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() {
                @Override
                public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
                    sharedPref.edit().putString("columns", "" + (which != 0 ? sort[which] : "" + -1)).commit();
                    dialog.dismiss();
                    return true;
                }
            });
            a.build().show();
            return true;
        }
    });

    findPreference("theme").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            String[] sort = getResources().getStringArray(R.array.theme);
            int current = Integer.parseInt(sharedPref.getString("theme", "0"));
            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            if (theme == 1)
                a.theme(Theme.DARK);
            a.items(sort).itemsCallbackSingleChoice(current, new MaterialDialog.ListCallbackSingleChoice() {
                @Override
                public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
                    sharedPref.edit().putString("theme", "" + which).commit();
                    dialog.dismiss();
                    restartPC(getActivity());
                    return true;
                }
            });
            a.title(R.string.theme);
            a.build().show();
            return true;
        }
    });
    findPreference("colors").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            ((com.amaze.filemanager.activities.Preferences) getActivity()).selectItem(1);
            return true;
        }
    });

    final CheckBx rootmode = (CheckBx) findPreference("rootmode");
    rootmode.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            boolean b = sharedPref.getBoolean("rootmode", false);
            if (b) {
                if (RootTools.isAccessGiven()) {
                    rootmode.setChecked(true);

                } else {
                    rootmode.setChecked(false);

                    Toast.makeText(getActivity(), getResources().getString(R.string.rootfailure),
                            Toast.LENGTH_LONG).show();
                }
            } else {
                rootmode.setChecked(false);

            }

            return false;
        }
    });

    // Authors
    Preference preference4 = (Preference) findPreference("authors");
    preference4.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {

            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            skin = PreferenceUtils.getPrimaryColorString(sharedPref);
            int fab_skin = Color.parseColor(PreferenceUtils.getAccentString(sharedPref));
            if (theme == 1)
                a.theme(Theme.DARK);

            a.positiveText(R.string.close);
            a.positiveColor(fab_skin);
            LayoutInflater layoutInflater = (LayoutInflater) getActivity()
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View view = layoutInflater.inflate(R.layout.authors, null);
            a.customView(view, true);
            a.title(R.string.authors);
            a.callback(new MaterialDialog.ButtonCallback() {
                @Override
                public void onPositive(MaterialDialog materialDialog) {

                    materialDialog.cancel();
                }

                @Override
                public void onNegative(MaterialDialog materialDialog) {

                }
            });
            /*a.setNegativeButton(R.string.close, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                dialogInterface.cancel();
            }
            });*/
            a.build().show();

            final Intent intent = new Intent(Intent.ACTION_VIEW);

            TextView googlePlus1 = (TextView) view.findViewById(R.id.googlePlus1);
            googlePlus1.setTextColor(Color.parseColor(skin));
            TextView googlePlus2 = (TextView) view.findViewById(R.id.googlePlus2);
            googlePlus2.setTextColor(Color.parseColor(skin));
            TextView git1 = (TextView) view.findViewById(R.id.git1);
            git1.setTextColor(Color.parseColor(skin));
            TextView git2 = (TextView) view.findViewById(R.id.git2);
            git2.setTextColor(Color.parseColor(skin));

            googlePlus1.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    intent.setData(Uri.parse("https://plus.google.com/u/0/110424067388738907251/"));
                    startActivity(intent);
                }
            });
            googlePlus2.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    intent.setData(Uri.parse("https://plus.google.com/+VishalNehra/"));
                    startActivity(intent);
                }
            });
            git1.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    intent.setData(Uri.parse("https://github.com/arpitkh96"));
                    startActivity(intent);
                }
            });
            git2.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    intent.setData(Uri.parse("https://github.com/vishal0071"));
                    startActivity(intent);
                }
            });

            // icon credits
            TextView textView = (TextView) view.findViewById(R.id.icon_credits);
            textView.setMovementMethod(LinkMovementMethod.getInstance());
            textView.setLinksClickable(true);
            textView.setText(Html.fromHtml(getActivity().getString(R.string.icon_credits)));

            return false;
        }
    });

    // Changelog
    Preference preference1 = (Preference) findPreference("changelog");
    preference1.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {

            MaterialDialog.Builder a = new MaterialDialog.Builder(getActivity());
            if (theme == 1)
                a.theme(Theme.DARK);
            a.title(R.string.changelog);
            a.content(Html.fromHtml(getActivity().getString(R.string.changelog_version_9)
                    + getActivity().getString(R.string.changelog_change_9)
                    + getActivity().getString(R.string.changelog_version_8)
                    + getActivity().getString(R.string.changelog_change_8)
                    + getActivity().getString(R.string.changelog_version_7)
                    + getActivity().getString(R.string.changelog_change_7)
                    + getActivity().getString(R.string.changelog_version_6)
                    + getActivity().getString(R.string.changelog_change_6)
                    + getActivity().getString(R.string.changelog_version_5)
                    + getActivity().getString(R.string.changelog_change_5)
                    + getActivity().getString(R.string.changelog_version_4)
                    + getActivity().getString(R.string.changelog_change_4)
                    + getActivity().getString(R.string.changelog_version_3)
                    + getActivity().getString(R.string.changelog_change_3)
                    + getActivity().getString(R.string.changelog_version_2)
                    + getActivity().getString(R.string.changelog_change_2)
                    + getActivity().getString(R.string.changelog_version_1)
                    + getActivity().getString(R.string.changelog_change_1)));
            a.negativeText(R.string.close);
            a.positiveText(R.string.fullChangelog);
            int fab_skin = Color.parseColor(PreferenceUtils.getAccentString(sharedPref));
            a.positiveColor(fab_skin);
            a.negativeColor(fab_skin);
            a.callback(new MaterialDialog.ButtonCallback() {
                @Override
                public void onPositive(MaterialDialog materialDialog) {

                    Intent intent = new Intent(Intent.ACTION_VIEW,
                            Uri.parse("https://github.com/arpitkh96/AmazeFileManager/commits/master"));
                    startActivity(intent);
                }

                @Override
                public void onNegative(MaterialDialog materialDialog) {

                    materialDialog.cancel();
                }
            }).build().show();
            return false;
        }
    });

    // Open Source Licenses
    Preference preference2 = (Preference) findPreference("os");
    //Defining dialog layout
    final Dialog dialog = new Dialog(getActivity(),
            android.R.style.Theme_Holo_Light_DialogWhenLarge_NoActionBar);
    //dialog.setTitle("Open-Source Licenses");
    LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
    final View dialog_view = inflater.inflate(R.layout.open_source_licenses, null);
    dialog.setContentView(dialog_view);

    preference2.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference arg0) {

            WebView wv = (WebView) dialog_view.findViewById(R.id.webView1);
            PreferenceUtils preferenceUtils = new PreferenceUtils();
            wv.loadData(PreferenceUtils.LICENCE_TERMS, "text/html", null);
            dialog.show();
            return false;
        }
    });

    // Feedback
    Preference preference3 = (Preference) findPreference("feedback");
    preference3.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Intent emailIntent = new Intent(Intent.ACTION_SENDTO,
                    Uri.fromParts("mailto", "arpitkh96@gmail.com", null));
            emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Feedback : Amaze File Manager");
            Toast.makeText(getActivity(), getActivity().getFilesDir().getPath(), Toast.LENGTH_SHORT).show();
            File f = new File(getActivity().getExternalFilesDir("internal"), "log.txt");
            if (f.exists()) {
                emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(f));
            }
            startActivity(Intent.createChooser(emailIntent, getResources().getString(R.string.feedback)));
            return false;
        }
    });

    // rate
    Preference preference5 = (Preference) findPreference("rate");
    preference5.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            Intent intent1 = new Intent(Intent.ACTION_VIEW);
            intent1.setData(Uri.parse("market://details?id=com.amaze.filemanager"));
            startActivity(intent1);
            return false;
        }
    });

    // studio
    Preference studio = findPreference("studio");
    studio.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            COUNT++;
            if (COUNT >= 5) {
                if (toast != null)
                    toast.cancel();
                toast = Toast.makeText(getActivity(), "Studio Mode : " + COUNT, Toast.LENGTH_SHORT);
                toast.show();

                sharedPref.edit().putInt("studio", Integer.parseInt(Integer.toString(COUNT) + "000")).apply();
            } else {
                sharedPref.edit().putInt("studio", 0).apply();
            }
            return false;
        }
    });

    // G+
    gplus = (CheckBx) findPreference("plus_pic");
    gplus.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            if (gplus.isChecked()) {
                boolean b = checkGplusPermission();
                if (!b)
                    requestGplusPermission();
            }
            return false;
        }
    });
    if (BuildConfig.IS_VERSION_FDROID)
        gplus.setEnabled(false);

    // Colored navigation bar
}