Filters boosts & replies in home timeline
This commit is contained in:
parent
e09dbbe307
commit
2175c17ce6
|
@ -58,6 +58,7 @@ public class Status implements Parcelable {
|
|||
private boolean isTranslationShown = false;
|
||||
private boolean isNew = false;
|
||||
private boolean isTakingScreenShot = false;
|
||||
private boolean isVisible = true;
|
||||
|
||||
protected Status(Parcel in) {
|
||||
id = in.readString();
|
||||
|
@ -370,4 +371,12 @@ public class Status implements Parcelable {
|
|||
public void setTakingScreenShot(boolean takingScreenShot) {
|
||||
isTakingScreenShot = takingScreenShot;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return isVisible;
|
||||
}
|
||||
|
||||
public void setVisible(boolean visible) {
|
||||
isVisible = visible;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -370,6 +370,17 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Refresh status in list
|
||||
*/
|
||||
public void refreshFilter(){
|
||||
int index = lv_status.getFirstVisiblePosition() + 1;
|
||||
View v = lv_status.getChildAt(0);
|
||||
int top = (v == null) ? 0 : v.getTop();
|
||||
statusListAdapter.notifyDataSetChanged();
|
||||
lv_status.setSelectionFromTop(index, top);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume(){
|
||||
super.onResume();
|
||||
|
|
|
@ -209,6 +209,9 @@ public class Helper {
|
|||
public static final String SET_PREVIEW_REPLIES_PP = "set_preview_replies_pp";
|
||||
public static final String SET_TRANSLATOR = "set_translator";
|
||||
public static final String SET_LED_COLOUR = "set_led_colour";
|
||||
public static final String SET_SHOW_BOOSTS = "set_show_boost";
|
||||
public static final String SET_SHOW_REPLIES = "set_show_replies";
|
||||
|
||||
|
||||
public static final int ATTACHMENT_ALWAYS = 1;
|
||||
public static final int ATTACHMENT_WIFI = 2;
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/action_show_boosts"
|
||||
android:checkable="true"
|
||||
android:title="@string/show_boosts"
|
||||
app:actionViewClass="android.widget.CheckBox"
|
||||
app:showAsAction="always"
|
||||
tools:ignore="AlwaysShowAction" />
|
||||
<item
|
||||
android:id="@+id/action_show_replies"
|
||||
android:checkable="true"
|
||||
android:title="@string/show_replies"
|
||||
app:actionViewClass="android.widget.CheckBox"
|
||||
app:showAsAction="always" />
|
||||
</menu>
|
|
@ -63,6 +63,9 @@
|
|||
<string name="follow">Neue Folgende</string>
|
||||
<string name="mention">Erwähnungen</string>
|
||||
<string name="reblog">Geteilte Beiträge</string>
|
||||
<string name="show_boosts">Geteilte Beiträge anzeigen</string>
|
||||
<string name="show_replies">Antworten anzeigen</string>
|
||||
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Home</string>
|
||||
<string name="local_menu">Lokale Zeitleiste</string>
|
||||
|
|
|
@ -64,7 +64,8 @@
|
|||
<string name="follow">Nouveaux⋅elles abonn⋅é⋅s</string>
|
||||
<string name="mention">Mentions</string>
|
||||
<string name="reblog">Partages</string>
|
||||
|
||||
<string name="show_boosts">Afficher les partages</string>
|
||||
<string name="show_replies">Afficher les réponses</string>
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Accueil</string>
|
||||
<string name="local_menu">Fil public local</string>
|
||||
|
|
|
@ -64,7 +64,8 @@
|
|||
<string name="follow">New followers</string>
|
||||
<string name="mention">Mentions</string>
|
||||
<string name="reblog">Boosts</string>
|
||||
|
||||
<string name="show_boosts">Show boosts</string>
|
||||
<string name="show_replies">Show replies</string>
|
||||
<!--- Menu -->
|
||||
<string name="home_menu">Home</string>
|
||||
<string name="local_menu">Local timeline</string>
|
||||
|
|
|
@ -144,7 +144,7 @@ public class MainActivity extends AppCompatActivity
|
|||
private String userIdService;
|
||||
private Intent streamingIntent;
|
||||
public static String lastHomeId = null, lastNotificationId = null;
|
||||
boolean notif_follow, notif_add, notif_mention, notif_share;
|
||||
boolean notif_follow, notif_add, notif_mention, notif_share, show_boosts, show_replies;
|
||||
|
||||
public MainActivity() {
|
||||
}
|
||||
|
@ -318,6 +318,70 @@ public class MainActivity extends AppCompatActivity
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
tabStrip.getChildAt(0).setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
//Only shown if the tab has focus
|
||||
if( homeFragment != null && homeFragment.getUserVisibleHint()){
|
||||
PopupMenu popup = new PopupMenu(MainActivity.this, tabStrip.getChildAt(0));
|
||||
popup.getMenuInflater()
|
||||
.inflate(R.menu.option_filter_toots, popup.getMenu());
|
||||
Menu menu = popup.getMenu();
|
||||
final MenuItem itemShowBoosts = menu.findItem(R.id.action_show_boosts);
|
||||
final MenuItem itemShowReplies = menu.findItem(R.id.action_show_replies);
|
||||
|
||||
show_boosts = sharedpreferences.getBoolean(Helper.SET_SHOW_BOOSTS, true);
|
||||
show_replies = sharedpreferences.getBoolean(Helper.SET_SHOW_REPLIES, true);
|
||||
itemShowBoosts.setChecked(show_boosts);
|
||||
itemShowReplies.setChecked(show_replies);
|
||||
popup.setOnDismissListener(new PopupMenu.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(PopupMenu menu) {
|
||||
if( homeFragment != null)
|
||||
homeFragment.refreshFilter();
|
||||
}
|
||||
});
|
||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
|
||||
item.setActionView(new View(getApplicationContext()));
|
||||
item.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
|
||||
@Override
|
||||
public boolean onMenuItemActionExpand(MenuItem item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemActionCollapse(MenuItem item) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
switch (item.getItemId()) {
|
||||
case R.id.action_show_boosts:
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
show_boosts = !show_boosts;
|
||||
editor.putBoolean(Helper.SET_SHOW_BOOSTS, show_boosts);
|
||||
itemShowBoosts.setChecked(show_boosts);
|
||||
editor.apply();
|
||||
break;
|
||||
case R.id.action_show_replies:
|
||||
editor = sharedpreferences.edit();
|
||||
show_replies = !show_replies;
|
||||
editor.putBoolean(Helper.SET_SHOW_REPLIES, show_replies);
|
||||
itemShowReplies.setChecked(show_replies);
|
||||
editor.apply();
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
viewPager = (ViewPager) findViewById(R.id.viewpager);
|
||||
int countPage = 2;
|
||||
if( sharedpreferences.getBoolean(Helper.SET_DISPLAY_LOCAL, true))
|
||||
|
|
Loading…
Reference in New Issue