News download finished.

This commit is contained in:
jens 2021-02-22 19:46:28 +01:00
parent 7efb59b9dc
commit bb22bcee95
4 changed files with 33 additions and 8 deletions

View File

@ -9,6 +9,7 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.StrictMode; import android.os.StrictMode;
import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
@ -603,15 +604,25 @@ public class ActivityMainScreen extends ActivityGeneric
public void processNewsResult(ArrayList<News> newsToDisplay) public void processNewsResult(ArrayList<News> newsToDisplay)
{ {
if (newsToDisplay.size() > 0) if(Settings.displayNewsOnMainScreen)
{ {
activityMainScreenInstance.tvMainScreenNote3.setText(HtmlCompat.fromHtml(newsToDisplay.get(0).toStringHtml(), 0)); try
activityMainScreenInstance.tvMainScreenNote3.setVisibility(View.VISIBLE); {
} if (newsToDisplay.size() > 0)
else {
{ activityMainScreenInstance.tvMainScreenNote3.setText(HtmlCompat.fromHtml(newsToDisplay.get(0).toStringHtml(), 0));
activityMainScreenInstance.tvMainScreenNote3.setText(""); activityMainScreenInstance.tvMainScreenNote3.setVisibility(View.VISIBLE);
activityMainScreenInstance.tvMainScreenNote3.setVisibility(View.GONE); }
else
{
activityMainScreenInstance.tvMainScreenNote3.setText("");
activityMainScreenInstance.tvMainScreenNote3.setVisibility(View.GONE);
}
}
catch(Exception e)
{
Miscellaneous.logEvent("e", "Error displaying news", Log.getStackTraceString(e), 3);
}
} }
} }
} }

View File

@ -55,6 +55,7 @@ public class Settings implements SharedPreferences
public static boolean privacyLocationing; public static boolean privacyLocationing;
public static int startScreen; public static int startScreen;
public static boolean executeRulesAndProfilesWithSingleClick; public static boolean executeRulesAndProfilesWithSingleClick;
public static boolean displayNewsOnMainScreen;
public static boolean lockSoundChanges; public static boolean lockSoundChanges;
public static boolean noticeAndroid9MicrophoneShown; public static boolean noticeAndroid9MicrophoneShown;
public static boolean noticeAndroid10WifiShown; public static boolean noticeAndroid10WifiShown;
@ -105,6 +106,7 @@ public class Settings implements SharedPreferences
protected static final boolean default_privacyLocationing = false; protected static final boolean default_privacyLocationing = false;
protected static final int default_startScreen = 0; protected static final int default_startScreen = 0;
protected static final boolean default_executeRulesAndProfilesWithSingleClick = false; protected static final boolean default_executeRulesAndProfilesWithSingleClick = false;
protected static final boolean default_displayNewsOnMainScreen = true;
protected static final boolean default_lockSoundChanges = false; protected static final boolean default_lockSoundChanges = false;
protected static final long default_lastNewsPolltime = -1; protected static final long default_lastNewsPolltime = -1;
@ -240,6 +242,7 @@ public class Settings implements SharedPreferences
startScreen = Integer.parseInt(prefs.getString("startScreen", String.valueOf(default_startScreen))); startScreen = Integer.parseInt(prefs.getString("startScreen", String.valueOf(default_startScreen)));
executeRulesAndProfilesWithSingleClick = prefs.getBoolean("executeRulesAndProfilesWithSingleClick", default_executeRulesAndProfilesWithSingleClick); executeRulesAndProfilesWithSingleClick = prefs.getBoolean("executeRulesAndProfilesWithSingleClick", default_executeRulesAndProfilesWithSingleClick);
displayNewsOnMainScreen = prefs.getBoolean("displayNewsOnMainScreen", default_displayNewsOnMainScreen);
lockSoundChanges = prefs.getBoolean("lockSoundChanges", default_lockSoundChanges); lockSoundChanges = prefs.getBoolean("lockSoundChanges", default_lockSoundChanges);
noticeAndroid9MicrophoneShown = prefs.getBoolean("noticeAndroid9MicrophoneShown", false); noticeAndroid9MicrophoneShown = prefs.getBoolean("noticeAndroid9MicrophoneShown", false);
@ -395,6 +398,9 @@ public class Settings implements SharedPreferences
if(!prefs.contains("executeRulesAndProfilesWithSingleClick") | force) if(!prefs.contains("executeRulesAndProfilesWithSingleClick") | force)
editor.putBoolean("executeRulesAndProfilesWithSingleClick", default_executeRulesAndProfilesWithSingleClick); editor.putBoolean("executeRulesAndProfilesWithSingleClick", default_executeRulesAndProfilesWithSingleClick);
if(!prefs.contains("displayNewsOnMainScreen") | force)
editor.putBoolean("displayNewsOnMainScreen", default_displayNewsOnMainScreen);
if(!prefs.contains("lockSoundChanges") | force) if(!prefs.contains("lockSoundChanges") | force)
editor.putBoolean("lockSoundChanges", default_lockSoundChanges); editor.putBoolean("lockSoundChanges", default_lockSoundChanges);
@ -465,6 +471,7 @@ public class Settings implements SharedPreferences
editor.putBoolean("privacyLocationing", privacyLocationing); editor.putBoolean("privacyLocationing", privacyLocationing);
editor.putString("startScreen", String.valueOf(startScreen)); editor.putString("startScreen", String.valueOf(startScreen));
editor.putBoolean("executeRulesAndProfilesWithSingleClick", executeRulesAndProfilesWithSingleClick); editor.putBoolean("executeRulesAndProfilesWithSingleClick", executeRulesAndProfilesWithSingleClick);
editor.putBoolean("displayNewsOnMainScreen", displayNewsOnMainScreen);
editor.putBoolean("lockSoundChanges", lockSoundChanges); editor.putBoolean("lockSoundChanges", lockSoundChanges);
editor.putBoolean("noticeAndroid9MicrophoneShown", noticeAndroid9MicrophoneShown); editor.putBoolean("noticeAndroid9MicrophoneShown", noticeAndroid9MicrophoneShown);

View File

@ -56,6 +56,11 @@
android:key="executeRulesAndProfilesWithSingleClick" android:key="executeRulesAndProfilesWithSingleClick"
android:title="@string/executeRulesAndProfilesWithSingleClickTitle" /> android:title="@string/executeRulesAndProfilesWithSingleClickTitle" />
<CheckBoxPreference
android:key="displayNewsOnMainScreen"
android:title="@string/displayNewsOnMainScreen"
android:summary="@string/displayNewsOnMainScreenDescription" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory

View File

@ -602,4 +602,6 @@
<string name="featureNotInFdroidVersion">This feature is based on non-free software. Therefore is is not available in the F-Droid version.</string> <string name="featureNotInFdroidVersion">This feature is based on non-free software. Therefore is is not available in the F-Droid version.</string>
<string name="settingsReferringToRestrictedFeatures">Your settings and or rules are currently referencing non-free features that cannot be provided in the F-Droid version.</string> <string name="settingsReferringToRestrictedFeatures">Your settings and or rules are currently referencing non-free features that cannot be provided in the F-Droid version.</string>
<string name="publishedOn">published on</string> <string name="publishedOn">published on</string>
<string name="displayNewsOnMainScreen">Display application news on main screen</string>
<string name="displayNewsOnMainScreenDescription">Announcements about this app only, we\'re probably talking about 1-2 per year, not more.</string>
</resources> </resources>