Skip to content

Commit

Permalink
Fix device name change
Browse files Browse the repository at this point in the history
Fixes #108
  • Loading branch information
ShortDevelopment committed Nov 1, 2023
1 parent da5131b commit 3fcc618
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
19 changes: 8 additions & 11 deletions Nearby Sharing Windows/Settings/SettingsActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Android.Views;
using AndroidX.Activity;
using AndroidX.AppCompat.App;
using AndroidX.Preference;

namespace Nearby_Sharing_Windows.Settings;

Expand Down Expand Up @@ -31,17 +32,11 @@ protected override void OnCreate(Bundle? savedInstanceState)
OnBackPressedDispatcher.AddCallback(this, new BackPressedListener(this, SupportFragmentManager, OnBackPressedDispatcher, true));
}

sealed class BackPressedListener : OnBackPressedCallback
sealed class BackPressedListener(ISettingsNavigation navigation, AndroidX.Fragment.App.FragmentManager fragmentManager, OnBackPressedDispatcher dispatcher, bool enabled) : OnBackPressedCallback(enabled)
{
readonly ISettingsNavigation _navigation;
readonly AndroidX.Fragment.App.FragmentManager _fragmentManager;
readonly OnBackPressedDispatcher _dispatcher;
public BackPressedListener(ISettingsNavigation navigation, AndroidX.Fragment.App.FragmentManager fragmentManager, OnBackPressedDispatcher dispatcher, bool enabled) : base(enabled)
{
_navigation = navigation;
_fragmentManager = fragmentManager;
_dispatcher = dispatcher;
}
readonly ISettingsNavigation _navigation = navigation;
readonly AndroidX.Fragment.App.FragmentManager _fragmentManager = fragmentManager;
readonly OnBackPressedDispatcher _dispatcher = dispatcher;

public override void HandleOnBackPressed()
{
Expand Down Expand Up @@ -125,8 +120,10 @@ public override void OnCreatePreferences(Bundle? savedInstanceState, string? roo
PreferenceScreen!.FindPreference("request_permissions_receive")!.PreferenceClick +=
(s, e) => UIHelper.RequestReceivePermissions(Activity!);

((EditTextPreference)PreferenceScreen!.FindPreference("device_name")!).DialogLayoutResource = Resource.Layout.settingslib_preference_dialog_edittext;

PreferenceScreen!.FindPreference("goto_mac_address")!.PreferenceClick +=
(s, e) => StartActivity(new Android.Content.Intent(Activity!, typeof(ReceiveSetupActivity)));
(s, e) => StartActivity(new Intent(Activity!, typeof(ReceiveSetupActivity)));
PreferenceScreen!.FindPreference("open_setup")!.PreferenceClick +=
(s, e) => UIHelper.OpenSetup(Activity!);
}
Expand Down

0 comments on commit 3fcc618

Please sign in to comment.