opr login added

This commit is contained in:
simon 2020-11-11 17:27:45 +02:00
parent a9c797ebd7
commit 0aafc4ce84
6 changed files with 225 additions and 37 deletions

View file

@ -0,0 +1,36 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="72dp"
android:height="63dp"
android:viewportWidth="72"
android:viewportHeight="63">
<path
android:pathData="M49.5,0C47.0147,0 45,2.0147 45,4.5C45,6.9853 47.0147,9 49.5,9H67.5C69.9853,9 72,6.9853 72,4.5C72,2.0147 69.9853,0 67.5,0H49.5Z"
android:fillColor="#8AC826"/>
<path
android:pathData="M67.5,54C69.9853,54 72,56.0147 72,58.5C72,60.9853 69.9853,63 67.5,63H58.5C56.0147,63 54,60.9853 54,58.5C54,56.0147 56.0147,54 58.5,54H67.5Z"
android:fillColor="#8AC826"/>
<path
android:pathData="M72,22.5C72,20.0147 69.9853,18 67.5,18H54C51.5147,18 49.5,20.0147 49.5,22.5C49.5,24.9853 51.5147,27 54,27H67.5C69.9853,27 72,24.9853 72,22.5Z"
android:fillColor="#8AC826"/>
<path
android:pathData="M67.5,36C69.9853,36 72,38.0147 72,40.5C72,42.9853 69.9853,45 67.5,45H45C42.5147,45 40.5,42.9853 40.5,40.5C40.5,38.0147 42.5147,36 45,36H67.5Z"
android:fillColor="#8AC826"/>
<path
android:pathData="M22.5,4.5C22.5,2.0147 24.5147,0 27,0H36C38.4853,0 40.5,2.0147 40.5,4.5C40.5,6.9853 38.4853,9 36,9H27C24.5147,9 22.5,6.9853 22.5,4.5Z"
android:fillColor="#FFC93A"/>
<path
android:pathData="M45,22.5C45,20.0147 42.9853,18 40.5,18H31.5C29.0147,18 27,20.0147 27,22.5C27,24.9853 29.0147,27 31.5,27H40.5C42.9853,27 45,24.9853 45,22.5Z"
android:fillColor="#FFC93A"/>
<path
android:pathData="M31.5,36C33.9853,36 36,38.0147 36,40.5C36,42.9853 33.9853,45 31.5,45H18C15.5147,45 13.5,42.9853 13.5,40.5C13.5,38.0147 15.5147,36 18,36H31.5Z"
android:fillColor="#FFC93A"/>
<path
android:pathData="M0,4.5C0,2.0147 2.0147,0 4.5,0H13.5C15.9853,0 18,2.0147 18,4.5C18,6.9853 15.9853,9 13.5,9H4.5C2.0147,9 0,6.9853 0,4.5Z"
android:fillColor="#140579"/>
<path
android:pathData="M22.5,22.5C22.5,20.0147 20.4853,18 18,18H4.5C2.0147,18 0,20.0147 0,22.5C0,24.9853 2.0147,27 4.5,27H18C20.4853,27 22.5,24.9853 22.5,22.5Z"
android:fillColor="#140579"/>
<path
android:pathData="M4.5,36C6.9853,36 9,38.0147 9,40.5C9,42.9853 6.9853,45 4.5,45C2.0147,45 0,42.9853 0,40.5C0,38.0147 2.0147,36 4.5,36Z"
android:fillColor="#140579"/>
</vector>

View file

@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M6,4C6,2.8954 6.8954,2 8,2H20C21.1046,2 22,2.8954 22,4V16C22,17.1046 21.1046,18 20,18H8C6.8954,18 6,17.1046 6,16V4ZM15,6H13V9H10V11H13V14H15V11H18V9H15V6Z"
android:fillColor="#237BFF"
android:fillType="evenOdd"/>
<path
android:pathData="M2,6H4V20H18V22H4C2.8954,22 2,21.1046 2,20V6Z"
android:fillColor="#237BFF"/>
</vector>

View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="56dp">
<ImageView
android:id="@+id/back_button"
style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:contentDescription="@string/shared_string_back"
app:srcCompat="@drawable/ic_arrow_back"/>
</LinearLayout>
<ImageView
android:id="@+id/opr_img"
style="@style/Widget.AppCompat.Toolbar.Button.Navigation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:contentDescription="@string/shared_string_back"
app:srcCompat="@drawable/ic_img_logo_openplacereview"/>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:textColor="@color/color_black"
android:textSize="20sp"
android:lineSpacingExtra="5sp"
android:textAlignment="center"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="6dp"
android:text="@string/register_on_openplacereviews"
android:gravity="center_horizontal"/>
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:layout_marginLeft="16dp"
android:lineSpacingExtra="5sp"
android:textColor="@color/color_black"
android:textColorLink="@color/icon_color_active_light"
android:layout_marginRight="16dp"
android:autoLink="all"
android:text="@string/register_on_openplacereviews_desc"/>
<LinearLayout
android:gravity="bottom"
android:orientation="vertical"
android:layout_marginBottom="12dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/register_opr_create_account"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="6dp"
android:text="@string/register_opr_create_new_account"
android:layout_marginTop="12dp"
android:background="@color/icon_color_active_light"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/register_opr_have_account"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="6dp"
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"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>

View file

@ -11,6 +11,11 @@
Thx - Hardy
-->
<string name="register_opr_have_account">I already have an account</string>
<string name="register_opr_create_new_account">Create new account</string>
<string name="register_on_openplacereviews_desc">Photos are provided by open data project OpenPlaceReviews.org. In order to upload your photos you need to sign up on website.</string>
<string name="register_on_openplacereviews">Register on\nOpenPlaceReviews.org</string>
<string name="shared_string_add_photo">Add photo</string>
<string name="subscription_on_hold_title">OsmAnd Live subscription is on hold</string>
<string name="subscription_paused_title">OsmAnd Live subscription has been paused</string>
<string name="subscription_expired_title">OsmAnd Live subscription has been expired</string>

View file

@ -8,6 +8,7 @@ import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
@ -21,30 +22,19 @@ import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.*;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import net.osmand.AndroidUtils;
import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.data.Amenity;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.data.QuadRect;
import net.osmand.osm.PoiCategory;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.*;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.mapcontextmenu.builders.cards.AbstractCard;
@ -53,6 +43,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.poi.PoiUIFilter;
import net.osmand.plus.render.RenderingIcons;
import net.osmand.plus.transport.TransportStopRoute;
@ -63,13 +54,7 @@ import net.osmand.plus.widgets.tools.ClickableSpanTouchListener;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import static net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask.GetImageCardsListener;
@ -77,7 +62,7 @@ public class MenuBuilder {
public static final float SHADOW_HEIGHT_TOP_DP = 17f;
public static final int TITLE_LIMIT = 60;
protected static final String[] arrowChars = new String[]{"=>"," - "};
protected static final String[] arrowChars = new String[] {"=>", " - "};
protected MapActivity mapActivity;
protected MapContextMenu mapContextMenu;
@ -254,7 +239,7 @@ public class MenuBuilder {
protected boolean needBuildPlainMenuItems() {
return true;
}
protected boolean needBuildCoordinatesRow() {
return true;
}
@ -282,7 +267,7 @@ public class MenuBuilder {
protected void buildNearestWikiRow(View view) {
if (processNearestWiki() && nearestWiki.size() > 0) {
buildRow(view, R.drawable.ic_action_wikipedia, null, app.getString(R.string.wiki_around) + " (" + nearestWiki.size()+")", 0,
buildRow(view, R.drawable.ic_action_wikipedia, null, app.getString(R.string.wiki_around) + " (" + nearestWiki.size() + ")", 0,
true, getCollapsableWikiView(view.getContext(), true),
false, 0, false, null, false);
}
@ -296,7 +281,14 @@ public class MenuBuilder {
boolean needUpdateOnly = onlinePhotoCardsRow != null && onlinePhotoCardsRow.getMenuBuilder() == this;
onlinePhotoCardsRow = new CardsRowBuilder(this, view, false);
onlinePhotoCardsRow.build();
CollapsableView collapsableView = new CollapsableView(onlinePhotoCardsRow.getContentView(), this,
LinearLayout parent = new LinearLayout(view.getContext());
parent.setLayoutParams(
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
parent.setOrientation(LinearLayout.VERTICAL);
parent.addView(onlinePhotoCardsRow.getContentView());
parent.addView(createAddPhotoButton(view.getContext()));
CollapsableView collapsableView = new CollapsableView(parent, this,
app.getSettings().ONLINE_PHOTOS_ROW_COLLAPSED);
collapsableView.setCollapseExpandListener(new CollapseExpandListener() {
@Override
@ -316,15 +308,46 @@ public class MenuBuilder {
}
}
private View createAddPhotoButton(Context context) {
TextView b = new TextView(context);
b.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
mapActivity.getSupportFragmentManager().beginTransaction()
.add(R.id.fragmentContainer, new OprStartFragment(), "OPR_REGISTER_FRAGMENT")
.addToBackStack(null).commit();
}
});
b.setTypeface(FontCache.getRobotoRegular(context));
Drawable d = ContextCompat.getDrawable(context, R.drawable.ic_sample);
b.setCompoundDrawablesWithIntrinsicBounds(d, null, null, null);
LinearLayout.LayoutParams params = new
LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
int dp16 = AndroidUtils.dpToPx(context, 16f);
int dp8 = AndroidUtils.dpToPx(context, 8f);
params.setMargins(dp16, 0, dp16, dp16);
b.setPadding(dp8, dp8, dp16, dp8);
b.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
b.setLayoutParams(params);
b.setCompoundDrawablePadding(dp8);
b.setGravity(Gravity.CENTER_VERTICAL);
b.setTypeface(null, Typeface.BOLD);
b.setText(context.getResources().getString(R.string.shared_string_add_photo));
b.setBackgroundResource(R.drawable.btn_border_light);
b.setTextColor(ContextCompat.getColor(context,R.color.preference_category_title));
return b;
}
private void buildCoordinatesRow(View view) {
Map<Integer, String> locationData = PointDescription.getLocationData(mapActivity, latLon.getLatitude(), latLon.getLongitude(), true);
String title = locationData.get(PointDescription.LOCATION_LIST_HEADER);
locationData.remove(PointDescription.LOCATION_LIST_HEADER);
CollapsableView cv = getLocationCollapsableView(locationData);
buildRow(view, R.drawable.ic_action_get_my_location, null, title, 0, true, cv, false, 1,
false, null, false);
false, null, false);
}
private void startLoadingImages() {
if (onlinePhotoCardsRow == null) {
return;
@ -379,7 +402,7 @@ public class MenuBuilder {
}
}
protected void buildDescription(View view){
protected void buildDescription(View view) {
}
protected void buildAfter(View view) {
@ -395,8 +418,8 @@ public class MenuBuilder {
}
public View buildRow(View view, int iconId, String buttonText, String text, int textColor,
boolean collapsable, final CollapsableView collapsableView,
boolean needLinks, int textLinesLimit, boolean isUrl, OnClickListener onClickListener, boolean matchWidthDivider) {
boolean collapsable, final CollapsableView collapsableView,
boolean needLinks, int textLinesLimit, boolean isUrl, OnClickListener onClickListener, boolean matchWidthDivider) {
return buildRow(view, iconId == 0 ? null : getRowIcon(iconId), buttonText, text, textColor, null, collapsable, collapsableView,
needLinks, textLinesLimit, isUrl, onClickListener, matchWidthDivider);
}
@ -480,7 +503,7 @@ public class MenuBuilder {
textPrefixView.setLayoutParams(llTextParams);
textPrefixView.setTypeface(FontCache.getRobotoRegular(view.getContext()));
textPrefixView.setTextSize(12);
textPrefixView.setTextColor(app.getResources().getColor(light ? R.color.text_color_secondary_light: R.color.text_color_secondary_dark));
textPrefixView.setTextColor(app.getResources().getColor(light ? R.color.text_color_secondary_light : R.color.text_color_secondary_dark));
textPrefixView.setMinLines(1);
textPrefixView.setMaxLines(1);
textPrefixView.setText(textPrefix);
@ -526,7 +549,7 @@ public class MenuBuilder {
textViewSecondary.setLayoutParams(llTextSecondaryParams);
textViewSecondary.setTypeface(FontCache.getRobotoRegular(view.getContext()));
textViewSecondary.setTextSize(14);
textViewSecondary.setTextColor(app.getResources().getColor(light ? R.color.text_color_secondary_light: R.color.text_color_secondary_dark));
textViewSecondary.setTextColor(app.getResources().getColor(light ? R.color.text_color_secondary_light : R.color.text_color_secondary_dark));
textViewSecondary.setText(secondaryText);
llText.addView(textViewSecondary);
}
@ -581,7 +604,7 @@ public class MenuBuilder {
}
if (collapsableView.getContentView().getParent() != null) {
((ViewGroup) collapsableView.getContentView().getParent())
.removeView(collapsableView.getContentView());
.removeView(collapsableView.getContentView());
}
baseView.addView(collapsableView.getContentView());
}
@ -682,7 +705,7 @@ public class MenuBuilder {
ssb.append("UTM: ");
} else if (line.getKey() == OsmAndFormatter.MGRS_FORMAT) {
ssb.append("MGRS: ");
} else if (line.getKey() == OsmAndFormatter.OLC_FORMAT){
} else if (line.getKey() == OsmAndFormatter.OLC_FORMAT) {
ssb.append("OLC: ");
}
ssb.setSpan(new ForegroundColorSpan(app.getResources().getColor(R.color.text_color_secondary_light)), 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
@ -747,8 +770,8 @@ public class MenuBuilder {
}
public void addPlainMenuItem(int iconId, String text, boolean needLinks, boolean isUrl,
boolean collapsable, CollapsableView collapsableView,
OnClickListener onClickListener) {
boolean collapsable, CollapsableView collapsableView,
OnClickListener onClickListener) {
plainMenuItems.add(new PlainMenuItem(iconId, null, text, needLinks, isUrl, collapsable, collapsableView, onClickListener));
}
@ -970,7 +993,7 @@ public class MenuBuilder {
button.setTypeface(FontCache.getRobotoRegular(context));
int bg;
if (selected) {
bg = light ? R.drawable.context_menu_controller_bg_light_selected: R.drawable.context_menu_controller_bg_dark_selected;
bg = light ? R.drawable.context_menu_controller_bg_light_selected : R.drawable.context_menu_controller_bg_dark_selected;
} else if (showAll) {
bg = light ? R.drawable.context_menu_controller_bg_light_show_all : R.drawable.context_menu_controller_bg_dark_show_all;
} else {
@ -1027,7 +1050,7 @@ public class MenuBuilder {
private List<Amenity> getAmenities(QuadRect rect, PoiUIFilter wikiPoiFilter) {
return wikiPoiFilter.searchAmenities(rect.top, rect.left,
rect.bottom, rect.right, -1, null);
rect.bottom, rect.right, -1, null);
}
@SuppressWarnings("unchecked")

View file

@ -0,0 +1,19 @@
package net.osmand.plus.openplacereviews;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import net.osmand.plus.R;
import net.osmand.plus.base.BaseOsmAndFragment;
public class OprStartFragment extends BaseOsmAndFragment {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_opr_login, container, false);
return v;
}
}