diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2025-05-22 09:31:02 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2025-05-22 09:31:02 +0300 |
| commit | 51687b6f1c409f741fe44907434ba9d9b036c33e (patch) | |
| tree | ff248fd4ee1a613d524b24695f5230572fb5bb97 | |
| parent | fc7adaedd45a30f48dac60ccc71ae241719a52a1 (diff) | |
| download | the-epube-android-51687b6f1c409f741fe44907434ba9d9b036c33e.tar.gz the-epube-android-51687b6f1c409f741fe44907434ba9d9b036c33e.tar.xz | |
reformat
3 files changed, 21 insertions, 20 deletions
diff --git a/org.fox.epube/src/main/java/org/fox/epube/Application.java b/org.fox.epube/src/main/java/org/fox/epube/Application.java index b9b81a6..7fd9c61 100644 --- a/org.fox.epube/src/main/java/org/fox/epube/Application.java +++ b/org.fox.epube/src/main/java/org/fox/epube/Application.java @@ -1,10 +1,5 @@ package org.fox.epube; -import android.os.Bundle; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - import java.net.CookieHandler; import java.net.CookieManager; @@ -21,7 +16,7 @@ public class Application extends android.app.Application { m_singleton = this; } - public static Application getInstance(){ + public static Application getInstance() { return m_singleton; } diff --git a/org.fox.epube/src/main/java/org/fox/epube/MasterActivity.java b/org.fox.epube/src/main/java/org/fox/epube/MasterActivity.java index 2875539..94b9cb6 100644 --- a/org.fox.epube/src/main/java/org/fox/epube/MasterActivity.java +++ b/org.fox.epube/src/main/java/org/fox/epube/MasterActivity.java @@ -38,7 +38,7 @@ public class MasterActivity extends AppCompatActivity implements NetworkStateRec private final String TAG = this.getClass().getSimpleName(); private MasterModel m_model; - public enum AppPage { PAGE_UNKNOWN, PAGE_LOGIN, PAGE_LIBRARY, PAGE_FAVORITES, PAGE_OFFLINE, PAGE_READER } + public enum AppPage {PAGE_UNKNOWN, PAGE_LOGIN, PAGE_LIBRARY, PAGE_FAVORITES, PAGE_OFFLINE, PAGE_READER} private ProgressBar m_loadingBar; private WebView m_web; @@ -315,7 +315,7 @@ public class MasterActivity extends AppCompatActivity implements NetworkStateRec m_model.setOffline(offline); if (m_web != null) { - m_web.evaluateJavascript("Reader.onOfflineModeChanged("+ offline +");", null); + m_web.evaluateJavascript("Reader.onOfflineModeChanged(" + offline + ");", null); } } @@ -395,7 +395,9 @@ public class MasterActivity extends AppCompatActivity implements NetworkStateRec } - /** actually shows or hides entire appbarlayout */ + /** + * actually shows or hides entire appbarlayout + */ private void showActionBar(boolean show) { View abl = findViewById(R.id.appbarlayout); abl.setVisibility(show ? View.VISIBLE : View.GONE); diff --git a/org.fox.epube/src/main/java/org/fox/epube/NetworkStateReceiver.java b/org.fox.epube/src/main/java/org/fox/epube/NetworkStateReceiver.java index 2987525..22afbe9 100644 --- a/org.fox.epube/src/main/java/org/fox/epube/NetworkStateReceiver.java +++ b/org.fox.epube/src/main/java/org/fox/epube/NetworkStateReceiver.java @@ -31,12 +31,13 @@ public class NetworkStateReceiver extends BroadcastReceiver { * During this time you can use the other methods on BroadcastReceiver to view/modify the current result values. * NOTE: When it runs on the main thread you should never perform long-running operations in it (there is a timeout of 10 seconds that the system allows before considering the receiver to be blocked and a candidate to be killed). * NOTE: You cannot launch a popup dialog in your implementation of onReceive(). - * @param context Object to access additional information or to start services or activities - * @param intent Object with action used to register your receiver. This object contains additional information (e.g. extras) + * + * @param context Object to access additional information or to start services or activities + * @param intent Object with action used to register your receiver. This object contains additional information (e.g. extras) */ public void onReceive(Context context, Intent intent) { Log.i(TAG, "Intent broadcast received"); - if(intent == null || intent.getExtras() == null) + if (intent == null || intent.getExtras() == null) return; // Retrieve a ConnectivityManager for handling management of network connections @@ -47,9 +48,9 @@ public class NetworkStateReceiver extends BroadcastReceiver { /** * NOTE: getActiveNetworkInfo() may return null when there is no default network e.g. Airplane Mode */ - if(networkInfo != null && networkInfo.getState() == NetworkInfo.State.CONNECTED) { + if (networkInfo != null && networkInfo.getState() == NetworkInfo.State.CONNECTED) { connected = true; - } else if(intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, Boolean.FALSE)) { //Boolean that indicates whether there is a complete lack of connectivity + } else if (intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, Boolean.FALSE)) { //Boolean that indicates whether there is a complete lack of connectivity connected = false; } @@ -61,19 +62,20 @@ public class NetworkStateReceiver extends BroadcastReceiver { */ private void notifyStateToAll() { Log.i(TAG, "Notifying state to " + listeners.size() + " listener(s)"); - for(NetworkStateReceiverListener eachNetworkStateReceiverListener : listeners) + for (NetworkStateReceiverListener eachNetworkStateReceiverListener : listeners) notifyState(eachNetworkStateReceiverListener); } /** * Notify the network state, triggering interface functions based on the current state - * @param networkStateReceiverListener Object which implements the NetworkStateReceiverListener interface + * + * @param networkStateReceiverListener Object which implements the NetworkStateReceiverListener interface */ private void notifyState(NetworkStateReceiverListener networkStateReceiverListener) { - if(connected == null || networkStateReceiverListener == null) + if (connected == null || networkStateReceiverListener == null) return; - if(connected == true) { + if (connected == true) { // Triggering function on the interface towards network availability networkStateReceiverListener.networkAvailable(); } else { @@ -84,7 +86,8 @@ public class NetworkStateReceiver extends BroadcastReceiver { /** * Adds a listener to the list so that it will receive connection state change updates - * @param networkStateReceiverListener Object which implements the NetworkStateReceiverListener interface + * + * @param networkStateReceiverListener Object which implements the NetworkStateReceiverListener interface */ public void addListener(NetworkStateReceiverListener networkStateReceiverListener) { Log.i(TAG, "addListener() - listeners.add(networkStateReceiverListener) + notifyState(networkStateReceiverListener);"); @@ -94,7 +97,8 @@ public class NetworkStateReceiver extends BroadcastReceiver { /** * Removes listener (when no longer necessary) from the list so that it will no longer receive connection state change updates - * @param networkStateReceiverListener Object which implements the NetworkStateReceiverListener interface + * + * @param networkStateReceiverListener Object which implements the NetworkStateReceiverListener interface */ public void removeListener(NetworkStateReceiverListener networkStateReceiverListener) { listeners.remove(networkStateReceiverListener); |
