Commit ea72327a authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Merge branch 'albertvaka/human-name-lib'

parents 720914dd 7c56aa9c
......@@ -75,6 +75,7 @@ dependencies {
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.jakewharton:disklrucache:2.0.2' //For caching album art bitmaps
implementation 'com.jaredrummler:android-device-names:1.1.9' //To get a human-friendly device name
implementation 'org.apache.sshd:sshd-core:0.14.0'
implementation 'org.apache.mina:mina-core:2.0.19' //For some reason, makes sshd-core:0.14.0 work without NIO, which isn't available until Android 8+
......
......@@ -100,11 +100,13 @@ public class MainActivity extends AppCompatActivity implements SharedPreferences
mDrawerToggle.setDrawerIndicatorEnabled(true);
mDrawerToggle.syncState();
String deviceName = DeviceHelper.getDeviceName(this);
mNavViewDeviceName.setText(deviceName);
preferences = getSharedPreferences("stored_menu_selection", Context.MODE_PRIVATE);
// Note: The preference changed listener should be registered before getting the name, because getting
// it can trigger a background fetch from the internet that will eventually update the preference
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);
String deviceName = DeviceHelper.getDeviceName(this);
mNavViewDeviceName.setText(deviceName);
mNavigationView.setNavigationItemSelectedListener(menuItem -> {
mCurrentMenuEntry = menuItem.getItemId();
......@@ -377,7 +379,7 @@ public class MainActivity extends AppCompatActivity implements SharedPreferences
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (DeviceHelper.KEY_DEVICE_NAME_PREFERENCE.equals(key)) {
mNavViewDeviceName.setText(DeviceHelper.getDeviceName(this));
BackgroundService.RunCommand(this, BackgroundService::onNetworkChange);
BackgroundService.RunCommand(this, BackgroundService::onNetworkChange); //Re-send our identity packet
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment