Search in sources :

Example 1 with QKTextView

use of com.moez.QKSMS.ui.view.QKTextView in project qksms by moezbhatti.

the class QKDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = new Dialog(mContext);
    Window window = dialog.getWindow();
    window.requestFeature(Window.FEATURE_NO_TITLE);
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View view = inflater.inflate(R.layout.dialog_material, null);
    if (mTitleEnabled || mMessageEnabled) {
        mContentPanel = (LinearLayout) view.findViewById(R.id.contentPanel);
        mContentPanel.setVisibility(View.VISIBLE);
    }
    if (mTitleEnabled) {
        mTitleView = (QKTextView) view.findViewById(R.id.alertTitle);
        mTitleView.setVisibility(View.VISIBLE);
        mTitleView.setText(mTitleText);
        Log.d(TAG, "title enabled");
    }
    if (mMessageEnabled) {
        mMessageView = (QKTextView) view.findViewById(R.id.message);
        mMessageView.setVisibility(View.VISIBLE);
        mMessageView.setText(mMessageText);
    }
    if (mCustomViewEnabled) {
        mCustomPanel = (LinearLayout) view.findViewById(R.id.customPanel);
        mCustomPanel.setVisibility(View.VISIBLE);
        if (mCustomView instanceof ListView || mCustomView instanceof RecyclerView) {
            mCustomPanel.addView(mCustomView);
        } else {
            ScrollView scrollView = new ScrollView(mContext);
            scrollView.addView(mCustomView);
            mCustomPanel.addView(scrollView);
        }
    }
    if (mPositiveButtonEnabled || mNegativeButtonEnabled) {
        mButtonBar = (LinearLayout) view.findViewById(R.id.buttonPanel);
        mButtonBar.setVisibility(View.VISIBLE);
        mButtonBar.setOrientation(mButtonBarOrientation);
    }
    if (mPositiveButtonEnabled) {
        mPositiveButtonView = (QKTextView) view.findViewById(R.id.buttonPositive);
        mPositiveButtonView.setVisibility(View.VISIBLE);
        mPositiveButtonView.setText(mPositiveButtonText);
        mPositiveButtonView.setOnClickListener(mPositiveButtonClickListener);
        LiveViewManager.registerView(QKPreference.THEME, mPositiveButtonView, key -> {
            mPositiveButtonView.setTextColor(ThemeManager.getColor());
        });
    }
    if (mNeutralButtonEnabled) {
        mNeutralButtonView = (QKTextView) view.findViewById(R.id.buttonNeutral);
        mNeutralButtonView.setVisibility(View.VISIBLE);
        mNeutralButtonView.setText(mNeutralButtonText);
        mNeutralButtonView.setOnClickListener(mNeutralButtonClickListener);
    }
    if (mNegativeButtonEnabled) {
        mNegativeButtonView = (QKTextView) view.findViewById(R.id.buttonNegative);
        mNegativeButtonView.setVisibility(View.VISIBLE);
        mNegativeButtonView.setText(mNegativeButtonText);
        mNegativeButtonView.setOnClickListener(mNegativeButtonClickListener);
    }
    dialog.setContentView(view);
    return dialog;
}
Also used : Window(android.view.Window) ListView(android.widget.ListView) ColorDrawable(android.graphics.drawable.ColorDrawable) ScrollView(android.widget.ScrollView) Dialog(android.app.Dialog) LayoutInflater(android.view.LayoutInflater) RecyclerView(android.support.v7.widget.RecyclerView) QKTextView(com.moez.QKSMS.ui.view.QKTextView) View(android.view.View) AdapterView(android.widget.AdapterView) RecyclerView(android.support.v7.widget.RecyclerView) ScrollView(android.widget.ScrollView) ListView(android.widget.ListView)

Example 2 with QKTextView

use of com.moez.QKSMS.ui.view.QKTextView in project qksms by moezbhatti.

the class MMSDialogFragment method onCreateDialog.

/**
     * Builds the dialog using all the View parameters.
     */
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = new Dialog(mContext);
    Window window = dialog.getWindow();
    window.requestFeature(Window.FEATURE_NO_TITLE);
    window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View view = inflater.inflate(R.layout.dialog_material, null);
    if (mTitleEnabled || mMessageEnabled) {
        mContentPanel = (LinearLayout) view.findViewById(R.id.contentPanel);
        mContentPanel.setVisibility(View.VISIBLE);
    }
    if (mTitleEnabled) {
        mTitleView = (QKTextView) view.findViewById(R.id.alertTitle);
        mTitleView.setVisibility(View.VISIBLE);
        mTitleView.setText(mTitleText);
    }
    if (mMessageEnabled) {
        mMessageView = (QKTextView) view.findViewById(R.id.message);
        mMessageView.setVisibility(View.VISIBLE);
        mMessageView.setText(mMessageText);
    }
    if (mCustomViewEnabled) {
        mCustomPanel = (LinearLayout) view.findViewById(R.id.customPanel);
        mCustomPanel.setVisibility(View.VISIBLE);
        if (mCustomView instanceof ListView) {
            mCustomPanel.addView(mCustomView);
        } else {
            ScrollView scrollView = new ScrollView(mContext);
            scrollView.addView(mCustomView);
            mCustomPanel.addView(scrollView);
        }
    }
    if (mPositiveButtonEnabled || mNeutralButtonEnabled || mNegativeButtonEnabled) {
        mButtonBar = (LinearLayout) view.findViewById(R.id.buttonPanel);
        mButtonBar.setVisibility(View.VISIBLE);
        mButtonBar.setOrientation(mButtonBarOrientation);
    }
    if (mPositiveButtonEnabled) {
        mPositiveButtonView = (QKTextView) view.findViewById(R.id.buttonPositive);
        mPositiveButtonView.setVisibility(View.VISIBLE);
        mPositiveButtonView.setText(mPositiveButtonText);
        mPositiveButtonView.setTextColor(ThemeManager.getColor());
        mPositiveButtonView.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                onResult(POSITIVE_BUTTON_RESULT);
            }
        });
    }
    if (mNeutralButtonEnabled) {
        mNeutralButtonView = (QKTextView) view.findViewById(R.id.buttonNeutral);
        mNeutralButtonView.setVisibility(View.VISIBLE);
        mNeutralButtonView.setText(mNeutralButtonText);
        mNeutralButtonView.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                onResult(NEUTRAL_BUTTON_RESULT);
            }
        });
    }
    if (mNegativeButtonEnabled) {
        mNegativeButtonView = (QKTextView) view.findViewById(R.id.buttonNegative);
        mNegativeButtonView.setVisibility(View.VISIBLE);
        mNegativeButtonView.setText(mNegativeButtonText);
        mNegativeButtonView.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                onResult(NEGATIVE_BUTTON_RESULT);
            }
        });
    }
    dialog.setContentView(view);
    return dialog;
}
Also used : Window(android.view.Window) ListView(android.widget.ListView) ColorDrawable(android.graphics.drawable.ColorDrawable) ScrollView(android.widget.ScrollView) Dialog(android.app.Dialog) LayoutInflater(android.view.LayoutInflater) QKTextView(com.moez.QKSMS.ui.view.QKTextView) ScrollView(android.widget.ScrollView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView)

Example 3 with QKTextView

use of com.moez.QKSMS.ui.view.QKTextView in project qksms by moezbhatti.

the class SettingsFragment method onPreferenceClick.

@Override
public boolean onPreferenceClick(Preference preference) {
    String key = preference.getKey() != null ? preference.getKey() : "";
    AnalyticsManager.getInstance().sendEvent(AnalyticsManager.CATEGORY_PREFERENCE_CLICK, key, null);
    // Categories
    int resId = 0;
    switch(key) {
        case CATEGORY_APPEARANCE:
            resId = R.xml.settings_appearance;
            break;
        case CATEGORY_GENERAL:
            resId = R.xml.settings_general;
            break;
        case CATEGORY_NOTIFICATIONS:
            resId = R.xml.settings_notifications;
            break;
        case CATEGORY_MMS:
            resId = R.xml.settings_mms;
            break;
        case CATEGORY_QUICKREPLY:
            resId = R.xml.settings_quickreply;
            break;
        case CATEGORY_QUICKCOMPOSE:
            resId = R.xml.settings_quickcompose;
            break;
        case CATEGORY_ABOUT:
            resId = R.xml.settings_about;
            break;
    }
    if (resId != 0) {
        Fragment fragment = SettingsFragment.newInstance(resId);
        getFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.content_frame, fragment, CATEGORY_TAG).commit();
    }
    switch(key) {
        case THEME:
            ThemeManager.showColorPickerDialog(mContext);
            break;
        case ICON:
            ThemeManager.setIcon(mContext);
            break;
        case BUBBLES:
            new BubblePreferenceDialog().setContext(mContext).show();
            break;
        case BLOCKED_FUTURE:
            BlockedNumberDialog.showDialog(mContext);
            break;
        case SHOULD_I_ANSWER:
            final String packageName = "org.mistergroup.muzutozvednout";
            if (!PackageUtils.isAppInstalled(mContext, packageName)) {
                String referrer = "referrer=utm_source%3Dqksms%26utm_medium%3Dapp%26utm_campaign%3Dqksmssettings";
                new QKDialog().setContext(mContext).setTitle(R.string.dialog_should_i_answer_title).setMessage(R.string.dialog_should_i_answer_message).setNegativeButton(R.string.cancel, null).setPositiveButton(R.string.okay, v -> {
                    try {
                        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName + "&" + referrer)));
                    } catch (android.content.ActivityNotFoundException anfe) {
                        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + packageName + "&" + referrer)));
                    }
                }).show();
                new Handler().postDelayed(() -> {
                    mPrefs.edit().putBoolean(SHOULD_I_ANSWER, false).commit();
                    ((CheckBoxPreference) preference).setChecked(false);
                }, 500);
            }
            break;
        case NOTIFICATION_LED_COLOR:
            mLedColorPickerDialog.show(getActivity().getFragmentManager(), "colorpicker");
            break;
        case DAY_START:
        case NIGHT_START:
            TimePickerFragment fragment = new TimePickerFragment();
            fragment.setPreference(preference);
            fragment.setOnPreferenceChangeListener(this);
            fragment.show(getFragmentManager(), "timepicker");
            break;
        case QK_RESPONSES:
            showQkResponseEditor();
            break;
        case AUTOMATICALLY_CONFIGURE_MMS:
            // Show the MMS setup dialogs. See the MMSSetupDialog class for info about what the
            // arguments mean.
            MMSSetupFragment f = new MMSSetupFragment();
            Bundle args = new Bundle();
            args.putBoolean(MMSSetupFragment.ARG_ASK_FIRST, false);
            args.putString(MMSSetupFragment.ARG_DONT_ASK_AGAIN_PREF, null);
            f.setArguments(args);
            getFragmentManager().beginTransaction().add(f, MMSSetupFragment.TAG).commit();
            break;
        case MMS_CONTACT_SUPPORT:
            // Opens an email compose intent with MMS debugging information
            MMSSetupFragment.contactSupport(getActivity());
            break;
        case CHANGELOG:
            DialogHelper.showChangelog(mContext);
            break;
        case THANKS:
            new QKDialog().setContext(mContext).setTitle(R.string.pref_about_thanks_title).setTripleLineItems(R.array.contributor_names, R.array.contributor_githubs, R.array.contributor_projects, new AdapterView.OnItemClickListener() {

                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    String baseUrl = ((QKTextView) view.findViewById(R.id.list_item_subtitle)).getText().toString();
                    startBrowserIntent("https://" + baseUrl);
                }
            }).show();
            break;
        case DONATE:
            DonationManager.getInstance(mContext).showDonateDialog();
            break;
        case GOOGLE_PLUS:
            startBrowserIntent(GOOGLE_PLUS_URL);
            break;
        case GITHUB:
            startBrowserIntent(GITHUB_URL);
            break;
        case CROWDIN:
            startBrowserIntent(CROWDIN_URL);
            break;
    }
    return false;
}
Also used : DateFormatter(com.moez.QKSMS.common.utils.DateFormatter) Arrays(java.util.Arrays) Bundle(android.os.Bundle) PackageManager(android.content.pm.PackageManager) MMSSetupFragment(com.moez.QKSMS.ui.dialog.mms.MMSSetupFragment) QKTextView(com.moez.QKSMS.ui.view.QKTextView) Uri(android.net.Uri) PendingIntent(android.app.PendingIntent) PreferenceScreen(android.preference.PreferenceScreen) EditTextPreference(android.preference.EditTextPreference) ListviewHelper(com.moez.QKSMS.common.ListviewHelper) Handler(android.os.Handler) LiveViewManager(com.moez.QKSMS.common.LiveViewManager) ColorPickerSwatch(com.moez.QKSMS.ui.view.colorpicker.ColorPickerSwatch) View(android.view.View) AdapterView(android.widget.AdapterView) PreferenceManager(android.preference.PreferenceManager) DonationManager(com.moez.QKSMS.common.DonationManager) ParseException(java.text.ParseException) PackageUtils(com.moez.QKSMS.common.utils.PackageUtils) Log(android.util.Log) BlockedNumberDialog(com.moez.QKSMS.ui.dialog.BlockedNumberDialog) Set(java.util.Set) AnalyticsManager(com.moez.QKSMS.common.AnalyticsManager) ListPreference(android.preference.ListPreference) PreferenceFragment(android.preference.PreferenceFragment) EndlessJabber(com.moez.QKSMS.transaction.EndlessJabber) ListView(android.widget.ListView) DeleteOldMessagesService(com.moez.QKSMS.service.DeleteOldMessagesService) QKPreferences(com.moez.QKSMS.common.QKPreferences) BubblePreferenceDialog(com.moez.QKSMS.ui.dialog.BubblePreferenceDialog) Context(android.content.Context) QKPreference(com.moez.QKSMS.enums.QKPreference) PreferenceCategory(android.preference.PreferenceCategory) SimpleDateFormat(java.text.SimpleDateFormat) Intent(android.content.Intent) CheckBoxPreference(android.preference.CheckBoxPreference) PackageInfo(android.content.pm.PackageInfo) QKActivity(com.moez.QKSMS.ui.base.QKActivity) Stack(java.util.Stack) KeyboardUtils(com.moez.QKSMS.common.utils.KeyboardUtils) ArrayList(java.util.ArrayList) R(com.moez.QKSMS.R) HashSet(java.util.HashSet) Calendar(java.util.Calendar) ColorPickerDialog(com.moez.QKSMS.ui.view.colorpicker.ColorPickerDialog) MenuInflater(android.view.MenuInflater) Toast(android.widget.Toast) Menu(android.view.Menu) QKDialog(com.moez.QKSMS.ui.dialog.QKDialog) DialogHelper(com.moez.QKSMS.common.DialogHelper) Build(android.os.Build) Fragment(android.app.Fragment) ThemeManager(com.moez.QKSMS.ui.ThemeManager) AlarmManager(android.app.AlarmManager) EndlessJabberInterface(com.mariussoft.endlessjabber.sdk.EndlessJabberInterface) NotificationManager(com.moez.QKSMS.transaction.NotificationManager) SharedPreferences(android.content.SharedPreferences) Preference(android.preference.Preference) SmsHelper(com.moez.QKSMS.transaction.SmsHelper) Collections(java.util.Collections) Resources(android.content.res.Resources) NightModeAutoReceiver(com.moez.QKSMS.receiver.NightModeAutoReceiver) CheckBoxPreference(android.preference.CheckBoxPreference) Bundle(android.os.Bundle) Handler(android.os.Handler) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) MMSSetupFragment(com.moez.QKSMS.ui.dialog.mms.MMSSetupFragment) PreferenceFragment(android.preference.PreferenceFragment) Fragment(android.app.Fragment) MMSSetupFragment(com.moez.QKSMS.ui.dialog.mms.MMSSetupFragment) QKTextView(com.moez.QKSMS.ui.view.QKTextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) QKDialog(com.moez.QKSMS.ui.dialog.QKDialog) BubblePreferenceDialog(com.moez.QKSMS.ui.dialog.BubblePreferenceDialog) AdapterView(android.widget.AdapterView)

Example 4 with QKTextView

use of com.moez.QKSMS.ui.view.QKTextView in project qksms by moezbhatti.

the class ThemeManager method setColor.

public static void setColor(QKActivity activity, int color) {
    AnalyticsManager.getInstance().sendEvent(AnalyticsManager.CATEGORY_PREFERENCE_CHANGE, SettingsFragment.CATEGORY_THEME, getColorString(color));
    int colorFrom = mActiveColor;
    mColor = color;
    mActiveColor = color;
    mPrefs.edit().putString(SettingsFragment.THEME, "" + color).apply();
    setSentBubbleColored(mPrefs.getBoolean(SettingsFragment.COLOR_SENT, true));
    setReceivedBubbleColored(mPrefs.getBoolean(SettingsFragment.COLOR_RECEIVED, false));
    mTextOnColorPrimary = mResources.getColor(isColorDarkEnough(mColor) ? R.color.theme_dark_text_primary : R.color.theme_light_text_primary);
    mTextOnColorSecondary = mResources.getColor(isColorDarkEnough(mColor) ? R.color.theme_dark_text_secondary : R.color.theme_light_text_secondary);
    ValueAnimator colorAnimation = ValueAnimator.ofObject(new CIELChEvaluator(colorFrom, color), 0);
    colorAnimation.setDuration(TRANSITION_LENGTH);
    colorAnimation.setInterpolator(new DecelerateInterpolator());
    colorAnimation.addUpdateListener(animation -> {
        setActiveColor((Integer) animation.getAnimatedValue());
    });
    colorAnimation.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            WidgetProvider.notifyThemeChanged(mContext);
        }
    });
    colorAnimation.start();
    if (activity.findViewById(R.id.toolbar_title) != null) {
        //final Toolbar toolbar = (Toolbar) mActivity.findViewById(R.id.title);
        final QKTextView title = (QKTextView) activity.findViewById(R.id.toolbar_title);
        if (title.getCurrentTextColor() != mTextOnColorPrimary) {
            ValueAnimator titleColorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), title.getCurrentTextColor(), mTextOnColorPrimary);
            titleColorAnimation.setDuration(TRANSITION_LENGTH);
            titleColorAnimation.setInterpolator(new DecelerateInterpolator());
            titleColorAnimation.addUpdateListener(animation -> {
                int color1 = (Integer) animation.getAnimatedValue();
                title.setTextColor(color1);
                activity.colorMenuIcons(activity.getMenu(), color1);
            });
            titleColorAnimation.start();
        }
    }
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) CIELChEvaluator(com.moez.QKSMS.common.CIELChEvaluator) Animator(android.animation.Animator) ValueAnimator(android.animation.ValueAnimator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) ArgbEvaluator(android.animation.ArgbEvaluator) ValueAnimator(android.animation.ValueAnimator) QKTextView(com.moez.QKSMS.ui.view.QKTextView)

Example 5 with QKTextView

use of com.moez.QKSMS.ui.view.QKTextView in project qksms by moezbhatti.

the class BubblePreferenceDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(mContext);
    mResources = mContext.getResources();
    View view = mContext.getLayoutInflater().inflate(R.layout.dialog_bubbles, null);
    final QKTextView in1 = (QKTextView) view.findViewById(R.id.in_1);
    in1.setBackgroundResource(ThemeManager.getReceivedBubbleRes());
    in1.getBackground().setColorFilter(ThemeManager.getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP);
    in1.setOnColorBackground(ThemeManager.getReceivedBubbleColor() == ThemeManager.getColor());
    final QKTextView in2 = (QKTextView) view.findViewById(R.id.in_2);
    in2.setBackgroundResource(ThemeManager.getReceivedBubbleAltRes());
    in2.getBackground().setColorFilter(ThemeManager.getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP);
    in2.setOnColorBackground(ThemeManager.getReceivedBubbleColor() == ThemeManager.getColor());
    final QKTextView out1 = (QKTextView) view.findViewById(R.id.out_1);
    out1.setBackgroundResource(ThemeManager.getSentBubbleRes());
    out1.getBackground().setColorFilter(ThemeManager.getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP);
    out1.setOnColorBackground(ThemeManager.getSentBubbleColor() == ThemeManager.getColor());
    final QKTextView out2 = (QKTextView) view.findViewById(R.id.out_2);
    out2.setBackgroundResource(ThemeManager.getSentBubbleAltRes());
    out2.getBackground().setColorFilter(ThemeManager.getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP);
    out2.setOnColorBackground(ThemeManager.getSentBubbleColor() == ThemeManager.getColor());
    Preference.OnPreferenceClickListener onPreferenceClickListener = new Preference.OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference preference) {
            Log.d(TAG, preference.getKey());
            switch(preference.getKey()) {
                case SettingsFragment.BUBBLES_NEW:
                    ThemeManager.setBubbleStyleNew(((QKSwitchPreference) preference).isChecked());
                    in1.setBackgroundResource(ThemeManager.getReceivedBubbleRes());
                    in1.getBackground().setColorFilter(ThemeManager.getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP);
                    in1.setOnColorBackground(ThemeManager.getReceivedBubbleColor() == ThemeManager.getColor());
                    in2.setBackgroundResource(ThemeManager.getReceivedBubbleAltRes());
                    in2.getBackground().setColorFilter(ThemeManager.getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP);
                    in2.setOnColorBackground(ThemeManager.getReceivedBubbleColor() == ThemeManager.getColor());
                    out1.setBackgroundResource(ThemeManager.getSentBubbleRes());
                    out1.getBackground().setColorFilter(ThemeManager.getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP);
                    out1.setOnColorBackground(ThemeManager.getSentBubbleColor() == ThemeManager.getColor());
                    out2.setBackgroundResource(ThemeManager.getSentBubbleAltRes());
                    out2.getBackground().setColorFilter(ThemeManager.getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP);
                    out2.setOnColorBackground(ThemeManager.getSentBubbleColor() == ThemeManager.getColor());
                    return true;
                case SettingsFragment.COLOR_RECEIVED:
                    ThemeManager.setReceivedBubbleColored(((QKSwitchPreference) preference).isChecked());
                    in1.getBackground().setColorFilter(ThemeManager.getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP);
                    in1.setOnColorBackground(ThemeManager.getReceivedBubbleColor() == ThemeManager.getColor());
                    in2.getBackground().setColorFilter(ThemeManager.getReceivedBubbleColor(), PorterDuff.Mode.SRC_ATOP);
                    in2.setOnColorBackground(ThemeManager.getReceivedBubbleColor() == ThemeManager.getColor());
                    return true;
                case SettingsFragment.COLOR_SENT:
                    ThemeManager.setSentBubbleColored(((QKSwitchPreference) preference).isChecked());
                    out1.getBackground().setColorFilter(ThemeManager.getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP);
                    out1.setOnColorBackground(ThemeManager.getSentBubbleColor() == ThemeManager.getColor());
                    out2.getBackground().setColorFilter(ThemeManager.getSentBubbleColor(), PorterDuff.Mode.SRC_ATOP);
                    out2.setOnColorBackground(ThemeManager.getSentBubbleColor() == ThemeManager.getColor());
                    return true;
            }
            return false;
        }
    };
    LinearLayout prefsLayout = (LinearLayout) view.findViewById(R.id.prefs);
    prefsLayout.addView(new QKSwitchPreference(mContext, onPreferenceClickListener, SettingsFragment.BUBBLES_NEW, prefs, true, R.string.pref_bubble_style_new, 0).getView());
    prefsLayout.addView(new QKSwitchPreference(mContext, onPreferenceClickListener, SettingsFragment.COLOR_RECEIVED, prefs, false, R.string.pref_color_received, 0).getView());
    prefsLayout.addView(new QKSwitchPreference(mContext, onPreferenceClickListener, SettingsFragment.COLOR_SENT, prefs, true, R.string.pref_color_sent, 0).getView());
    setTitle(R.string.pref_bubbles);
    setCustomView(view);
    setPositiveButton(R.string.okay, null);
    return super.onCreateDialog(savedInstanceState);
}
Also used : SharedPreferences(android.content.SharedPreferences) Preference(android.preference.Preference) QKSwitchPreference(com.moez.QKSMS.ui.view.QKSwitchPreference) QKTextView(com.moez.QKSMS.ui.view.QKTextView) View(android.view.View) QKTextView(com.moez.QKSMS.ui.view.QKTextView) LinearLayout(android.widget.LinearLayout) QKSwitchPreference(com.moez.QKSMS.ui.view.QKSwitchPreference)

Aggregations

QKTextView (com.moez.QKSMS.ui.view.QKTextView)9 View (android.view.View)7 ListView (android.widget.ListView)4 AdapterView (android.widget.AdapterView)3 Dialog (android.app.Dialog)2 SharedPreferences (android.content.SharedPreferences)2 ColorDrawable (android.graphics.drawable.ColorDrawable)2 Preference (android.preference.Preference)2 LayoutInflater (android.view.LayoutInflater)2 Window (android.view.Window)2 LinearLayout (android.widget.LinearLayout)2 ScrollView (android.widget.ScrollView)2 QKSwitchPreference (com.moez.QKSMS.ui.view.QKSwitchPreference)2 Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1 ArgbEvaluator (android.animation.ArgbEvaluator)1 ValueAnimator (android.animation.ValueAnimator)1 AlarmManager (android.app.AlarmManager)1 Fragment (android.app.Fragment)1 PendingIntent (android.app.PendingIntent)1