Browse Source

WebView hardware acceleration fix

pull/24/head
Ezerous 7 years ago
parent
commit
40e2b6c17f
  1. 9
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java

9
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java

@ -181,7 +181,6 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
//Post's WebView parameters //Post's WebView parameters
holder.post.setClickable(true); holder.post.setClickable(true);
holder.post.setWebViewClient(new LinkLauncher()); holder.post.setWebViewClient(new LinkLauncher());
holder.post.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
//Avoids errors about layout having 0 width/height //Avoids errors about layout having 0 width/height
holder.thumbnail.setMinimumWidth(1); holder.thumbnail.setMinimumWidth(1);
@ -484,6 +483,14 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
//notifyDataSetChanged(); //notifyDataSetChanged();
} }
//Fix for WebView not rendering with Hardware Acceleration
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
super.onViewAttachedToWindow(holder);
if (holder instanceof PostViewHolder)
((PostViewHolder) holder).post.reload();
}
@Override @Override
public int getItemCount() { public int getItemCount() {
return postsList.size(); return postsList.size();

Loading…
Cancel
Save