Skip to content

Commit e25b510

Browse files
committed
code clean-up
code clean-up and replaced ab_icon png with vector
1 parent af7ad02 commit e25b510

File tree

12 files changed

+41
-18
lines changed

12 files changed

+41
-18
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
applicationId "livio.rssreader"
88
minSdkVersion 23
99
targetSdkVersion 35
10-
versionCode 108
11-
versionName "1.0.8"
10+
versionCode 109
11+
versionName "1.0.9"
1212
}
1313

1414
compileOptions {

app/src/main/java/livio/rssreader/RSSReader.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
import tools.FileHandler;
127127
import tools.FileManager;
128128
import tools.LocalBroadcastManager;//added after deprecation of orignal class from Google
129-
//import tools.ReportBug;
129+
import tools.ReportBug;
130130
import workers.RSSReaderWorker;
131131

132132
import static livio.rssreader.SelectCategory.ID_CATEGORY;
@@ -197,7 +197,6 @@ public final class RSSReader extends AppCompatActivity implements FileHandler, A
197197
private final static long zzBackup_age = 7L * 24L * 3600L * 1000L;
198198

199199
private static String latest_feed_id = null;
200-
static FeedsDB feedsDB = FeedsDB.getInstance();//contiene feeds per tutte le categorie e tutte le lingue definite
201200
static String message_publisher = "unknown";//publisher
202201
//colorpicker
203202

@@ -236,7 +235,7 @@ public void onCreate(Bundle savedInstanceState) {
236235

237236
setContentView(R.layout.main);
238237

239-
// ReportBug.enableMonitor(this);
238+
ReportBug.enableMonitor(this);
240239

241240
System.setProperty("http.keepAlive", "false"); // workaround to avoid responseCode = -1 problem
242241

@@ -255,13 +254,6 @@ public void onCreate(Bundle savedInstanceState) {
255254
final Toolbar toolbar = findViewById(R.id.toolbar);
256255
setSupportActionBar(toolbar);
257256

258-
ActionBar ab = getSupportActionBar();
259-
if (ab != null) {
260-
ab.setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_TITLE);
261-
ab.setIcon(R.drawable.ab_icon);
262-
ab.setTitle(R.string.app_name);
263-
}
264-
265257
mTts = new TTSEngine(this, new UtteranceProgressListener() {
266258
@Override
267259
public void onDone(String utteranceId) {
@@ -471,6 +463,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
471463
String pref_lang = prefs.getString(PREF_FEEDS_LANGUAGE, getString(R.string.default_feed_language_code));
472464
String feed_id = prefs.getString(PREF_FEED_ID, null);//lang
473465
if (feed_id == null) {
466+
FeedsDB feedsDB = FeedsDB.getInstance();
474467
feed_id = feedsDB.getDefaultFeedId(pref_lang);//lang
475468
}
476469
File feedFile = new File(getCacheDir(), feed_id.concat(".cache"));
@@ -610,6 +603,7 @@ protected void onResume() {
610603
String feed_id = prefs.getString(PREF_FEED_ID, null);//lang
611604
if (feed_id == null) {
612605
String pref_lang = prefs.getString(PREF_FEEDS_LANGUAGE, getString(R.string.default_feed_language_code));
606+
FeedsDB feedsDB = FeedsDB.getInstance();
613607
feed_id = feedsDB.getDefaultFeedId(pref_lang);//lang
614608
}
615609
File feedFile = new File(getCacheDir(), feed_id.concat(".cache"));
@@ -737,6 +731,7 @@ public void onReceive(Context context, Intent intent) {
737731
String feed_id = prefs.getString(PREF_FEED_ID, null);//lang
738732
if (feed_id == null) {
739733
String pref_lang = prefs.getString(PREF_FEEDS_LANGUAGE, getString(R.string.default_feed_language_code));
734+
FeedsDB feedsDB = FeedsDB.getInstance();
740735
feed_id = feedsDB.getDefaultFeedId(pref_lang);//lang
741736
}
742737
File feedFile = new File(getCacheDir(), feed_id.concat(".cache"));
@@ -889,6 +884,7 @@ public boolean decodeFile(String content) throws JSONException {
889884
}
890885
//sync to file if needed
891886
if (listUserFeeds.size() + listUserCats.size() > 0) {
887+
FeedsDB feedsDB = FeedsDB.getInstance();
892888
UserDB ft = UserDB.getInstance(this, prefs, feedsDB, listUserFeeds, listUserCats); //create feedstree with restored user feeds
893889
ft.synctoFile(this); //write restored user feeds to file
894890
}

app/src/main/java/livio/rssreader/backend/UserDB.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import android.util.Log;
2626

2727
import androidx.annotation.NonNull;
28-
import androidx.annotation.Nullable;
2928
import livio.rssreader.BuildConfig;
3029
import livio.rssreader.R;
3130
import livio.rssreader.RSSReader;
@@ -74,7 +73,7 @@ public synchronized static UserDB getInstance(Context context, SharedPreferences
7473
return singleton;
7574
}
7675

77-
public synchronized static UserDB getInstance(Context context, SharedPreferences prefs, @Nullable FeedsDB feedsDB, ArrayList<String[]> listUserFeeds, ArrayList<String[]> listUserCats) {
76+
public synchronized static UserDB getInstance(Context context, SharedPreferences prefs, FeedsDB feedsDB, ArrayList<String[]> listUserFeeds, ArrayList<String[]> listUserCats) {
7877
if (singleton == null) {
7978
singleton = new UserDB(context, prefs, listUserFeeds, listUserCats, feedsDB);
8079
} else {
@@ -91,6 +90,7 @@ public synchronized static UserDB getInstance(Context context, SharedPreferences
9190
return singleton;
9291
}
9392

93+
/** @noinspection unchecked*/
9494
private UserDB(Context context, SharedPreferences prefs, FeedsDB feedsDB) {
9595
if (BuildConfig.DEBUG)
9696
Log.d(tag, "new UserDB from file in feedListfn");
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package tools;
2+
3+
import android.content.Context;
4+
5+
public final class ReportBug {
6+
public static void enableMonitor(final Context ctx) {
7+
//for future use
8+
}
9+
}
-2.82 KB
Binary file not shown.
-1.7 KB
Binary file not shown.
-3.74 KB
Binary file not shown.
-6.24 KB
Binary file not shown.
-11.9 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<vector android:height="32dp"
2+
android:viewportHeight="10.0"
3+
android:viewportWidth="10.0" android:width="32dp" xmlns:android="http://schemas.android.com/apk/res/android">
4+
<path android:fillColor="#FFFFFFFF" android:pathData="m2 2H8V8H2z"/>
5+
<path android:fillColor="#FFFA6900" android:pathData="m8 1a1 1 0 0 1 1 1v6a-1 1 0 0 1 -1 1h-6a-1 -1 0 0 1 -1 -1v-6a1 1 0 0 1 1 -1zm-6 2a5 5 0 0 1 5 5h1a6 6 0 0 0 -6 -6zm0 2a3 3 0 0 1 3 3h1a4 4 0 0 0 -4 -4zm1 1a1 1 0 1 0 1 1a1 1 0 0 0 -1 -1"/>
6+
</vector>

0 commit comments

Comments
 (0)