Add card shortcuts for most recently used cards

This adds app shortcuts for the most recently used cards.
When a new card is accessed, it is added to the shortcuts list.
When the list exceeds its maximum size, the least recently
used shortcut is discarded.

Android limits the maximum number of shortcuts to 5, however
it recommends in its documentation to limit this to 4. This
commit limits this to 3, however, as that is aesthetically pleasing.
This commit is contained in:
Branden Archer
2017-09-26 22:52:32 -04:00
parent bc360aa06c
commit ce1acb83f0
5 changed files with 159 additions and 1 deletions

View File

@@ -354,6 +354,9 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
DBHelper db = new DBHelper(LoyaltyCardViewActivity.this);
db.deleteLoyaltyCard(loyaltyCardId);
ShortcutHelper.removeShortcut(LoyaltyCardViewActivity.this, loyaltyCardId);
finish();
dialog.dismiss();
}