kopia lustrzana https://github.com/TeamNewPipe/NewPipe
-Fixed memory leak on rogue observable in history fragment.
-Removed stream id from playlist stream join table since only foreign constraint is needed. -Added bar to playlist control UI. -Modified local playlist fragment to no longer save when out of focus.pull/1004/head
rodzic
62814f083e
commit
75a58d6381
|
@ -28,7 +28,7 @@ public class Migrations {
|
|||
database.execSQL("CREATE TABLE IF NOT EXISTS `stream_state` (`stream_id` INTEGER NOT NULL, `progress_time` INTEGER NOT NULL, PRIMARY KEY(`stream_id`), FOREIGN KEY(`stream_id`) REFERENCES `streams`(`uid`) ON UPDATE CASCADE ON DELETE CASCADE )");
|
||||
database.execSQL("CREATE TABLE IF NOT EXISTS `playlists` (`uid` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT, `thumbnail_url` TEXT)");
|
||||
database.execSQL("CREATE INDEX `index_playlists_name` ON `playlists` (`name`)");
|
||||
database.execSQL("CREATE TABLE IF NOT EXISTS `playlist_stream_join` (`playlist_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `join_index` INTEGER NOT NULL, PRIMARY KEY(`playlist_id`, `stream_id`, `join_index`), FOREIGN KEY(`playlist_id`) REFERENCES `playlists`(`uid`) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, FOREIGN KEY(`stream_id`) REFERENCES `streams`(`uid`) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED)");
|
||||
database.execSQL("CREATE TABLE IF NOT EXISTS `playlist_stream_join` (`playlist_id` INTEGER NOT NULL, `stream_id` INTEGER NOT NULL, `join_index` INTEGER NOT NULL, PRIMARY KEY(`playlist_id`, `join_index`), FOREIGN KEY(`playlist_id`) REFERENCES `playlists`(`uid`) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED, FOREIGN KEY(`stream_id`) REFERENCES `streams`(`uid`) ON UPDATE CASCADE ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED)");
|
||||
database.execSQL("CREATE UNIQUE INDEX `index_playlist_stream_join_playlist_id_join_index` ON `playlist_stream_join` (`playlist_id`, `join_index`)");
|
||||
database.execSQL("CREATE INDEX `index_playlist_stream_join_stream_id` ON `playlist_stream_join` (`stream_id`)");
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import static org.schabi.newpipe.database.playlist.model.PlaylistStreamEntity.JO
|
|||
import static org.schabi.newpipe.database.playlist.model.PlaylistStreamEntity.PLAYLIST_STREAM_JOIN_TABLE;
|
||||
|
||||
@Entity(tableName = PLAYLIST_STREAM_JOIN_TABLE,
|
||||
primaryKeys = {JOIN_PLAYLIST_ID, JOIN_STREAM_ID, JOIN_INDEX},
|
||||
primaryKeys = {JOIN_PLAYLIST_ID, JOIN_INDEX},
|
||||
indices = {
|
||||
@Index(value = {JOIN_PLAYLIST_ID, JOIN_INDEX}, unique = true),
|
||||
@Index(value = {JOIN_STREAM_ID})
|
||||
|
|
|
@ -469,7 +469,6 @@ public class LocalPlaylistFragment extends BaseLocalListFragment<List<PlaylistSt
|
|||
return debouncedSaveSignal
|
||||
.debounce(SAVE_DEBOUNCE_MILLIS, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnDispose(this::saveJoin)
|
||||
.subscribe(ignored -> saveJoin());
|
||||
}
|
||||
|
||||
|
|
|
@ -222,11 +222,16 @@ public abstract class HistoryFragment<E> extends BaseFragment
|
|||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
if (disposables != null) disposables.dispose();
|
||||
if (historySubscription != null) historySubscription.cancel();
|
||||
|
||||
mSharedPreferences.unregisterOnSharedPreferenceChangeListener(mHistoryIsEnabledChangeListener);
|
||||
mSharedPreferences = null;
|
||||
mHistoryIsEnabledChangeListener = null;
|
||||
mHistoryIsEnabledKey = null;
|
||||
if (disposables != null) disposables.dispose();
|
||||
historySubscription = null;
|
||||
disposables = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,83 +1,100 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/playlist_ctrl_height"
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/playlist_control"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:visibility="invisible">
|
||||
android:visibility="invisible"
|
||||
tools:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/playlist_ctrl_play_bg_button"
|
||||
android:id="@+id/playlist_panel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/controls_background_title"
|
||||
android:textSize="@dimen/channel_rss_title_size"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:drawablePadding="4dp"
|
||||
android:drawableLeft="?attr/audio"
|
||||
android:drawableStart="?attr/audio"/>
|
||||
android:layout_height="@dimen/playlist_ctrl_height">
|
||||
<LinearLayout
|
||||
android:id="@+id/playlist_ctrl_play_bg_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/controls_background_title"
|
||||
android:textSize="@dimen/channel_rss_title_size"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:drawablePadding="4dp"
|
||||
android:drawableLeft="?attr/audio"
|
||||
android:drawableStart="?attr/audio"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View android:id="@+id/anchorLeft"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="false"
|
||||
android:layout_marginBottom="@dimen/playlist_ctrl_seperator_margin"
|
||||
android:layout_marginTop="@dimen/playlist_ctrl_seperator_margin"
|
||||
android:background="?attr/colorAccent"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:id="@+id/playlist_ctrl_play_all_button">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/play_all"
|
||||
android:textSize="@dimen/channel_rss_title_size"
|
||||
android:textColor="?attr/colorAccent"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View android:id="@+id/anchorRight"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="false"
|
||||
android:layout_marginBottom="@dimen/playlist_ctrl_seperator_margin"
|
||||
android:layout_marginTop="@dimen/playlist_ctrl_seperator_margin"
|
||||
android:background="?attr/colorAccent"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:id="@+id/playlist_ctrl_play_popup_button">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/controls_popup_title"
|
||||
android:textSize="@dimen/channel_rss_title_size"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:drawablePadding="4dp"
|
||||
android:drawableLeft="?attr/popup"
|
||||
android:drawableStart="?attr/popup"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<View android:id="@+id/anchorLeft"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="false"
|
||||
android:layout_marginBottom="@dimen/playlist_ctrl_seperator_margin"
|
||||
android:layout_marginTop="@dimen/playlist_ctrl_seperator_margin"
|
||||
android:background="?attr/colorAccent"/>
|
||||
|
||||
<LinearLayout
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:id="@+id/playlist_ctrl_play_all_button">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/play_all"
|
||||
android:textSize="@dimen/channel_rss_title_size"
|
||||
android:textColor="?attr/colorAccent"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View android:id="@+id/anchorRight"
|
||||
android:layout_width="1dp"
|
||||
android:layout_height="match_parent"
|
||||
android:clickable="false"
|
||||
android:layout_marginBottom="@dimen/playlist_ctrl_seperator_margin"
|
||||
android:layout_marginTop="@dimen/playlist_ctrl_seperator_margin"
|
||||
android:background="?attr/colorAccent"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:id="@+id/playlist_ctrl_play_popup_button">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:text="@string/controls_popup_title"
|
||||
android:textSize="@dimen/channel_rss_title_size"
|
||||
android:textColor="?attr/colorAccent"
|
||||
android:drawablePadding="4dp"
|
||||
android:drawableLeft="?attr/popup"
|
||||
android:drawableStart="?attr/popup"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
android:layout_height="1dp"
|
||||
android:layout_below="@+id/playlist_panel"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:background="?attr/separator_color"/>
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true">
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/whatsNewIcon"
|
||||
|
|
Ładowanie…
Reference in New Issue