Implemented #373. Added code to move the activity to background after copy to clipboard is selected. This causes the app to 'minimize' and the homescreen will be brought up. Added checkbox in app settings to enable/disable this feature. Added appropriate english strings
This commit is contained in:
parent
149e7f1a7d
commit
1ca16cb07a
6 changed files with 21 additions and 2 deletions
|
@ -349,7 +349,8 @@ public class MainActivity extends BaseActivity
|
||||||
if (key.equals(getString(R.string.settings_key_label_size)) ||
|
if (key.equals(getString(R.string.settings_key_label_size)) ||
|
||||||
key.equals(getString(R.string.settings_key_label_scroll)) ||
|
key.equals(getString(R.string.settings_key_label_scroll)) ||
|
||||||
key.equals(getString(R.string.settings_key_split_group_size)) ||
|
key.equals(getString(R.string.settings_key_split_group_size)) ||
|
||||||
key.equals(getString(R.string.settings_key_thumbnail_size))) {
|
key.equals(getString(R.string.settings_key_thumbnail_size)) ||
|
||||||
|
key.equals(getString(R.string.settings_key_minimize_on_copy))) {
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
} else if (key.equals(getString(R.string.settings_key_tap_to_reveal)) ||
|
} else if (key.equals(getString(R.string.settings_key_tap_to_reveal)) ||
|
||||||
key.equals(getString(R.string.settings_key_theme)) ||
|
key.equals(getString(R.string.settings_key_theme)) ||
|
||||||
|
|
|
@ -524,4 +524,9 @@ public class Settings {
|
||||||
public boolean getIsAppendingDateTimeToBackups() {
|
public boolean getIsAppendingDateTimeToBackups() {
|
||||||
return getBoolean(R.string.settings_key_backup_append_date_time, false);
|
return getBoolean(R.string.settings_key_backup_append_date_time, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isMinimizeAppOnCopyEnabled() {
|
||||||
|
return getBoolean(R.string.settings_key_minimize_on_copy, false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ import android.widget.GridView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import org.shadowice.flocke.andotp.Activities.MainActivity;
|
||||||
import org.shadowice.flocke.andotp.Database.Entry;
|
import org.shadowice.flocke.andotp.Database.Entry;
|
||||||
import org.shadowice.flocke.andotp.R;
|
import org.shadowice.flocke.andotp.R;
|
||||||
import org.shadowice.flocke.andotp.Utilities.Constants;
|
import org.shadowice.flocke.andotp.Utilities.Constants;
|
||||||
|
@ -228,6 +229,9 @@ public class EntriesCardAdapter extends RecyclerView.Adapter<EntryViewHolder>
|
||||||
public void onCopyButtonClicked(String text, int position) {
|
public void onCopyButtonClicked(String text, int position) {
|
||||||
copyToClipboard(text);
|
copyToClipboard(text);
|
||||||
updateLastUsed(position, getRealIndex(position));
|
updateLastUsed(position, getRealIndex(position));
|
||||||
|
if(context != null && settings.isMinimizeAppOnCopyEnabled()) {
|
||||||
|
((MainActivity)context).moveTaskToBack(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,10 +22,12 @@
|
||||||
<string name="settings_key_theme" translatable="false">pref_theme</string>
|
<string name="settings_key_theme" translatable="false">pref_theme</string>
|
||||||
<string name="settings_key_label_size" translatable="false">pref_label_size_sp</string>
|
<string name="settings_key_label_size" translatable="false">pref_label_size_sp</string>
|
||||||
<string name="settings_key_label_scroll" translatable="false">pref_label_scroll</string>
|
<string name="settings_key_label_scroll" translatable="false">pref_label_scroll</string>
|
||||||
|
<string name="settings_key_minimize_on_copy" translatable="false">pref_minimize_on_copy</string>
|
||||||
<string name="settings_key_thumbnail_size" translatable="false">pref_thumbnail_size</string>
|
<string name="settings_key_thumbnail_size" translatable="false">pref_thumbnail_size</string>
|
||||||
<string name="settings_key_split_group_size" translatable="false">pref_split_group_size</string>
|
<string name="settings_key_split_group_size" translatable="false">pref_split_group_size</string>
|
||||||
<string name="settings_key_tag_functionality" translatable="false">pref_tag_functionality</string>
|
<string name="settings_key_tag_functionality" translatable="false">pref_tag_functionality</string>
|
||||||
|
|
||||||
|
|
||||||
<string name="settings_key_backup_append_date_time" translatable="false">pref_backup_append_date_time</string>
|
<string name="settings_key_backup_append_date_time" translatable="false">pref_backup_append_date_time</string>
|
||||||
<string name="settings_key_backup_ask" translatable="false">pref_backup_ask</string>
|
<string name="settings_key_backup_ask" translatable="false">pref_backup_ask</string>
|
||||||
<string name="settings_key_backup_directory" translatable="false">pref_backup_directory</string>
|
<string name="settings_key_backup_directory" translatable="false">pref_backup_directory</string>
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
<string name="settings_title_thumbnail_size_ask">Thumbnail size</string>
|
<string name="settings_title_thumbnail_size_ask">Thumbnail size</string>
|
||||||
<string name="settings_title_split_group_size">Split Token with space</string>
|
<string name="settings_title_split_group_size">Split Token with space</string>
|
||||||
<string name="settings_title_tag_functionality">Tag selection behavior</string>
|
<string name="settings_title_tag_functionality">Tag selection behavior</string>
|
||||||
|
<string name="settings_title_minimize_on_copy">Minimize app after copying OTP</string>
|
||||||
|
|
||||||
<string name="settings_title_backup_append_date">Append date to filename</string>
|
<string name="settings_title_backup_append_date">Append date to filename</string>
|
||||||
<string name="settings_title_backup_ask">Ask for filename</string>
|
<string name="settings_title_backup_ask">Ask for filename</string>
|
||||||
|
@ -50,7 +51,7 @@
|
||||||
has been turned off</string>
|
has been turned off</string>
|
||||||
|
|
||||||
<string name="settings_desc_label_scroll">Scroll overlong labels instead of truncating them</string>
|
<string name="settings_desc_label_scroll">Scroll overlong labels instead of truncating them</string>
|
||||||
|
<string name="settings_desc_minimize_on_copy">App will be minimized when you copy the OTP to clipboard</string>
|
||||||
|
|
||||||
<string name="settings_desc_backup_append_date">Append the current date and time to the suggested
|
<string name="settings_desc_backup_append_date">Append the current date and time to the suggested
|
||||||
backup filename</string>
|
backup filename</string>
|
||||||
|
|
|
@ -105,6 +105,12 @@
|
||||||
android:entryValues="@array/settings_values_tag_functionality"
|
android:entryValues="@array/settings_values_tag_functionality"
|
||||||
android:defaultValue="@string/settings_default_tag_functionality" />
|
android:defaultValue="@string/settings_default_tag_functionality" />
|
||||||
|
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="@string/settings_key_minimize_on_copy"
|
||||||
|
android:title="@string/settings_title_minimize_on_copy"
|
||||||
|
android:summary="@string/settings_desc_minimize_on_copy"
|
||||||
|
android:defaultValue="false" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
<PreferenceCategory
|
||||||
|
|
Loading…
Reference in a new issue