Some fixes

This commit is contained in:
stom79 2018-02-17 15:28:15 +01:00
parent a1aa96a2bd
commit 2bc75b5c06
4 changed files with 29 additions and 9 deletions

View File

@ -78,9 +78,6 @@ import fr.gouv.etalab.mastodon.sqlite.StatusCacheDAO;
public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeedsInterface {
private TextView toolbarTitle;
private RecyclerView lv_status;
private boolean isRefreshed;
private ImageView pp_actionBar;
private StatusListAdapter statusListAdapter;
private SharedPreferences sharedpreferences;
@ -130,12 +127,12 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
finish();
}
});
toolbarTitle = actionBar.getCustomView().findViewById(R.id.toolbar_title);
TextView toolbarTitle = actionBar.getCustomView().findViewById(R.id.toolbar_title);
pp_actionBar = actionBar.getCustomView().findViewById(R.id.pp_actionBar);
toolbarTitle.setText(getString(R.string.owner_cached_toots));
}
statuses = new ArrayList<>();
lv_status = findViewById(R.id.lv_status);
RecyclerView lv_status = findViewById(R.id.lv_status);
mainLoader = findViewById(R.id.loader);
nextElementLoader = findViewById(R.id.loading_next_status);
textviewNoAction = findViewById(R.id.no_action);
@ -185,8 +182,6 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
}
});
isRefreshed = false;
swipeRefreshLayout = findViewById(R.id.swipeContainer);
new RetrieveFeedsAsyncTask(OwnerStatusActivity.this, filterToots, null, OwnerStatusActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
swipeRefreshLayout.setColorSchemeResources(R.color.mastodonC4,
@ -346,6 +341,9 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
RelativeLayout no_result = findViewById(R.id.no_result);
no_result.setVisibility(View.GONE);
filterToots.setBoosts(FilterToots.typeFilter.values()[filter_boost.getSelectedItemPosition()]);
filterToots.setReplies(FilterToots.typeFilter.values()[filter_replies.getSelectedItemPosition()]);
filterToots.setMedia(FilterToots.typeFilter.values()[filter_media.getSelectedItemPosition()]);
@ -422,6 +420,9 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
if( statuses != null && statuses.size() > 0) {
this.statuses.addAll(statuses);
statusListAdapter.notifyItemRangeInserted(previousPosition, statuses.size());
}else {
RelativeLayout no_result = findViewById(R.id.no_result);
no_result.setVisibility(View.VISIBLE);
}
swipeRefreshLayout.setRefreshing(false);
firstLoad = false;

View File

@ -67,6 +67,22 @@
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/no_result"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:padding="10dp"
android:gravity="center"
android:textSize="25sp"
android:layout_gravity="center"
android:textStyle="italic|bold"
android:typeface="serif"
android:text="@string/filter_no_result"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
<!-- Main Loader -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/loader"

View File

@ -137,7 +137,7 @@
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/media"/>
android:text="@string/show_media"/>
<Spinner
android:id="@+id/filter_media"
android:entries="@array/filter_select"
@ -156,7 +156,7 @@
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pinned_toots"/>
android:text="@string/show_pinned"/>
<Spinner
android:id="@+id/filter_pinned"
android:entries="@array/filter_select"

View File

@ -406,6 +406,9 @@
<string name="v_private">Private</string>
<string name="v_direct">Direct</string>
<string name="v_keywords">Some keywords…</string>
<string name="show_media">Show media</string>
<string name="show_pinned">Show pinned</string>
<string name="filter_no_result">No matching result found!</string>
<string-array name="filter_select">
<item>No</item>
<item>Only</item>