Compare commits

...

7 Commits

Author SHA1 Message Date
Sylvia van Os
c6f28272d9 Release 1.2.2 2020-11-19 21:16:36 +01:00
Sylvia van Os
ba8c20f415 Merge branch 'master' of github.com:TheLastProject/loyalty-card-locker into master 2020-11-19 16:48:55 +01:00
Sylvia van Os
b41dcc7ba1 Add IzzyOnDroid button 2020-11-19 16:45:33 +01:00
Sylvia van Os
6a14b5706b Merge pull request #102 from weblate/weblate-catima-catima
Translations update from Weblate
2020-11-17 18:36:27 +01:00
opsik
5bde6796b9 Translated using Weblate (Russian)
Currently translated at 66.6% (2 of 3 strings)

Translation: Catima/Fastlane
Translate-URL: https://hosted.weblate.org/projects/catima/fastlane/ru/
2020-11-17 18:32:39 +01:00
Sylvia van Os
3c797b5ec9 Remember active group tab 2020-11-17 18:30:47 +01:00
Sylvia van Os
dec85d8fa9 Release 1.2.1 2020-11-17 14:19:21 +01:00
8 changed files with 76 additions and 36 deletions

View File

@@ -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:

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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() {

View File

@@ -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>

View File

@@ -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>
![Logo](https://github.com/TheLastProject/Catima/raw/master/app/src/main/ic_launcher-playstore.png)

View File

@@ -0,0 +1 @@
Управление картами покупателя и скидок со штрих-кодами на вашем телефоне

View File

@@ -0,0 +1 @@
Catima - менеджер карт скидок