mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 21:13:35 +00:00
[android] Migrate login screen to Material components
Signed-off-by: Jean-Baptiste Charron <jeanbaptiste.charron@outlook.fr>
This commit is contained in:
committed by
Konstantin Pastbin
parent
7d834beba5
commit
d38ffe2fa8
@@ -6,7 +6,6 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.ScrollView;
|
||||
|
||||
@@ -24,14 +23,16 @@ import app.organicmaps.util.Utils;
|
||||
import app.organicmaps.util.WindowInsetUtils.ScrollableContentInsetsListener;
|
||||
import app.organicmaps.util.concurrency.ThreadPool;
|
||||
import app.organicmaps.util.concurrency.UiThread;
|
||||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
|
||||
public class OsmLoginFragment extends BaseMwmToolbarFragment
|
||||
{
|
||||
private ProgressBar mProgress;
|
||||
private Button mLoginButton;
|
||||
private Button mLostPasswordButton;
|
||||
private MaterialButton mLoginButton;
|
||||
private MaterialButton mLostPasswordButton;
|
||||
private TextInputEditText mLoginInput;
|
||||
private TextInputEditText mPasswordInput;
|
||||
|
||||
@@ -51,7 +52,7 @@ public class OsmLoginFragment extends BaseMwmToolbarFragment
|
||||
mPasswordInput = view.findViewById(R.id.osm_password);
|
||||
mLoginButton = view.findViewById(R.id.login);
|
||||
mLostPasswordButton = view.findViewById(R.id.lost_password);
|
||||
Button registerButton = view.findViewById(R.id.register);
|
||||
MaterialButton registerButton = view.findViewById(R.id.register);
|
||||
registerButton.setOnClickListener((v) -> Utils.openUrl(requireActivity(), Constants.Url.OSM_REGISTER));
|
||||
mProgress = view.findViewById(R.id.osm_login_progress);
|
||||
final String dataVersion = DateUtils.getShortDateFormatter().format(Framework.getDataVersion());
|
||||
|
||||
@@ -6,9 +6,7 @@ import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -22,15 +20,17 @@ import app.organicmaps.util.WindowInsetUtils;
|
||||
import app.organicmaps.util.concurrency.ThreadPool;
|
||||
import app.organicmaps.util.concurrency.UiThread;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.imageview.ShapeableImageView;
|
||||
import com.google.android.material.textview.MaterialTextView;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
|
||||
public class ProfileFragment extends BaseMwmToolbarFragment
|
||||
{
|
||||
private View mUserInfoBlock;
|
||||
private TextView mEditsSent;
|
||||
private TextView mProfileName;
|
||||
private ImageView mProfileImage;
|
||||
private MaterialTextView mEditsSent;
|
||||
private MaterialTextView mProfileName;
|
||||
private ShapeableImageView mProfileImage;
|
||||
private ProgressBar mProfileInfoLoading;
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/margin_base">
|
||||
<TextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -47,7 +47,7 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="@dimen/osm_logo"
|
||||
android:layout_height="@dimen/osm_logo"
|
||||
@@ -56,7 +56,7 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<TextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/osm_presentation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -108,7 +108,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/margin_base">
|
||||
<Button
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/login"
|
||||
style="@style/MwmWidget.Button.Accent"
|
||||
android:layout_width="match_parent"
|
||||
@@ -123,7 +123,7 @@
|
||||
android:elevation="@dimen/design_fab_elevation"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
<Button
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/lost_password"
|
||||
style="@style/MwmWidget.Button"
|
||||
android:layout_width="match_parent"
|
||||
@@ -138,14 +138,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_base"
|
||||
android:layout_marginBottom="@dimen/margin_base" />
|
||||
<TextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@string/robotoRegular"
|
||||
android:text="@string/no_osm_account"
|
||||
android:textAppearance="@style/MwmTextAppearance.Body2"
|
||||
android:textColor="?android:textColorPrimary" />
|
||||
<Button
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/register"
|
||||
style="@style/MwmWidget.Button.Accent"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/margin_base"
|
||||
tools:ignore="ScrollViewSize">
|
||||
<TextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/textView2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -39,7 +39,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/margin_base">
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/osm_logo"
|
||||
android:layout_width="@dimen/osm_logo"
|
||||
android:layout_height="@dimen/osm_logo"
|
||||
@@ -48,7 +48,7 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
<TextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/osm_presentation"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -92,7 +92,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/margin_base">
|
||||
<Button
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/login"
|
||||
style="@style/MwmWidget.Button.Accent"
|
||||
android:layout_width="match_parent"
|
||||
@@ -107,7 +107,7 @@
|
||||
android:elevation="@dimen/design_fab_elevation"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
<Button
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/lost_password"
|
||||
style="@style/MwmWidget.Button"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -122,14 +122,14 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/margin_base"
|
||||
android:layout_marginBottom="@dimen/margin_base" />
|
||||
<TextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@string/robotoRegular"
|
||||
android:text="@string/no_osm_account"
|
||||
android:textAppearance="@style/MwmTextAppearance.Body2"
|
||||
android:textColor="?android:textColorPrimary" />
|
||||
<Button
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/register"
|
||||
style="@style/MwmWidget.Button.Accent"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
style="@style/MwmWidget.ToolbarStyle"
|
||||
android:layout_width="match_parent"
|
||||
@@ -15,7 +15,7 @@
|
||||
android:gravity="end|center_vertical"
|
||||
android:theme="@style/MwmWidget.ToolbarTheme"
|
||||
tools:ignore="UnusedAttribute">
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/logout"
|
||||
android:layout_width="?actionBarSize"
|
||||
android:layout_height="?actionBarSize"
|
||||
@@ -24,7 +24,7 @@
|
||||
android:scaleType="center"
|
||||
app:srcCompat="@drawable/ic_logout"
|
||||
android:contentDescription="@string/logout" />
|
||||
</androidx.appcompat.widget.Toolbar>
|
||||
</com.google.android.material.appbar.MaterialToolbar>
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -44,7 +44,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:orientation="horizontal">
|
||||
<ImageView
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/user_profile_image"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="match_parent"
|
||||
@@ -57,7 +57,7 @@
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/user_profile_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -68,7 +68,7 @@
|
||||
android:autoSizeTextType="uniform"
|
||||
android:textSize="25sp"
|
||||
tools:text="Long Username" />
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/user_sent_edits"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -76,7 +76,7 @@
|
||||
android:textSize="35sp"
|
||||
android:textStyle="bold"
|
||||
tools:text="2,000,000" />
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/verified_changes_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
@@ -93,7 +93,7 @@
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<TextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/osm_history"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -110,7 +110,7 @@
|
||||
android:textColor="?colorAccent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/osm_notes"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -126,7 +126,7 @@
|
||||
android:textColor="?colorAccent"
|
||||
app:layout_constraintTop_toBottomOf="@id/osm_history" />
|
||||
|
||||
<TextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/about_osm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user