Night mode layout bug fixed

This commit is contained in:
Alessandro Ferro 2022-10-24 09:13:23 +02:00
parent 8cd7508dff
commit 24c10fdddc
2 changed files with 26 additions and 5 deletions

View File

@ -12,10 +12,11 @@ import android.widget.Toast;
public class SmsReceiver extends BroadcastReceiver { public class SmsReceiver extends BroadcastReceiver {
// https://www.vogella.com/tutorials/AndroidBroadcastReceiver/article.html // https://www.vogella.com/tutorials/AndroidBroadcastReceiver/article.html
// This method gets fired as soon as it receives an SMS. // This method gets fired as soon as it receives an SMS.
// Consider using a JobService: https://developer.android.com/topic/performance/vitals/anr#slow_broadcast_receivers
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
/* Consider using a WorkManager: https://developer.android.com/topic/performance/vitals/anr#slow_broadcast_receivers
* because the maximum BroadcastReceiver lifespan is 10seconds https://developer.android.com/training/articles/perf-anr.html
*/
if (intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")) { if (intent.getAction().equals("android.provider.Telephony.SMS_RECEIVED")) {
Bundle bundle = intent.getExtras(); Bundle bundle = intent.getExtras();
if (bundle != null) { if (bundle != null) {
@ -46,3 +47,25 @@ public class SmsReceiver extends BroadcastReceiver {
} }
} }
} }
/*
NOTE:
On Android 3.1 and higher, when your app is first installed on the device, it is in a
stopped state. This has nothing to do with onStop() of any activity. While in the
stopped state, your manifest-registered BroadcastReceivers will not receive any
broadcasts.
To get out of the stopped state, something on the device, such as another app (that
itself is not in the stopped state), must use an explicit Intent to invoke one of your
components.
The most common way this happens is for the user to tap on a launcher icon
associated with your launcher activity. Under the covers, the home screens launcher
will create an explicit Intent, identifying your activity, and use that with
startActivity(). This moves you out of the stopped state.
As noted above, you start off in the stopped state. Once you are moved out of the
stopped state, via the explicit Intent, you will remain out of the stopped state until
one of two things happens:
1. The user uninstalls your app
2. The user force-stops your app
- The busy's guide to Android Development, Mark L. Murphy
*/

View File

@ -21,7 +21,6 @@
android:textSize="17sp" android:textSize="17sp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:textColor="@color/design_default_color_on_secondary"
android:text="Password" /> android:text="Password" />
<TextView <TextView
@ -50,7 +49,6 @@
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:textSize="17sp" android:textSize="17sp"
android:textColor="@color/black"
android:text="SMS command" /> android:text="SMS command" />
<TextView <TextView