-
-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort by usage #1212
base: main
Are you sure you want to change the base?
Sort by usage #1212
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't tested it yet, but noticing multiple issues already.
@@ -47,6 +47,7 @@ public static class LoyaltyCardDbIds { | |||
public static final String LAST_USED = "lastused"; | |||
public static final String ZOOM_LEVEL = "zoomlevel"; | |||
public static final String ARCHIVE_STATUS = "archive"; | |||
public static final String USAGE_NUMBER = "usagenumber"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd much prefer this to be named USAGE_COUNT
and usagecount
. To me that is more logical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)
|
||
UsageNumber |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UsageNumber | |
UsageCount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done !
@@ -189,6 +193,7 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { | |||
LoyaltyCardDbIds.HEADER_COLOR + " INTEGER," + | |||
LoyaltyCardDbIds.CARD_ID + " TEXT not null," + | |||
LoyaltyCardDbIds.BARCODE_ID + " TEXT," + | |||
LoyaltyCardDbIds.USAGE_NUMBER + " INTEGER DEFAULT '0', " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, this will only be executed when users are on database version 9. So existing installations won't get the usage column. This should be removed (there should be an extra upgrade at the end and the DATABASE_VERSION variable needs to be increased).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in progress..
@@ -202,6 +207,7 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { | |||
LoyaltyCardDbIds.HEADER_COLOR + " ," + | |||
LoyaltyCardDbIds.CARD_ID + " ," + | |||
LoyaltyCardDbIds.BARCODE_ID + " ," + | |||
LoyaltyCardDbIds.USAGE_NUMBER + " , " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -214,6 +220,7 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { | |||
LoyaltyCardDbIds.HEADER_COLOR + " ," + | |||
LoyaltyCardDbIds.CARD_ID + " ," + | |||
LoyaltyCardDbIds.BARCODE_ID + " ," + | |||
LoyaltyCardDbIds.USAGE_NUMBER + " , " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
DBHelper.updateLoyaltyCardUsageNumber(database, loyaltyCardId); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to put this either near the top or all the way at the bottom for clarity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, i don't know where to put this function, i think it going to be null :/
//this.database | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary debug comment.
//this.database |
@@ -308,6 +308,7 @@ private void setCenterGuideline(int zoomLevel) { | |||
|
|||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary whitespace change.
@@ -466,7 +469,10 @@ public void onLayoutChange(View v, int left, int top, int right, int bottom, int | |||
iconImage.setClipBounds(new Rect(left, top, right, bottom)); | |||
} | |||
}); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary whitespace change.
@@ -67,7 +67,7 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard | |||
private int mLoyaltyCardCount = 0; | |||
protected String mFilter = ""; | |||
protected Object mGroup = null; | |||
protected DBHelper.LoyaltyCardOrder mOrder = DBHelper.LoyaltyCardOrder.Alpha; | |||
protected DBHelper.LoyaltyCardOrder mOrder = DBHelper.LoyaltyCardOrder.UsageNumber; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't change the default sorting style.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Modification of the database to add a column which corresponds to the number of uses.
Added a method to update the value on each use.
To enable sorting by this value :)