From 589379f1324b25bbb3eada6eb16e5941be31ea77 Mon Sep 17 00:00:00 2001 From: NudeDude Date: Tue, 8 Oct 2019 21:14:53 +0200 Subject: [PATCH] small fix --- .idea/codeStyles/Project.xml | 116 ++++++++++++++++++ .idea/inspectionProfiles/Project_Default.xml | 6 + .idea/modules.xml | 9 ++ .../twidda/database/AppDatabase.java | 19 +-- 4 files changed, 141 insertions(+), 9 deletions(-) create mode 100644 .idea/codeStyles/Project.xml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/modules.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 00000000..681f41ae --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,116 @@ + + + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..a0ca8d15 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..2596d4b7 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/org/nuclearfog/twidda/database/AppDatabase.java b/app/src/main/java/org/nuclearfog/twidda/database/AppDatabase.java index b11084c4..6dc212e9 100644 --- a/app/src/main/java/org/nuclearfog/twidda/database/AppDatabase.java +++ b/app/src/main/java/org/nuclearfog/twidda/database/AppDatabase.java @@ -31,16 +31,16 @@ public class AppDatabase { private static final int FRQ_MASK = 1 << 2; // USER REQUEST FOLLOW private static final int EXCL_USR = 1 << 3; // EXCLUDE USERS TWEETS - private final String limit; // DATABASE ENTRY limit + private final int limit; // DATABASE ENTRY limit + private final long homeId; private DatabaseAdapter dataHelper; - private long homeId; public AppDatabase(Context context) { dataHelper = DatabaseAdapter.getInstance(context); GlobalSettings settings = GlobalSettings.getInstance(context); homeId = settings.getUserId(); - limit = Integer.toString(settings.getRowLimit()); + limit = settings.getRowLimit(); } /** @@ -183,7 +183,7 @@ public class AppDatabase { * @return tweet list */ public List getHomeTimeline() { - final String[] ARGS = new String[]{Integer.toString(HOM_MASK), limit}; + final String[] ARGS = new String[]{Integer.toString(HOM_MASK), Integer.toString(limit)}; final String QUERY = "SELECT * FROM tweet INNER JOIN user ON tweet.userID=user.userID " + "WHERE statusregister&? IS NOT 0 ORDER BY tweetID DESC LIMIT ?"; @@ -207,7 +207,7 @@ public class AppDatabase { * @return tweet list */ public List getMentions() { - final String[] ARGS = new String[]{Integer.toString(MEN_MASK), Integer.toString(EXCL_USR), limit}; + final String[] ARGS = new String[]{Integer.toString(MEN_MASK), Integer.toString(EXCL_USR), Integer.toString(limit)}; final String QUERY = "SELECT * FROM tweet INNER JOIN user ON tweet.userID=user.userID " + "WHERE statusregister&? IS NOT 0 AND userregister&? IS 0 ORDER BY tweetID DESC LIMIT ?"; @@ -232,7 +232,7 @@ public class AppDatabase { * @return Tweet list of user tweets */ public List getUserTweets(long userID) { - final String[] ARGS = new String[]{Integer.toString(UTW_MASK), Long.toString(userID), limit}; + final String[] ARGS = new String[]{Integer.toString(UTW_MASK), Long.toString(userID), Integer.toString(limit)}; final String QUERY = "SELECT * FROM tweet INNER JOIN user ON tweet.userID=user.userID " + "WHERE statusregister&? IS NOT 0 AND user.userID=? ORDER BY tweetID DESC LIMIT ?"; @@ -257,7 +257,7 @@ public class AppDatabase { * @return favored tweets by user */ public List getUserFavs(long ownerID) { - final String[] ARGS = new String[]{Long.toString(ownerID), limit}; + final String[] ARGS = new String[]{Long.toString(ownerID), Integer.toString(limit)}; final String QUERY = "SELECT * FROM tweet INNER JOIN favorit on tweet.tweetID=favorit.tweetID " + "INNER JOIN user ON tweet.userID=user.userID WHERE favorit.ownerID=? ORDER BY tweetID DESC LIMIT ?"; @@ -304,7 +304,8 @@ public class AppDatabase { * @return list of tweet answers */ public List getAnswers(long tweetId) { - final String[] ARGS = new String[]{Long.toString(tweetId), Integer.toString(RPL_MASK), Integer.toString(EXCL_USR), limit}; + final String[] ARGS = new String[]{Long.toString(tweetId), Integer.toString(RPL_MASK), + Integer.toString(EXCL_USR), Integer.toString(limit)}; final String QUERY = "SELECT * FROM tweet INNER JOIN user ON tweet.userID=user.userID " + "WHERE tweet.replyID=? AND statusregister&? IS NOT 0 AND userregister&? IS 0 ORDER BY tweetID DESC LIMIT ?"; @@ -456,7 +457,7 @@ public class AppDatabase { * @return list of direct messages */ public List getMessages() { - final String[] ARGS = new String[]{limit}; + final String[] ARGS = new String[]{Integer.toString(limit)}; final String QUERY = "SELECT * FROM message ORDER BY messageID DESC LIMIT ?"; List result = new LinkedList<>();