different local file transfer title depending on mode

This commit is contained in:
HissPirat 2020-09-22 13:13:23 +02:00
parent 46de76560f
commit 7e0931f743
3 changed files with 14 additions and 3 deletions

View File

@ -106,8 +106,8 @@ class LocalFileTransferFragment : BaseFragment(),
setHasOptionsMenu(true) setHasOptionsMenu(true)
val activity = requireActivity() as CoreMainActivity val activity = requireActivity() as CoreMainActivity
val filesForTransfer = getFilesForTransfer() val filesForTransfer = getFilesForTransfer()
val isReceiver = filesForTransfer.isEmpty()
setupToolbar(view, activity) setupToolbar(view, activity, isReceiver)
wifiPeerListAdapter = WifiPeerListAdapter( wifiPeerListAdapter = WifiPeerListAdapter(
WifiP2pDelegate(wifiDirectManager::sendToDevice) WifiP2pDelegate(wifiDirectManager::sendToDevice)
@ -127,9 +127,12 @@ class LocalFileTransferFragment : BaseFragment(),
list_peer_devices.setHasFixedSize(true) list_peer_devices.setHasFixedSize(true)
} }
private fun setupToolbar(view: View, activity: CoreMainActivity) { private fun setupToolbar(view: View, activity: CoreMainActivity, isReceiver: Boolean) {
val toolbar: Toolbar = view.findViewById(R.id.toolbar) val toolbar: Toolbar = view.findViewById(R.id.toolbar)
activity.setSupportActionBar(toolbar) activity.setSupportActionBar(toolbar)
toolbar.title =
if (isReceiver) getString(R.string.receive_files_title)
else getString(R.string.send_files_title)
toolbar.setNavigationIcon(R.drawable.ic_close_white_24dp) toolbar.setNavigationIcon(R.drawable.ic_close_white_24dp)
toolbar.setNavigationOnClickListener { activity.popNavigationBackstack() } toolbar.setNavigationOnClickListener { activity.popNavigationBackstack() }
} }

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="send_files_title">The title of an activity used for sending files.</string>
<string name="receive_files_title">The titles of an activity used for receiving files.</string>
</resources>

View File

@ -4,4 +4,6 @@
<string name="file_system_does_not_support_4gb">Your file system doesnt support files over 4GB</string> <string name="file_system_does_not_support_4gb">Your file system doesnt support files over 4GB</string>
<string name="detecting_file_system">Detecting if file system can create 4GB files</string> <string name="detecting_file_system">Detecting if file system can create 4GB files</string>
<string name="cannot_open_file">Failed to open file\nPlease try looking for this file in the Device Tab of your Library</string> <string name="cannot_open_file">Failed to open file\nPlease try looking for this file in the Device Tab of your Library</string>
<string name="send_files_title">Send Files</string>
<string name="receive_files_title">Receive Files</string>
</resources> </resources>