Resolve Java warnings

This commit is contained in:
Adeel Zafar 2019-08-17 01:56:32 +05:00
parent 0fe29eff35
commit 4b21258442
3 changed files with 7 additions and 7 deletions

View File

@ -505,7 +505,7 @@ public class ZimHostActivity extends BaseActivity implements
}); });
} }
@Override public void onHotspotStateReceived(@Nullable Boolean isHotspotEnabled) { @Override public void onHotspotStateReceived(@NonNull Boolean isHotspotEnabled) {
if (isHotspotEnabled) //if hotspot is already enabled, turn it off. if (isHotspotEnabled) //if hotspot is already enabled, turn it off.
{ {
startService(ACTION_TURN_OFF_AFTER_O); startService(ACTION_TURN_OFF_AFTER_O);

View File

@ -1,18 +1,19 @@
package org.kiwix.kiwixmobile.webserver; package org.kiwix.kiwixmobile.webserver;
import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiConfiguration;
import androidx.annotation.NonNull;
public interface ZimHostCallbacks { public interface ZimHostCallbacks {
void onServerStarted(String ip); void onServerStarted(@NonNull String ip);
void onServerStopped(); void onServerStopped();
void onServerFailedToStart(); void onServerFailedToStart();
void onHotspotTurnedOn(WifiConfiguration wifiConfiguration); void onHotspotTurnedOn(@NonNull WifiConfiguration wifiConfiguration);
void onHotspotFailedToStart(); void onHotspotFailedToStart();
void onHotspotStateReceived(Boolean state); void onHotspotStateReceived(@NonNull Boolean state);
} }

View File

@ -18,13 +18,12 @@ import org.kiwix.kiwixmobile.webserver.ZimHostCallbacks;
public class WifiHotspotManager { public class WifiHotspotManager {
private final WifiManager wifiManager; private final WifiManager wifiManager;
private final Context context;
WifiManager.LocalOnlyHotspotReservation hotspotReservation; WifiManager.LocalOnlyHotspotReservation hotspotReservation;
private static final String TAG = "WifiHotspotManager"; private static final String TAG = "WifiHotspotManager";
public WifiHotspotManager(@NonNull Context context) { public WifiHotspotManager(@NonNull Context context) {
this.context = context; wifiManager =
wifiManager = (WifiManager) this.context.getSystemService(Context.WIFI_SERVICE); (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
} }
//Workaround to turn on hotspot for Oreo versions //Workaround to turn on hotspot for Oreo versions