mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-26 02:48:23 +01:00
Minor bugs fixed. Minor layout tweaks.
This commit is contained in:
parent
469542fb68
commit
66ed3d8f16
@ -84,8 +84,8 @@ class CommentData implements Parcelable {
|
|||||||
hasReply = in.readByte() != 0;
|
hasReply = in.readByte() != 0;
|
||||||
scoreHidden = in.readByte() != 0;
|
scoreHidden = in.readByte() != 0;
|
||||||
isExpanded = in.readByte() != 0;
|
isExpanded = in.readByte() != 0;
|
||||||
children = in.readArrayList(null);
|
children = in.readArrayList(CommentData.class.getClassLoader());
|
||||||
moreChildrenFullnames = in.readArrayList(null);
|
moreChildrenFullnames = in.readArrayList(CommentData.class.getClassLoader());
|
||||||
moreChildrenStartingIndex = in.readInt();
|
moreChildrenStartingIndex = in.readInt();
|
||||||
isPlaceHolder = in.readByte() != 0;
|
isPlaceHolder = in.readByte() != 0;
|
||||||
isLoadingMoreChildren = in.readByte() != 0;
|
isLoadingMoreChildren = in.readByte() != 0;
|
||||||
|
@ -122,7 +122,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
mFragment = new PostFragment();
|
mFragment = new PostFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putInt(PostFragment.EXTRA_POST_TYPE_KEY, PostDataSource.TYPE_FRONT_PAGE);
|
bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_FRONT_PAGE);
|
||||||
mFragment.setArguments(bundle);
|
mFragment.setArguments(bundle);
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_content_main, mFragment).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_content_main, mFragment).commit();
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,7 +54,7 @@ class ParseSubredditData {
|
|||||||
JSONObject data = jsonResponse.getJSONObject(JSONUtils.DATA_KEY);
|
JSONObject data = jsonResponse.getJSONObject(JSONUtils.DATA_KEY);
|
||||||
mNCurrentOnlineSubscribers = data.getInt(JSONUtils.ACTIVE_USER_COUNT_KEY);
|
mNCurrentOnlineSubscribers = data.getInt(JSONUtils.ACTIVE_USER_COUNT_KEY);
|
||||||
subredditData = parseSubredditData(data);
|
subredditData = parseSubredditData(data);
|
||||||
/*String id = data.getString(JSONUtils.EXTRA_SUBREDDIT_NAME_KEY);
|
/*String id = data.getString(JSONUtils.EXTRA_SUBREDDIT_NAME);
|
||||||
String subredditFullName = data.getString(JSONUtils.DISPLAY_NAME);
|
String subredditFullName = data.getString(JSONUtils.DISPLAY_NAME);
|
||||||
String description = data.getString(JSONUtils.PUBLIC_DESCRIPTION_KEY).trim();
|
String description = data.getString(JSONUtils.PUBLIC_DESCRIPTION_KEY).trim();
|
||||||
|
|
||||||
|
@ -45,9 +45,9 @@ import retrofit2.Retrofit;
|
|||||||
*/
|
*/
|
||||||
public class PostFragment extends Fragment implements FragmentCommunicator {
|
public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||||
|
|
||||||
static final String EXTRA_SUBREDDIT_NAME_KEY = "ENK";
|
static final String EXTRA_SUBREDDIT_NAME = "EN";
|
||||||
static final String EXTRA_QUERY_KEY = "EQK";
|
static final String EXTRA_QUERY = "EQ";
|
||||||
static final String EXTRA_POST_TYPE_KEY = "EPTK";
|
static final String EXTRA_POST_TYPE = "EPT";
|
||||||
|
|
||||||
private static final String IS_IN_LAZY_MODE_STATE = "IILMS";
|
private static final String IS_IN_LAZY_MODE_STATE = "IILMS";
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
int postType = getArguments().getInt(EXTRA_POST_TYPE_KEY);
|
int postType = getArguments().getInt(EXTRA_POST_TYPE);
|
||||||
|
|
||||||
String accessToken = activity.getSharedPreferences(SharedPreferencesUtils.AUTH_CODE_FILE_KEY, Context.MODE_PRIVATE)
|
String accessToken = activity.getSharedPreferences(SharedPreferencesUtils.AUTH_CODE_FILE_KEY, Context.MODE_PRIVATE)
|
||||||
.getString(SharedPreferencesUtils.ACCESS_TOKEN_KEY, "");
|
.getString(SharedPreferencesUtils.ACCESS_TOKEN_KEY, "");
|
||||||
@ -173,8 +173,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
PostViewModel.Factory factory;
|
PostViewModel.Factory factory;
|
||||||
|
|
||||||
if(postType == PostDataSource.TYPE_SEARCH) {
|
if(postType == PostDataSource.TYPE_SEARCH) {
|
||||||
String subredditName = getArguments().getString(EXTRA_SUBREDDIT_NAME_KEY);
|
String subredditName = getArguments().getString(EXTRA_SUBREDDIT_NAME);
|
||||||
String query = getArguments().getString(EXTRA_QUERY_KEY);
|
String query = getArguments().getString(EXTRA_QUERY);
|
||||||
|
|
||||||
mAdapter = new PostRecyclerViewAdapter(activity, mRetrofit,
|
mAdapter = new PostRecyclerViewAdapter(activity, mRetrofit,
|
||||||
mSharedPreferences, postType, () -> mPostViewModel.retryLoadingMore());
|
mSharedPreferences, postType, () -> mPostViewModel.retryLoadingMore());
|
||||||
@ -195,7 +195,13 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if(postType != PostDataSource.TYPE_FRONT_PAGE) {
|
} else if(postType != PostDataSource.TYPE_FRONT_PAGE) {
|
||||||
String subredditName = getArguments().getString(EXTRA_SUBREDDIT_NAME_KEY);
|
if(postType == PostDataSource.TYPE_USER) {
|
||||||
|
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) mFetchPostInfoLinearLayout.getLayoutParams();
|
||||||
|
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
|
||||||
|
mFetchPostInfoLinearLayout.setLayoutParams(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
String subredditName = getArguments().getString(EXTRA_SUBREDDIT_NAME);
|
||||||
|
|
||||||
mAdapter = new PostRecyclerViewAdapter(activity, mRetrofit,
|
mAdapter = new PostRecyclerViewAdapter(activity, mRetrofit,
|
||||||
mSharedPreferences, postType, () -> mPostViewModel.retryLoadingMore());
|
mSharedPreferences, postType, () -> mPostViewModel.retryLoadingMore());
|
||||||
|
@ -668,7 +668,7 @@ class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView.ViewHo
|
|||||||
ErrorViewHolder(View itemView) {
|
ErrorViewHolder(View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
ButterKnife.bind(this, itemView);
|
ButterKnife.bind(this, itemView);
|
||||||
errorTextView.setText(R.string.load_posts_failed);
|
errorTextView.setText(R.string.load_posts_error);
|
||||||
retryButton.setOnClickListener(view -> retryLoadingMoreCallback.retryLoadingMore());
|
retryButton.setOnClickListener(view -> retryLoadingMoreCallback.retryLoadingMore());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,9 +101,9 @@ public class SearchResultActivity extends AppCompatActivity {
|
|||||||
case 0: {
|
case 0: {
|
||||||
PostFragment mFragment = new PostFragment();
|
PostFragment mFragment = new PostFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putInt(PostFragment.EXTRA_POST_TYPE_KEY, PostDataSource.TYPE_SEARCH);
|
bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_SEARCH);
|
||||||
bundle.putString(PostFragment.EXTRA_SUBREDDIT_NAME_KEY, mSubredditName);
|
bundle.putString(PostFragment.EXTRA_SUBREDDIT_NAME, mSubredditName);
|
||||||
bundle.putString(PostFragment.EXTRA_QUERY_KEY, mQuery);
|
bundle.putString(PostFragment.EXTRA_QUERY, mQuery);
|
||||||
mFragment.setArguments(bundle);
|
mFragment.setArguments(bundle);
|
||||||
return mFragment;
|
return mFragment;
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ public class ViewPostDetailActivity extends AppCompatActivity {
|
|||||||
mProgressBar.setVisibility(View.GONE);
|
mProgressBar.setVisibility(View.GONE);
|
||||||
mFetchPostInfoLinearLayout.setVisibility(View.VISIBLE);
|
mFetchPostInfoLinearLayout.setVisibility(View.VISIBLE);
|
||||||
mFetchPostInfoLinearLayout.setOnClickListener(view -> fetchPostAndCommentsById(subredditId));
|
mFetchPostInfoLinearLayout.setOnClickListener(view -> fetchPostAndCommentsById(subredditId));
|
||||||
mFetchPostInfoTextView.setText(R.string.error_loading_post);
|
mFetchPostInfoTextView.setText(R.string.load_posts_error);
|
||||||
mGlide.load(R.drawable.load_post_error_indicator).into(mFetchPostInfoImageView);
|
mGlide.load(R.drawable.load_post_error_indicator).into(mFetchPostInfoImageView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,8 +261,8 @@ public class ViewSubredditDetailActivity extends AppCompatActivity {
|
|||||||
if(savedInstanceState == null) {
|
if(savedInstanceState == null) {
|
||||||
mFragment = new PostFragment();
|
mFragment = new PostFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(PostFragment.EXTRA_SUBREDDIT_NAME_KEY, subredditName);
|
bundle.putString(PostFragment.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||||
bundle.putInt(PostFragment.EXTRA_POST_TYPE_KEY, PostDataSource.TYPE_SUBREDDIT);
|
bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT);
|
||||||
mFragment.setArguments(bundle);
|
mFragment.setArguments(bundle);
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_view_subreddit_detail_activity, mFragment).commit();
|
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_view_subreddit_detail_activity, mFragment).commit();
|
||||||
} else {
|
} else {
|
||||||
@ -270,8 +270,8 @@ public class ViewSubredditDetailActivity extends AppCompatActivity {
|
|||||||
if(mFragment == null) {
|
if(mFragment == null) {
|
||||||
mFragment = new PostFragment();
|
mFragment = new PostFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(PostFragment.EXTRA_SUBREDDIT_NAME_KEY, subredditName);
|
bundle.putString(PostFragment.EXTRA_SUBREDDIT_NAME, subredditName);
|
||||||
bundle.putInt(PostFragment.EXTRA_POST_TYPE_KEY, PostDataSource.TYPE_SUBREDDIT);
|
bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_SUBREDDIT);
|
||||||
mFragment.setArguments(bundle);
|
mFragment.setArguments(bundle);
|
||||||
}
|
}
|
||||||
isInLazyMode = savedInstanceState.getBoolean(IS_IN_LAZY_MODE_STATE);
|
isInLazyMode = savedInstanceState.getBoolean(IS_IN_LAZY_MODE_STATE);
|
||||||
|
@ -273,8 +273,8 @@ public class ViewUserDetailActivity extends AppCompatActivity {
|
|||||||
if(savedInstanceState == null) {
|
if(savedInstanceState == null) {
|
||||||
/*mFragment = new PostFragment();
|
/*mFragment = new PostFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(PostFragment.EXTRA_SUBREDDIT_NAME_KEY, userName);
|
bundle.putString(PostFragment.EXTRA_SUBREDDIT_NAME, userName);
|
||||||
bundle.putInt(PostFragment.EXTRA_POST_TYPE_KEY, PostDataSource.TYPE_USER);
|
bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_USER);
|
||||||
mFragment.setArguments(bundle);
|
mFragment.setArguments(bundle);
|
||||||
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_view_user_detail_activity, mFragment).commit();*/
|
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_view_user_detail_activity, mFragment).commit();*/
|
||||||
} else {
|
} else {
|
||||||
@ -282,8 +282,8 @@ public class ViewUserDetailActivity extends AppCompatActivity {
|
|||||||
if(mFragment == null) {
|
if(mFragment == null) {
|
||||||
mFragment = new PostFragment();
|
mFragment = new PostFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(PostFragment.EXTRA_SUBREDDIT_NAME_KEY, userName);
|
bundle.putString(PostFragment.EXTRA_SUBREDDIT_NAME, userName);
|
||||||
bundle.putInt(PostFragment.EXTRA_POST_TYPE_KEY, PostDataSource.TYPE_USER);
|
bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_USER);
|
||||||
mFragment.setArguments(bundle);
|
mFragment.setArguments(bundle);
|
||||||
}*/
|
}*/
|
||||||
isInLazyMode = savedInstanceState.getBoolean(IS_IN_LAZY_MODE_STATE);
|
isInLazyMode = savedInstanceState.getBoolean(IS_IN_LAZY_MODE_STATE);
|
||||||
@ -430,8 +430,8 @@ public class ViewUserDetailActivity extends AppCompatActivity {
|
|||||||
if (position == 0) {
|
if (position == 0) {
|
||||||
PostFragment fragment = new PostFragment();
|
PostFragment fragment = new PostFragment();
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putInt(PostFragment.EXTRA_POST_TYPE_KEY, PostDataSource.TYPE_USER);
|
bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_USER);
|
||||||
bundle.putString(PostFragment.EXTRA_SUBREDDIT_NAME_KEY, userName);
|
bundle.putString(PostFragment.EXTRA_SUBREDDIT_NAME, userName);
|
||||||
fragment.setArguments(bundle);
|
fragment.setArguments(bundle);
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/fetch_comments_info_linear_layout_comments_listing_fragment"
|
android:id="@+id/fetch_comments_info_linear_layout_comments_listing_fragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
@ -32,8 +32,7 @@
|
|||||||
<string name="no_users">No users found.</string>
|
<string name="no_users">No users found.</string>
|
||||||
<string name="no_storage_permission">No storage permission to save this file</string>
|
<string name="no_storage_permission">No storage permission to save this file</string>
|
||||||
|
|
||||||
<string name="load_posts_failed">Error loading posts</string>
|
<string name="load_comments_failed">Error loading comments.</string>
|
||||||
<string name="load_comments_failed">Error loading comments</string>
|
|
||||||
<string name="retry">Retry</string>
|
<string name="retry">Retry</string>
|
||||||
<string name="comments">Comments</string>
|
<string name="comments">Comments</string>
|
||||||
<string name="no_comments_yet">No comments yet. Write a comment?</string>
|
<string name="no_comments_yet">No comments yet. Write a comment?</string>
|
||||||
@ -71,8 +70,6 @@
|
|||||||
|
|
||||||
<string name="content_description_banner_imageview">Subreddit Banner Image</string>
|
<string name="content_description_banner_imageview">Subreddit Banner Image</string>
|
||||||
|
|
||||||
<string name="error_loading_posts">Error loading post</string>
|
|
||||||
|
|
||||||
<string name="app_label">Infinity</string>
|
<string name="app_label">Infinity</string>
|
||||||
<string name="search_hint">Search anything</string>
|
<string name="search_hint">Search anything</string>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user