Fix "register on" fragment, add "add photos" bottom sheet
This commit is contained in:
parent
f892a72af0
commit
8848da6466
6 changed files with 181 additions and 43 deletions
|
@ -1,15 +1,16 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
android:background="@color/color_white"
|
||||
<LinearLayout android:background="@color/color_white"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:clickable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:focusable="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:layout_height="@dimen/toolbar_height"
|
||||
android:layout_marginTop="@dimen/dialog_content_margin">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
|
@ -32,15 +33,16 @@
|
|||
android:contentDescription="@string/shared_string_back"
|
||||
app:srcCompat="@drawable/ic_img_logo_openplacereview" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:textColor="@color/color_black"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
app:typeface="@string/font_roboto_medium"
|
||||
android:textSize="20sp"
|
||||
android:lineSpacingExtra="5sp"
|
||||
android:textAlignment="center"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginTop="@dimen/content_padding"
|
||||
android:layout_marginBottom="@dimen/dashPadding"
|
||||
android:text="@string/register_on_openplacereviews"
|
||||
|
@ -54,7 +56,7 @@
|
|||
android:layout_marginTop="@dimen/dashPadding"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:lineSpacingExtra="5sp"
|
||||
android:textColor="@color/color_black"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textColorLink="@color/icon_color_active_light"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:text="@string/register_on_openplacereviews_desc" />
|
||||
|
@ -63,32 +65,23 @@
|
|||
android:gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginBottom="@dimen/content_padding_small"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
<include
|
||||
android:id="@+id/register_opr_create_account"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_marginBottom="@dimen/dashPadding"
|
||||
android:text="@string/register_opr_create_new_account"
|
||||
android:textColor="@color/color_white"
|
||||
android:layout_marginTop="@dimen/content_padding_small"
|
||||
android:background="@color/icon_color_active_light"
|
||||
layout="@layout/bottom_sheet_dialog_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="@dimen/dialog_button_height"
|
||||
android:layout_marginBottom="@dimen/content_padding_small" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
<include
|
||||
android:id="@+id/register_opr_have_account"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_marginTop="@dimen/dashPadding"
|
||||
android:layout_gravity="bottom"
|
||||
android:text="@string/register_opr_have_account"
|
||||
android:textColor="@color/icon_color_active_light"
|
||||
android:background="@color/activity_background_color_light"
|
||||
layout="@layout/bottom_sheet_dialog_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="@dimen/dialog_button_height" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
40
OsmAnd/res/layout/opr_add_photo.xml
Normal file
40
OsmAnd/res/layout/opr_add_photo.xml
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/add_photos_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/bottom_sheet_icon_margin"
|
||||
android:layout_marginBottom="@dimen/content_padding_small"
|
||||
android:layout_gravity="center"
|
||||
osmand:srcCompat="@drawable/ic_img_logo_openplacereview" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/add_photos_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/content_padding_small"
|
||||
android:layout_marginBottom="@dimen/content_padding_small"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/dialog_header_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:text="@string/shared_string_add_photos" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/add_photos_descr"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
android:text="@string/add_photos_descr" />
|
||||
|
||||
</LinearLayout>
|
|
@ -17,6 +17,9 @@
|
|||
<string name="select_data_to_export">Select the data to be exported to the file.</string>
|
||||
<string name="approximate_file_size">Approximate file size</string>
|
||||
<string name="shared_string_resources">Resources</string>
|
||||
<string name="add_photos_descr">OsmAnd shows photos from several sources:\nOpenPlaceReviews - POI photos;\nMapillary - street-level imagery;\nWeb / Wikimedia - POI photos specified in OpenStreetMap data.</string>
|
||||
<string name="add_to_opr">Add to OpenPlaceReviews</string>
|
||||
<string name="add_to_mapillary">Add to Mapillary</string>
|
||||
<string name="app_mode_motorboat">Motorboat</string>
|
||||
<string name="app_mode_kayak">Kayak</string>
|
||||
<string name="shared_string_search_history">Search history</string>
|
||||
|
|
|
@ -46,7 +46,7 @@ import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard;
|
|||
import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask;
|
||||
import net.osmand.plus.mapcontextmenu.builders.cards.NoImagesCard;
|
||||
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
|
||||
import net.osmand.plus.openplacereviews.OprStartFragment;
|
||||
import net.osmand.plus.openplacereviews.AddPhotosBottomSheetDialogFragment;
|
||||
import net.osmand.plus.poi.PoiUIFilter;
|
||||
import net.osmand.plus.render.RenderingIcons;
|
||||
import net.osmand.plus.transport.TransportStopRoute;
|
||||
|
@ -316,7 +316,7 @@ public class MenuBuilder {
|
|||
b.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
OprStartFragment.showInstance(mapActivity.getSupportFragmentManager());
|
||||
AddPhotosBottomSheetDialogFragment.showInstance(mapActivity.getSupportFragmentManager());
|
||||
}
|
||||
});
|
||||
b.setTypeface(FontCache.getRobotoRegular(context));
|
||||
|
@ -337,7 +337,7 @@ public class MenuBuilder {
|
|||
b.setText(context.getResources().getString(R.string.shared_string_add_photo));
|
||||
b.setBackgroundResource(R.drawable.btn_border_light);
|
||||
//TODO This feature is under development
|
||||
b.setVisibility(View.GONE);
|
||||
b.setVisibility(View.VISIBLE);
|
||||
b.setTextColor(ContextCompat.getColor(context, R.color.preference_category_title));
|
||||
return b;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
package net.osmand.plus.openplacereviews;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemButton;
|
||||
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerSpaceItem;
|
||||
|
||||
public class AddPhotosBottomSheetDialogFragment extends MenuBottomSheetDialogFragment {
|
||||
|
||||
public static final String TAG = AddPhotosBottomSheetDialogFragment.class.getSimpleName();
|
||||
|
||||
@Override
|
||||
public void createMenuItems(Bundle savedInstanceState) {
|
||||
|
||||
View mainView = View.inflate(UiUtilities.getThemedContext(getMyApplication(), nightMode),
|
||||
R.layout.opr_add_photo, null);
|
||||
items.add(new SimpleBottomSheetItem.Builder()
|
||||
.setCustomView(mainView)
|
||||
.create());
|
||||
|
||||
DividerItem divider = new DividerItem(getContext());
|
||||
int contextPadding = getResources().getDimensionPixelSize(R.dimen.content_padding);
|
||||
int contextPaddingSmall = getResources().getDimensionPixelSize(R.dimen.content_padding_small);
|
||||
divider.setMargins(contextPadding, contextPadding, contextPadding, contextPaddingSmall);
|
||||
items.add(divider);
|
||||
|
||||
items.add(new BottomSheetItemButton.Builder()
|
||||
.setTitle(getString(R.string.add_to_opr))
|
||||
.setLayoutId(R.layout.bottom_sheet_button)
|
||||
.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity != null) {
|
||||
OprStartFragment.showInstance(activity.getSupportFragmentManager());
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
})
|
||||
.create());
|
||||
|
||||
items.add(new DividerSpaceItem(getContext(), contextPaddingSmall));
|
||||
|
||||
items.add(new BottomSheetItemButton.Builder()
|
||||
.setButtonType(UiUtilities.DialogButtonType.SECONDARY)
|
||||
.setTitle(getString(R.string.add_to_mapillary))
|
||||
.setLayoutId(R.layout.bottom_sheet_button)
|
||||
.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Activity activity = getActivity();
|
||||
if (activity instanceof MapActivity) {
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
})
|
||||
.create());
|
||||
|
||||
items.add(new DividerSpaceItem(getContext(), contextPaddingSmall));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDismissButtonTextId() {
|
||||
return R.string.shared_string_cancel;
|
||||
}
|
||||
|
||||
public static void showInstance(@NonNull FragmentManager fragmentManager) {
|
||||
if (!fragmentManager.isStateSaved()) {
|
||||
AddPhotosBottomSheetDialogFragment fragment = new AddPhotosBottomSheetDialogFragment();
|
||||
fragment.show(fragmentManager, TAG);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.openplacereviews;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.Spanned;
|
||||
|
@ -11,23 +12,41 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
public class OprStartFragment extends BaseOsmAndFragment {
|
||||
private static final String TAG = "fragment_oprstart";
|
||||
private static final String TAG = OprStartFragment.class.getSimpleName();
|
||||
private static final Log LOG = PlatformUtil.getLog(OprStartFragment.class);
|
||||
private static final String openPlaceReviewsUrl = "OpenPlaceReviews.org";
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
boolean nightMode = getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
View v = inflater.inflate(R.layout.fragment_opr_login, container, false);
|
||||
v.findViewById(R.id.register_opr_create_account).setOnClickListener(new View.OnClickListener() {
|
||||
View createAccount = v.findViewById(R.id.register_opr_create_account);
|
||||
v.findViewById(R.id.back_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
FragmentActivity activity = getActivity();
|
||||
if (activity != null) {
|
||||
activity.getSupportFragmentManager().popBackStack();
|
||||
}
|
||||
}
|
||||
});
|
||||
UiUtilities.setupDialogButton(nightMode, createAccount, UiUtilities.DialogButtonType.PRIMARY,
|
||||
R.string.register_opr_create_new_account);
|
||||
createAccount.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent i = new Intent(requireContext(), OPRWebviewActivity.class);
|
||||
|
@ -36,13 +55,10 @@ public class OprStartFragment extends BaseOsmAndFragment {
|
|||
startActivity(i);
|
||||
}
|
||||
});
|
||||
v.findViewById(R.id.back_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
getActivity().getSupportFragmentManager().popBackStack();
|
||||
}
|
||||
});
|
||||
v.findViewById(R.id.register_opr_have_account).setOnClickListener(new View.OnClickListener() {
|
||||
View haveAccount = v.findViewById(R.id.register_opr_have_account);
|
||||
UiUtilities.setupDialogButton(nightMode, haveAccount, UiUtilities.DialogButtonType.SECONDARY,
|
||||
R.string.register_opr_have_account);
|
||||
haveAccount.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent i = new Intent(requireContext(), OPRWebviewActivity.class);
|
||||
|
@ -71,9 +87,10 @@ public class OprStartFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
public void updateDrawState(@NonNull TextPaint ds) {
|
||||
super.updateDrawState(ds);
|
||||
ds.setUnderlineText(false);
|
||||
ds.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue