]> git.ktnx.net Git - mobile-ledger.git/commitdiff
whitespace
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 9 Jan 2020 21:19:58 +0000 (23:19 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 9 Jan 2020 21:19:58 +0000 (23:19 +0200)
app/src/main/java/net/ktnx/mobileledger/model/Data.java
app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionModel.java
app/src/main/java/net/ktnx/mobileledger/ui/transaction_list/TransactionListAdapter.java

index 2cc401980815d250341e3a1da65378c9c196c998..9b832b0353e0dcd561b1a8c708624082d3f0fc47 100644 (file)
@@ -79,10 +79,12 @@ public final class Data {
     public static int getProfileIndex(MobileLedgerProfile profile) {
         try (LockHolder ignored = profilesLocker.lockForReading()) {
             List<MobileLedgerProfile> prList = profiles.getValue();
-            if (prList == null) throw new AssertionError();
+            if (prList == null)
+                throw new AssertionError();
             for (int i = 0; i < prList.size(); i++) {
                 MobileLedgerProfile p = prList.get(i);
-                if (p.equals(profile)) return i;
+                if (p.equals(profile))
+                    return i;
             }
 
             return -1;
@@ -92,10 +94,13 @@ public final class Data {
     public static int getProfileIndex(String profileUUID) {
         try (LockHolder ignored = profilesLocker.lockForReading()) {
             List<MobileLedgerProfile> prList = profiles.getValue();
-            if (prList == null) throw new AssertionError();
+            if (prList == null)
+                throw new AssertionError();
             for (int i = 0; i < prList.size(); i++) {
                 MobileLedgerProfile p = prList.get(i);
-                if (p.getUuid().equals(profileUUID)) return i;
+                if (p.getUuid()
+                     .equals(profileUUID))
+                    return i;
             }
 
             return -1;
@@ -103,13 +108,15 @@ public final class Data {
     }
     public static int retrieveCurrentThemeIdFromDb() {
         String profileUUID = MLDB.getOption(MLDB.OPT_PROFILE_UUID, null);
-        if (profileUUID == null) return -1;
+        if (profileUUID == null)
+            return -1;
 
         SQLiteDatabase db = App.getDatabase();
-        try (Cursor c = db
-                .rawQuery("SELECT theme from profiles where uuid=?", new String[]{profileUUID}))
+        try (Cursor c = db.rawQuery("SELECT theme from profiles where uuid=?",
+                new String[]{profileUUID}))
         {
-            if (c.moveToNext()) return c.getInt(0);
+            if (c.moveToNext())
+                return c.getInt(0);
         }
 
         return -1;
@@ -126,7 +133,8 @@ public final class Data {
             }
             else {
                 int i = getProfileIndex(profileUUID);
-                if (i == -1) i = 0;
+                if (i == -1)
+                    i = 0;
                 profile = prList.get(i);
             }
         }
@@ -138,7 +146,8 @@ public final class Data {
             return;
         }
         MobileLedgerProfile pr = profile.getValue();
-        if (pr == null) throw new IllegalStateException("No current profile");
+        if (pr == null)
+            throw new IllegalStateException("No current profile");
 
         retrieveTransactionsTask =
                 new RetrieveTransactionsTask(new WeakReference<>(activity), profile.getValue());
@@ -147,7 +156,8 @@ public final class Data {
         retrieveTransactionsTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
     }
     public static synchronized void stopTransactionsRetrieval() {
-        if (retrieveTransactionsTask != null) retrieveTransactionsTask.cancel(false);
+        if (retrieveTransactionsTask != null)
+            retrieveTransactionsTask.cancel(false);
     }
     public static void transactionRetrievalDone() {
         retrieveTransactionsTask = null;
index 6dd640f9d8d22d505811f309dc0bd1b733979488..0198b8696a12de0c3cbe929baa3a64461d43c8da 100644 (file)
@@ -298,7 +298,7 @@ public class NewTransactionModel extends ViewModel {
         getItem(position).setFocusedElement(element);
     }
     public void swapItems(int one, int two) {
-        Collections.swap(items, one-1, two-1);
+        Collections.swap(items, one - 1, two - 1);
     }
     public void toggleComment(int position) {
         final MutableLiveData<Boolean> commentVisible = getItem(position).commentVisible;
index d8e2c7b0df8aa303d89498fd1627b77d7598b97b..6961f97781e3cc2b23be53a39948e5439cd311cb 100644 (file)
@@ -59,7 +59,8 @@ public class TransactionListAdapter extends RecyclerView.Adapter<TransactionRowH
         // the view will disappear when the notifications reaches the model, so by simply omitting
         // the out-of-range get() call nothing bad happens - just a to-be-deleted view remains
         // a bit longer
-        if (item == null) return;
+        if (item == null)
+            return;
 
         switch (item.getType()) {
             case TRANSACTION:
@@ -67,39 +68,44 @@ public class TransactionListAdapter extends RecyclerView.Adapter<TransactionRowH
                 holder.vDelimiter.setVisibility(View.GONE);
                 LedgerTransaction tr = item.getTransaction();
 
-                //        debug("transactions", String.format("Filling position %d with %d accounts", position,
+                //        debug("transactions", String.format("Filling position %d with %d
+                //        accounts", position,
                 //                tr.getAccounts().size()));
 
                 TransactionLoader loader = new TransactionLoader();
                 loader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,
-                        new TransactionLoaderParams(tr, holder, position, Data.accountFilter.getValue(),
-                                item.isOdd()));
+                        new TransactionLoaderParams(tr, holder, position,
+                                Data.accountFilter.getValue(), item.isOdd()));
 
                 // WORKAROUND what seems to be a bug in CardHolder somewhere
                 // when a view that was previously holding a delimiter is re-purposed
                 // occasionally it stays too short (not high enough)
-                holder.vTransaction.measure(View.MeasureSpec
-                                .makeMeasureSpec(holder.itemView.getWidth(), View.MeasureSpec.EXACTLY),
+                holder.vTransaction.measure(
+                        View.MeasureSpec.makeMeasureSpec(holder.itemView.getWidth(),
+                                View.MeasureSpec.EXACTLY),
                         View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
                 break;
             case DELIMITER:
                 Date date = item.getDate();
                 holder.vTransaction.setVisibility(View.GONE);
                 holder.vDelimiter.setVisibility(View.VISIBLE);
-                holder.tvDelimiterDate.setText(DateFormat.getDateInstance().format(date));
+                holder.tvDelimiterDate.setText(DateFormat.getDateInstance()
+                                                         .format(date));
                 if (item.isMonthShown()) {
                     GregorianCalendar cal = new GregorianCalendar(TimeZone.getDefault());
                     cal.setTime(date);
-                    holder.tvDelimiterMonth
-                            .setText(Globals.monthNames[cal.get(GregorianCalendar.MONTH)]);
+                    holder.tvDelimiterMonth.setText(
+                            Globals.monthNames[cal.get(GregorianCalendar.MONTH)]);
                     holder.tvDelimiterMonth.setVisibility(View.VISIBLE);
-                    //                holder.vDelimiterLine.setBackgroundResource(R.drawable.dashed_border_8dp);
+                    //                holder.vDelimiterLine.setBackgroundResource(R.drawable
+                    //                .dashed_border_8dp);
                     holder.vDelimiterLine.setVisibility(View.GONE);
                     holder.vDelimiterThick.setVisibility(View.VISIBLE);
                 }
                 else {
                     holder.tvDelimiterMonth.setVisibility(View.GONE);
-                    //                holder.vDelimiterLine.setBackgroundResource(R.drawable.dashed_border_1dp);
+                    //                holder.vDelimiterLine.setBackgroundResource(R.drawable
+                    //                .dashed_border_1dp);
                     holder.vDelimiterLine.setVisibility(View.VISIBLE);
                     holder.vDelimiterThick.setVisibility(View.GONE);
                 }
@@ -112,7 +118,7 @@ public class TransactionListAdapter extends RecyclerView.Adapter<TransactionRowH
     public TransactionRowHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
 //        debug("perf", "onCreateViewHolder called");
         View row = LayoutInflater.from(parent.getContext())
-                .inflate(R.layout.transaction_list_row, parent, false);
+                                 .inflate(R.layout.transaction_list_row, parent, false);
         return new TransactionRowHolder(row);
     }
 
@@ -121,6 +127,7 @@ public class TransactionListAdapter extends RecyclerView.Adapter<TransactionRowH
         return Data.transactions.size();
     }
     enum LoaderStep {HEAD, ACCOUNTS, DONE}
+
     private static class TransactionLoader
             extends AsyncTask<TransactionLoaderParams, TransactionLoaderStep, Void> {
         @Override
@@ -153,10 +160,13 @@ public class TransactionListAdapter extends RecyclerView.Adapter<TransactionRowH
 
             switch (step.getStep()) {
                 case HEAD:
-                    holder.tvDescription.setText(step.getTransaction().getDescription());
+                    holder.tvDescription.setText(step.getTransaction()
+                                                     .getDescription());
 
-                    if (step.isOdd()) holder.row.setBackgroundColor(Colors.tableRowDarkBG);
-                    else holder.row.setBackgroundColor(Colors.tableRowLightBG);
+                    if (step.isOdd())
+                        holder.row.setBackgroundColor(Colors.tableRowDarkBG);
+                    else
+                        holder.row.setBackgroundColor(Colors.tableRowLightBG);
 
                     break;
                 case ACCOUNTS:
@@ -180,8 +190,8 @@ public class TransactionListAdapter extends RecyclerView.Adapter<TransactionRowH
 //                            acc.getAccountName(), acc.getAmount()));
 
                     String boldAccountName = step.getBoldAccountName();
-                    if ((boldAccountName != null) &&
-                        acc.getAccountName().startsWith(boldAccountName))
+                    if ((boldAccountName != null) && acc.getAccountName()
+                                                        .startsWith(boldAccountName))
                     {
                         accName.setTextColor(Colors.accent);
                         accAmount.setTextColor(Colors.accent);