[Android] TV: Remove history row when needed
Geoffrey Métais
git at videolan.org
Thu Jul 19 09:46:19 CEST 2018
vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jul 19 09:45:55 2018 +0200| [e6253806287a3744142e33bb40d20cb6d05c39b3] | committer: Geoffrey Métais
TV: Remove history row when needed
> https://code.videolan.org/videolan/vlc-android/commit/e6253806287a3744142e33bb40d20cb6d05c39b3
---
vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index 29a655953..603cacf07 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -186,6 +186,19 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
public void run() {
final ListRow hist = updateHistory(history);
if (hist != null) mRowsAdapter.add(Math.min(2, mRowsAdapter.size()), hist);
+ else removeHistory();
+ }
+
+ private void removeHistory() {
+ int position = -1;
+ for (int i = 0; i < mRowsAdapter.size(); ++i) {
+ if (((ListRow)mRowsAdapter.get(i)).getHeaderItem().getId() == HEADER_HISTORY) {
+ position = i;
+ break;
+ }
+ }
+ if (position != -1) mRowsAdapter.removeItems(position, 1);
+ mHistoryAdapter = null;
}
});
}
More information about the Android
mailing list