Android Change/BindPhoneNum Impl

This commit is contained in:
Aigio Liu
2022-03-04 19:40:26 +08:00
parent 6c905ab4c7
commit 33b76c6622
18 changed files with 700 additions and 103 deletions
@@ -29,7 +29,7 @@ namespace System.Application.Services
if ((!string.IsNullOrWhiteSpace(value)) &&
(string.IsNullOrWhiteSpace(textBoxText) ||
(textBoxText.Length < value.Length &&
value.Substring(0, textBoxText.Length) == textBoxText)))
value[..textBoxText.Length] == textBoxText)))
{
return value;
}
+29 -25
View File
@@ -84,34 +84,38 @@ namespace System.Application
return default;
}
public static void StartActivity(Activity activity, Type activityType, object viewModel, Type? viewModelType = null)
{
viewModelType ??= viewModel.GetType();
var viewModel_ = Serializable.SMP(viewModelType, viewModel);
#if DEBUG
var t = Serializable.DMP(viewModelType, viewModel_);
#endif
StartActivity(activity, activityType, viewModel_);
}
// [Obsolete]
// public static void StartActivity(Activity activity, Type activityType, object viewModel, Type? viewModelType = null)
// {
// viewModelType ??= viewModel.GetType();
// var viewModel_ = Serializable.SMP(viewModelType, viewModel);
//#if DEBUG
// var t = Serializable.DMP(viewModelType, viewModel_);
//#endif
// StartActivity(activity, activityType, viewModel_);
// }
public static void StartActivity(Fragment fragment, Type activityType, object viewModel, Type? viewModelType = null)
{
var activity = fragment.Activity;
if (activity == null) return;
StartActivity(activity, activityType, viewModel, viewModelType);
}
// [Obsolete]
// public static void StartActivity(Fragment fragment, Type activityType, object viewModel, Type? viewModelType = null)
// {
// var activity = fragment.Activity;
// if (activity == null) return;
// StartActivity(activity, activityType, viewModel, viewModelType);
// }
public static void StartActivity<TActivity>(Activity activity, object viewModel, Type? viewModelType = null)
{
StartActivity(activity, typeof(TActivity), viewModel, viewModelType);
}
// [Obsolete]
// public static void StartActivity<TActivity>(Activity activity, object viewModel, Type? viewModelType = null)
// {
// StartActivity(activity, typeof(TActivity), viewModel, viewModelType);
// }
public static void StartActivity<TActivity>(Fragment fragment, object viewModel, Type? viewModelType = null)
{
var activity = fragment.Activity;
if (activity == null) return;
StartActivity<TActivity>(activity, viewModel, viewModelType);
}
// [Obsolete]
// public static void StartActivity<TActivity>(Fragment fragment, object viewModel, Type? viewModelType = null)
// {
// var activity = fragment.Activity;
// if (activity == null) return;
// StartActivity<TActivity>(activity, viewModel, viewModelType);
// }
public static void StartActivity<TViewModel>(Activity activity, Type activityType, TViewModel viewModel)
{
@@ -529,6 +529,18 @@
<AndroidBoundLayout Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\layout\fragment_basic_profile_content.xml">
<Link>Resources\layout\fragment_basic_profile_content.xml</Link>
</AndroidBoundLayout>
<AndroidBoundLayout Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\layout\fragment_bind_phone_number.xml">
<Link>Resources\layout\fragment_bind_phone_number.xml</Link>
</AndroidBoundLayout>
<AndroidBoundLayout Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\layout\fragment_bind_phone_number_content.xml">
<Link>Resources\layout\fragment_bind_phone_number_content.xml</Link>
</AndroidBoundLayout>
<AndroidBoundLayout Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\layout\fragment_change_bind_phone_number.xml">
<Link>Resources\layout\fragment_change_bind_phone_number.xml</Link>
</AndroidBoundLayout>
<AndroidBoundLayout Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\layout\fragment_change_bind_phone_number_content.xml">
<Link>Resources\layout\fragment_change_bind_phone_number_content.xml</Link>
</AndroidBoundLayout>
<AndroidBoundLayout Include="..\ST.Client.Mobile.Droid.Design\ui\src\main\res\layout\fragment_community_fix.xml">
<Link>Resources\layout\fragment_community_fix.xml</Link>
</AndroidBoundLayout>
@@ -1,22 +0,0 @@
using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Runtime;
namespace System.Application.UI.Activities
{
[Authorize]
[Register(JavaPackageConstants.Activities + nameof(BindPhoneNumberActivity))]
[Activity(Theme = ManifestConstants.MainTheme2,
LaunchMode = LaunchMode.SingleTask,
ConfigurationChanges = ManifestConstants.ConfigurationChanges)]
internal sealed class BindPhoneNumberActivity : BaseActivity
{
protected override int? LayoutResource => throw new NotImplementedException();
protected override void OnCreate2(Bundle? savedInstanceState)
{
base.OnCreate2(savedInstanceState);
}
}
}
@@ -1,22 +0,0 @@
using Android.App;
using Android.Content.PM;
using Android.OS;
using Android.Runtime;
namespace System.Application.UI.Activities
{
[Authorize]
[Register(JavaPackageConstants.Activities + nameof(ChangePhoneNumberActivity))]
[Activity(Theme = ManifestConstants.MainTheme2,
LaunchMode = LaunchMode.SingleTask,
ConfigurationChanges = ManifestConstants.ConfigurationChanges)]
internal sealed class ChangePhoneNumberActivity : BaseActivity
{
protected override int? LayoutResource => throw new NotImplementedException();
protected override void OnCreate2(Bundle? savedInstanceState)
{
base.OnCreate2(savedInstanceState);
}
}
}
@@ -8,6 +8,8 @@ using System.Application.UI.Fragments;
using System.Application.UI.Resx;
using System.Application.UI.ViewModels;
using Fragment = AndroidX.Fragment.App.Fragment;
using NUserService = System.Application.Services.UserService;
using static System.Application.UI.ViewModels.UserProfileWindowViewModel;
namespace System.Application.UI.Activities
{
@@ -33,14 +35,18 @@ namespace System.Application.UI.Activities
var adapter = new ViewPagerWithTabLayoutAdapter(this, this);
binding!.pager.SetupWithTabLayout(binding!.tab_layout, adapter);
var position = this.GetViewModel<SubPageType>();
GoToSubPage(position);
}
int ViewPagerAdapter.IHost.ItemCount => 2;
int ViewPagerAdapter.IHost.ItemCount => pageCount;
Fragment ViewPagerAdapter.IHost.CreateFragment(int position) => position switch
{
0 => new UserBasicInfoFragment(),
1 => new UserAccountBindFragment(),
2 => NUserService.Current.HasPhoneNumber ? new ChangePhoneNumberFragment() : new BindPhoneNumberFragment(),
_ => throw new ArgumentOutOfRangeException(nameof(position), position.ToString()),
};
@@ -48,6 +54,7 @@ namespace System.Application.UI.Activities
{
0 => AppResources.User_BasicInfo,
1 => AppResources.User_AccountBind,
2 => NUserService.Current.HasPhoneNumber ? AppResources.User_ChangePhoneNum : AppResources.User_BindPhoneNum,
_ => throw new ArgumentOutOfRangeException(nameof(position), position.ToString()),
};
@@ -64,5 +71,26 @@ namespace System.Application.UI.Activities
base.OnBackPressed();
}
const int pageCount = 3;
public static void StartActivity(Activity activity, SubPageType position = 0)
{
if (position.IsDefined())
{
GoToPlatformPages.StartActivity<UserProfileActivity, SubPageType>(activity, position);
}
else
{
activity.StartActivity<UserProfileActivity>();
}
}
public void GoToSubPage(SubPageType position)
{
if (position.IsDefined())
{
binding!.pager.SetCurrentItem((int)position, false);
}
}
}
}
@@ -42,19 +42,19 @@ namespace System.Application.UI.Fragments
return;
}
#if !DEBUG
var isUnderConstruction = e.Current.Id switch
{
PreferenceButton.BindPhoneNumber or
PreferenceButton.ChangePhoneNumber or PreferenceButton.UserProfile => true,
_ => false,
};
if (isUnderConstruction)
{
MainApplication.ShowUnderConstructionTips();
return;
}
#endif
//#if !DEBUG
// var isUnderConstruction = e.Current.Id switch
// {
// PreferenceButton.BindPhoneNumber or
// PreferenceButton.ChangePhoneNumber or PreferenceButton.UserProfile => true,
// _ => false,
// };
// if (isUnderConstruction)
// {
// MainApplication.ShowUnderConstructionTips();
// return;
// }
//#endif
#if __XAMARIN_FORMS__
var route = e.Current.Id switch
@@ -73,16 +73,23 @@ namespace System.Application.UI.Fragments
}
#endif
var activityType = e.Current.Id switch
switch (e.Current.Id)
{
PreferenceButton.UserProfile => typeof(UserProfileActivity),
PreferenceButton.BindPhoneNumber => typeof(BindPhoneNumberActivity),
PreferenceButton.ChangePhoneNumber => typeof(ChangePhoneNumberActivity),
PreferenceButton.Settings => typeof(SettingsActivity),
PreferenceButton.About => typeof(AboutActivity),
_ => (Type?)null,
};
if (activityType != null) this.StartActivity(activityType);
case PreferenceButton.UserProfile:
this.StartActivity<UserProfileActivity>();
break;
case PreferenceButton.BindPhoneNumber:
case PreferenceButton.ChangePhoneNumber:
UserProfileActivity.StartActivity(RequireActivity(),
UserProfileWindowViewModel.SubPageType.ChangeOrBindPhoneNumber);
break;
case PreferenceButton.Settings:
this.StartActivity<SettingsActivity>();
break;
case PreferenceButton.About:
this.StartActivity<AboutActivity>();
break;
}
};
binding.rvPreferenceButtons.SetLinearLayoutManager();
binding.rvPreferenceButtons.AddVerticalGroupItemDecoration(binding.rvPreferenceButtons.PaddingTop);
@@ -93,9 +100,9 @@ namespace System.Application.UI.Fragments
{
if (view.Id == Resource.Id.layoutUser)
{
#if !DEBUG
MainApplication.ShowUnderConstructionTips();
#else
//#if !DEBUG
// MainApplication.ShowUnderConstructionTips();
//#else
if (UserService.Current.IsAuthenticated)
{
this.StartActivity<UserProfileActivity>();
@@ -104,7 +111,7 @@ namespace System.Application.UI.Fragments
{
this.StartActivity<LoginOrRegisterActivity>();
}
#endif
//#endif
return true;
}
//else if (view.Id == Resource.Id.???)
@@ -0,0 +1,137 @@
using Android.Text;
using Android.Views;
using Android.Views.InputMethods;
using Android.Widget;
using Binding;
using ReactiveUI;
using System.Application.Services;
using System.Application.UI.Resx;
using System.Application.UI.ViewModels;
using System.Collections.Generic;
using static System.Application.UI.ViewModels.UserProfileWindowViewModel;
namespace System.Application.UI.Fragments
{
[Authorize]
internal sealed class BindPhoneNumberFragment : BaseFragment<fragment_bind_phone_number, UserProfileWindowViewModel>, TextView.IOnEditorActionListener
{
protected override int? LayoutResource => Resource.Layout.fragment_bind_phone_number;
public new BindPhoneNumberWindowViewModel ViewModel => base.ViewModel!.BindPhoneNumberVM;
public override void OnCreateView(View view)
{
base.OnCreateView(view);
binding!.tbPhoneNumber.TextChanged += (_, _)
=> ViewModel.PhoneNumber = binding!.tbPhoneNumber.Text;
binding!.tbSmsCode.TextChanged += (_, _)
=> ViewModel.SmsCode = binding!.tbSmsCode.Text;
OnCreateViewAsync();
// https://developer.android.google.cn/reference/android/widget/TextView.html#protected-methods
binding!.tbPhoneNumber.SetRawInputType(InputTypes.ClassPhone);
binding!.tbPhoneNumber.SetDigitsKeyListener();
binding!.tbPhoneNumber.SetMaxLength(ModelValidatorLengths.PhoneNumber);
binding!.tbPhoneNumber.ImeOptions = ImeAction.Next;
binding!.tbPhoneNumber.SetOnEditorActionListener(this);
binding!.tbSmsCode.SetRawInputType(InputTypes.ClassNumber | InputTypes.NumberVariationNormal);
binding!.tbSmsCode.SetDigitsKeyListener();
binding!.tbSmsCode.SetMaxLength(ModelValidatorLengths.SMS_CAPTCHA);
binding!.tbSmsCode.ImeOptions = ImeAction.Done;
binding!.tbSmsCode.SetOnEditorActionListener(this);
R.Subscribe(() =>
{
if (binding == null) return;
binding.tbPhoneNumber.Hint = AppResources.User_Phone;
binding!.tbPhoneNumber.SetImeActionLabel(AppResources.NextStep, binding!.tbPhoneNumber.ImeOptions);
binding.tbSmsCode.Hint = AppResources.User_SMSCode;
binding.tbSmsCode.SetImeActionLabel(AppResources.Btn_Text_Complete, binding!.tbSmsCode.ImeOptions);
binding.btnDone.Text = AppResources.Btn_Text_Complete;
if (!ViewModel!.IsUnTimeLimit)
{
binding.btnSendSms.Text = AppResources.User_GetSMSCode;
}
}).AddTo(this);
ViewModel!.WhenAnyValue(x => x.IsLoading).SubscribeInMainThread(value =>
{
if (binding == null) return;
binding.loading.Visibility = value ? ViewStates.Visible : ViewStates.Gone;
binding.group_show_when_loading_false.Visibility = !value ? ViewStates.Visible : ViewStates.Gone;
}).AddTo(this);
ViewModel!.WhenAnyValue(x => x.IsUnTimeLimit).SubscribeInMainThread(value =>
{
if (binding == null) return;
var enabled = !value;
if (binding.btnSendSms.Enabled != enabled)
{
binding.btnSendSms.Enabled = enabled;
}
}).AddTo(this);
ViewModel!.WhenAnyValue(x => x.BtnSendSmsCodeText).SubscribeInMainThread(value =>
{
if (binding == null) return;
binding.btnSendSms.Text = value;
}).AddTo(this);
SetOnClickListener(
binding.btnSendSms,
binding.btnDone);
ViewModel!.TbPhoneNumberFocus = () =>
{
if (binding == null) return;
binding.tbPhoneNumber.RequestFocus();
};
ViewModel!.TbSmsCodeFocus = () =>
{
if (binding == null) return;
binding.tbSmsCode.RequestFocus();
};
}
async void OnCreateViewAsync()
{
binding!.tbPhoneNumber.Text = await ITelephonyService.GetAutoFillPhoneNumberAsync(binding!.tbPhoneNumber.Text);
}
protected override bool OnClick(View view)
{
if (view.Id == Resource.Id.btnSendSms)
{
ViewModel!.SendSms();
return true;
}
else if (view.Id == Resource.Id.btnDone)
{
ViewModel!.Submit();
return true;
}
return base.OnClick(view);
}
bool TextView.IOnEditorActionListener.OnEditorAction(TextView? view, ImeAction actionId, KeyEvent? e)
{
if (view != null && binding != null && ((e != null && e.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter) || e == null))
{
if (view.Id == Resource.Id.tbPhoneNumber)
{
OnClick(binding.btnSendSms);
binding.tbSmsCode.RequestFocus();
return true;
}
else if (view.Id == Resource.Id.tbSmsCode)
{
OnClick(binding.btnDone);
return true;
}
}
return false;
}
}
}
@@ -0,0 +1,183 @@
using Android.Text;
using Android.Views;
using Android.Views.InputMethods;
using Android.Widget;
using Binding;
using ReactiveUI;
using System.Application.Services;
using System.Application.UI.Resx;
using System.Application.UI.ViewModels;
using System.Collections.Generic;
using static System.Application.UI.ViewModels.UserProfileWindowViewModel;
namespace System.Application.UI.Fragments
{
[Authorize]
internal sealed class ChangePhoneNumberFragment : BaseFragment<fragment_change_bind_phone_number, UserProfileWindowViewModel>, TextView.IOnEditorActionListener
{
protected override int? LayoutResource => Resource.Layout.fragment_change_bind_phone_number;
public new ChangeBindPhoneNumberWindowViewModel ViewModel => base.ViewModel!.ChangeBindPhoneNumberVM;
public override void OnCreateView(View view)
{
base.OnCreateView(view);
binding!.tbPhoneNumber.Text = UserService.Current.PhoneNumber;
binding!.tbNewPhoneNumber.TextChanged += (_, _)
=> ViewModel.PhoneNumber = binding!.tbNewPhoneNumber.Text;
binding!.tbSmsCode.TextChanged += (_, _)
=> ViewModel.SmsCodeValidation = binding!.tbSmsCode.Text;
binding!.tbNewSmsCode.TextChanged += (_, _)
=> ViewModel.SmsCodeNew = binding!.tbNewSmsCode.Text;
OnCreateViewAsync();
// https://developer.android.google.cn/reference/android/widget/TextView.html#protected-methods
binding!.tbNewPhoneNumber.SetRawInputType(InputTypes.ClassPhone);
binding!.tbNewPhoneNumber.SetDigitsKeyListener();
binding!.tbNewPhoneNumber.SetMaxLength(ModelValidatorLengths.PhoneNumber);
binding!.tbNewPhoneNumber.ImeOptions = ImeAction.Next;
binding!.tbNewPhoneNumber.SetOnEditorActionListener(this);
binding!.tbSmsCode.SetRawInputType(InputTypes.ClassNumber | InputTypes.NumberVariationNormal);
binding!.tbSmsCode.SetDigitsKeyListener();
binding!.tbSmsCode.SetMaxLength(ModelValidatorLengths.SMS_CAPTCHA);
binding!.tbSmsCode.ImeOptions = ImeAction.Done;
binding!.tbSmsCode.SetOnEditorActionListener(this);
binding!.tbNewSmsCode.SetRawInputType(InputTypes.ClassNumber | InputTypes.NumberVariationNormal);
binding!.tbNewSmsCode.SetDigitsKeyListener();
binding!.tbNewSmsCode.SetMaxLength(ModelValidatorLengths.SMS_CAPTCHA);
binding!.tbNewSmsCode.ImeOptions = ImeAction.Done;
binding!.tbNewSmsCode.SetOnEditorActionListener(this);
R.Subscribe(() =>
{
if (binding == null) return;
binding.tbPhoneNumber.Hint = AppResources.User_Phone;
binding.tbNewPhoneNumber.Hint = AppResources.User_NewPhone;
binding.tbNewPhoneNumber.SetImeActionLabel(AppResources.NextStep, binding!.tbNewPhoneNumber.ImeOptions);
binding.tbSmsCode.Hint = AppResources.User_SMSCode;
binding.tbSmsCode.SetImeActionLabel(AppResources.NextStep, binding!.tbSmsCode.ImeOptions);
binding.tbNewSmsCode.Hint = AppResources.User_SMSCode;
binding.tbNewSmsCode.SetImeActionLabel(AppResources.Btn_Text_Complete, binding!.tbSmsCode.ImeOptions);
}).AddTo(this);
ViewModel!.WhenAnyValue(x => x.IsLoading).SubscribeInMainThread(value =>
{
if (binding == null) return;
binding.loading.Visibility = value ? ViewStates.Visible : ViewStates.Gone;
binding.group_show_when_loading_false.Visibility = !value ? ViewStates.Visible : ViewStates.Gone;
}).AddTo(this);
ViewModel!.WhenAnyValue(x => x.IsUnTimeLimitValidation).SubscribeInMainThread(value =>
{
if (binding == null) return;
var enabled = !value;
if (binding.btnSendSms.Enabled != enabled)
{
binding.btnSendSms.Enabled = enabled;
}
}).AddTo(this);
ViewModel!.WhenAnyValue(x => x.BtnSendSmsCodeTextValidation).SubscribeInMainThread(value =>
{
if (binding == null) return;
binding.btnSendSms.Text = value;
}).AddTo(this);
ViewModel!.WhenAnyValue(x => x.IsUnTimeLimitNew).SubscribeInMainThread(value =>
{
if (binding == null) return;
var enabled = !value;
if (binding.btnNewSendSms.Enabled != enabled)
{
binding.btnNewSendSms.Enabled = enabled;
}
}).AddTo(this);
ViewModel!.WhenAnyValue(x => x.BtnSendSmsCodeTextNew).SubscribeInMainThread(value =>
{
if (binding == null) return;
binding.btnNewSendSms.Text = value;
}).AddTo(this);
ViewModel!.WhenAnyValue(x => x.BtnSubmitText).SubscribeInMainThread(value =>
{
if (binding == null) return;
binding.btnDone.Text = value;
}).AddTo(this);
ViewModel!.WhenAnyValue(x => x.CurrentStepIsValidation).SubscribeInMainThread(value =>
{
if (binding == null) return;
binding.tbSmsCode.Enabled = value;
binding.tbNewPhoneNumber.Enabled = value;
}).AddTo(this);
SetOnClickListener(
binding.btnSendSms,
binding.btnNewSendSms,
binding.btnDone);
ViewModel.TbSmsCodeFocusValidation = () =>
{
if (binding == null) return;
binding.tbSmsCode.RequestFocus();
};
ViewModel.TbSmsCodeFocusNew = () =>
{
if (binding == null) return;
binding.tbNewSmsCode.RequestFocus();
};
}
async void OnCreateViewAsync()
{
var value = await ITelephonyService.GetAutoFillPhoneNumberAsync(binding!.tbPhoneNumber.Text);
if (value != IUserManager.Instance.GetCurrentUser()?.PhoneNumber)
{
binding!.tbNewPhoneNumber.Text = value;
}
}
protected override bool OnClick(View view)
{
if (view.Id == Resource.Id.btnSendSms || view.Id == Resource.Id.btnNewSendSms)
{
ViewModel!.SendSms();
return true;
}
else if (view.Id == Resource.Id.btnDone)
{
ViewModel!.Submit();
return true;
}
return base.OnClick(view);
}
bool TextView.IOnEditorActionListener.OnEditorAction(TextView? view, ImeAction actionId, KeyEvent? e)
{
if (view != null && binding != null && ((e != null && e.Action == KeyEventActions.Down && e.KeyCode == Keycode.Enter) || e == null))
{
if (view.Id == Resource.Id.tbNewPhoneNumber || view.Id == Resource.Id.tbNewSmsCode)
{
OnClick(binding.btnDone);
return true;
}
else if (view.Id == Resource.Id.tbSmsCode)
{
OnClick(binding.btnSendSms);
binding.tbNewPhoneNumber.RequestFocus();
return true;
}
}
return false;
}
}
}
@@ -12,6 +12,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Application.UI.Activities;
namespace System.Application.UI.Fragments
{
@@ -276,14 +277,18 @@ namespace System.Application.UI.Fragments
{
if (view.Id == Resource.Id.btnModifyPhoneNumber)
{
if (UserService.Current.HasPhoneNumber)
if (RequireActivity() is UserProfileActivity userProfileActivity)
{
ViewModel.OnBtnChangeBindPhoneNumberClick.Invoke();
}
else
{
ViewModel.OnBtnBindPhoneNumberClick.Invoke();
userProfileActivity.GoToSubPage(UserProfileWindowViewModel.SubPageType.ChangeOrBindPhoneNumber);
}
//if (UserService.Current.HasPhoneNumber)
//{
// ViewModel.OnBtnChangeBindPhoneNumberClick.Invoke();
//}
//else
//{
// ViewModel.OnBtnBindPhoneNumberClick.Invoke();
//}
return true;
}
else if (view.Id == Resource.Id.clickBirthDate)
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<include layout="@layout/fragment_bind_phone_number_content" />
</androidx.core.widget.NestedScrollView>
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:xamarin="http://schemas.xamarin.com/android/xamarin/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.Group
android:id="@+id/group_show_when_loading_false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
app:constraint_referenced_ids="tbPhoneNumber,tbSmsCode,btnSendSms,btnDone"
xamarin:managedType="AndroidX.ConstraintLayout.Widget.Group" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/tbPhoneNumber"
android:layout_width="match_parent"
android:layout_height="@dimen/textbox_height"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:background="@drawable/bg_textbox"
android:imeOptions="actionNext"
android:paddingStart="@dimen/textbox_padding"
android:paddingEnd="@dimen/textbox_padding"
android:textSize="@dimen/input_font_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:hint="手机号码"
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatEditText" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/tbSmsCode"
android:layout_width="match_parent"
android:layout_height="@dimen/textbox_height"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:background="@drawable/bg_textbox"
android:imeOptions="actionDone"
android:paddingStart="@dimen/textbox_padding"
android:paddingEnd="@dimen/textbox_padding"
android:textSize="@dimen/input_font_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tbPhoneNumber"
tools:hint="短信验证码"
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatEditText" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnSendSms"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4.5dp"
android:textAllCaps="false"
app:layout_constraintBottom_toBottomOf="@+id/tbSmsCode"
app:layout_constraintEnd_toEndOf="@+id/tbSmsCode"
app:layout_constraintTop_toTopOf="@+id/tbSmsCode"
tools:text="重新获取(59)"
xamarin:managedType="Google.Android.Material.Button.MaterialButton" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnDone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:insetTop="0dp"
android:insetBottom="0dp"
android:textAllCaps="false"
android:textSize="@dimen/input_font_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tbSmsCode"
tools:text="完成"
xamarin:managedType="Google.Android.Material.Button.MaterialButton" />
<include layout="@layout/shared_loading" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<include layout="@layout/fragment_change_bind_phone_number_content" />
</androidx.core.widget.NestedScrollView>
@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:xamarin="http://schemas.xamarin.com/android/xamarin/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.Group
android:id="@+id/group_show_when_loading_false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
app:constraint_referenced_ids="tbPhoneNumber,tbSmsCode,btnSendSms,btnDone,tbNewPhoneNumber,tbNewSmsCode,btnNewSendSms"
xamarin:managedType="AndroidX.ConstraintLayout.Widget.Group" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/tbPhoneNumber"
android:layout_width="match_parent"
android:layout_height="@dimen/textbox_height"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:background="@drawable/bg_textbox"
android:enabled="false"
android:imeOptions="actionNext"
android:paddingStart="@dimen/textbox_padding"
android:paddingEnd="@dimen/textbox_padding"
android:textSize="@dimen/input_font_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:hint="手机号码"
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatEditText" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/tbSmsCode"
android:layout_width="match_parent"
android:layout_height="@dimen/textbox_height"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:background="@drawable/bg_textbox"
android:imeOptions="actionDone"
android:paddingStart="@dimen/textbox_padding"
android:paddingEnd="@dimen/textbox_padding"
android:textSize="@dimen/input_font_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tbPhoneNumber"
tools:hint="短信验证码"
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatEditText" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnSendSms"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4.5dp"
android:textAllCaps="false"
app:layout_constraintBottom_toBottomOf="@+id/tbSmsCode"
app:layout_constraintEnd_toEndOf="@+id/tbSmsCode"
app:layout_constraintTop_toTopOf="@+id/tbSmsCode"
tools:text="重新获取(59)"
xamarin:managedType="Google.Android.Material.Button.MaterialButton" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/tbNewPhoneNumber"
android:layout_width="match_parent"
android:layout_height="@dimen/textbox_height"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:background="@drawable/bg_textbox"
android:imeOptions="actionNext"
android:paddingStart="@dimen/textbox_padding"
android:paddingEnd="@dimen/textbox_padding"
android:textSize="@dimen/input_font_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tbSmsCode"
tools:hint="新手机号码"
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatEditText" />
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/tbNewSmsCode"
android:layout_width="match_parent"
android:layout_height="@dimen/textbox_height"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:background="@drawable/bg_textbox"
android:imeOptions="actionDone"
android:paddingStart="@dimen/textbox_padding"
android:paddingEnd="@dimen/textbox_padding"
android:textSize="@dimen/input_font_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tbNewPhoneNumber"
tools:enabled="false"
tools:hint="短信验证码"
xamarin:managedType="AndroidX.AppCompat.Widget.AppCompatEditText" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnNewSendSms"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="4.5dp"
android:textAllCaps="false"
app:layout_constraintBottom_toBottomOf="@+id/tbNewSmsCode"
app:layout_constraintEnd_toEndOf="@+id/tbNewSmsCode"
app:layout_constraintTop_toTopOf="@+id/tbNewSmsCode"
tools:enabled="false"
tools:text="重新获取(59)"
xamarin:managedType="Google.Android.Material.Button.MaterialButton" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnDone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:insetTop="0dp"
android:insetBottom="0dp"
android:textAllCaps="false"
android:textSize="@dimen/input_font_size"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btnNewSendSms"
tools:text="继续"
xamarin:managedType="Google.Android.Material.Button.MaterialButton" />
<include layout="@layout/shared_loading" />
</androidx.constraintlayout.widget.ConstraintLayout>
+2
View File
@@ -23,9 +23,11 @@ namespace System.Application
EditAppInfo,
IdleApp,
ShareManage,
[Obsolete]
ChangeBindPhoneNumber,
UserProfile,
NewVersion,
[Obsolete]
BindPhoneNumber,
ASF_AddBot,
SteamShutdown,
@@ -123,4 +123,10 @@ namespace System.Application.UI.ViewModels
i.RemoveAllDelegate();
}
}
partial class UserProfileWindowViewModel
{
readonly Lazy<BindPhoneNumberWindowViewModel> mBindPhoneNumberVM = new(() => new BindPhoneNumberWindowViewModel());
public BindPhoneNumberWindowViewModel BindPhoneNumberVM => mBindPhoneNumberVM.Value;
}
}
@@ -359,4 +359,10 @@ namespace System.Application.UI.ViewModels
}
}
}
partial class UserProfileWindowViewModel
{
readonly Lazy<ChangeBindPhoneNumberWindowViewModel> mChangeBindPhoneNumberVM = new(() => new ChangeBindPhoneNumberWindowViewModel());
public ChangeBindPhoneNumberWindowViewModel ChangeBindPhoneNumberVM => mChangeBindPhoneNumberVM.Value;
}
}
@@ -38,5 +38,12 @@ namespace System.Application.UI.ViewModels
OnUnbundleFastLoginClick.Invoke(channel.ToString());
}
}
public enum SubPageType : ushort
{
UserBasicInfo,
UserAccountBind,
ChangeOrBindPhoneNumber,
}
}
}