Fix add point button
This commit is contained in:
parent
a661ce677f
commit
53a3b24c6c
4 changed files with 58 additions and 39 deletions
|
@ -1,25 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/color_white"
|
||||
android:background="?attr/bg_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:background="@color/color_white"
|
||||
android:background="?attr/bg_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp">
|
||||
android:layout_height="@dimen/toolbar_height">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/toolbar_text"
|
||||
android:textSize="20sp"
|
||||
tools:text="demdadao"
|
||||
android:textColor="@color/color_black"
|
||||
android:textSize="@dimen/dialog_header_text_size"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
|
|
@ -311,35 +311,37 @@ public class MenuBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
private View createAddPhotoButton(Context context) {
|
||||
TextView b = new TextView(context);
|
||||
b.setOnClickListener(new OnClickListener() {
|
||||
private View createAddPhotoButton(Context ctx) {
|
||||
boolean nightMode = getApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
View view = UiUtilities.getInflater(app, nightMode).inflate(R.layout.bottom_sheet_dialog_button, null);
|
||||
LinearLayout buttonLayout = new LinearLayout(ctx);
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
AddPhotosBottomSheetDialogFragment.showInstance(mapActivity.getSupportFragmentManager());
|
||||
}
|
||||
});
|
||||
b.setTypeface(FontCache.getRobotoRegular(context));
|
||||
Drawable d = ContextCompat.getDrawable(context, R.drawable.ic_sample);
|
||||
b.setCompoundDrawablesWithIntrinsicBounds(d, null, null, null);
|
||||
int dp6 = ctx.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_title_padding_bottom);
|
||||
int dp8 = ctx.getResources().getDimensionPixelSize(R.dimen.content_padding_half);
|
||||
int dp12 = ctx.getResources().getDimensionPixelSize(R.dimen.content_padding_small);
|
||||
int dp16 = ctx.getResources().getDimensionPixelSize(R.dimen.content_padding);
|
||||
view.findViewById(R.id.button_text).setPadding(dp8, 0, dp16, 0);
|
||||
((TextView) view.findViewById(R.id.button_text)).setCompoundDrawablePadding(0);
|
||||
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);
|
||||
params.setMargins(dp16, 0, dp12, dp16);
|
||||
buttonLayout.setLayoutParams(params);
|
||||
LinearLayout.LayoutParams buttonParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
|
||||
ctx.getResources().getDimensionPixelSize(R.dimen.dialog_button_height));
|
||||
view.setLayoutParams(buttonParams);
|
||||
buttonLayout.addView(view);
|
||||
UiUtilities.setupDialogButton(nightMode, buttonLayout, UiUtilities.DialogButtonType.STROKED,
|
||||
ctx.getString(R.string.shared_string_add_photo), R.drawable.ic_sample);
|
||||
((TextView) view.findViewById(R.id.button_text)).setCompoundDrawablePadding(dp6);
|
||||
//TODO This feature is under development
|
||||
b.setVisibility(View.VISIBLE);
|
||||
b.setTextColor(ContextCompat.getColor(context, R.color.preference_category_title));
|
||||
return b;
|
||||
buttonLayout.setVisibility(View.VISIBLE);
|
||||
return buttonLayout;
|
||||
}
|
||||
|
||||
private void buildCoordinatesRow(View view) {
|
||||
|
|
|
@ -2,8 +2,10 @@ package net.osmand.plus.openplacereviews;
|
|||
|
||||
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
@ -12,8 +14,10 @@ import androidx.appcompat.widget.Toolbar;
|
|||
import androidx.core.content.ContextCompat;
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.BuildConfig;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
|
||||
public class OPRWebviewActivity extends OsmandActionBarActivity {
|
||||
public static final String KEY_LOGIN = "LOGIN_KEY";
|
||||
|
@ -27,24 +31,38 @@ public class OPRWebviewActivity extends OsmandActionBarActivity {
|
|||
private boolean isLogin = false;
|
||||
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
OsmandSettings settings = app.getSettings();
|
||||
boolean nightMode = !settings.isLightContent();
|
||||
int themeId = nightMode ? R.style.OsmandDarkTheme_NoActionbar : R.style.OsmandLightTheme_NoActionbar_LightStatusBar;
|
||||
setTheme(themeId);
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_opr_webview);
|
||||
Bundle b = getIntent().getExtras();
|
||||
setSupportActionBar(this.<Toolbar>findViewById(R.id.toolbar));
|
||||
if (b != null) {
|
||||
String title = b.getString(KEY_TITLE, "");
|
||||
this.<TextView>findViewById(R.id.toolbar_text).setText(title);
|
||||
Bundle bundle = getIntent().getExtras();
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
if (bundle != null) {
|
||||
TextView titleView = findViewById(R.id.toolbar_text);
|
||||
String title = bundle.getString(KEY_TITLE, "");
|
||||
titleView.setText(title);
|
||||
}
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
final Drawable upArrow = getMyApplication().getUIUtilities().getIcon(AndroidUtils.getNavigationIconResId(this));
|
||||
ColorDrawable colorDrawable = new ColorDrawable(AndroidUtils.getColorFromAttr(app, R.attr.bg_color));
|
||||
toolbar.setBackgroundDrawable(colorDrawable);
|
||||
final Drawable upArrow = app.getUIUtilities().getIcon(AndroidUtils.getNavigationIconResId(this));
|
||||
upArrow.setColorFilter(ContextCompat.getColor(this, R.color.color_favorite_gray), PorterDuff.Mode.SRC_ATOP);
|
||||
getSupportActionBar().setHomeAsUpIndicator(upArrow);
|
||||
webView = (WebView) findViewById(R.id.printDialogWebview);
|
||||
toolbar.setNavigationIcon(upArrow);
|
||||
toolbar.setNavigationContentDescription(R.string.access_shared_string_navigate_up);
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onBackPressed();
|
||||
}
|
||||
});
|
||||
webView = findViewById(R.id.printDialogWebview);
|
||||
webView.setWebViewClient(new CloseOnSuccessWebViewClient());
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
WebView.setWebContentsDebuggingEnabled(true);
|
||||
if (b != null) {
|
||||
isLogin = b.getBoolean(KEY_LOGIN);
|
||||
if (bundle != null) {
|
||||
isLogin = bundle.getBoolean(KEY_LOGIN);
|
||||
if (isLogin) {
|
||||
webView.loadUrl(loginUrl);
|
||||
} else {
|
||||
|
|
|
@ -33,7 +33,8 @@ public class OprStartFragment extends BaseOsmAndFragment {
|
|||
@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);
|
||||
View v = UiUtilities.getInflater(requireMyActivity(), nightMode).inflate(R.layout.fragment_opr_login, container,
|
||||
false);
|
||||
View createAccount = v.findViewById(R.id.register_opr_create_account);
|
||||
v.findViewById(R.id.back_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue