mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-24 19:00:04 +08:00
ASFSettings.ConsoleFontSize
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
using Android.Util;
|
||||
using Android.Views;
|
||||
using AndroidX.AppCompat.Widget;
|
||||
using Binding;
|
||||
using ReactiveUI;
|
||||
using System.Application.Services;
|
||||
using System.Application.Settings;
|
||||
using System.Application.UI.Resx;
|
||||
using System.Application.UI.ViewModels;
|
||||
using System.Text;
|
||||
@@ -24,6 +26,28 @@ namespace System.Application.UI.Fragments
|
||||
if (binding == null) return;
|
||||
binding.tvConsole.Text = value;
|
||||
}).AddTo(this);
|
||||
|
||||
SetConsoleFontSize(ASFSettings.ConsoleFontSize.Value);
|
||||
ASFSettings.ConsoleFontSize.ValueChanged += ConsoleFontSize_ValueChanged;
|
||||
}
|
||||
|
||||
public override void OnDestroyView()
|
||||
{
|
||||
ASFSettings.ConsoleFontSize.ValueChanged -= ConsoleFontSize_ValueChanged;
|
||||
base.OnDestroyView();
|
||||
}
|
||||
|
||||
void SetConsoleFontSize(int value)
|
||||
{
|
||||
if (binding == null) return;
|
||||
binding.tvConsole.SetTextSize(ComplexUnitType.Sp, value);
|
||||
binding.tvArrow.SetTextSize(ComplexUnitType.Sp, value);
|
||||
binding.tbInput.SetTextSize(ComplexUnitType.Sp, value);
|
||||
}
|
||||
|
||||
void ConsoleFontSize_ValueChanged(object sender, ValueChangedEventArgs<int> e)
|
||||
{
|
||||
SetConsoleFontSize(e.NewValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tvArrow"
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
|
||||
@@ -66,5 +66,11 @@ namespace System.Application.Settings
|
||||
= GetProperty(defaultValue: DefaultConsoleMaxLine, autoSave: true);
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 控制台字体大小,默认值 14,Android 上单位为 sp
|
||||
/// </summary>
|
||||
public static SerializableProperty<int> ConsoleFontSize { get; }
|
||||
= GetProperty(defaultValue: 14, autoSave: true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user