diff --git a/app/src/main/java/awais/instagrabber/activities/MainActivity.java b/app/src/main/java/awais/instagrabber/activities/MainActivity.java
index 411f6225..7aaf4d43 100644
--- a/app/src/main/java/awais/instagrabber/activities/MainActivity.java
+++ b/app/src/main/java/awais/instagrabber/activities/MainActivity.java
@@ -21,6 +21,7 @@ import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import android.view.WindowManager;
import android.widget.AutoCompleteTextView;
import android.widget.Toast;
@@ -142,6 +143,8 @@ public class MainActivity extends BaseLanguageActivity implements FragmentManage
final String cookie = settingsHelper.getString(Constants.COOKIE);
CookieUtils.setupCookies(cookie);
isLoggedIn = !TextUtils.isEmpty(cookie) && CookieUtils.getUserIdFromCookie(cookie) != 0;
+ if (settingsHelper.getBoolean(Constants.FLAG_SECURE))
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
setContentView(binding.getRoot());
final Toolbar toolbar = binding.toolbar;
setSupportActionBar(toolbar);
diff --git a/app/src/main/java/awais/instagrabber/fragments/settings/GeneralPreferencesFragment.java b/app/src/main/java/awais/instagrabber/fragments/settings/GeneralPreferencesFragment.java
index deb7c277..4606fb48 100644
--- a/app/src/main/java/awais/instagrabber/fragments/settings/GeneralPreferencesFragment.java
+++ b/app/src/main/java/awais/instagrabber/fragments/settings/GeneralPreferencesFragment.java
@@ -28,6 +28,7 @@ public class GeneralPreferencesFragment extends BasePreferencesFragment {
screen.addPreference(getDefaultTabPreference(context));
}
screen.addPreference(getUpdateCheckPreference(context));
+ screen.addPreference(getFlagSecurePreference(context));
}
private Preference getDefaultTabPreference(@NonNull final Context context) {
@@ -58,4 +59,17 @@ public class GeneralPreferencesFragment extends BasePreferencesFragment {
preference.setIconSpaceReserved(false);
return preference;
}
+
+ private Preference getFlagSecurePreference(@NonNull final Context context) {
+ return PreferenceHelper.getSwitchPreference(
+ context,
+ Constants.FLAG_SECURE,
+ R.string.flag_secure,
+ -1,
+ false,
+ (preference, newValue) -> {
+ shouldRecreate();
+ return true;
+ });
+ }
}
diff --git a/app/src/main/java/awais/instagrabber/utils/Constants.java b/app/src/main/java/awais/instagrabber/utils/Constants.java
index 45fd9e3f..cb56eba2 100644
--- a/app/src/main/java/awais/instagrabber/utils/Constants.java
+++ b/app/src/main/java/awais/instagrabber/utils/Constants.java
@@ -30,6 +30,7 @@ public final class Constants {
// deprecated: public static final String AMOLED_THEME = "amoled_theme";
public static final String CHECK_ACTIVITY = "check_activity";
public static final String CHECK_UPDATES = "check_updates";
+ public static final String FLAG_SECURE = "flag_secure";
// never Export
public static final String COOKIE = "cookie";
public static final String SHOW_QUICK_ACCESS_DIALOG = "show_quick_dlg";
diff --git a/app/src/main/java/awais/instagrabber/utils/SettingsHelper.java b/app/src/main/java/awais/instagrabber/utils/SettingsHelper.java
index e3426f99..b6238a97 100755
--- a/app/src/main/java/awais/instagrabber/utils/SettingsHelper.java
+++ b/app/src/main/java/awais/instagrabber/utils/SettingsHelper.java
@@ -30,6 +30,7 @@ import static awais.instagrabber.utils.Constants.DEFAULT_TAB;
import static awais.instagrabber.utils.Constants.DEVICE_UUID;
import static awais.instagrabber.utils.Constants.DM_MARK_AS_SEEN;
import static awais.instagrabber.utils.Constants.DOWNLOAD_USER_FOLDER;
+import static awais.instagrabber.utils.Constants.FLAG_SECURE;
import static awais.instagrabber.utils.Constants.FOLDER_PATH;
import static awais.instagrabber.utils.Constants.FOLDER_SAVE_TO;
import static awais.instagrabber.utils.Constants.MARK_AS_SEEN;
@@ -139,7 +140,8 @@ public final class SettingsHelper {
@StringDef({DOWNLOAD_USER_FOLDER, FOLDER_SAVE_TO, AUTOPLAY_VIDEOS, SHOW_QUICK_ACCESS_DIALOG, MUTED_VIDEOS,
SHOW_CAPTIONS, CUSTOM_DATE_TIME_FORMAT_ENABLED, MARK_AS_SEEN, DM_MARK_AS_SEEN, CHECK_ACTIVITY,
- CHECK_UPDATES, SWAP_DATE_TIME_FORMAT_ENABLED, PREF_ENABLE_DM_NOTIFICATIONS, PREF_ENABLE_DM_AUTO_REFRESH})
+ CHECK_UPDATES, SWAP_DATE_TIME_FORMAT_ENABLED, PREF_ENABLE_DM_NOTIFICATIONS, PREF_ENABLE_DM_AUTO_REFRESH,
+ FLAG_SECURE})
public @interface BooleanSettings {}
@StringDef({PREV_INSTALL_VERSION, BROWSER_UA_CODE, APP_UA_CODE, PREF_ENABLE_DM_AUTO_REFRESH_FREQ_NUMBER})
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 8296c069..5cc6c45b 100755
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -28,6 +28,7 @@
Activity
Highlight: %s
Check for updates at startup
+ Block screenshots & app preview
Download posts to username folders
Mark stories as seen after viewing
Story author will know you viewed it