mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 03:54:18 -04:00
Minor refactors
This commit is contained in:
parent
3b1e073f05
commit
4e7a2e03c2
@ -117,12 +117,7 @@ public class LocalFileTransferActivity extends AppCompatActivity implements
|
||||
|
||||
setSupportActionBar(actionBar);
|
||||
actionBar.setNavigationIcon(R.drawable.ic_close_white_24dp);
|
||||
actionBar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
actionBar.setNavigationOnClickListener(v -> finish());
|
||||
|
||||
listViewPeerDevices.setAdapter(
|
||||
new WifiPeerListAdapter(this, R.layout.row_peer_device, availablePeerDevices));
|
||||
|
@ -46,7 +46,7 @@ class ReceiverDeviceAsyncTask extends AsyncTask<Void, Integer, Boolean> {
|
||||
try (ServerSocket serverSocket = new ServerSocket(FILE_TRANSFER_PORT)) {
|
||||
Log.d(TAG, "Server: Socket opened at " + FILE_TRANSFER_PORT);
|
||||
|
||||
final String KIWIX_ROOT = wifiDirectManager.getZimStorageRootPath();
|
||||
final String zimStorageRootPath = wifiDirectManager.getZimStorageRootPath();
|
||||
int totalFileCount = wifiDirectManager.getTotalFilesForTransfer();
|
||||
boolean result = true;
|
||||
int fileItemIndex;
|
||||
@ -62,7 +62,7 @@ class ReceiverDeviceAsyncTask extends AsyncTask<Void, Integer, Boolean> {
|
||||
if (BuildConfig.DEBUG) Log.d(TAG, "Server: Client connected for file " + currentFile);
|
||||
publishProgress(fileItemIndex, SENDING);
|
||||
|
||||
final File clientNoteFileLocation = new File(KIWIX_ROOT + incomingFileName);
|
||||
final File clientNoteFileLocation = new File(zimStorageRootPath + incomingFileName);
|
||||
File dirs = new File(clientNoteFileLocation.getParent());
|
||||
if (!dirs.exists() && !dirs.mkdirs()) {
|
||||
Log.d(TAG, "ERROR: Required parent directories couldn't be created");
|
||||
|
@ -301,10 +301,6 @@ public class WifiDirectManager implements WifiP2pManager.ChannelListener, WifiP2
|
||||
this.filesSent++;
|
||||
}
|
||||
|
||||
public boolean allFilesSent() {
|
||||
return (filesSent == totalFilesForTransfer);
|
||||
}
|
||||
|
||||
public @NonNull String getZimStorageRootPath() {
|
||||
return (sharedPreferenceUtil.getPrefStorage() + "/Kiwix/");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user