mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2025-12-24 23:57:53 -05:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6f28272d9 | ||
|
|
ba8c20f415 | ||
|
|
b41dcc7ba1 | ||
|
|
6a14b5706b | ||
|
|
5bde6796b9 | ||
|
|
3c797b5ec9 | ||
|
|
dec85d8fa9 |
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,5 +1,17 @@
|
||||
# Changelog
|
||||
|
||||
## v1.2.2 (2020-11-19)
|
||||
|
||||
Changes:
|
||||
|
||||
- Remember active group tab between screens and sessions
|
||||
|
||||
## v1.2.1 (2020-11-17)
|
||||
|
||||
Changes:
|
||||
|
||||
- Fix home screen swiping triggering during vertical swipes too
|
||||
|
||||
## v1.2.0 (2020-11-17)
|
||||
|
||||
Changes:
|
||||
|
||||
@@ -13,8 +13,8 @@ android {
|
||||
applicationId "me.hackerchick.catima"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 29
|
||||
versionCode 44
|
||||
versionName "1.2.0"
|
||||
versionCode 46
|
||||
versionName "1.2.2"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
@@ -63,6 +64,14 @@ public class MainActivity extends AppCompatActivity implements GestureDetector.O
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
selectedTab = tab.getPosition();
|
||||
updateLoyaltyCardList(filter, tab.getTag());
|
||||
|
||||
// Store active tab in Shared Preference to restore next app launch
|
||||
SharedPreferences activeTabPref = getApplicationContext().getSharedPreferences(
|
||||
getString(R.string.sharedpreference_active_tab),
|
||||
Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor activeTabPrefEditor = activeTabPref.edit();
|
||||
activeTabPrefEditor.putInt(getString(R.string.sharedpreference_active_tab), selectedTab);
|
||||
activeTabPrefEditor.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,15 +116,22 @@ public class MainActivity extends AppCompatActivity implements GestureDetector.O
|
||||
}
|
||||
}
|
||||
|
||||
// Start of active tab logic
|
||||
TabLayout groupsTabLayout = findViewById(R.id.groups);
|
||||
boolean hasReset = updateTabGroups(groupsTabLayout);
|
||||
updateTabGroups(groupsTabLayout);
|
||||
|
||||
// Restore active tab from Shared Preference
|
||||
SharedPreferences activeTabPref = getApplicationContext().getSharedPreferences(
|
||||
getString(R.string.sharedpreference_active_tab),
|
||||
Context.MODE_PRIVATE);
|
||||
selectedTab = activeTabPref.getInt(getString(R.string.sharedpreference_active_tab), 0);
|
||||
|
||||
Object group = null;
|
||||
|
||||
if (groupsTabLayout.getTabCount() != 0) {
|
||||
TabLayout.Tab tab = groupsTabLayout.getTabAt(0);
|
||||
|
||||
if (!hasReset) {
|
||||
if (selectedTab < groupsTabLayout.getTabCount()) {
|
||||
tab = groupsTabLayout.getTabAt(selectedTab);
|
||||
}
|
||||
|
||||
@@ -123,6 +139,7 @@ public class MainActivity extends AppCompatActivity implements GestureDetector.O
|
||||
group = tab.getTag();
|
||||
}
|
||||
updateLoyaltyCardList(filter, group);
|
||||
// End of active tab logic
|
||||
|
||||
FloatingActionButton addButton = findViewById(R.id.fabAdd);
|
||||
addButton.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -241,7 +258,7 @@ public class MainActivity extends AppCompatActivity implements GestureDetector.O
|
||||
});
|
||||
}
|
||||
|
||||
public boolean updateTabGroups(TabLayout groupsTabLayout)
|
||||
public void updateTabGroups(TabLayout groupsTabLayout)
|
||||
{
|
||||
final DBHelper db = new DBHelper(this);
|
||||
|
||||
@@ -250,42 +267,24 @@ public class MainActivity extends AppCompatActivity implements GestureDetector.O
|
||||
if (newGroups.size() == 0) {
|
||||
groupsTabLayout.removeAllTabs();
|
||||
groupsTabLayout.setVisibility(View.GONE);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
// -1 because there is an "All" tab
|
||||
boolean isChanged = groupsTabLayout.getTabCount() - 1 != newGroups.size();
|
||||
groupsTabLayout.removeAllTabs();
|
||||
|
||||
if (!isChanged) {
|
||||
for (int i = 0; i < newGroups.size(); i++) {
|
||||
if (!((Group) groupsTabLayout.getTabAt(i + 1).getTag())._id.equals(newGroups.get(i)._id)) {
|
||||
isChanged = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
TabLayout.Tab allTab = groupsTabLayout.newTab();
|
||||
allTab.setText(R.string.all);
|
||||
allTab.setTag(null);
|
||||
groupsTabLayout.addTab(allTab, false);
|
||||
|
||||
for (Group group : newGroups) {
|
||||
TabLayout.Tab tab = groupsTabLayout.newTab();
|
||||
tab.setText(group._id);
|
||||
tab.setTag(group);
|
||||
groupsTabLayout.addTab(tab, false);
|
||||
}
|
||||
|
||||
if (isChanged) {
|
||||
groupsTabLayout.removeAllTabs();
|
||||
|
||||
TabLayout.Tab allTab = groupsTabLayout.newTab();
|
||||
allTab.setText(R.string.all);
|
||||
allTab.setTag(null);
|
||||
groupsTabLayout.addTab(allTab);
|
||||
|
||||
for (Group group : newGroups) {
|
||||
TabLayout.Tab tab = groupsTabLayout.newTab();
|
||||
tab.setText(group._id);
|
||||
tab.setTag(group);
|
||||
groupsTabLayout.addTab(tab);
|
||||
}
|
||||
|
||||
groupsTabLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
groupsTabLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -536,6 +535,11 @@ public class MainActivity extends AppCompatActivity implements GestureDetector.O
|
||||
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
|
||||
Log.d(TAG, "On fling");
|
||||
|
||||
// Don't swipe if we have too much vertical movement
|
||||
if (Math.abs(velocityY) > (0.75 * Math.abs(velocityX))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TabLayout groupsTabLayout = findViewById(R.id.groups);
|
||||
if (groupsTabLayout.getTabCount() < 2) {
|
||||
return false;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package protect.card_locker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.Cursor;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
@@ -88,6 +90,16 @@ public class ManageGroupsActivity extends AppCompatActivity
|
||||
registerForContextMenu(groupList);
|
||||
}
|
||||
|
||||
private void invalidateHomescreenActiveTab()
|
||||
{
|
||||
SharedPreferences activeTabPref = getApplicationContext().getSharedPreferences(
|
||||
getString(R.string.sharedpreference_active_tab),
|
||||
Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor activeTabPrefEditor = activeTabPref.edit();
|
||||
activeTabPrefEditor.putInt(getString(R.string.sharedpreference_active_tab), 0);
|
||||
activeTabPrefEditor.apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item)
|
||||
{
|
||||
@@ -119,6 +131,8 @@ public class ManageGroupsActivity extends AppCompatActivity
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
db.updateGroup(groupName, input.getText().toString());
|
||||
updateGroupList();
|
||||
// Rename may change ordering, so invalidate
|
||||
invalidateHomescreenActiveTab();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@@ -147,6 +161,8 @@ public class ManageGroupsActivity extends AppCompatActivity
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
db.deleteGroup(groupName);
|
||||
updateGroupList();
|
||||
// Delete may change ordering, so invalidate
|
||||
invalidateHomescreenActiveTab();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
@@ -171,6 +187,8 @@ public class ManageGroupsActivity extends AppCompatActivity
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
db.insertGroup(input.getText().toString());
|
||||
updateGroupList();
|
||||
// Create may change ordering, so invalidate
|
||||
invalidateHomescreenActiveTab();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(getString(R.string.cancel), new DialogInterface.OnClickListener() {
|
||||
|
||||
@@ -117,6 +117,8 @@
|
||||
<string name="settings_lock_barcode_orientation">Lock barcode orientation</string>
|
||||
<string name="settings_key_lock_barcode_orientation" translatable="false">pref_lock_barcode_orientation</string>
|
||||
|
||||
<string name="sharedpreference_active_tab" translatable="false">sharedpreference_active_tab</string>
|
||||
|
||||
<string name="intent_import_card_from_url_share_text">I want to share a card with you</string>
|
||||
<string name="intent_import_card_from_url_host" translatable="false">thelastproject.github.io</string>
|
||||
<string name="intent_import_card_from_url_path_prefix" translatable="false">/Catima/share</string>
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png" alt="Get it on F-Droid" height="90"/></a>
|
||||
<a href="https://play.google.com/store/apps/details?id=me.hackerchick.catima" target="_blank">
|
||||
<img src="https://play.google.com/intl/en_us/badges/images/generic/en-play-badge.png" alt="Get it on Google Play" height="90"/></a>
|
||||
<a href=https://apt.izzysoft.de/fdroid/index/apk/me.hackerchick.catima" target="_blank">
|
||||
<img src="https://gitlab.com/IzzyOnDroid/repo/-/raw/master/assets/IzzyOnDroid.png" alt="Get it on IzzyOnDroid" height="90"/></a>
|
||||
|
||||

|
||||
|
||||
|
||||
1
fastlane/metadata/android/ru/short_description.txt
Normal file
1
fastlane/metadata/android/ru/short_description.txt
Normal file
@@ -0,0 +1 @@
|
||||
Управление картами покупателя и скидок со штрих-кодами на вашем телефоне
|
||||
1
fastlane/metadata/android/ru/title.txt
Normal file
1
fastlane/metadata/android/ru/title.txt
Normal file
@@ -0,0 +1 @@
|
||||
Catima - менеджер карт скидок
|
||||
Reference in New Issue
Block a user