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();
}
}
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
}
}
}
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();
}
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;
}
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);
}
Aggregations