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