mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-01-12 19:27:12 +01:00
Tap the error view to retry loading comments in ViewPostDetailActivity. Minor UI tweaks.
This commit is contained in:
parent
5e144c6de9
commit
1da0e08552
@ -86,6 +86,7 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
|
||||
|
||||
interface CommentRecyclerViewAdapterCallback {
|
||||
void updatePost(Post post);
|
||||
void retryFetchingComments();
|
||||
void retryFetchingMoreComments();
|
||||
}
|
||||
|
||||
@ -1413,6 +1414,9 @@ class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVie
|
||||
class LoadCommentsFailedViewHolder extends RecyclerView.ViewHolder {
|
||||
LoadCommentsFailedViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
itemView.setOnClickListener(view -> {
|
||||
mCommentRecyclerViewAdapterCallback.retryFetchingComments();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ import android.content.res.Resources;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -117,6 +116,13 @@ public class RulesActivity extends AppCompatActivity {
|
||||
params.topMargin = getResources().getDimensionPixelSize(statusBarResourceId);
|
||||
toolbar.setLayoutParams(params);
|
||||
}
|
||||
|
||||
if (resources.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || resources.getBoolean(R.bool.isTablet)) {
|
||||
int navBarResourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (navBarResourceId > 0) {
|
||||
recyclerView.setPadding(0, 0, 0, resources.getDimensionPixelSize(navBarResourceId));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -240,7 +246,6 @@ public class RulesActivity extends AppCompatActivity {
|
||||
String shortName = rulesArray.getJSONObject(i).getString(JSONUtils.SHORT_NAME_KEY);
|
||||
String description = null;
|
||||
if(rulesArray.getJSONObject(i).has(JSONUtils.DESCRIPTION_KEY)) {
|
||||
Log.i("asdfasdf", "" + rulesArray.getJSONObject(i).getString(JSONUtils.DESCRIPTION_KEY));
|
||||
description = Utils.addSubredditAndUserLink(rulesArray.getJSONObject(i).getString(JSONUtils.DESCRIPTION_KEY));
|
||||
}
|
||||
rules.add(new Rule(shortName, description));
|
||||
|
@ -351,6 +351,11 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo
|
||||
EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void retryFetchingComments() {
|
||||
fetchComments(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void retryFetchingMoreComments() {
|
||||
isLoadingMoreChildren = false;
|
||||
@ -443,6 +448,11 @@ public class ViewPostDetailActivity extends AppCompatActivity implements FlairBo
|
||||
EventBus.getDefault().post(new PostUpdateEventToPostList(mPost, postListPosition));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void retryFetchingComments() {
|
||||
fetchComments(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void retryFetchingMoreComments() {
|
||||
isLoadingMoreChildren = false;
|
||||
|
@ -64,7 +64,7 @@
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/rules"
|
||||
android:textColor="@color/colorAccent" />
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@ -156,7 +156,9 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/select_from_library_fab_post_image_activity"
|
||||
app:layout_constraintHorizontal_chainStyle="spread" />
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:backgroundTint="@color/backgroundColorPrimary"
|
||||
app:tint="@android:color/white" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/select_from_library_fab_post_image_activity"
|
||||
@ -167,7 +169,9 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/capture_fab_post_image_activity"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="spread" />
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:backgroundTint="@color/backgroundColorPrimary"
|
||||
app:tint="@android:color/white" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
@ -64,7 +64,7 @@
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/rules"
|
||||
android:textColor="@color/colorAccent" />
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
@ -64,7 +64,7 @@
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/rules"
|
||||
android:textColor="@color/colorAccent" />
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
@ -64,7 +64,7 @@
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="@string/rules"
|
||||
android:textColor="@color/colorAccent" />
|
||||
android:textColor="@android:color/white" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@ -156,7 +156,9 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/select_from_library_fab_post_video_activity"
|
||||
app:layout_constraintHorizontal_chainStyle="spread" />
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:backgroundTint="@color/backgroundColorPrimary"
|
||||
app:tint="@android:color/white" />
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/select_from_library_fab_post_video_activity"
|
||||
@ -167,7 +169,9 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/capture_fab_post_video_activity"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="spread" />
|
||||
app:layout_constraintHorizontal_chainStyle="spread"
|
||||
app:backgroundTint="@color/backgroundColorPrimary"
|
||||
app:tint="@android:color/white" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
@ -125,6 +125,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:backgroundTint="@color/backgroundColorPrimary"
|
||||
app:tint="@android:color/white"
|
||||
app:srcCompat="@drawable/baseline_add_white_24" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -72,6 +72,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:backgroundTint="@color/backgroundColorPrimary"
|
||||
app:tint="@android:color/white"
|
||||
app:srcCompat="@drawable/baseline_add_white_24" />
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
@ -9,12 +9,13 @@
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:src="@drawable/load_post_error_indicator"/>
|
||||
android:src="@drawable/load_post_error_indicator" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="@string/load_comments_failed"/>
|
||||
android:gravity="center"
|
||||
android:text="@string/load_comments_failed" />
|
||||
|
||||
</LinearLayout>
|
@ -22,6 +22,8 @@
|
||||
|
||||
<color name="backgroundColor">#121212</color>
|
||||
|
||||
<color name="backgroundColorPrimary">#1565C0</color>
|
||||
|
||||
<color name="backgroundColorPrimaryDark">#1565C0</color>
|
||||
|
||||
<color name="roundedBottomSheetPrimaryBackground">#242424</color>
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
<color name="backgroundColor">#FFFFFF</color>
|
||||
|
||||
<color name="backgroundColorPrimary">@color/colorPrimary</color>
|
||||
|
||||
<color name="backgroundColorPrimaryDark">@color/colorPrimaryDark</color>
|
||||
|
||||
<color name="roundedBottomSheetPrimaryBackground">#FFFFFF</color>
|
||||
|
@ -52,7 +52,7 @@
|
||||
<string name="no_users">No users found</string>
|
||||
<string name="no_storage_permission">No storage permission to save this file</string>
|
||||
|
||||
<string name="load_comments_failed">Error loading comments</string>
|
||||
<string name="load_comments_failed">Error loading comments.\nTap to retry.</string>
|
||||
<string name="retry">Retry</string>
|
||||
<string name="comments">Comments</string>
|
||||
<string name="no_comments_yet">No comments yet. Write a comment?</string>
|
||||
|
Loading…
Reference in New Issue
Block a user