diff --git a/app/src/main/java/awais/instagrabber/MainHelper.java b/app/src/main/java/awais/instagrabber/MainHelper.java
index 91d24340..501852c6 100755
--- a/app/src/main/java/awais/instagrabber/MainHelper.java
+++ b/app/src/main/java/awais/instagrabber/MainHelper.java
@@ -261,7 +261,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
private RecyclerLazyLoader feedLazyLoader, discoverLazyLoader;
private DiscoverAdapter discoverAdapter;
public SimpleExoPlayer currentFeedPlayer; // hack for remix drawer layout
- final boolean isLoggedIn = !Utils.isEmpty(Utils.settingsHelper.getString(Constants.COOKIE));
+ public final boolean isLoggedIn = !Utils.isEmpty(Utils.settingsHelper.getString(Constants.COOKIE));
public MainHelper(@NonNull final Main main) {
stopCurrentExecutor();
@@ -624,6 +624,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
}
main.mainBinding.appBarLayout.setExpanded(true, true);
main.mainBinding.privatePage.setVisibility(View.GONE);
+ main.mainBinding.privatePage2.setTextSize(28);
main.mainBinding.mainProfileImage.setImageBitmap(null);
main.mainBinding.mainHashtagImage.setImageBitmap(null);
main.mainBinding.mainLocationImage.setImageBitmap(null);
@@ -928,7 +929,6 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
if (!profileModel.isReallyPrivate()) {
main.mainBinding.mainFollowing.setClickable(true);
main.mainBinding.mainFollowers.setClickable(true);
- main.mainBinding.privatePage.setVisibility(View.GONE);
if (isLoggedIn) {
final View.OnClickListener followClickListener = v -> main.startActivity(new Intent(main, FollowViewer.class)
diff --git a/app/src/main/java/awais/instagrabber/activities/Login.java b/app/src/main/java/awais/instagrabber/activities/Login.java
index db825719..6d5b6e00 100755
--- a/app/src/main/java/awais/instagrabber/activities/Login.java
+++ b/app/src/main/java/awais/instagrabber/activities/Login.java
@@ -1,6 +1,7 @@
package awais.instagrabber.activities;
import android.annotation.SuppressLint;
+import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
@@ -31,10 +32,19 @@ public final class Login extends BaseLanguageActivity implements View.OnClickLis
@Override
public void onPageFinished(final WebView view, final String url) {
webViewUrl = url;
+ final String mainCookie = Utils.getCookie(url);
+ if (!mainCookie.contains("; ds_user_id=")) ready = true;
+ else if (mainCookie.contains("; ds_user_id=") && ready) {
+ Utils.setupCookies(mainCookie);
+ settingsHelper.putString(Constants.COOKIE, mainCookie);
+ Toast.makeText(getApplicationContext(), R.string.login_success_loading_cookies, Toast.LENGTH_SHORT).show();
+ finish();
+ }
}
};
private final WebChromeClient webChromeClient = new WebChromeClient();
private String webViewUrl, defaultUserAgent;
+ private boolean ready = false;
private ActivityLoginBinding loginBinding;
@Override
@@ -62,7 +72,9 @@ public final class Login extends BaseLanguageActivity implements View.OnClickLis
Utils.setupCookies(mainCookie);
settingsHelper.putString(Constants.COOKIE, mainCookie);
Toast.makeText(this, R.string.login_success_loading_cookies, Toast.LENGTH_SHORT).show();
- finish();
+ Intent intent = new Intent(getApplicationContext(), Main.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ startActivity(intent);
}
}
}
diff --git a/app/src/main/java/awais/instagrabber/activities/Main.java b/app/src/main/java/awais/instagrabber/activities/Main.java
index 1f16240c..228725f0 100755
--- a/app/src/main/java/awais/instagrabber/activities/Main.java
+++ b/app/src/main/java/awais/instagrabber/activities/Main.java
@@ -230,8 +230,13 @@ public final class Main extends BaseLanguageActivity {
mainBinding.mainLocationImage.setEnabled(false);
final boolean isQueryNull = userQuery == null;
- if (isQueryNull) allItems.clear();
- if (BuildConfig.DEBUG && isQueryNull) userQuery = "@austinhuang.me";
+ if (isQueryNull) {
+ allItems.clear();
+ mainBinding.privatePage1.setImageResource(R.drawable.ic_info);
+ mainBinding.privatePage2.setTextSize(20);
+ mainBinding.privatePage2.setText(mainHelper.isLoggedIn ? R.string.no_acc_logged_in : R.string.no_acc);
+ mainBinding.privatePage.setVisibility(View.VISIBLE);
+ }
if (!mainBinding.swipeRefreshLayout.isRefreshing() && userQuery != null) mainHelper.onRefresh();
mainHelper.onIntent(getIntent());
@@ -327,7 +332,7 @@ public final class Main extends BaseLanguageActivity {
searchView.setQueryHint(getResources().getString(R.string.action_search));
searchView.setSuggestionsAdapter(suggestionAdapter);
searchView.setOnSearchClickListener(v -> {
- searchView.setQuery((cookieModel != null && userQuery.equals("@"+cookieModel.getUsername())) ? "" : userQuery, false);
+ searchView.setQuery((cookieModel != null && userQuery != null && userQuery.equals("@"+cookieModel.getUsername())) ? "" : userQuery, false);
menu.findItem(R.id.action_about).setVisible(false);
menu.findItem(R.id.action_settings).setVisible(false);
menu.findItem(R.id.action_dms).setVisible(false);
diff --git a/app/src/main/res/drawable-anydpi/ic_info.xml b/app/src/main/res/drawable-anydpi/ic_info.xml
new file mode 100644
index 00000000..28e2af78
--- /dev/null
+++ b/app/src/main/res/drawable-anydpi/ic_info.xml
@@ -0,0 +1,11 @@
+
+
+
diff --git a/app/src/main/res/drawable-hdpi/ic_info.png b/app/src/main/res/drawable-hdpi/ic_info.png
new file mode 100644
index 00000000..884ee57b
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_info.png differ
diff --git a/app/src/main/res/drawable-mdpi/ic_info.png b/app/src/main/res/drawable-mdpi/ic_info.png
new file mode 100644
index 00000000..40f84825
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_info.png differ
diff --git a/app/src/main/res/drawable-xhdpi/ic_info.png b/app/src/main/res/drawable-xhdpi/ic_info.png
new file mode 100644
index 00000000..b3d8e89d
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_info.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/ic_info.png b/app/src/main/res/drawable-xxhdpi/ic_info.png
new file mode 100644
index 00000000..4c9ddff5
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_info.png differ
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d74e059d..73a82a5d 100755
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -68,6 +68,8 @@
Vote successful!
You have already voted!
This Account is Private
+ You can log in via Settings on the bottom-right corner. Or, you can view public accounts without login!
+ You can swipe left/right for explore/feed, or search something below!
This Account has No Posts
No Such Posts!
Current version: v%s