Browse Source

Fix weird layout when keyboard is open and indexoutofbounds when fetching profile details

renovate/org.robolectric-robolectric-4.x
Ammar Githam 4 years ago
parent
commit
3bf4aa86d0
  1. 2
      app/src/main/AndroidManifest.xml
  2. 3
      app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java

2
app/src/main/AndroidManifest.xml

@ -21,7 +21,7 @@
android:name=".activities.MainActivity" android:name=".activities.MainActivity"
android:launchMode="singleTop" android:launchMode="singleTop"
android:taskAffinity=".Main" android:taskAffinity=".Main"
android:windowSoftInputMode="adjustResize">
android:windowSoftInputMode="adjustPan">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />

3
app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java

@ -370,6 +370,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
} }
if (TextUtils.isEmpty(username) && !isLoggedIn) { if (TextUtils.isEmpty(username) && !isLoggedIn) {
binding.infoContainer.setVisibility(View.GONE); binding.infoContainer.setVisibility(View.GONE);
binding.swipeRefreshLayout.setEnabled(false);
binding.privatePage1.setImageResource(R.drawable.ic_outline_info_24); binding.privatePage1.setImageResource(R.drawable.ic_outline_info_24);
binding.privatePage2.setText(R.string.no_acc); binding.privatePage2.setText(R.string.no_acc);
final NestedCoordinatorLayout.LayoutParams layoutParams = (NestedCoordinatorLayout.LayoutParams) binding.privatePage.getLayoutParams(); final NestedCoordinatorLayout.LayoutParams layoutParams = (NestedCoordinatorLayout.LayoutParams) binding.privatePage.getLayoutParams();
@ -378,6 +379,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
binding.privatePage.setVisibility(View.VISIBLE); binding.privatePage.setVisibility(View.VISIBLE);
return; return;
} }
binding.swipeRefreshLayout.setEnabled(true);
setupPosts(); setupPosts();
setupHighlights(); setupHighlights();
setupCommonListeners(); setupCommonListeners();
@ -412,6 +414,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
} }
private void fetchProfileDetails() { private void fetchProfileDetails() {
if (TextUtils.isEmpty(username)) return;
new ProfileFetcher(username.substring(1), profileModel -> { new ProfileFetcher(username.substring(1), profileModel -> {
if (getContext() == null) return; if (getContext() == null) return;
this.profileModel = profileModel; this.profileModel = profileModel;

Loading…
Cancel
Save