Search in sources :

Example 86 with OsmandApplication

use of net.osmand.plus.OsmandApplication in project Osmand by osmandapp.

the class FavoritesActivity method updateSearchView.

public static void updateSearchView(Activity activity, SearchView searchView) {
    // do not ever do like this
    OsmandApplication app = (OsmandApplication) activity.getApplication();
    if (!app.getSettings().isLightContent()) {
        return;
    }
    try {
        ImageView cancelIcon = (ImageView) searchView.findViewById(R.id.search_close_btn);
        cancelIcon.setImageResource(R.drawable.ic_action_gremove_dark);
        // styling search hint icon and text
        SearchView.SearchAutoComplete searchEdit = (SearchView.SearchAutoComplete) searchView.findViewById(R.id.search_src_text);
        searchEdit.setTextColor(activity.getResources().getColor(R.color.color_white));
        SpannableStringBuilder stopHint = new SpannableStringBuilder("   ");
        Float rawTextSize = searchEdit.getTextSize();
        int textSize = (int) (rawTextSize * 1.25);
        // setting icon as spannable
        Drawable searchIcon = activity.getResources().getDrawable(R.drawable.ic_action_search_dark);
        searchIcon.setBounds(0, 0, textSize, textSize);
        stopHint.setSpan(new ImageSpan(searchIcon), 1, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        searchEdit.setHint(stopHint);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : OsmandApplication(net.osmand.plus.OsmandApplication) SearchView(android.support.v7.widget.SearchView) Drawable(android.graphics.drawable.Drawable) ImageView(android.widget.ImageView) SpannableStringBuilder(android.text.SpannableStringBuilder) ImageSpan(android.text.style.ImageSpan)

Example 87 with OsmandApplication

use of net.osmand.plus.OsmandApplication in project Osmand by osmandapp.

the class NotificationDismissReceiver method onReceive.

@Override
public void onReceive(Context context, Intent intent) {
    final NotificationHelper helper = ((OsmandApplication) context.getApplicationContext()).getNotificationHelper();
    String notificationTypeStr = intent.getExtras().getString(NOTIFICATION_TYPE_KEY_NAME);
    if (!Algorithms.isEmpty(notificationTypeStr)) {
        try {
            NotificationType notificationType = NotificationType.valueOf(notificationTypeStr);
            helper.onNotificationDismissed(notificationType);
        } catch (Exception e) {
        // ignored
        }
    }
}
Also used : OsmandApplication(net.osmand.plus.OsmandApplication) NotificationHelper(net.osmand.plus.NotificationHelper) NotificationType(net.osmand.plus.notifications.OsmandNotification.NotificationType)

Example 88 with OsmandApplication

use of net.osmand.plus.OsmandApplication in project Osmand by osmandapp.

the class PoiTypeDialogFragment method onCreateDialog.

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    MapPoiTypes poiTypes = ((OsmandApplication) getActivity().getApplication()).getPoiTypes();
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    final List<PoiCategory> categories = new ArrayList<PoiCategory>();
    ArrayList<String> vals = new ArrayList<>();
    for (PoiCategory category : poiTypes.getCategories(false)) {
        if (!category.isNotEditableOsm()) {
            vals.add(category.getTranslation());
            categories.add(category);
        }
    }
    builder.setItems(vals.toArray(new String[vals.size()]), new Dialog.OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            PoiCategory aType = categories.get(which);
            onItemSelectListener.select(aType);
            dismiss();
        }
    });
    return builder.create();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) OsmandApplication(net.osmand.plus.OsmandApplication) DialogInterface(android.content.DialogInterface) ArrayList(java.util.ArrayList) MapPoiTypes(net.osmand.osm.MapPoiTypes) PoiCategory(net.osmand.osm.PoiCategory) AlertDialog(android.support.v7.app.AlertDialog) Dialog(android.app.Dialog) NonNull(android.support.annotation.NonNull)

Example 89 with OsmandApplication

use of net.osmand.plus.OsmandApplication in project Osmand by osmandapp.

the class CreateEditActionDialog method onCreateDialog.

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    OsmandApplication application = (OsmandApplication) getActivity().getApplication();
    boolean light = application.getSettings().isLightContent() && !application.getDaynightHelper().isNightMode();
    Dialog dialog = new Dialog(new ContextThemeWrapper(getActivity(), light ? R.style.Dialog90Light : R.style.Dialog90Dark), getTheme());
    dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    return dialog;
}
Also used : OsmandApplication(net.osmand.plus.OsmandApplication) ContextThemeWrapper(android.support.v7.view.ContextThemeWrapper) ColorDrawable(android.graphics.drawable.ColorDrawable) Dialog(android.app.Dialog) AlertDialog(android.support.v7.app.AlertDialog)

Example 90 with OsmandApplication

use of net.osmand.plus.OsmandApplication in project Osmand by osmandapp.

the class CreateEditActionDialog method onCreate.

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    OsmandApplication application = (OsmandApplication) getActivity().getApplication();
    boolean light = application.getSettings().isLightContent() && !application.getDaynightHelper().isNightMode();
    setStyle(DialogFragment.STYLE_NORMAL, light ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme);
}
Also used : OsmandApplication(net.osmand.plus.OsmandApplication)

Aggregations

OsmandApplication (net.osmand.plus.OsmandApplication)181 View (android.view.View)46 TextView (android.widget.TextView)39 ArrayList (java.util.ArrayList)33 AlertDialog (android.support.v7.app.AlertDialog)32 ImageView (android.widget.ImageView)31 DialogInterface (android.content.DialogInterface)27 OsmandSettings (net.osmand.plus.OsmandSettings)27 LatLon (net.osmand.data.LatLon)25 Intent (android.content.Intent)21 AdapterView (android.widget.AdapterView)19 File (java.io.File)17 OsmandMapTileView (net.osmand.plus.views.OsmandMapTileView)15 Location (net.osmand.Location)13 EditText (android.widget.EditText)12 ContextMenuAdapter (net.osmand.plus.ContextMenuAdapter)12 ArrayAdapter (android.widget.ArrayAdapter)11 ListView (android.widget.ListView)11 ContextMenuItem (net.osmand.plus.ContextMenuItem)11 SelectedGpxFile (net.osmand.plus.GpxSelectionHelper.SelectedGpxFile)11