mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-25 22:12:09 -04:00
Add menu item to turn on/off Wifi Hotspot
Initialize WifiManager object in MainActivity. And work with WifiHotspotManager class.
This commit is contained in:
parent
bd328b5d1d
commit
d4b0ea1dd3
@ -110,6 +110,7 @@ import org.kiwix.kiwixmobile.utils.LanguageUtils;
|
||||
import org.kiwix.kiwixmobile.utils.NetworkUtils;
|
||||
import org.kiwix.kiwixmobile.utils.StyleUtils;
|
||||
import org.kiwix.kiwixmobile.utils.files.FileUtils;
|
||||
import org.kiwix.kiwixmobile.wifi_hotspot.WifiHotspotManager;
|
||||
import org.kiwix.kiwixmobile.zim_manager.ZimManageActivity;
|
||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.StorageObserver;
|
||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.adapter.BookOnDiskDelegate;
|
||||
@ -163,6 +164,7 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
|
||||
public static boolean refresh;
|
||||
public static boolean wifiOnly;
|
||||
public static boolean nightMode;
|
||||
private WifiHotspotManager wifiHotspotManager;
|
||||
private static Uri KIWIX_LOCAL_MARKET_URI;
|
||||
private static Uri KIWIX_BROWSER_MARKET_URI;
|
||||
private final ArrayList<String> bookmarks = new ArrayList<>();
|
||||
@ -383,6 +385,9 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
|
||||
tabRecyclerView.setAdapter(tabsAdapter);
|
||||
new ItemTouchHelper(tabCallback).attachToRecyclerView(tabRecyclerView);
|
||||
drawerLayout.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
|
||||
|
||||
wifiHotspotManager = new WifiHotspotManager(this);
|
||||
wifiHotspotManager.showWritePermissionSettings(true);
|
||||
}
|
||||
|
||||
//End of onCreate
|
||||
@ -920,6 +925,13 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
|
||||
intentSupportKiwix.putExtra(EXTRA_EXTERNAL_LINK, true);
|
||||
openExternalUrl(intentSupportKiwix);
|
||||
|
||||
case R.id.menu_wifi_hotspot:
|
||||
if (wifiHotspotManager.isWifiApEnabled()) {
|
||||
wifiHotspotManager.setWifiEnabled(null, false);
|
||||
} else {
|
||||
wifiHotspotManager.setWifiEnabled(null, true);
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -94,4 +94,9 @@
|
||||
android:title="@string/menu_support_kiwix"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_wifi_hotspot"
|
||||
android:title="@string/menu_wifi_hotspot"
|
||||
app:showAsAction="never"/>
|
||||
|
||||
</menu>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<string name="menu_read_aloud">Read aloud</string>
|
||||
<string name="menu_read_aloud_stop">Stop reading aloud</string>
|
||||
<string name="menu_support_kiwix">Support Kiwix</string>
|
||||
<string name="menu_wifi_hotspot">Wifi Hotspot</string>
|
||||
<string name="save_media">Save Media</string>
|
||||
<string name="save_media_error">An error occurred when trying to save the media!</string>
|
||||
<string name="save_media_saved">Saved media as %s to Android/media/org.kiwix…/</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user