]> git.ktnx.net Git - mobile-ledger.git/commitdiff
lower minSdkVersion from 23 to 22
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 9 Dec 2018 18:31:22 +0000 (18:31 +0000)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 9 Dec 2018 18:31:22 +0000 (18:31 +0000)
app/build.gradle
app/src/main/java/net/ktnx/mobileledger/AccountSummary.java

index 5bf204b7d27221b77b421f73f364607201a6561b..35d467480e9f37adb6662e68284fb7c6cd2d5be4 100644 (file)
@@ -4,7 +4,7 @@ android {
     compileSdkVersion 28
     defaultConfig {
         applicationId "net.ktnx.mobileledger"
-        minSdkVersion 23
+        minSdkVersion 22
         targetSdkVersion 28
         versionCode 1
         versionName "1.0"
index 82104b5eddf3ac386e187b18de15e00c566bd88b..dedc1005649fa6872b860029ea3d65c0b9459f62 100644 (file)
@@ -79,9 +79,24 @@ public class AccountSummary extends AppCompatActivity {
     protected void onStart() {
         super.onStart();
         LinearLayout grp = drawer.findViewById(R.id.nav_actions);
-        for (int i = 0; i < grp.getChildCount(); i++)
-            grp.getChildAt(i).setBackgroundColor(getResources().getColor(R.color.drawer_background, getTheme()));
-        drawer.findViewById(R.id.nav_account_summary).setBackgroundColor(getResources().getColor(R.color.table_row_even_bg, getTheme()));
+        for (int i = 0; i < grp.getChildCount(); i++) {
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+                grp.getChildAt(i).setBackgroundColor(
+                        getResources().getColor(R.color.drawer_background, getTheme()));
+            }
+            else {
+                grp.getChildAt(i)
+                        .setBackgroundColor(getResources().getColor(R.color.drawer_background));
+            }
+        }
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+            drawer.findViewById(R.id.nav_account_summary).setBackgroundColor(
+                    getResources().getColor(R.color.table_row_even_bg, getTheme()));
+        }
+        else {
+            drawer.findViewById(R.id.nav_account_summary)
+                    .setBackgroundColor(getResources().getColor(R.color.table_row_even_bg));
+        }
     }
 
     public void fab_new_transaction_clicked(View view) {
@@ -143,7 +158,8 @@ public class AccountSummary extends AppCompatActivity {
             MobileLedgerDB.setDb_filename(this.getApplicationInfo().deviceProtectedDataDir + "/" + MobileLedgerDB.DATABASE_NAME);
         }
         else {
-            MobileLedgerDB.setDb_filename(MobileLedgerDB.DATABASE_NAME);
+            MobileLedgerDB.setDb_filename(
+                    this.getApplicationInfo().dataDir + "/" + MobileLedgerDB.DATABASE_NAME);
         }
         MobileLedgerDB.initDB(getResources(), getPackageName());
 
@@ -247,10 +263,19 @@ public class AccountSummary extends AppCompatActivity {
                 r.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
                 r.setGravity(Gravity.CENTER_VERTICAL);
                 r.setPadding(getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin), dp2px(3), getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin), dp2px(4));
-                if (even)
-                    r.setBackgroundColor(getResources().getColor(R.color.table_row_even_bg, getTheme()));
+                if (even) {
+                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+                        r.setBackgroundColor(
+                                getResources().getColor(R.color.table_row_even_bg, getTheme()));
+                    }
+                    else {
+                        r.setBackgroundColor(getResources().getColor(R.color.table_row_even_bg));
+                    }
+                }
                 even = !even;
-                r.setContextClickable(true);
+                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+                    r.setContextClickable(true);
+                }
                 r.setOnCreateContextMenuListener(ccml);