Some tries

This commit is contained in:
stom79 2018-11-15 19:09:44 +01:00
parent d097ee3934
commit 2b3eb1a67d
10 changed files with 190 additions and 109 deletions

View File

@ -27,12 +27,12 @@ import android.support.v7.app.ActionBar;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
@ -71,6 +71,7 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
private String statusId;
private Status initialStatus;
private Status detailsStatus;
private SwipeRefreshLayout swipeRefreshLayout;
private RecyclerView lv_status;
private boolean isRefreshed;
@ -108,9 +109,10 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
setSupportActionBar(toolbar);
Bundle b = getIntent().getExtras();
statuses = new ArrayList<>();
if(b != null)
statusId = b.getString("statusId", null);
if( statusId == null)
detailsStatus = b.getParcelable("status");
if( detailsStatus == null || detailsStatus.getId() == null)
finish();
if( getSupportActionBar() != null)
@ -196,8 +198,21 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
isRefreshed = false;
swipeRefreshLayout = findViewById(R.id.swipeContainer);
new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, false,false, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
//new RetrieveFeedsAsyncTask(getApplicationContext(), RetrieveFeedsAsyncTask.Type.ONESTATUS, statusId,null, false,false, ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
boolean isOnWifi = Helper.isOnWIFI(getApplicationContext());
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
statuses.add(detailsStatus);
statusListAdapter = new StatusListAdapter(ShowConversationActivity.this, 0, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses);
final LinearLayoutManager mLayoutManager;
mLayoutManager = new LinearLayoutManager(this);
Log.v(Helper.TAG,"statuses= " + statuses.size());
lv_status.setLayoutManager(mLayoutManager);
boolean compactMode = sharedpreferences.getBoolean(Helper.SET_COMPACT_MODE, false);
lv_status.addItemDecoration(new ConversationDecoration(ShowConversationActivity.this, theme, compactMode));
lv_status.setAdapter(statusListAdapter);
new RetrieveContextAsyncTask(getApplicationContext(), expanded, detailsStatus.getId(), ShowConversationActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
switch (theme){
case Helper.THEME_LIGHT:
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
@ -257,21 +272,15 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
@Override
public void onRetrieveContext(Context context, Status statusFirst, Error error) {
swipeRefreshLayout.setRefreshing(false);
RelativeLayout loader = findViewById(R.id.loader);
if( error != null){
Toast.makeText(getApplicationContext(), error.getError(),Toast.LENGTH_LONG).show();
return;
}
boolean isOnWifi = Helper.isOnWIFI(getApplicationContext());
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
int behaviorWithAttachments = sharedpreferences.getInt(Helper.SET_ATTACHMENT_ACTION, Helper.ATTACHMENT_ALWAYS);
int positionSpinnerTrans = sharedpreferences.getInt(Helper.SET_TRANSLATOR, Helper.TRANS_YANDEX);
int position = 0;
boolean positionFound = false;
statuses = new ArrayList<>();
if( expanded) {
int position = 0;
boolean positionFound = false;
statuses = new ArrayList<>();
if (statusFirst != null)
statuses.add(0, statusFirst);
if (context.getAncestors() != null && context.getAncestors().size() > 0) {
@ -297,18 +306,26 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
}
}
if( isRefreshed){
position = statuses.size()-1;
lv_status.scrollToPosition(position);
}else {
lv_status.smoothScrollToPosition(position);
}
statusListAdapter.notifyDataSetChanged();
}else {
position = 0;
if (context.getAncestors() != null && context.getAncestors().size() > 0) {
statuses.addAll(context.getAncestors());
position = context.getAncestors().size();
statuses.addAll(0,context.getAncestors());
statusListAdapter.notifyItemRangeInserted(0, context.getAncestors().size()-1);
}
statuses.add(initialStatus);
if (context.getDescendants() != null && context.getDescendants().size() > 0) {
statuses.addAll(context.getDescendants());
statuses.addAll(context.getAncestors().size()+1,context.getDescendants());
statusListAdapter.notifyItemRangeInserted(context.getAncestors().size()+1, context.getDescendants().size()-1);
}
}
statusListAdapter = new StatusListAdapter(ShowConversationActivity.this, position, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses);
/*statusListAdapter = new StatusListAdapter(ShowConversationActivity.this, position, null, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, statuses);
final LinearLayoutManager mLayoutManager;
mLayoutManager = new LinearLayoutManager(this);
@ -317,18 +334,10 @@ public class ShowConversationActivity extends BaseActivity implements OnRetrieve
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
boolean compactMode = sharedpreferences.getBoolean(Helper.SET_COMPACT_MODE, false);
lv_status.addItemDecoration(new ConversationDecoration(ShowConversationActivity.this, theme, compactMode));
lv_status.setAdapter(statusListAdapter);
lv_status.setAdapter(statusListAdapter);*/
if( isRefreshed){
position = statuses.size()-1;
lv_status.scrollToPosition(position);
}else {
lv_status.smoothScrollToPosition(position);
}
statusListAdapter.notifyDataSetChanged();
loader.setVisibility(View.GONE);
lv_status.setVisibility(View.VISIBLE);
}

View File

@ -15,8 +15,8 @@
package fr.gouv.etalab.mastodon.client.Entities;
import android.app.Activity;
import android.content.*;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Bundle;
@ -594,7 +594,7 @@ public class Account implements Parcelable {
}
public void makeEmojisAccount(final Context context, final OnRetrieveEmojiAccountInterface listener){
public void makeEmojisAccount(final Context context, final OnRetrieveEmojiAccountInterface listener, Account account){
if( ((Activity)context).isFinishing() )
return;

View File

@ -15,16 +15,39 @@
package fr.gouv.etalab.mastodon.client.Entities;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by Thomas on 20/10/2017.
*/
public class Emojis {
public class Emojis implements Parcelable {
private String shortcode;
private String static_url;
private String url;
public Emojis(){}
protected Emojis(Parcel in) {
shortcode = in.readString();
static_url = in.readString();
url = in.readString();
}
public static final Creator<Emojis> CREATOR = new Creator<Emojis>() {
@Override
public Emojis createFromParcel(Parcel in) {
return new Emojis(in);
}
@Override
public Emojis[] newArray(int size) {
return new Emojis[size];
}
};
public String getShortcode() {
return shortcode;
}
@ -48,4 +71,16 @@ public class Emojis {
public void setUrl(String url) {
this.url = url;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(shortcode);
dest.writeString(static_url);
dest.writeString(url);
}
}

View File

@ -36,6 +36,7 @@ import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.text.style.ImageSpan;
import android.text.style.URLSpan;
import android.util.Log;
import android.view.View;
import com.bumptech.glide.Glide;
@ -135,7 +136,11 @@ public class Status implements Parcelable{
reblog = in.readParcelable(Status.class.getClassLoader());
account = in.readParcelable(Account.class.getClassLoader());
mentions = in.readArrayList(Mention.class.getClassLoader());
media_attachments = in.readArrayList(Attachment.class.getClassLoader());
emojis = in.readArrayList(Emojis.class.getClassLoader());
tags = in.readArrayList(Tag.class.getClassLoader());
content = in.readString();
created_at = (java.util.Date) in.readSerializable();
contentTranslated = in.readString();
reblogs_count = in.readInt();
itemViewType = in.readInt();
@ -156,6 +161,40 @@ public class Status implements Parcelable{
pinned = in.readByte() != 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(id);
dest.writeString(uri);
dest.writeString(url);
dest.writeString(in_reply_to_id);
dest.writeString(in_reply_to_account_id);
dest.writeParcelable(reblog, flags);
dest.writeParcelable(account, flags);
dest.writeList(mentions);
dest.writeList(media_attachments);
dest.writeList(emojis);
dest.writeList(tags);
dest.writeString(content);
dest.writeSerializable(created_at);
dest.writeString(contentTranslated);
dest.writeInt(reblogs_count);
dest.writeInt(itemViewType);
dest.writeInt(favourites_count);
dest.writeInt(replies_count);
dest.writeByte((byte) (reblogged ? 1 : 0));
dest.writeByte((byte) (favourited ? 1 : 0));
dest.writeByte((byte) (muted ? 1 : 0));
dest.writeByte((byte) (sensitive ? 1 : 0));
dest.writeString(contentCW);
dest.writeString(visibility);
dest.writeString(language);
dest.writeByte((byte) (attachmentShown ? 1 : 0));
dest.writeByte((byte) (spoilerShown ? 1 : 0));
dest.writeByte((byte) (isTranslated ? 1 : 0));
dest.writeByte((byte) (isTranslationShown ? 1 : 0));
dest.writeByte((byte) (isNew ? 1 : 0));
dest.writeByte((byte) (pinned ? 1 : 0));
}
public static final Creator<Status> CREATOR = new Creator<Status>() {
@ -359,36 +398,6 @@ public class Status implements Parcelable{
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(id);
dest.writeString(uri);
dest.writeString(url);
dest.writeString(in_reply_to_id);
dest.writeString(in_reply_to_account_id);
dest.writeParcelable(reblog, flags);
dest.writeParcelable(account, flags);
dest.writeList(mentions);
dest.writeString(content);
dest.writeString(contentTranslated);
dest.writeInt(reblogs_count);
dest.writeInt(itemViewType);
dest.writeInt(favourites_count);
dest.writeInt(replies_count);
dest.writeByte((byte) (reblogged ? 1 : 0));
dest.writeByte((byte) (favourited ? 1 : 0));
dest.writeByte((byte) (muted ? 1 : 0));
dest.writeByte((byte) (sensitive ? 1 : 0));
dest.writeString(contentCW);
dest.writeString(visibility);
dest.writeString(language);
dest.writeByte((byte) (attachmentShown ? 1 : 0));
dest.writeByte((byte) (spoilerShown ? 1 : 0));
dest.writeByte((byte) (isTranslated ? 1 : 0));
dest.writeByte((byte) (isTranslationShown ? 1 : 0));
dest.writeByte((byte) (isNew ? 1 : 0));
dest.writeByte((byte) (pinned ? 1 : 0));
}
public boolean isSpoilerShown() {
return spoilerShown;
@ -459,12 +468,16 @@ public class Status implements Parcelable{
return isEmojiFound;
}
public void setEmojiFound(boolean emojiFound) {
isEmojiFound = emojiFound;
}
public void makeClickable(Context context){
public static void transform(Context context, Status status, OnRetrieveEmojiInterface listener){
if( ((Activity)context).isFinishing() || status == null)
return;
@ -477,20 +490,21 @@ public class Status implements Parcelable{
else
//noinspection deprecation
spannableStringCW = new SpannableString(Html.fromHtml(status.getReblog() != null ?status.getReblog().getSpoiler_text():status.getSpoiler_text()));
status.setContentSpan(treatment(context, spannableStringContent));
status.setContentSpanCW(treatment(context, spannableStringCW));
isClickable = true;
if( spannableStringContent.length() > 0)
status.setContentSpan(treatment(context, spannableStringContent, status));
if( spannableStringCW.length() > 0)
status.setContentSpanCW(treatment(context, spannableStringCW, status));
makeEmojis(context, listener, status);
status.setClickable(true);
}
public void makeClickableTranslation(Context context){
public static void transformTranslation(Context context, OnRetrieveEmojiInterface listener, Status status){
if( ((Activity)context).isFinishing() || status == null)
return;
if( (status.getReblog() != null && status.getReblog().getContent() == null) || (status.getReblog() == null && status.getContent() == null))
return;
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
SpannableString spannableStringTranslated;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
spannableStringTranslated = new SpannableString(Html.fromHtml(status.getContentTranslated(), Html.FROM_HTML_MODE_LEGACY));
@ -498,12 +512,12 @@ public class Status implements Parcelable{
//noinspection deprecation
spannableStringTranslated = new SpannableString(Html.fromHtml(status.getContentTranslated()));
status.setContentSpanTranslated(treatment(context, spannableStringTranslated));
status.setContentSpanTranslated(treatment(context, spannableStringTranslated, status));
makeEmojisTranslation(context, listener, status);
}
public void makeEmojis(final Context context, final OnRetrieveEmojiInterface listener){
private static void makeEmojis(final Context context, final OnRetrieveEmojiInterface listener, Status status){
if( ((Activity)context).isFinishing() )
return;
@ -516,15 +530,16 @@ public class Status implements Parcelable{
final List<Emojis> emojis = status.getReblog() != null ? status.getReblog().getEmojis() : status.getEmojis();
final List<Emojis> emojisAccounts = status.getReblog() != null ?status.getReblog().getAccount().getEmojis():status.getAccount().getEmojis();
status.getAccount().makeEmojisAccount(context, null);
status.getAccount().makeEmojisAccount(context, null, status.getAccount());
String displayName;
if( status.getReblog() != null){
displayName = status.getReblog().getAccount().getDisplay_name();
}else {
displayName = status.getAccount().getDisplay_name();
}
displayNameSpan = new SpannableString(displayName);
SpannableString displayNameSpan = new SpannableString(displayName);
SpannableString contentSpan = new SpannableString(status.getContent());
SpannableString contentSpanCW = new SpannableString(status.getSpoiler_text());
if( emojisAccounts != null)
emojis.addAll(emojisAccounts);
if( emojis != null && emojis.size() > 0 ) {
@ -564,7 +579,7 @@ public class Status implements Parcelable{
endPosition, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
}
}
if (displayNameSpan != null && displayNameSpan.toString().contains(targetedEmoji)) {
if (displayNameSpan.toString().contains(targetedEmoji)) {
//emojis can be used several times so we have to loop
for (int startPosition = -1; (startPosition = displayNameSpan.toString().indexOf(targetedEmoji, startPosition + 1)) != -1; startPosition++) {
final int endPosition = startPosition + targetedEmoji.length();
@ -590,6 +605,8 @@ public class Status implements Parcelable{
}
i[0]++;
if( i[0] == (emojis.size())) {
status.setContentSpan(contentSpan);
status.setContentSpanCW(contentSpanCW);
listener.onRetrieveEmoji(status, false);
}
}
@ -600,7 +617,7 @@ public class Status implements Parcelable{
}
public void makeEmojisTranslation(final Context context, final OnRetrieveEmojiInterface listener){
private static void makeEmojisTranslation(final Context context, final OnRetrieveEmojiInterface listener, Status status){
if( ((Activity)context).isFinishing() )
return;
@ -671,12 +688,14 @@ public class Status implements Parcelable{
private SpannableString treatment(final Context context, final SpannableString spannableString){
private static SpannableString treatment(final Context context, final SpannableString spannableString, Status status){
URLSpan[] urls = spannableString.getSpans(0, spannableString.length(), URLSpan.class);
for(URLSpan span : urls)
spannableString.removeSpan(span);
List<Mention> mentions = this.status.getReblog() != null ? this.status.getReblog().getMentions() : this.status.getMentions();
List<Mention> mentions = status.getReblog() != null ? status.getReblog().getMentions() : status.getMentions();
Log.v(Helper.TAG,"spannableString: " + spannableString);
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
@ -767,7 +786,7 @@ public class Status implements Parcelable{
else
//noinspection deprecation
spannableStringT = new SpannableString(Html.fromHtml(spannableString.toString().replaceAll("^<p>","").replaceAll("<p>","<br/><br/>").replaceAll("</p>","")));
Log.v(Helper.TAG,"spannableStringT: " + spannableStringT);
URLSpan[] spans = spannableStringT.getSpans(0, spannableStringT.length(), URLSpan.class);
for (URLSpan span : spans) {
spannableStringT.removeSpan(span);
@ -989,6 +1008,9 @@ public class Status implements Parcelable{
this.contentSpanTranslated = contentSpanTranslated;
}
public void setClickable(boolean clickable) {
isClickable = clickable;
}
public boolean isClickable() {
return isClickable;
}

View File

@ -14,18 +14,38 @@
* see <http://www.gnu.org/licenses>. */
package fr.gouv.etalab.mastodon.client.Entities;
import java.io.Serializable;
import android.os.Parcel;
import android.os.Parcelable;
/**
* Created by Thomas on 23/04/2017.
* Manage Tags
*/
public class Tag {
public class Tag implements Parcelable {
private String name;
private String url;
public Tag(){}
protected Tag(Parcel in) {
name = in.readString();
url = in.readString();
}
public static final Creator<Tag> CREATOR = new Creator<Tag>() {
@Override
public Tag createFromParcel(Parcel in) {
return new Tag(in);
}
@Override
public Tag[] newArray(int size) {
return new Tag[size];
}
};
public String getName() {
return name;
}
@ -41,4 +61,15 @@ public class Tag {
public void setUrl(String url) {
this.url = url;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(name);
dest.writeString(url);
}
}

View File

@ -164,7 +164,7 @@ public class AccountsListAdapter extends RecyclerView.Adapter implements OnPostA
});
}
account.makeEmojisAccount(context, AccountsListAdapter.this);
account.makeEmojisAccount(context, AccountsListAdapter.this, account);
if( account.getdisplayNameSpan() == null || account.getdisplayNameSpan().toString().trim().equals("")) {
if( account.getDisplay_name() != null && !account.getDisplay_name().trim().equals(""))
holder.account_dn.setText(Helper.shortnameToUnicode(account.getDisplay_name(), true));

View File

@ -252,7 +252,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
notification.getAccount().setDisplay_name(typeString);
}else
holder.notification_type.setText(notification.getAccount().getdisplayNameSpan(), TextView.BufferType.SPANNABLE);
notification.getAccount().makeEmojisAccount(context, NotificationsListAdapter.this);
notification.getAccount().makeEmojisAccount(context, NotificationsListAdapter.this, notification.getAccount());
if( imgH != null) {
holder.notification_type.setCompoundDrawablePadding((int)Helper.convertDpToPixel(5, context));
imgH.setBounds(0, 0, (int) (20 * iconSizePercent / 100 * scale + 0.5f), (int) (20 * iconSizePercent / 100 * scale + 0.5f));
@ -309,9 +309,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
holder.status_reply.setText("");
if( !status.isClickable())
status.makeClickable(context);
if( !status.isEmojiFound())
status.makeEmojis(context, NotificationsListAdapter.this);
Status.transform(context, status, NotificationsListAdapter.this);
holder.notification_status_content.setText(status.getContentSpan(), TextView.BufferType.SPANNABLE);
holder.status_spoiler.setText(status.getContentSpanCW(), TextView.BufferType.SPANNABLE);
holder.status_spoiler.setMovementMethod(LinkMovementMethod.getInstance());

View File

@ -638,9 +638,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
holder.vertical_content.setLayoutParams(params);
holder.left_buttons.setLayoutParams(paramsB);
if( !status.isClickable())
status.makeClickable(context);
if( !status.isEmojiFound())
status.makeEmojis(context, StatusListAdapter.this);
Status.transform(context, status, this);
holder.status_content.setOnTouchListener(new View.OnTouchListener() {
@Override
@ -660,9 +658,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
Intent intent = new Intent(context, ShowConversationActivity.class);
Bundle b = new Bundle();
if (status.getReblog() == null)
b.putString("statusId", status.getId());
b.putParcelable("status", status);
else
b.putString("statusId", status.getReblog().getId());
b.putParcelable("status", status.getReblog());
intent.putExtras(b);
if (type == RetrieveFeedsAsyncTask.Type.CONTEXT)
((Activity) context).finish();
@ -679,9 +677,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
Intent intent = new Intent(context, ShowConversationActivity.class);
Bundle b = new Bundle();
if (status.getReblog() == null)
b.putString("statusId", status.getId());
b.putParcelable("status", status);
else
b.putString("statusId", status.getReblog().getId());
b.putParcelable("status", status.getReblog());
intent.putExtras(b);
if (type == RetrieveFeedsAsyncTask.Type.CONTEXT)
((Activity) context).finish();
@ -2263,8 +2261,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
status.setTranslated(true);
status.setTranslationShown(true);
status.setContentTranslated(translate.getTranslatedContent());
status.makeClickableTranslation(context);
status.makeEmojisTranslation(context, StatusListAdapter.this);
status.transformTranslation(context, StatusListAdapter.this, status);
notifyStatusChanged(status);
}else {
Toast.makeText(context, R.string.toast_error_translate, Toast.LENGTH_LONG).show();

View File

@ -1477,7 +1477,7 @@ public class Helper {
activity.startActivity(myIntent);
activity.finish(); //User is logged out to get a new token
}else {
account.makeEmojisAccount(activity, ((BaseMainActivity)activity));
account.makeEmojisAccount(activity, ((BaseMainActivity)activity), account);
username.setText(String.format("@%s",account.getUsername() + "@" + account.getInstance()));
displayedName.setText(account.getdisplayNameSpan(), TextView.BufferType.SPANNABLE);
String url = account.getAvatar();
@ -2608,6 +2608,8 @@ public class Helper {
public static boolean filterToots(Context context, Status status, List<String> timedMute, RetrieveFeedsAsyncTask.Type type){
String filter;
if( status == null)
return true;
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
if( type == RetrieveFeedsAsyncTask.Type.HOME)
filter = sharedpreferences.getString(Helper.SET_FILTER_REGEX_HOME, null);

View File

@ -45,25 +45,12 @@
android:id="@+id/swipeContainer"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:visibility="gone"
android:id="@+id/lv_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
android:divider="@null" />
</android.support.v4.widget.SwipeRefreshLayout>
<!-- Main Loader -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/loader"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
>
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
</RelativeLayout>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>