mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-30 22:05:19 +00:00
Fix an issue with the number of shortcuts
This commit is contained in:
@@ -44,9 +44,10 @@ import org.eclipse.jgit.lib.Repository;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class PasswordStore extends AppCompatActivity {
|
public class PasswordStore extends AppCompatActivity {
|
||||||
@@ -409,7 +410,16 @@ public class PasswordStore extends AppCompatActivity {
|
|||||||
.setIcon(Icon.createWithResource(this, R.drawable.ic_launcher))
|
.setIcon(Icon.createWithResource(this, R.drawable.ic_launcher))
|
||||||
.setIntent(intent.setAction("DECRYPT_PASS")) // Needs action
|
.setIntent(intent.setAction("DECRYPT_PASS")) // Needs action
|
||||||
.build();
|
.build();
|
||||||
shortcutManager.addDynamicShortcuts(Arrays.asList(shortcut));
|
List<ShortcutInfo> shortcuts = shortcutManager.getDynamicShortcuts();
|
||||||
|
|
||||||
|
if (shortcuts.size() >= shortcutManager.getMaxShortcutCountPerActivity() &&
|
||||||
|
shortcuts.size() > 0) {
|
||||||
|
shortcuts.remove(shortcuts.size() - 1);
|
||||||
|
shortcuts.add(0, shortcut);
|
||||||
|
shortcutManager.setDynamicShortcuts(shortcuts);
|
||||||
|
} else {
|
||||||
|
shortcutManager.addDynamicShortcuts(Collections.singletonList(shortcut));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
startActivityForResult(intent, PgpHandler.REQUEST_CODE_DECRYPT_AND_VERIFY);
|
startActivityForResult(intent, PgpHandler.REQUEST_CODE_DECRYPT_AND_VERIFY);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user