Replace methods with lambda in ZimHostActivity

This commit is contained in:
Adeel Zafar 2019-08-15 16:20:58 +05:00
parent b2b7632b53
commit a93a508044

View File

@ -144,20 +144,18 @@ public class ZimHostActivity extends BaseActivity implements
serviceIntent = new Intent(this, HotspotService.class); serviceIntent = new Intent(this, HotspotService.class);
startServerButton.setOnClickListener(new View.OnClickListener() { startServerButton.setOnClickListener(v -> {
@Override public void onClick(View v) { //Get the path of ZIMs user has selected
//Get the path of ZIMs user has selected if (!isServerStarted) {
if (!isServerStarted) { getSelectedBooksPath();
getSelectedBooksPath(); if (selectedBooksPath.size() > 0) {
if (selectedBooksPath.size() > 0) {
startHotspotHelper();
} else {
Toast.makeText(ZimHostActivity.this, R.string.no_books_selected_toast_message,
Toast.LENGTH_SHORT).show();
}
} else {
startHotspotHelper(); startHotspotHelper();
} else {
Toast.makeText(ZimHostActivity.this, R.string.no_books_selected_toast_message,
Toast.LENGTH_SHORT).show();
} }
} else {
startHotspotHelper();
} }
}); });
} }
@ -407,12 +405,9 @@ public class ZimHostActivity extends BaseActivity implements
true); true);
progressDialog.show(); progressDialog.show();
final Handler handler = new Handler(); final Handler handler = new Handler();
handler.postDelayed(new Runnable() { handler.postDelayed(() -> {
@Override progressDialog.dismiss();
public void run() { startService(ACTION_START_SERVER);
progressDialog.dismiss();
startService(ACTION_START_SERVER);
}
}, 7000); }, 7000);
}); });
@ -481,12 +476,9 @@ public class ZimHostActivity extends BaseActivity implements
builder.setPositiveButton(android.R.string.ok, (dialog, id) -> { builder.setPositiveButton(android.R.string.ok, (dialog, id) -> {
final Handler handler = new Handler(); final Handler handler = new Handler();
handler.postDelayed(new Runnable() { handler.postDelayed(() -> {
@Override progressDialog.dismiss();
public void run() { startService(ACTION_START_SERVER);
progressDialog.dismiss();
startService(ACTION_START_SERVER);
}
}, 2000); }, 2000);
}); });