TunnelListFragment: Name a CompletionStage what it is
Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
parent
1862ff0bbe
commit
77fdd7c883
@ -63,7 +63,7 @@ public class TunnelListFragment extends BaseFragment {
|
|||||||
if (activity == null)
|
if (activity == null)
|
||||||
return;
|
return;
|
||||||
final ContentResolver contentResolver = activity.getContentResolver();
|
final ContentResolver contentResolver = activity.getContentResolver();
|
||||||
final CompletionStage<String> nameFuture = asyncWorker.supplyAsync(() -> {
|
final CompletionStage<String> nameStage = asyncWorker.supplyAsync(() -> {
|
||||||
final String[] columns = {OpenableColumns.DISPLAY_NAME};
|
final String[] columns = {OpenableColumns.DISPLAY_NAME};
|
||||||
String name = null;
|
String name = null;
|
||||||
try (final Cursor cursor = contentResolver.query(uri, columns, null, null, null)) {
|
try (final Cursor cursor = contentResolver.query(uri, columns, null, null, null)) {
|
||||||
@ -80,7 +80,7 @@ public class TunnelListFragment extends BaseFragment {
|
|||||||
return name;
|
return name;
|
||||||
});
|
});
|
||||||
asyncWorker.supplyAsync(() -> Config.from(contentResolver.openInputStream(uri)))
|
asyncWorker.supplyAsync(() -> Config.from(contentResolver.openInputStream(uri)))
|
||||||
.thenCombine(nameFuture, (config, name) -> tunnelManager.create(name, config))
|
.thenCombine(nameStage, (config, name) -> tunnelManager.create(name, config))
|
||||||
.thenCompose(Function.identity())
|
.thenCompose(Function.identity())
|
||||||
.handle(this::onTunnelImportFinished);
|
.handle(this::onTunnelImportFinished);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user