Minor refactors

This commit is contained in:
Aditya-Sood 2019-08-11 18:22:58 +05:30
parent 3b1e073f05
commit 4e7a2e03c2
3 changed files with 3 additions and 12 deletions

View File

@ -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));

View File

@ -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");

View File

@ -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/");
} }