Skip to content

Commit

Permalink
Version 12.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
papyrussolution committed Jul 7, 2024
1 parent edd84f1 commit a1a7142
Show file tree
Hide file tree
Showing 89 changed files with 1,952 additions and 1,549 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -621,10 +621,17 @@ else if(st.Transp == NetworkConnectionInfoManager.Transport.WIFI) {
ir = R.drawable.ic_mobile_network_wifi;
}
else if(st.Transp == NetworkConnectionInfoManager.Transport.Cellular) {
ir = R.drawable.ic_mobile_network_4g;
if(st.CellularQuality == 4)
ir = R.drawable.ic_network_cellular_signal_excellent;
else if(st.CellularQuality == 3)
ir = R.drawable.ic_network_cellular_signal_good;
else if(st.CellularQuality == 2)
ir = R.drawable.ic_network_cellular_signal_ok;
else
ir = R.drawable.ic_network_cellular_signal_weak;
}
else if(st.Transp == NetworkConnectionInfoManager.Transport.GenericAvailable) {
ir = R.drawable.ic_mobile_network_4g;
ir = R.drawable.ic_network_cellular_signal_ok;
}
else
ir = R.drawable.ic_mobile_network_disconnected;
Expand Down Expand Up @@ -770,7 +777,7 @@ public Object HandleEvent(int ev, Object srcObj, Object subj)
app_ctx.SetupNetworkStatusManager(this);
{
Timer tmr = new Timer();
tmr.schedule(new UpdateNetworkStateIndicator_TimerTask(), 12000);
tmr.schedule(new UpdateNetworkStateIndicator_TimerTask(), 500, 12000);
}
// } @v12.0.6
} catch(StyloQException | PackageManager.NameNotFoundException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
// NetworkConnectionInfoManager.java
//
package ru.petroglif.styloq;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;

public class NetworkConnectionInfoManager {
public enum Transport {
Unavailable, // Сеть недоступна
GenericAvailable, // Сеть доступна (без детализации)
Ethernet, // Доступна сеть ethernet
WIFI, // Доступна сеть wifi
Cellular, // Доступна сеть посредством сотового оператора
}
public static class Status {
Status()
{
Transp = Transport.Unavailable;
DownloadBandwithKbps = 0;
UploadBandwithKbps = 0;
CellularQuality = 0;
}
public Transport Transp;
public int DownloadBandwithKbps;
public int UploadBandwithKbps;
public int CellularQuality; // 0 - no info, 1 - unstable, 2 - 2G, 3 - 3G, 4 - 4G
}
private Context Ctx;
private SLib.EventHandler Handler;
private static ConnectivityManager.NetworkCallback Cb;
NetworkConnectionInfoManager(Context ctx, SLib.EventHandler handler)
{
Ctx = ctx;
Handler = handler;
ConnectivityManager cmgr = Ctx.getSystemService(ConnectivityManager.class);
if(cmgr != null) {
if(Cb != null) {
cmgr.unregisterNetworkCallback(Cb);
Cb = null;
}
Network current_network = cmgr.getActiveNetwork();
Cb = new Callback(Ctx, Handler);
cmgr.registerDefaultNetworkCallback(Cb);
}
}
void Unregister()
{
if(Cb != null) {
ConnectivityManager cmgr = Ctx.getSystemService(ConnectivityManager.class);
if(cmgr != null) {
cmgr.unregisterNetworkCallback(Cb);
Cb = null;
}
}
}
private static class Callback extends ConnectivityManager.NetworkCallback {
private Context Ctx;
private SLib.EventHandler Handler;
public Callback(Context ctx, SLib.EventHandler handler)
{
Ctx = ctx;
Handler = handler;
}
@Override public void onAvailable(Network network)
{
Status st = new Status();
st.Transp = Transport.GenericAvailable;
SendData(st);
}
@Override public void onLost(Network network)
{
Status st = new Status();
st.Transp = Transport.Unavailable;
SendData(st);
}
@Override public void onCapabilitiesChanged(Network network, NetworkCapabilities networkCapabilities)
{
Status st = new Status();
st.Transp = Transport.GenericAvailable;
st.DownloadBandwithKbps = networkCapabilities.getLinkDownstreamBandwidthKbps();
st.UploadBandwithKbps = networkCapabilities.getLinkUpstreamBandwidthKbps();
if(networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET)) {
st.Transp = Transport.Ethernet;
}
else if(networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI)) {
st.Transp = Transport.WIFI;
}
else if(networkCapabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR)) {
st.Transp = Transport.Cellular;
if(st.DownloadBandwithKbps < 15) {
st.CellularQuality = 1; // unstable
}
else if(st.DownloadBandwithKbps < 300) {
st.CellularQuality = 2; // 2G
}
else if(st.DownloadBandwithKbps < 45000) {
st.CellularQuality = 3; // 3G
}
else /*if(st.DownloadBandwithKbps < 150000)*/{
st.CellularQuality = 4; // 4G
}
}
SendData(st);
}
private void SendData(Status data)
{
((SLib.SlActivity)Handler).runOnUiThread(new Runnable() {
@Override public void run()
{
Handler.HandleEvent(SLib.EV_ASYNCSET, "NetworkConnectionStatus", data);
}
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,21 @@ public static class ThreadEngine_SvcPoll implements Runnable {
}
@Override public void run()
{
SvcNotificationPoll(AppCtx); // @v11.5.10
DocStatusPoll(AppCtx);
// @v12.0.6 {
NetworkConnectionInfoManager.Status nws = AppCtx.GetNetworkStatus();
boolean disable_because_bad_network = true;
if(nws != null) {
if(nws.Transp == NetworkConnectionInfoManager.Transport.WIFI || nws.Transp == NetworkConnectionInfoManager.Transport.Ethernet)
disable_because_bad_network = false;
else if(nws.Transp == NetworkConnectionInfoManager.Transport.Cellular) {
if(nws.CellularQuality > 2)
disable_because_bad_network = false;
}
}
if(!disable_because_bad_network) /* } @v12.0.6 */ {
SvcNotificationPoll(AppCtx); // @v11.5.10
DocStatusPoll(AppCtx);
}
}
}
public static void SvcNotificationPoll(StyloQApp appCtx)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@color/PrimaryDark"
android:pathData="M120,840q-33,0 -56.5,-23.5T40,760v-560q0,-33 23.5,-56.5T120,120h720q33,0 56.5,23.5T920,200v560q0,33 -23.5,56.5T840,840L120,840ZM120,760h720v-560L120,200v560ZM120,760v-560,560ZM800,440L660,440v80h60v80L600,600v-240h200q0,-33 -23.5,-56.5T720,280L600,280q-33,0 -56.5,23.5T520,360v240q0,33 23.5,56.5T600,680h120q33,0 56.5,-23.5T800,600v-160ZM320,680h80v-120h80v-80h-80v-200h-80v200h-80v-200h-80v280h160v120Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="18.7835dp" android:viewportHeight="75.134"
android:viewportWidth="96" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/PrimaryDark" android:pathData="M67.459,23.385c-0.59,0.289 -1.177,0.605 -1.762,0.948c-1.762,1.029 -3.496,2.289 -5.263,3.735l-3.776,-4.329c1.303,-1.21 2.721,-2.314 4.221,-3.29c1.199,-0.78 2.449,-1.474 3.732,-2.071c0.514,-0.257 1.032,-0.5 1.56,-0.726c-2.494,-4.413 -6.079,-7.581 -10.144,-9.531c-4.062,-1.949 -8.61,-2.697 -13.038,-2.269c-4.4,0.426 -8.67,2.021 -12.203,4.763c-4.083,3.168 -7.189,7.902 -8.381,14.172l-0.373,1.962l-1.955,0.343c-1.914,0.336 -3.622,0.796 -5.124,1.38c-1.455,0.565 -2.749,1.259 -3.88,2.078c-0.906,0.656 -1.689,1.391 -2.353,2.187c-2.056,2.464 -3.009,5.549 -2.987,8.671c0.023,3.171 1.056,6.373 2.964,9.01c0.707,0.978 1.533,1.873 2.471,2.655c0.95,0.793 2.022,1.441 3.224,1.938c1.191,0.491 2.516,0.844 3.98,1.05h6.672v5.755h-6.78l-0.359,-0.034c-2.085,-0.265 -3.979,-0.758 -5.693,-1.465c-1.772,-0.731 -3.346,-1.681 -4.73,-2.837c-1.311,-1.093 -2.459,-2.337 -3.438,-3.689C1.44,50.195 0.033,45.802 0,41.432c-0.032,-4.421 1.344,-8.823 4.313,-12.381c0.964,-1.154 2.091,-2.215 3.388,-3.153c1.51,-1.093 3.238,-2.019 5.185,-2.775c1.345,-0.523 2.778,-0.96 4.299,-1.31c1.717,-6.825 5.386,-12.084 10.093,-15.738c4.403,-3.417 9.71,-5.404 15.171,-5.932C47.884,-0.383 53.482,0.544 58.5,2.952c5.487,2.632 10.267,7.015 13.37,13.183l0,0c1.247,-0.195 2.498,-0.293 3.741,-0.285c5.246,0.035 10.309,1.914 14.299,6.21c0.835,0.899 1.626,1.913 2.363,3.047c2.5,3.844 3.779,8.976 3.725,14c-0.054,4.927 -1.386,9.836 -4.102,13.449c-1.771,2.354 -4.045,4.273 -6.771,5.799c-2.628,1.472 -5.687,2.587 -9.125,3.385l-0.641,0.078h-4.405v-5.755h4.097c2.76,-0.666 5.194,-1.563 7.264,-2.721c2.055,-1.151 3.733,-2.55 4.993,-4.227c1.954,-2.599 2.914,-6.279 2.955,-10.054c0.044,-3.959 -0.919,-7.934 -2.803,-10.83c-0.541,-0.832 -1.129,-1.584 -1.756,-2.259c-2.819,-3.036 -6.401,-4.364 -10.116,-4.389C72.889,21.566 70.105,22.214 67.459,23.385L67.459,23.385L67.459,23.385zM48,41.036c9.414,0 17.049,7.635 17.049,17.049S57.414,75.134 48,75.134s-17.049,-7.635 -17.049,-17.049S38.586,41.036 48,41.036L48,41.036zM58.285,51.316L41.232,68.369C43.174,69.65 45.5,70.396 48,70.396c6.798,0 12.312,-5.514 12.312,-12.312C60.312,55.585 59.565,53.259 58.285,51.316L58.285,51.316L58.285,51.316zM37.716,64.853L54.769,47.8C52.826,46.52 50.5,45.772 48,45.772c-6.798,0 -12.312,5.514 -12.312,12.312C35.688,60.585 36.435,62.91 37.716,64.853L37.716,64.853L37.716,64.853z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@color/PrimaryDark"
android:pathData="M792,904 L400,512v174l62,-62 58,56 -160,160 -160,-160 58,-56 62,62v-254L56,168l56,-56 736,736 -56,56ZM640,526l-80,-80v-174l-64,64 -56,-56 160,-160 160,160 -56,56 -64,-64v254Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="24"
android:viewportWidth="24" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/PrimaryDark" android:pathData="M7.831,16.169c-0.557,-0.557 -0.975,-1.207 -1.281,-1.901l1.57,-1.57c0.175,0.761 0.548,1.48 1.125,2.057 0.675,0.675 1.54,1.076 2.472,1.193l1.898,1.898c-0.444,0.098 -0.9,0.154 -1.365,0.154 -1.67,0 -3.239,-0.65 -4.419,-1.831ZM0.043,1.457L22.543,23.957l1.414,-1.414 -6.831,-6.831 5.043,-5.043c1.181,-1.18 1.831,-2.75 1.831,-4.419 0,-1.669 -0.65,-3.239 -1.831,-4.419C20.989,0.65 19.42,0 17.75,0s-3.239,0.65 -4.419,1.831l-2.2,2.2c0.205,-0.015 0.411,-0.03 0.618,-0.03 0.681,0 1.346,0.091 1.99,0.25l1.005,-1.005c0.803,-0.803 1.87,-1.245 3.005,-1.245s2.202,0.442 3.005,1.245 1.245,1.87 1.245,3.005 -0.442,2.203 -1.245,3.005l-5.043,5.043 -5.852,-5.852c0.587,-0.294 1.227,-0.446 1.89,-0.446 1.135,0 2.202,0.442 3.005,1.245 0.577,0.577 0.95,1.296 1.125,2.057l1.57,-1.57c-0.306,-0.694 -0.724,-1.345 -1.281,-1.901 -1.18,-1.181 -2.749,-1.831 -4.419,-1.831 -1.209,0 -2.365,0.341 -3.359,0.977L1.457,0.043 0.043,1.457ZM0,17.75c0,1.669 0.65,3.239 1.831,4.419 1.18,1.181 2.749,1.831 4.419,1.831s3.239,-0.65 4.419,-1.831l2.2,-2.2c-0.205,0.015 -0.411,0.03 -0.618,0.03 -0.681,0 -1.346,-0.091 -1.99,-0.25l-1.006,1.006c-0.803,0.803 -1.87,1.245 -3.005,1.245s-2.202,-0.442 -3.005,-1.245 -1.245,-1.87 -1.245,-3.005 0.442,-2.203 1.245,-3.005l3.673,-3.673 -1.414,-1.414 -3.673,3.673C0.65,14.511 0,16.081 0,17.75Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="@color/PrimaryDark"
android:pathData="M480,840q-42,0 -71,-29t-29,-71q0,-42 29,-71t71,-29q42,0 71,29t29,71q0,42 -29,71t-71,29ZM254,614l-84,-86q59,-59 138.5,-93.5T480,400q92,0 171.5,35T790,530l-84,84q-44,-44 -102,-69t-124,-25q-66,0 -124,25t-102,69ZM84,444 L0,360q92,-94 215,-147t265,-53q142,0 265,53t215,147l-84,84q-77,-77 -178.5,-120.5T480,280q-116,0 -217.5,43.5T84,444Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="16"
android:viewportWidth="16" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/PrimaryDark" android:pathData="m13,1c-0.5547,0 -1,0.4453 -1,1v12c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-12c0,-0.5547 -0.4453,-1 -1,-1zM9,4c-0.5547,0 -1,0.4453 -1,1v9c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-9c0,-0.5547 -0.4453,-1 -1,-1zM5,7c-0.5547,0 -1,0.4453 -1,1v6c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-6c0,-0.5547 -0.4453,-1 -1,-1zM1,10c-0.5547,0 -1,0.4453 -1,1v3c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-3c0,-0.5547 -0.4453,-1 -1,-1zM1,10"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:viewportHeight="16"
android:viewportWidth="16" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/PrimaryDark" android:pathData="m9,4c-0.5547,0 -1,0.4453 -1,1v9c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-9c0,-0.5547 -0.4453,-1 -1,-1zM5,7c-0.5547,0 -1,0.4453 -1,1v6c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-6c0,-0.5547 -0.4453,-1 -1,-1zM1,10c-0.5547,0 -1,0.4453 -1,1v3c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-3c0,-0.5547 -0.4453,-1 -1,-1zM1,10"/>
<path android:fillAlpha="0.34902" android:fillColor="#2e3436" android:pathData="m13,1c-0.5547,0 -1,0.4453 -1,1v12c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-12c0,-0.5547 -0.4453,-1 -1,-1zM13,1"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:viewportHeight="16"
android:viewportWidth="16" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/PrimaryDark" android:pathData="m5,7c-0.5547,0 -1,0.4453 -1,1v6c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-6c0,-0.5547 -0.4453,-1 -1,-1zM1,10c-0.5547,0 -1,0.4453 -1,1v3c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-3c0,-0.5547 -0.4453,-1 -1,-1zM1,10"/>
<path android:fillAlpha="0.34902" android:fillColor="#2e3436" android:pathData="m13,1c-0.5547,0 -1,0.4453 -1,1v12c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-12c0,-0.5547 -0.4453,-1 -1,-1zM9,4c-0.5547,0 -1,0.4453 -1,1v9c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-9c0,-0.5547 -0.4453,-1 -1,-1zM9,4"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector android:height="24dp" android:viewportHeight="16"
android:viewportWidth="16" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/PrimaryDark" android:pathData="m1,10c-0.5547,0 -1,0.4453 -1,1v3c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-3c0,-0.5547 -0.4453,-1 -1,-1zM1,10"/>
<path android:fillAlpha="0.34902" android:fillColor="#2e3436" android:pathData="m13,1c-0.5547,0 -1,0.4453 -1,1v12c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-12c0,-0.5547 -0.4453,-1 -1,-1zM9,4c-0.5547,0 -1,0.4453 -1,1v9c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-9c0,-0.5547 -0.4453,-1 -1,-1zM5,7c-0.5547,0 -1,0.4453 -1,1v6c0,0.5547 0.4453,1 1,1h1c0.5547,0 1,-0.4453 1,-1v-6c0,-0.5547 -0.4453,-1 -1,-1zM5,7"/>
</vector>
4 changes: 4 additions & 0 deletions Src/Android/StyloQ/app/src/main/res/drawable/ic_refresh01.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<vector android:height="24dp" android:viewportHeight="48"
android:viewportWidth="48" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/PrimaryDark" android:pathData="M35.3,12.7C32.41,9.8 28.42,8 24,8 15.16,8 8.02,15.16 8.02,24S15.16,40 24,40c7.45,0 13.69,-5.1 15.46,-12H35.3c-1.65,4.66 -6.07,8 -11.3,8 -6.63,0 -12,-5.37 -12,-12s5.37,-12 12,-12c3.31,0 6.28,1.38 8.45,3.55L26,22h14V8l-4.7,4.7z"/>
</vector>
Loading

0 comments on commit a1a7142

Please sign in to comment.