removed listview animations library (which also provided swipe to dismiss)

This commit is contained in:
Andrew Dolgov 2017-06-01 15:00:10 +03:00
parent c436dedced
commit 1ca3a7d681
6 changed files with 14 additions and 106 deletions

View File

@ -42,8 +42,8 @@ dependencies {
compile 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:1.2.32@aar'
compile 'me.relex:circleindicator:1.2.2@aar'
compile 'com.viewpagerindicator:library:2.4.1'
compile 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0@aar'
//compile 'com.nhaarman.listviewanimations:lib-core:3.1.0@aar'
//compile 'com.nhaarman.listviewanimations:lib-manipulation:3.1.0@aar'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile files('libs/YouTubeAndroidPlayerApi.jar')

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.fox.ttrss"
android:versionCode="429"
android:versionName="1.195" >
android:versionCode="430"
android:versionName="1.196" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

View File

@ -66,13 +66,6 @@ import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.GlideDrawableImageViewTarget;
import com.bumptech.glide.request.target.Target;
import com.google.gson.JsonElement;
import com.nhaarman.listviewanimations.appearance.AnimationAdapter;
import com.nhaarman.listviewanimations.appearance.simple.SwingBottomInAnimationAdapter;
import com.nhaarman.listviewanimations.itemmanipulation.DynamicListView;
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.DismissableManager;
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.OnDismissCallback;
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.undo.TimedUndoAdapter;
import com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.undo.UndoAdapter;
import com.shamanland.fab.FloatingActionButton;
import com.shamanland.fab.ShowHideOnScroll;
@ -114,7 +107,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
private SharedPreferences m_prefs;
private ArticleListAdapter m_adapter;
private AnimationAdapter m_animationAdapter;
private ArticleList m_articles = new ArticleList(); //Application.getInstance().m_loadedArticles;
//private ArticleList m_selectedArticles = new ArticleList();
private ArticleList m_readArticles = new ArticleList();
@ -124,7 +116,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
private int m_maxImageSize = 0;
private boolean m_compactLayoutMode = false;
private int m_listPreviousVisibleItem;
private DynamicListView m_list;
private ListView m_list;
//private ImageLoader m_imageLoader = ImageLoader.getInstance();
private View m_listLoadingView;
private View m_topChangedView;
@ -335,7 +327,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
}
});
m_list = (DynamicListView) view.findViewById(R.id.headlines_list);
m_list = (ListView) view.findViewById(R.id.headlines_list);
FloatingActionButton fab = (FloatingActionButton) view.findViewById(R.id.headlines_fab);
@ -379,55 +371,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
}
m_adapter = new ArticleListAdapter(getActivity(), R.layout.headlines_row, m_articles);
m_animationAdapter = new SwingBottomInAnimationAdapter(m_adapter);
m_animationAdapter.setAbsListView(m_list);
m_list.setAdapter(m_animationAdapter);
if (enableSwipeToDismiss && !m_prefs.getBoolean("headlines_mark_read_scroll", false)) {
TimedUndoAdapter swipeUndoAdapter = new TimedUndoAdapter(m_adapter, m_activity,
new OnDismissCallback() {
@Override
public void onDismiss(final ViewGroup listView, final int[] reverseSortedPositions) {
for (int position : reverseSortedPositions) {
Article article = m_adapter.getItem(position);
Log.d(TAG, "onSwipeDismiss: " + article);
if (article != null) {
if (article.unread) {
article.unread = false;
m_activity.saveArticleUnread(article);
}
m_adapter.remove(article);
m_adapter.notifyDataSetChanged();
}
}
}
}
);
swipeUndoAdapter.setTimeoutMs(2000);
swipeUndoAdapter.setAbsListView(m_list);
m_list.setAdapter(swipeUndoAdapter);
m_list.enableSimpleSwipeUndo();
m_list.setDismissableManager(new DismissableManager() {
@Override
public boolean isDismissable(long id, int position) {
try {
Article article = m_adapter.getItem(position);
return article != null;
} catch (Exception e) {
// index out of bounds == footer or w/e
return false;
}
}
});
}
m_list.setAdapter(m_adapter);
m_list.setOnItemClickListener(this);
m_list.setOnScrollListener(this);
@ -515,7 +459,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
m_autoCatchupDisabled = true;
m_list.setSelection(0);
m_autoCatchupDisabled = false;
m_animationAdapter.reset();
m_articles.clear();
m_adapter.notifyDataSetChanged();
}
@ -720,7 +663,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
public boolean flavorImageEmbedded;
}
private class ArticleListAdapter extends ArrayAdapter<Article> implements UndoAdapter {
private class ArticleListAdapter extends ArrayAdapter<Article> {
private ArrayList<Article> items;
public static final int VIEW_NORMAL = 0;
@ -1541,23 +1484,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
tv.setPaintFlags(tv.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
}
}
@NonNull
@Override
public View getUndoView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View view = convertView;
if (view == null) {
view = LayoutInflater.from(m_activity).inflate(R.layout.headlines_row_undo, parent, false);
}
return view;
}
@NonNull
@Override
public View getUndoClickView(@NonNull View view) {
return view.findViewById(R.id.headlines_row_undo_button);
}
}
private void releaseSurface() {

View File

@ -43,8 +43,6 @@ import android.widget.TextView;
import com.amulyakhare.textdrawable.TextDrawable;
import com.amulyakhare.textdrawable.util.ColorGenerator;
import com.nhaarman.listviewanimations.appearance.AnimationAdapter;
import com.nhaarman.listviewanimations.appearance.simple.SwingBottomInAnimationAdapter;
import com.shamanland.fab.FloatingActionButton;
import org.fox.ttrss.Application;
@ -73,7 +71,6 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
private Cursor m_cursor;
private ArticleListAdapter m_adapter;
private AnimationAdapter m_animationAdapter;
private OfflineHeadlinesEventListener m_listener;
private OfflineActivity m_activity;
@ -329,10 +326,7 @@ public class OfflineHeadlinesFragment extends Fragment implements OnItemClickLis
m_adapter = new ArticleListAdapter(getActivity(), R.layout.headlines_row, m_cursor,
new String[] { "title" }, new int[] { R.id.title }, 0);
m_animationAdapter = new SwingBottomInAnimationAdapter(m_adapter);
m_animationAdapter.setAbsListView(m_list);
m_list.setAdapter(m_animationAdapter);
m_list.setAdapter(m_adapter);
m_list.setOnItemClickListener(this);
m_list.setOnScrollListener(this);

View File

@ -11,12 +11,11 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.nhaarman.listviewanimations.itemmanipulation.DynamicListView
<ListView
android:id="@+id/headlines_list"
android:drawSelectorOnTop="true"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</com.nhaarman.listviewanimations.itemmanipulation.DynamicListView>
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
<!-- <TextView

View File

@ -84,23 +84,12 @@
android:summary="@string/pref_headlines_show_content_long"
android:title="@string/pref_headlines_show_content" />
<org.fox.ttrss.util.LessBrokenSwitchPreference
<!-- <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="true"
android:dependency="headlines_mark_read_scroll"
android:key="headlines_swipe_to_dismiss"
android:summary="@string/pref_headlines_swipe_to_dismiss_long"
android:title="@string/pref_headlines_swipe_to_dismiss" />
<!-- <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="true"
android:key="headlines_show_flavor_image"
android:title="@string/prefs_headlines_show_flavor_image" /> -->
<!-- <org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="false"
android:key="headlines_full_content"
android:summary="@string/pref_headlines_full_content_long"
android:title="@string/pref_headlines_full_content" /> -->
android:title="@string/pref_headlines_swipe_to_dismiss" /> -->
<org.fox.ttrss.util.LessBrokenSwitchPreference
android:defaultValue="false"