Search in sources :

Example 96 with AdapterView

use of android.widget.AdapterView in project qksms by moezbhatti.

the class QKDialog method setDoubleLineItems.

public QKDialog setDoubleLineItems(String[] titles, String[] bodies, final OnItemClickListener onClickListener) {
    int size = Math.min(titles.length, bodies.length);
    DoubleLineListItem[] doubleLineListItems = new DoubleLineListItem[size];
    for (int i = 0; i < size; i++) {
        doubleLineListItems[i] = new DoubleLineListItem();
        doubleLineListItems[i].title = titles[i];
        doubleLineListItems[i].body = bodies[i];
    }
    ArrayAdapter adapter = new DoubleLineArrayAdapter(mContext, doubleLineListItems);
    ListView listView = new ListView(mContext);
    listView.setAdapter(adapter);
    listView.setDivider(null);
    listView.setPadding(0, Units.dpToPx(mContext, 8), 0, Units.dpToPx(mContext, 8));
    listView.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (onClickListener != null) {
                onClickListener.onItemClick(parent, view, position, id);
                dismiss();
            }
        }
    });
    return setCustomView(listView);
}
Also used : ListView(android.widget.ListView) OnItemClickListener(android.widget.AdapterView.OnItemClickListener) 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) ArrayAdapter(android.widget.ArrayAdapter)

Example 97 with AdapterView

use of android.widget.AdapterView in project qksms by moezbhatti.

the class MMSDialogFragment method setDoubleLineItems.

public MMSDialogFragment setDoubleLineItems(String[] titles, String[] bodies) {
    int size = Math.min(titles.length, bodies.length);
    DoubleLineListItem[] doubleLineListItems = new DoubleLineListItem[size];
    for (int i = 0; i < size; i++) {
        doubleLineListItems[i] = new DoubleLineListItem();
        doubleLineListItems[i].title = titles[i];
        doubleLineListItems[i].body = bodies[i];
    }
    ArrayAdapter adapter = new DoubleLineArrayAdapter(mContext, doubleLineListItems);
    ListView listView = new ListView(mContext);
    listView.setAdapter(adapter);
    listView.setDivider(null);
    listView.setPadding(0, Units.dpToPx(mContext, 8), 0, Units.dpToPx(mContext, 8));
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            onListResult(LIST_ITEM_CLICK_RESULT, position);
            dismiss();
        }
    });
    return setCustomView(listView);
}
Also used : ListView(android.widget.ListView) AdapterView(android.widget.AdapterView) QKTextView(com.moez.QKSMS.ui.view.QKTextView) ScrollView(android.widget.ScrollView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter)

Example 98 with AdapterView

use of android.widget.AdapterView in project qksms by moezbhatti.

the class MMSDialogFragment method setTripleLineItems.

public MMSDialogFragment setTripleLineItems(String[] titles, String[] subtitles, String[] bodies) {
    int size = Math.min(titles.length, Math.min(subtitles.length, bodies.length));
    TripleLineListItem[] tripleLineListItems = new TripleLineListItem[size];
    for (int i = 0; i < size; i++) {
        tripleLineListItems[i] = new TripleLineListItem();
        tripleLineListItems[i].title = titles[i];
        tripleLineListItems[i].subtitle = subtitles[i];
        tripleLineListItems[i].body = bodies[i];
    }
    ArrayAdapter adapter = new TripleLineArrayAdapter(mContext, tripleLineListItems);
    ListView listView = new ListView(mContext);
    listView.setAdapter(adapter);
    listView.setDivider(null);
    listView.setPadding(0, Units.dpToPx(mContext, 8), 0, Units.dpToPx(mContext, 8));
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            onListResult(LIST_ITEM_CLICK_RESULT, position);
            dismiss();
        }
    });
    return setCustomView(listView);
}
Also used : ListView(android.widget.ListView) AdapterView(android.widget.AdapterView) QKTextView(com.moez.QKSMS.ui.view.QKTextView) ScrollView(android.widget.ScrollView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter)

Example 99 with AdapterView

use of android.widget.AdapterView 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 100 with AdapterView

use of android.widget.AdapterView in project android-app-common-tasks by multidots.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mContext = MainActivity.this;
    //Activity mActivity = MainActivity.this;
    tvText = (TextView) findViewById(R.id.text);
    String[] sdkFunctionalityListValue = new String[] { "Validations", /* 0 */
    "Internet availability", /* 1 */
    "Date formats", /* 2 */
    "Device id", /* 3 */
    "Set preferences", /* 4 */
    "Get preferences", /* 5 */
    "Get current location", /* 6 */
    "Pinchzoom image", /* 7 */
    "Get application icon", /* 8 */
    "Send notification", /* 9 */
    "Get random character from A to Z", /* 10 */
    "Screen sleep mode on off", /* 11 */
    "Open image from path", /* 12 */
    "Open video from path", /* 13 */
    "Open url in browser", /* 14 */
    "Show address on map", /* 15 */
    "Create folder or directory", /* 16 */
    "Download image from url", /* 17 */
    "Open date picker", /* 18 */
    "Open time picker", /* 19 */
    "Get files count in directory", /* 20 */
    "Get date difference", /* 21 */
    "Convert string date to dateformat", /* 22 */
    "Get device height", /* 23 */
    "Get device width", /* 24 */
    "Generate random number", /* 25 */
    "Postfix for number", /* 26 */
    "Convert comma separated string to arraylist and viseversa", /* 27 */
    "Music ON OFF", /* 28 */
    "Apply blur bffect on image", /* 29 */
    "Drawable to bitmap and viceversa", /* 30 */
    "Set device volume as app volume", /* 31 */
    "Set and get image from preferences", /* 32 */
    "Application version", /* 33 */
    "Vertical text views", /* 34 */
    "Is SDCard available?", /* 35 */
    "Show share dialog", /* 36 */
    "Change device profile", /* 37 */
    "Change bitmap to rounded cornered", /* 38 */
    "Show toast", /* 39 */
    "Prevent double click", /* 40 */
    "Bluetooth/wifi ON OFF", /* 41 */
    "Pick/capture/preview image/video and crop image", /* 42 */
    "Url validation & ripple effect", /* 43 */
    "Contacts with email id & screenshot", /* 44 */
    "Social integration", /* 45 */
    "Pick color", /* 46 */
    "Remote file size or download file" };
    ListView sdkFunctionalityList = (ListView) findViewById(R.id.Md_list_company);
    ArrayAdapter<String> stringArrayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, sdkFunctionalityListValue);
    sdkFunctionalityList.setAdapter(stringArrayAdapter);
    sdkFunctionalityList.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            selectedListItem(position);
        }
    });
    sdkFunctionalityList.setOnScrollListener(new AbsListView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
            tvText.setText("");
        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
        }
    });
}
Also used : OnItemClickListener(android.widget.AdapterView.OnItemClickListener) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) ListView(android.widget.ListView) AbsListView(android.widget.AbsListView) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter)

Aggregations

AdapterView (android.widget.AdapterView)650 View (android.view.View)626 ListView (android.widget.ListView)393 TextView (android.widget.TextView)325 Intent (android.content.Intent)171 ImageView (android.widget.ImageView)166 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)135 ArrayAdapter (android.widget.ArrayAdapter)73 ArrayList (java.util.ArrayList)67 ViewGroup (android.view.ViewGroup)60 AbsListView (android.widget.AbsListView)57 GridView (android.widget.GridView)55 Bundle (android.os.Bundle)52 Spinner (android.widget.Spinner)49 LinearLayout (android.widget.LinearLayout)47 OnClickListener (android.view.View.OnClickListener)44 RecyclerView (android.support.v7.widget.RecyclerView)39 SuppressLint (android.annotation.SuppressLint)37 DialogInterface (android.content.DialogInterface)37 Context (android.content.Context)30