show Toast when scanning an SDCard for repos
This commit is contained in:
parent
43ee48ac2b
commit
c97424f054
@ -117,13 +117,6 @@ class NearbyViewBinder {
|
|||||||
@RequiresApi(api = 21)
|
@RequiresApi(api = 21)
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
File storage = externalStorage.getParentFile();
|
|
||||||
File[] files = storage.listFiles();
|
|
||||||
String msg = "";
|
|
||||||
if (files != null) for (File f : files) {
|
|
||||||
msg += "|" + f.getName();
|
|
||||||
}
|
|
||||||
Toast.makeText(activity, msg, Toast.LENGTH_LONG).show();
|
|
||||||
if (Build.VERSION.SDK_INT >= 23
|
if (Build.VERSION.SDK_INT >= 23
|
||||||
&& (externalStorage == null || !externalStorage.canRead())
|
&& (externalStorage == null || !externalStorage.canRead())
|
||||||
&& PackageManager.PERMISSION_GRANTED
|
&& PackageManager.PERMISSION_GRANTED
|
||||||
@ -131,11 +124,13 @@ class NearbyViewBinder {
|
|||||||
ActivityCompat.requestPermissions(activity, new String[]{writeExternalStorage},
|
ActivityCompat.requestPermissions(activity, new String[]{writeExternalStorage},
|
||||||
MainActivity.REQUEST_STORAGE_PERMISSIONS);
|
MainActivity.REQUEST_STORAGE_PERMISSIONS);
|
||||||
} else {
|
} else {
|
||||||
|
Toast.makeText(activity,
|
||||||
|
activity.getString(R.string.scan_removable_storage_toast, externalStorage),
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
SDCardScannerService.scan(activity);
|
SDCardScannerService.scan(activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
<string name="local_repo_name_summary">The advertised title of your local repo: %s</string>
|
<string name="local_repo_name_summary">The advertised title of your local repo: %s</string>
|
||||||
<string name="local_repo_https_on">Use encrypted HTTPS:// connection for local repo</string>
|
<string name="local_repo_https_on">Use encrypted HTTPS:// connection for local repo</string>
|
||||||
<string name="scan_removable_storage_title">Scan removable storage</string>
|
<string name="scan_removable_storage_title">Scan removable storage</string>
|
||||||
|
<string name="scan_removable_storage_toast">Scanning %s…</string>
|
||||||
<string name="scan_removable_storage_summary">Look for package repos on removable storage like SD Cards
|
<string name="scan_removable_storage_summary">Look for package repos on removable storage like SD Cards
|
||||||
and USB thumb drives
|
and USB thumb drives
|
||||||
</string>
|
</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user