mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 12:03:09 -04:00
Make fields private in ZimHostActivity
This commit is contained in:
parent
8b4b701ff7
commit
e6cdc08043
@ -82,12 +82,12 @@ public class ZimHostActivity extends BaseActivity implements
|
|||||||
private Intent serviceIntent;
|
private Intent serviceIntent;
|
||||||
private Task<LocationSettingsResponse> task;
|
private Task<LocationSettingsResponse> task;
|
||||||
|
|
||||||
BooksOnDiskAdapter booksAdapter;
|
private BooksOnDiskAdapter booksAdapter;
|
||||||
HotspotService hotspotService;
|
private HotspotService hotspotService;
|
||||||
String ip;
|
private String ip;
|
||||||
boolean bound;
|
private boolean bound;
|
||||||
ServiceConnection serviceConnection;
|
private ServiceConnection serviceConnection;
|
||||||
ArrayList<String> selectedBooksPath = new ArrayList<>();
|
private ArrayList<String> selectedBooksPath = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
@ -162,7 +162,7 @@ public class ZimHostActivity extends BaseActivity implements
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void startHotspotHelper() {
|
private void startHotspotHelper() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
toggleHotspot();
|
toggleHotspot();
|
||||||
} else {
|
} else {
|
||||||
@ -178,7 +178,8 @@ public class ZimHostActivity extends BaseActivity implements
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void getSelectedBooksPath() {
|
|
||||||
|
private void getSelectedBooksPath() {
|
||||||
BooksOnDiskListItem.BookOnDisk bookOnDisk;
|
BooksOnDiskListItem.BookOnDisk bookOnDisk;
|
||||||
|
|
||||||
for (BooksOnDiskListItem item : booksAdapter.getItems()) {
|
for (BooksOnDiskListItem item : booksAdapter.getItems()) {
|
||||||
@ -191,7 +192,7 @@ public class ZimHostActivity extends BaseActivity implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void open(@Nullable BooksOnDiskListItem.BookOnDisk bookOnDisk) {
|
private void open(@Nullable BooksOnDiskListItem.BookOnDisk bookOnDisk) {
|
||||||
File file = bookOnDisk.getFile();
|
File file = bookOnDisk.getFile();
|
||||||
Intent zimFile = new Intent(this, MainActivity.class);
|
Intent zimFile = new Intent(this, MainActivity.class);
|
||||||
zimFile.setData(Uri.fromFile(file));
|
zimFile.setData(Uri.fromFile(file));
|
||||||
@ -199,7 +200,7 @@ public class ZimHostActivity extends BaseActivity implements
|
|||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void select(@NonNull BooksOnDiskListItem.BookOnDisk bookOnDisk) {
|
private void select(@NonNull BooksOnDiskListItem.BookOnDisk bookOnDisk) {
|
||||||
ArrayList<BooksOnDiskListItem> booksList = new ArrayList<>();
|
ArrayList<BooksOnDiskListItem> booksList = new ArrayList<>();
|
||||||
for (BooksOnDiskListItem item : booksAdapter.getItems()) {
|
for (BooksOnDiskListItem item : booksAdapter.getItems()) {
|
||||||
if (item.equals(bookOnDisk)) {
|
if (item.equals(bookOnDisk)) {
|
||||||
@ -238,8 +239,7 @@ public class ZimHostActivity extends BaseActivity implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
@RequiresApi(api = Build.VERSION_CODES.O) private void toggleHotspot() {
|
||||||
void toggleHotspot() {
|
|
||||||
//Check if location permissions are granted
|
//Check if location permissions are granted
|
||||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
|
if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
|
||||||
== PackageManager.PERMISSION_GRANTED) {
|
== PackageManager.PERMISSION_GRANTED) {
|
||||||
@ -336,7 +336,7 @@ public class ZimHostActivity extends BaseActivity implements
|
|||||||
toolbar.setNavigationOnClickListener(v -> onBackPressed());
|
toolbar.setNavigationOnClickListener(v -> onBackPressed());
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupLocationServices() {
|
private void setupLocationServices() {
|
||||||
LocationRequest locationRequest = new LocationRequest();
|
LocationRequest locationRequest = new LocationRequest();
|
||||||
locationRequest.setInterval(10);
|
locationRequest.setInterval(10);
|
||||||
locationRequest.setSmallestDisplacement(10);
|
locationRequest.setSmallestDisplacement(10);
|
||||||
@ -392,7 +392,7 @@ public class ZimHostActivity extends BaseActivity implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Advice user to turn on hotspot manually for API<26
|
//Advice user to turn on hotspot manually for API<26
|
||||||
void startHotspotDialog() {
|
private void startHotspotDialog() {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this, dialogStyle());
|
AlertDialog.Builder builder = new AlertDialog.Builder(this, dialogStyle());
|
||||||
|
|
||||||
builder.setPositiveButton(getString(R.string.go_to_settings_label), (dialog, id) -> {
|
builder.setPositiveButton(getString(R.string.go_to_settings_label), (dialog, id) -> {
|
||||||
@ -425,7 +425,7 @@ public class ZimHostActivity extends BaseActivity implements
|
|||||||
dialog.show();
|
dialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void startService(String ACTION) {
|
private void startService(String ACTION) {
|
||||||
if (ACTION.equals(ACTION_START_SERVER)) {
|
if (ACTION.equals(ACTION_START_SERVER)) {
|
||||||
serviceIntent.putStringArrayListExtra(SELECTED_ZIM_PATHS_KEY, selectedBooksPath);
|
serviceIntent.putStringArrayListExtra(SELECTED_ZIM_PATHS_KEY, selectedBooksPath);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user