Search in sources :

Example 76 with OnCheckedChangeListener

use of android.widget.CompoundButton.OnCheckedChangeListener in project Osmand by osmandapp.

the class IntermediatePointsDialog method getListAdapter.

private static ArrayAdapter<TargetPoint> getListAdapter(final OsmandApplication app, final Activity activity, final boolean changeOrder, final List<TargetPoint> intermediates, final TIntArrayList originalPositions, final boolean[] checkedIntermediates) {
    final int padding = (int) (12 * activity.getResources().getDisplayMetrics().density + 0.5f);
    final ArrayAdapter<TargetPoint> listadapter = new ArrayAdapter<TargetPoint>(app, changeOrder ? R.layout.change_order_item : R.layout.list_menu_item_native, R.id.title, intermediates) {

        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            // User super class to create the View
            View v = super.getView(position, convertView, parent);
            TextView tv = (TextView) v.findViewById(R.id.title);
            String nm = originalPositions.get(position) + ". ";
            TargetPoint tp = intermediates.get(position);
            String distString = "";
            if (activity instanceof MapActivity) {
                double lat = ((MapActivity) activity).getMapView().getLatitude();
                double lon = ((MapActivity) activity).getMapView().getLongitude();
                double meters = MapUtils.getDistance(tp.point, lat, lon);
                distString = OsmAndFormatter.getFormattedDistance((float) meters, app);
            }
            if (position < intermediates.size() - 1) {
                nm += app.getString(R.string.target_point, distString);
            } else {
                nm += app.getString(R.string.destination_point, distString);
            }
            String descr = tp.getOnlyName();
            if (descr != null && descr.trim().length() > 0) {
                nm += "\n" + descr;
            }
            tv.setText(nm);
            if (changeOrder) {
                ((ImageButton) v.findViewById(R.id.up)).setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        if (position > 0) {
                            TargetPoint old = intermediates.remove(position - 1);
                            int oldI = originalPositions.removeAt(position - 1);
                            intermediates.add(position, old);
                            originalPositions.insert(position, oldI);
                            notifyDataSetInvalidated();
                        }
                    }
                });
                ((ImageButton) v.findViewById(R.id.down)).setOnClickListener(new View.OnClickListener() {

                    @Override
                    public void onClick(View v) {
                        if (position < intermediates.size() - 1) {
                            TargetPoint old = intermediates.remove(position + 1);
                            int oldI = originalPositions.removeAt(position + 1);
                            intermediates.add(position, old);
                            originalPositions.insert(position, oldI);
                            notifyDataSetInvalidated();
                        }
                    }
                });
            } else {
                int icon = position == intermediates.size() - 1 ? R.drawable.ic_action_target : R.drawable.ic_action_intermediate;
                tv.setCompoundDrawablesWithIntrinsicBounds(app.getIconsCache().getThemedIcon(icon), null, null, null);
                tv.setCompoundDrawablePadding(padding);
                final CheckBox ch = ((CheckBox) v.findViewById(R.id.toggle_item));
                ch.setVisibility(View.VISIBLE);
                ch.setOnCheckedChangeListener(null);
                ch.setChecked(checkedIntermediates[position]);
                ch.setOnCheckedChangeListener(new OnCheckedChangeListener() {

                    @Override
                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                        checkedIntermediates[position] = isChecked;
                    }
                });
            }
            return v;
        }
    };
    return listadapter;
}
Also used : OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) ViewGroup(android.view.ViewGroup) TargetPoint(net.osmand.plus.TargetPointsHelper.TargetPoint) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) TargetPoint(net.osmand.plus.TargetPointsHelper.TargetPoint) ImageButton(android.widget.ImageButton) CheckBox(android.widget.CheckBox) TextView(android.widget.TextView) ArrayAdapter(android.widget.ArrayAdapter) CompoundButton(android.widget.CompoundButton)

Example 77 with OnCheckedChangeListener

use of android.widget.CompoundButton.OnCheckedChangeListener in project Osmand by osmandapp.

the class OsmAndLocationSimulation method startStopRouteAnimation.

// public void startStopRouteAnimationRoute(final MapActivity ma) {
// if (!isRouteAnimating()) {
// List<Location> currentRoute = app.getRoutingHelper().getCurrentRoute();
// if (currentRoute.isEmpty()) {
// Toast.makeText(app, R.string.animate_routing_route_not_calculated, Toast.LENGTH_LONG).show();
// } else {
// startAnimationThread(app.getRoutingHelper(), ma, new ArrayList<Location>(currentRoute), false, 1);
// }
// } else {
// stop();
// }
// }
public void startStopRouteAnimation(final Activity ma, final Runnable runnable) {
    if (!isRouteAnimating()) {
        AlertDialog.Builder builder = new AlertDialog.Builder(ma);
        builder.setTitle(R.string.animate_route);
        final View view = ma.getLayoutInflater().inflate(R.layout.animate_route, null);
        final View gpxView = ((LinearLayout) view.findViewById(R.id.layout_animate_gpx));
        final RadioButton radioGPX = (RadioButton) view.findViewById(R.id.radio_gpx);
        radioGPX.setOnCheckedChangeListener(new OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                gpxView.setVisibility(isChecked ? View.VISIBLE : View.GONE);
            }
        });
        // $NON-NLS-1$
        ((TextView) view.findViewById(R.id.MinSpeedup)).setText("1");
        // $NON-NLS-1$
        ((TextView) view.findViewById(R.id.MaxSpeedup)).setText("4");
        final SeekBar speedup = (SeekBar) view.findViewById(R.id.Speedup);
        speedup.setMax(3);
        builder.setView(view);
        builder.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                boolean gpxNavigation = radioGPX.isChecked();
                if (gpxNavigation) {
                    GpxUiHelper.selectGPXFile(ma, false, false, new CallbackWithObject<GPXUtilities.GPXFile[]>() {

                        @Override
                        public boolean processResult(GPXUtilities.GPXFile[] result) {
                            GPXRouteParamsBuilder builder = new GPXRouteParamsBuilder(result[0], app.getSettings());
                            startAnimationThread(app, builder.getPoints(), true, speedup.getProgress() + 1);
                            if (runnable != null) {
                                runnable.run();
                            }
                            return true;
                        }
                    });
                } else {
                    List<Location> currentRoute = app.getRoutingHelper().getCurrentCalculatedRoute();
                    if (currentRoute.isEmpty()) {
                        Toast.makeText(app, R.string.animate_routing_route_not_calculated, Toast.LENGTH_LONG).show();
                    } else {
                        startAnimationThread(app, new ArrayList<Location>(currentRoute), false, 1);
                        if (runnable != null) {
                            runnable.run();
                        }
                    }
                }
            }
        });
        builder.setNegativeButton(R.string.shared_string_cancel, null);
        builder.show();
    } else {
        stop();
    }
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) SeekBar(android.widget.SeekBar) DialogInterface(android.content.DialogInterface) GPXRouteParamsBuilder(net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder) GPXRouteParamsBuilder(net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder) ArrayList(java.util.ArrayList) RadioButton(android.widget.RadioButton) TextView(android.widget.TextView) View(android.view.View) CallbackWithObject(net.osmand.CallbackWithObject) TextView(android.widget.TextView) ArrayList(java.util.ArrayList) List(java.util.List) CompoundButton(android.widget.CompoundButton)

Example 78 with OnCheckedChangeListener

use of android.widget.CompoundButton.OnCheckedChangeListener in project Osmand by osmandapp.

the class QuickSearchCustomPoiFragment method showDialog.

private void showDialog(final PoiCategory poiCategory, boolean selectAll) {
    final int index = listView.getFirstVisiblePosition();
    View v = listView.getChildAt(0);
    final int top = (v == null) ? 0 : v.getTop();
    final AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
    final LinkedHashMap<String, String> subCategories = new LinkedHashMap<String, String>();
    Set<String> acceptedCategories = filter.getAcceptedSubtypes(poiCategory);
    if (acceptedCategories != null) {
        for (String s : acceptedCategories) {
            subCategories.put(s, Algorithms.capitalizeFirstLetterAndLowercase(s));
        }
    }
    for (PoiType pt : poiCategory.getPoiTypes()) {
        subCategories.put(pt.getKeyName(), pt.getTranslation());
    }
    final String[] array = subCategories.keySet().toArray(new String[0]);
    final Collator cl = Collator.getInstance();
    cl.setStrength(Collator.SECONDARY);
    Arrays.sort(array, 0, array.length, new Comparator<String>() {

        @Override
        public int compare(String object1, String object2) {
            String v1 = subCategories.get(object1);
            String v2 = subCategories.get(object2);
            return cl.compare(v1, v2);
        }
    });
    final String[] visibleNames = new String[array.length];
    final boolean[] selected = new boolean[array.length];
    boolean allSelected = true;
    for (int i = 0; i < array.length; i++) {
        final String subcategory = array[i];
        visibleNames[i] = subCategories.get(subcategory);
        if (acceptedCategories == null || selectAll) {
            selected[i] = true;
        } else {
            if (allSelected) {
                allSelected = false;
            }
            selected[i] = acceptedCategories.contains(subcategory);
        }
    }
    View titleView = LayoutInflater.from(getActivity()).inflate(R.layout.subcategories_dialog_title, null);
    TextView titleTextView = (TextView) titleView.findViewById(R.id.title);
    titleTextView.setText(poiCategory.getTranslation());
    SwitchCompat check = (SwitchCompat) titleView.findViewById(R.id.check);
    check.setChecked(allSelected);
    builder.setCustomTitle(titleView);
    builder.setCancelable(true);
    builder.setNegativeButton(getContext().getText(R.string.shared_string_cancel), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            listAdapter.notifyDataSetChanged();
        }
    });
    builder.setPositiveButton(getContext().getText(R.string.shared_string_apply), new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            LinkedHashSet<String> accepted = new LinkedHashSet<String>();
            for (int i = 0; i < selected.length; i++) {
                if (selected[i]) {
                    accepted.add(array[i]);
                }
            }
            if (subCategories.size() == accepted.size()) {
                filter.selectSubTypesToAccept(poiCategory, null);
            } else if (accepted.size() == 0) {
                filter.setTypeToAccept(poiCategory, false);
            } else {
                filter.selectSubTypesToAccept(poiCategory, accepted);
            }
            saveFilter();
            listAdapter.notifyDataSetChanged();
            listView.setSelectionFromTop(index, top);
        }
    });
    builder.setMultiChoiceItems(visibleNames, selected, new DialogInterface.OnMultiChoiceClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int item, boolean isChecked) {
            selected[item] = isChecked;
        }
    });
    final AlertDialog dialog = builder.show();
    check.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                Arrays.fill(selected, true);
            } else {
                Arrays.fill(selected, false);
            }
            for (int i = 0; i < selected.length; i++) {
                dialog.getListView().setItemChecked(i, selected[i]);
            }
        }
    });
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) LinkedHashSet(java.util.LinkedHashSet) DialogInterface(android.content.DialogInterface) PoiType(net.osmand.osm.PoiType) LinkedHashMap(java.util.LinkedHashMap) Collator(java.text.Collator) AppCompatTextView(android.support.v7.widget.AppCompatTextView) TextView(android.widget.TextView) OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) View(android.view.View) AdapterView(android.widget.AdapterView) AppCompatImageView(android.support.v7.widget.AppCompatImageView) AppCompatTextView(android.support.v7.widget.AppCompatTextView) TextView(android.widget.TextView) ListView(android.widget.ListView) CompoundButton(android.widget.CompoundButton) SwitchCompat(android.support.v7.widget.SwitchCompat)

Example 79 with OnCheckedChangeListener

use of android.widget.CompoundButton.OnCheckedChangeListener in project android_packages_apps_OmniGears by omnirom.

the class TimeInState method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup root, Bundle savedInstanceState) {
    super.onCreateView(inflater, root, savedInstanceState);
    View view = inflater.inflate(R.layout.time_in_state, root, false);
    mStatesView = (LinearLayout) view.findViewById(R.id.ui_states_view);
    mStatesWarning = (TextView) view.findViewById(R.id.ui_states_warning);
    mTotalStateTime = (TextView) view.findViewById(R.id.ui_total_state_time);
    mStateMode = (CheckBox) view.findViewById(R.id.ui_mode_switch);
    mActiveStateMode = getPrefs().getBoolean(PREF_STATE_MODE, false);
    mStateMode.setChecked(mActiveStateMode);
    mStateMode.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            mActiveStateMode = isChecked;
            SharedPreferences.Editor editor = getPrefs().edit();
            editor.putBoolean(PREF_STATE_MODE, mActiveStateMode).commit();
            updateView();
        }
    });
    mCoreMode = (CheckBox) view.findViewById(R.id.ui_core_switch);
    mCoreMode.setVisibility(View.GONE);
    mPeriodTypeSelect = (Spinner) view.findViewById(R.id.period_type_select);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(mContext, R.array.period_type_entries, R.layout.spinner_item);
    mPeriodTypeSelect.setAdapter(adapter);
    mPeriodTypeSelect.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            mPeriodType = position;
            if (position == 0) {
                loadOffsets();
            } else if (position == 1) {
                monitor.removeOffsets();
            }
            refreshData();
        }

        @Override
        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });
    mPeriodTypeSelect.setSelection(mPeriodType);
    mProgress = (LinearLayout) view.findViewById(R.id.ui_progress);
    return view;
}
Also used : OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener)

Example 80 with OnCheckedChangeListener

use of android.widget.CompoundButton.OnCheckedChangeListener in project LibreraReader by foobnix.

the class OpdsFragment2 method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_opds2, container, false);
    recyclerView = (FastScrollRecyclerView) view.findViewById(R.id.recyclerView);
    titleView = (TextView) view.findViewById(R.id.titleView);
    onPlus = (ImageView) view.findViewById(R.id.onPlus);
    onProxy = (ImageView) view.findViewById(R.id.onProxy);
    starIcon = (ImageView) view.findViewById(R.id.starIcon);
    pathContainer = view.findViewById(R.id.pathContainer);
    view1 = view.findViewById(R.id.view1);
    view2 = view.findViewById(R.id.view2);
    progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
    progressBar.setVisibility(View.GONE);
    TintUtil.setDrawableTint(progressBar.getIndeterminateDrawable().getCurrent(), Color.WHITE);
    onPlus.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            AddCatalogDialog.showDialog(getActivity(), new Runnable() {

                @Override
                public void run() {
                    populate();
                }
            }, null, true);
        }
    });
    searchAdapter = new EntryAdapter();
    defaults = (TextView) view.findViewById(R.id.defaults);
    faq = (TextView) view.findViewById(R.id.faq);
    defaults.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            AlertDialogs.showOkDialog(getActivity(), getActivity().getString(R.string.restore_defaults_full), new Runnable() {

                @Override
                public void run() {
                    AppState.get().myOPDSLinks = AppState.OPDS_DEFAULT;
                    url = "/";
                    populate();
                }
            });
        }
    });
    faq.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Urls.open(getActivity(), "https://wiki.mobileread.com/wiki/OPDS");
        }
    });
    onGridList();
    searchAdapter.setOnItemClickListener(new ResultResponse<Entry>() {

        @Override
        public boolean onResultRecive(Entry result) {
            for (Link link : result.links) {
                if (link.isOpdsLink()) {
                    onClickLink(link);
                    break;
                }
            }
            return false;
        }
    });
    searchAdapter.setOnRemoveLinkClickListener(new ResultResponse<Entry>() {

        @Override
        public boolean onResultRecive(final Entry result) {
            AlertDialogs.showDialog(getActivity(), getActivity().getString(R.string.do_you_want_to_delete_), getString(R.string.delete), new Runnable() {

                @Override
                public void run() {
                    AppState.get().myOPDSLinks = AppState.get().myOPDSLinks.replace(result.appState, "");
                    url = "/";
                    populate();
                }
            });
            return false;
        }
    });
    searchAdapter.setOnLinkClickListener(new ResultResponse<Link>() {

        @Override
        public boolean onResultRecive(Link link) {
            onClickLink(link);
            return false;
        }
    });
    searchAdapter.setOnItemLongClickListener(new ResultResponse<Entry>() {

        @Override
        public boolean onResultRecive(Entry result) {
            if (url.equals("/")) {
                AddCatalogDialog.showDialog(getActivity(), new Runnable() {

                    @Override
                    public void run() {
                        populate();
                    }
                }, result, SamlibOPDS.isSamlibUrl(result.homeUrl) ? false : true);
            }
            return false;
        }
    });
    starIcon.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            final Entry entry = new Entry();
            String url2 = url;
            if (url2.contains("?")) {
                url2 = url2.substring(0, url2.indexOf("?"));
            }
            entry.setAppState(url, title, url2, "assets://opds/star_1.png");
            if (!AppState.get().myOPDSLinks.contains(url)) {
                AddCatalogDialog.showDialog(getActivity(), new Runnable() {

                    @Override
                    public void run() {
                        starIcon.setImageResource(R.drawable.star_1);
                        TintUtil.setTintImageWithAlpha(starIcon, Color.WHITE);
                    }
                }, entry, false);
            } else {
                AppState.get().myOPDSLinks = AppState.get().myOPDSLinks.replace(entry.appState, "");
                starIcon.setImageResource(R.drawable.star_2);
                TintUtil.setTintImageWithAlpha(starIcon, Color.WHITE);
            // AlertDialogs.showOkDialog(getActivity(),
            // getActivity().getString(R.string.do_you_want_to_delete_), new Runnable() {
            // 
            // @Override
            // public void run() {
            // 
            // // url = "/";
            // }
            // });
            }
        }
    });
    view.findViewById(R.id.onBack).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            onBackAction();
        }
    });
    view.findViewById(R.id.onHome).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            stack.clear();
            url = getHome();
            LOG.d("URLAction", "ADD", url);
            urlRoot = "";
            populate();
        }
    });
    view.findViewById(R.id.onHome).setOnLongClickListener(new OnLongClickListener() {

        @Override
        public boolean onLongClick(View v) {
            AlertDialogs.showOkDialog(getActivity(), getActivity().getString(R.string.restore_defaults_full), new Runnable() {

                @Override
                public void run() {
                    AppState.get().myOPDSLinks = AppState.OPDS_DEFAULT;
                    populate();
                }
            });
            return true;
        }
    });
    onProxy.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            final AlertDialog.Builder builder = new AlertDialog.Builder(v.getContext());
            View view = LayoutInflater.from(v.getContext()).inflate(R.layout.dialog_proxy_server, null, false);
            final CheckBox proxyEnable = (CheckBox) view.findViewById(R.id.proxyEnable);
            final CheckBox opdsLargeCovers = (CheckBox) view.findViewById(R.id.opdsLargeCovers);
            final EditText proxyServer = (EditText) view.findViewById(R.id.proxyServer);
            final EditText proxyPort = (EditText) view.findViewById(R.id.proxyPort);
            final EditText proxyUser = (EditText) view.findViewById(R.id.proxyUser);
            final EditText proxyPassword = (EditText) view.findViewById(R.id.proxyPassword);
            final TextView proxyType = (TextView) view.findViewById(R.id.proxyType);
            TintUtil.setBackgroundFillColor(view.findViewById(R.id.section1), TintUtil.color);
            TintUtil.setBackgroundFillColor(view.findViewById(R.id.section2), TintUtil.color);
            proxyEnable.setChecked(AppState.get().proxyEnable);
            proxyServer.setText(AppState.get().proxyServer);
            proxyPort.setText(AppState.get().proxyPort == 0 ? "" : "" + AppState.get().proxyPort);
            proxyUser.setText(AppState.get().proxyUser);
            proxyPassword.setText(AppState.get().proxyPassword);
            proxyEnable.setOnCheckedChangeListener(new OnCheckedChangeListener() {

                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    if (isChecked) {
                        if (TxtUtils.isEmpty(proxyServer.getText().toString())) {
                            proxyServer.requestFocus();
                            proxyEnable.setChecked(false);
                            Toast.makeText(getContext(), R.string.incorrect_value, Toast.LENGTH_SHORT).show();
                        } else if ("0".equals(proxyPort.getText().toString()) || TxtUtils.isEmpty(proxyPort.getText().toString())) {
                            proxyPort.requestFocus();
                            proxyEnable.setChecked(false);
                            Toast.makeText(getContext(), R.string.incorrect_value, Toast.LENGTH_SHORT).show();
                        }
                    }
                }
            });
            TxtUtils.underline(proxyType, AppState.get().proxyType);
            proxyType.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    PopupMenu menu = new PopupMenu(v.getContext(), v);
                    menu.getMenu().add(AppState.PROXY_HTTP).setOnMenuItemClickListener(new OnMenuItemClickListener() {

                        @Override
                        public boolean onMenuItemClick(MenuItem item) {
                            AppState.get().proxyType = AppState.PROXY_HTTP;
                            TxtUtils.underline(proxyType, AppState.get().proxyType);
                            return false;
                        }
                    });
                    menu.getMenu().add(AppState.PROXY_SOCKS).setOnMenuItemClickListener(new OnMenuItemClickListener() {

                        @Override
                        public boolean onMenuItemClick(MenuItem item) {
                            AppState.get().proxyType = AppState.PROXY_SOCKS;
                            TxtUtils.underline(proxyType, AppState.get().proxyType);
                            return false;
                        }
                    });
                    menu.show();
                }
            });
            builder.setPositiveButton(R.string.apply, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    AppState.get().proxyEnable = proxyEnable.isChecked();
                    AppState.get().proxyServer = proxyServer.getText().toString();
                    try {
                        AppState.get().proxyPort = Integer.parseInt(proxyPort.getText().toString());
                    } catch (Exception e) {
                        AppState.get().proxyPort = 0;
                    }
                    AppState.get().proxyUser = proxyUser.getText().toString().trim();
                    AppState.get().proxyPassword = proxyPassword.getText().toString().trim();
                    OPDS.buildProxy();
                    AppState.get().save(getActivity());
                    Keyboards.close(proxyServer);
                }
            });
            builder.setNeutralButton(R.string.cancel, new DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                }
            });
            opdsLargeCovers.setChecked(AppState.get().opdsLargeCovers);
            opdsLargeCovers.setOnCheckedChangeListener(new OnCheckedChangeListener() {

                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    AppState.get().opdsLargeCovers = isChecked;
                }
            });
            final TextView downlodsPath = (TextView) view.findViewById(R.id.downlodsPath);
            TxtUtils.underline(downlodsPath, TxtUtils.lastTwoPath(AppState.get().downlodsPath));
            downlodsPath.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(final View v) {
                    ChooserDialogFragment.chooseFolder(getActivity(), AppState.get().downlodsPath).setOnSelectListener(new ResultResponse2<String, Dialog>() {

                        @Override
                        public boolean onResultRecive(String nPath, Dialog dialog) {
                            AppState.get().downlodsPath = nPath;
                            TxtUtils.underline(downlodsPath, TxtUtils.lastTwoPath(AppState.get().downlodsPath));
                            dialog.dismiss();
                            return false;
                        }
                    });
                }
            });
            builder.setView(view);
            builder.show();
        }
    });
    OPDS.buildProxy();
    populate();
    onTintChanged();
    return view;
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) OnMenuItemClickListener(android.view.MenuItem.OnMenuItemClickListener) Entry(com.foobnix.opds.Entry) AlertDialog(android.app.AlertDialog) Dialog(android.app.Dialog) AddCatalogDialog(com.foobnix.pdf.info.widget.AddCatalogDialog) OnLongClickListener(android.view.View.OnLongClickListener) TextView(android.widget.TextView) EditText(android.widget.EditText) OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) EntryAdapter(com.foobnix.ui2.adapter.EntryAdapter) MenuItem(android.view.MenuItem) FastScrollRecyclerView(com.foobnix.ui2.fast.FastScrollRecyclerView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) RecyclerView(android.support.v7.widget.RecyclerView) CheckBox(android.widget.CheckBox) OnClickListener(android.view.View.OnClickListener) Link(com.foobnix.opds.Link) CompoundButton(android.widget.CompoundButton) PopupMenu(android.widget.PopupMenu)

Aggregations

OnCheckedChangeListener (android.widget.CompoundButton.OnCheckedChangeListener)101 CompoundButton (android.widget.CompoundButton)98 View (android.view.View)78 TextView (android.widget.TextView)66 ImageView (android.widget.ImageView)40 OnClickListener (android.view.View.OnClickListener)31 CheckBox (android.widget.CheckBox)30 DialogInterface (android.content.DialogInterface)27 AdapterView (android.widget.AdapterView)24 AlertDialog (android.app.AlertDialog)23 ListView (android.widget.ListView)20 Button (android.widget.Button)19 LayoutInflater (android.view.LayoutInflater)17 ArrayList (java.util.ArrayList)17 List (java.util.List)15 OnClickListener (android.content.DialogInterface.OnClickListener)12 SuppressLint (android.annotation.SuppressLint)11 Intent (android.content.Intent)11 ViewGroup (android.view.ViewGroup)10 Cursor (android.database.Cursor)9