mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-23 12:42:56 -04:00
Resolve lint warnings
This commit is contained in:
parent
37b7b5050e
commit
089dc8b00d
@ -2,6 +2,8 @@ package org.kiwix.kiwixmobile.webserver;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import java.net.InetAddress;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
@ -25,12 +27,12 @@ public class WebServerHelper {
|
||||
JNIKiwixServer kiwixServer = new JNIKiwixServer(kiwixLibrary);
|
||||
private static final String TAG = "WebServerHelper";
|
||||
|
||||
public WebServerHelper(Context context) {
|
||||
public WebServerHelper(@NonNull Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public boolean startServerHelper(ServerStateListener stateListener,
|
||||
ArrayList<String> selectedBooksPath) {
|
||||
public boolean startServerHelper(@NonNull ServerStateListener stateListener,
|
||||
@NonNull ArrayList<String> selectedBooksPath) {
|
||||
|
||||
// 1. Get port from settings screen
|
||||
// 2. Ask user to change port in settings if port is in use.
|
||||
@ -46,7 +48,7 @@ public class WebServerHelper {
|
||||
return isServerStarted;
|
||||
}
|
||||
|
||||
public boolean stopAndroidWebServer(ServerStateListener stateListener) {
|
||||
public boolean stopAndroidWebServer(@NonNull ServerStateListener stateListener) {
|
||||
if (isServerStarted) {
|
||||
kiwixServer.stop();
|
||||
isServerStarted = false;
|
||||
@ -111,7 +113,7 @@ public class WebServerHelper {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public static String getAddress() {
|
||||
@Nullable public static String getAddress() {
|
||||
return "http://" + getIpAddress() + ":" + port;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import android.os.Build;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import org.kiwix.kiwixmobile.R;
|
||||
@ -68,7 +69,7 @@ public class HotspotService extends Service {
|
||||
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
}
|
||||
|
||||
@Override public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
@Override public int onStartCommand(@Nullable Intent intent, int flags, int startId) {
|
||||
switch (intent.getAction()) {
|
||||
|
||||
case ACTION_IS_HOTSPOT_ENABLED:
|
||||
@ -115,7 +116,7 @@ public class HotspotService extends Service {
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
|
||||
@Nullable @Override public IBinder onBind(Intent intent) {
|
||||
@Nullable @Override public IBinder onBind(@Nullable Intent intent) {
|
||||
return serviceBinder;
|
||||
}
|
||||
|
||||
@ -176,12 +177,12 @@ public class HotspotService extends Service {
|
||||
|
||||
public class HotspotBinder extends Binder {
|
||||
|
||||
public HotspotService getService() {
|
||||
@NonNull public HotspotService getService() {
|
||||
return HotspotService.this;
|
||||
}
|
||||
}
|
||||
|
||||
public void registerCallBack(ServerStateListener myCallback) {
|
||||
public void registerCallBack(@NonNull ServerStateListener myCallback) {
|
||||
serverStateListener = myCallback;
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import android.net.wifi.WifiManager;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import org.kiwix.kiwixmobile.webserver.ServerStateListener;
|
||||
|
||||
@ -23,14 +24,14 @@ public class WifiHotspotManager {
|
||||
WifiConfiguration currentConfig;
|
||||
private static final String TAG = "WifiHotspotManager";
|
||||
|
||||
public WifiHotspotManager(Context context) {
|
||||
public WifiHotspotManager(@NonNull Context context) {
|
||||
this.context = context;
|
||||
wifiManager = (WifiManager) this.context.getSystemService(Context.WIFI_SERVICE);
|
||||
}
|
||||
|
||||
//Workaround to turn on hotspot for Oreo versions
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public void turnOnHotspot(ServerStateListener serverStateListener) {
|
||||
public void turnOnHotspot(@NonNull ServerStateListener serverStateListener) {
|
||||
wifiManager.startLocalOnlyHotspot(new WifiManager.LocalOnlyHotspotCallback() {
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user