fix login button display

This commit is contained in:
CiufudeanDani 2022-04-20 17:11:37 +03:00
parent 729bdf5d90
commit 49d15e1064
2 changed files with 33 additions and 0 deletions

View File

@ -7,6 +7,7 @@
android:glEsVersion="0x00020000" android:glEsVersion="0x00020000"
android:required="true" /> android:required="true" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CAMERA" android:required="false"/> <uses-permission android:name="android.permission.CAMERA" android:required="false"/>
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

View File

@ -10,13 +10,19 @@ import android.content.ServiceConnection;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.Color; import android.graphics.Color;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.Looper; import android.os.Looper;
import android.text.Editable; import android.text.Editable;
import android.text.InputType; import android.text.InputType;
import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -114,6 +120,17 @@ public class SDMobileActivity extends Activity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
SM.Debug("##### onCREATE ##### with LANGUAGE " + AppParams.LANGUAGETMP); SM.Debug("##### onCREATE ##### with LANGUAGE " + AppParams.LANGUAGETMP);
ConnectivityManager connectivityManager =
(ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
connectivityManager.registerDefaultNetworkCallback(networkCallback);
else {
NetworkRequest request = new NetworkRequest.Builder()
.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build();
connectivityManager.registerNetworkCallback(request, networkCallback);
}
AppParams.theme = AppParams.Theme.SAFEDISPATCH; AppParams.theme = AppParams.Theme.SAFEDISPATCH;
if (AppParams.theme == AppParams.Theme.SAFENET) if (AppParams.theme == AppParams.Theme.SAFENET)
this.setTheme(R.style.Theme_Safenet); this.setTheme(R.style.Theme_Safenet);
@ -532,6 +549,21 @@ public class SDMobileActivity extends Activity {
SM.Debug("##### onRESUME #####"); SM.Debug("##### onRESUME #####");
} }
private final ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback() {
@Override
public void onAvailable(Network network) {
// network available
Log.v("NetworkAvailability", "available");
if (tcp != null && !tcp.isConnectionUP)
saveIPandRestartTCP(AppParams.IP, AppParams.PORT);
}
@Override
public void onLost(Network network) {
// network unavailable
Log.v("NetworkAvailability", "unavailable");
}
};
private void startTabActivity(long userID) { private void startTabActivity(long userID) {
// good login - load activity // good login - load activity