diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java index 49637709..0cb1edeb 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java @@ -19,7 +19,6 @@ import android.widget.TextView; import android.widget.Toast; import androidx.appcompat.app.AppCompatDelegate; -import androidx.core.content.res.ResourcesCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentPagerAdapter; diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java index 8e81cdd4..629b2f60 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java @@ -187,6 +187,7 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo recyclerView.setLayoutManager(layoutManager); topicAdapter = new TopicAdapter(this, emojiKeyboard, topicItems); recyclerView.setAdapter(topicAdapter); + recyclerView.setItemViewCacheSize(15); //Every page has maximum 15 posts replyFAB = findViewById(R.id.topic_fab); replyFAB.hide(); @@ -661,11 +662,11 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo Toast.makeText(this, "Failed to remove vote", Toast.LENGTH_LONG).show(); } }); - // observe the chages in data + // observe the changes in data viewModel.getPageIndicatorIndex().observe(this, pageIndicatorIndex -> { if (pageIndicatorIndex == null) return; - pageIndicator.setText(String.valueOf(pageIndicatorIndex) + "/" + - String.valueOf(viewModel.getPageCount())); + pageIndicator.setText(pageIndicatorIndex + "/" + + viewModel.getPageCount()); }); viewModel.getTopicTitle().observe(this, newTopicTitle -> { if (newTopicTitle == null) return; @@ -692,6 +693,7 @@ public class TopicActivity extends BaseActivity implements TopicAdapter.OnPostFo viewModel.getTopicItems().observe(this, postList -> { if (postList == null) progressBar.setVisibility(ProgressBar.VISIBLE); recyclerView.getRecycledViewPool().clear(); //Avoid inconsistency detected bug + recyclerView.scrollToPosition(0); topicItems.clear(); topicItems.addAll(postList); topicAdapter.notifyDataSetChanged(); diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java index d457db1d..50b1f157 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java @@ -43,13 +43,10 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.widget.AppCompatButton; -import androidx.core.content.res.ResourcesCompat; import androidx.lifecycle.ViewModelProviders; import androidx.recyclerview.widget.RecyclerView; import com.bumptech.glide.Glide; -import com.bumptech.glide.RequestBuilder; -import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.github.mikephil.charting.charts.HorizontalBarChart; import com.github.mikephil.charting.components.XAxis; import com.github.mikephil.charting.components.YAxis; @@ -67,7 +64,6 @@ import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.activities.board.BoardActivity; import gr.thmmy.mthmmy.activities.profile.ProfileActivity; import gr.thmmy.mthmmy.base.BaseActivity; -import gr.thmmy.mthmmy.base.BaseApplication; import gr.thmmy.mthmmy.model.Poll; import gr.thmmy.mthmmy.model.Post; import gr.thmmy.mthmmy.model.ThmmyFile; diff --git a/app/src/main/java/gr/thmmy/mthmmy/views/ReactiveWebView.java b/app/src/main/java/gr/thmmy/mthmmy/views/ReactiveWebView.java index 1d41bda7..35fe87b7 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/views/ReactiveWebView.java +++ b/app/src/main/java/gr/thmmy/mthmmy/views/ReactiveWebView.java @@ -31,19 +31,24 @@ public class ReactiveWebView extends WebView { public ReactiveWebView(Context context) { super(context); this.context = context; - setOnLongClickListener(); + init(); } public ReactiveWebView(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; - setOnLongClickListener(); + init(); } public ReactiveWebView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); this.context = context; + init(); + } + + private void init(){ setOnLongClickListener(); + this.setVerticalScrollBarEnabled(false); } @Override