UI Prototype for Batch Edit Episodes rework (from #1145)
This commit is contained in:
parent
56de034c7c
commit
737f7571ab
|
@ -14,6 +14,7 @@ android {
|
|||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
multiDexEnabled true
|
||||
vectorDrawables.useSupportLibrary true // consider to use pngs instead
|
||||
// Version code schema:
|
||||
// "1.2.3-SNAPSHOT" -> 1020300
|
||||
// "1.2.3-RC4" -> 1020304
|
||||
|
@ -158,6 +159,7 @@ dependencies {
|
|||
}
|
||||
|
||||
implementation "com.github.shts:TriangleLabelView:$triangleLabelViewVersion"
|
||||
implementation 'com.leinardi.android:speed-dial:1.0.2' // 1.0.2 uses support 27.1.1 ; newer versions use 28.0.0;
|
||||
|
||||
implementation "com.github.AntennaPod:AntennaPod-AudioPlayer:$audioPlayerVersion"
|
||||
|
||||
|
|
|
@ -7,17 +7,22 @@ import android.os.Bundle;
|
|||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.util.ArrayMap;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.leinardi.android.speeddial.SpeedDialView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -51,6 +56,7 @@ public class EpisodesApplyActionFragment extends Fragment {
|
|||
private Button btnMarkAsUnplayed;
|
||||
private Button btnDownload;
|
||||
private Button btnDelete;
|
||||
private SpeedDialView mSpeedDialView;
|
||||
|
||||
private final Map<Long,FeedItem> idMap = new ArrayMap<>();
|
||||
private final List<FeedItem> episodes = new ArrayList<>();
|
||||
|
@ -118,15 +124,28 @@ public class EpisodesApplyActionFragment extends Fragment {
|
|||
}).show();
|
||||
return true;
|
||||
});
|
||||
mListView.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
||||
if (AbsListView.OnScrollListener.SCROLL_STATE_IDLE == scrollState) {
|
||||
showSpeedDialIfAnyChecked();
|
||||
} else {
|
||||
hideSpeedDial();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {}
|
||||
});
|
||||
|
||||
for(FeedItem episode : episodes) {
|
||||
titles.add(episode.getTitle());
|
||||
}
|
||||
|
||||
mAdapter = new ArrayAdapter<>(getActivity(),
|
||||
android.R.layout.simple_list_item_multiple_choice, titles);
|
||||
R.layout.simple_list_item_multiple_choice_on_start, titles);
|
||||
mListView.setAdapter(mAdapter);
|
||||
checkAll();
|
||||
/// checkAll(); // TODO: no longer check all by default
|
||||
|
||||
int lastVisibleDiv = 0;
|
||||
btnAddToQueue = view.findViewById(R.id.btnAddToQueue);
|
||||
|
@ -171,9 +190,22 @@ public class EpisodesApplyActionFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
// replacement for the buttons
|
||||
mSpeedDialView = view.findViewById(R.id.fabSD);
|
||||
mSpeedDialView.inflate(R.menu.episodes_apply_action_speeddial);
|
||||
showSpeedDialIfAnyChecked();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void showSpeedDialIfAnyChecked() {
|
||||
mSpeedDialView.setVisibility(checkedIds.size() > 0 ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void hideSpeedDial() {
|
||||
mSpeedDialView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
|
@ -410,6 +442,13 @@ public class EpisodesApplyActionFragment extends Fragment {
|
|||
mListView.setItemChecked(i, checked);
|
||||
}
|
||||
ActivityCompat.invalidateOptionsMenu(EpisodesApplyActionFragment.this.getActivity());
|
||||
showSpeedDialIfAnyChecked();
|
||||
|
||||
ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
String title = checkedIds.size() > 0 ? checkedIds.size() + " selected" : ""; // TODO: restore to the original title
|
||||
actionBar.setTitle(title);
|
||||
}
|
||||
}
|
||||
|
||||
private void queueChecked() {
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bottomBar"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="68dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
|
@ -97,7 +99,25 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<com.leinardi.android.speeddial.SpeedDialOverlayLayout
|
||||
android:id="@+id/fabSDOverlay"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
<com.leinardi.android.speeddial.SpeedDialView
|
||||
android:id="@+id/fabSD"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:sdMainFabClosedSrc="@drawable/ic_fab_edit"
|
||||
app:sdOverlayLayout="@id/fabSDOverlay"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
/>
|
||||
<View
|
||||
android:visibility="gone"
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
|
@ -110,6 +130,6 @@
|
|||
android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/divider"/>
|
||||
android:layout_alignParentTop="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Based on simple_list_item_multiple_choice.xml
|
||||
from The Android Open Source Project
|
||||
This one puts the check box at the start of the view (rather than at the end).
|
||||
-->
|
||||
<!-- Copyright (C) 2008 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/text1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeightSmall"
|
||||
android:textAppearance="?android:attr/textAppearanceListItemSmall"
|
||||
android:gravity="center_vertical"
|
||||
android:drawableStart="?android:attr/listChoiceIndicatorMultiple"
|
||||
android:drawableLeft="?android:attr/listChoiceIndicatorMultiple"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:paddingRight="?android:attr/listPreferredItemPaddingRight"
|
||||
/>
|
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/addToQueue"
|
||||
android:icon="?attr/content_new"
|
||||
android:title="@string/add_to_queue_label"
|
||||
/>
|
||||
<item android:id="@+id/remove_from_queue_item"
|
||||
android:icon="@drawable/ic_remove_grey600"
|
||||
android:title="@string/remove_from_queue_label"
|
||||
/>
|
||||
<item
|
||||
android:id="@+id/markAsPlayed"
|
||||
android:icon="?attr/navigation_accept"
|
||||
android:title="@string/mark_read_label"
|
||||
/>
|
||||
<item android:id="@+id/markAsUnplayed"
|
||||
android:icon="?attr/navigation_cancel"
|
||||
android:title="@string/mark_unread_label"
|
||||
/>
|
||||
<item android:id="@+id/download"
|
||||
android:icon="?attr/av_download"
|
||||
android:title="@string/download_label"
|
||||
/>
|
||||
<item android:id="@+id/delete"
|
||||
android:icon="?attr/content_discard"
|
||||
android:title="@string/remove_episode_lable"
|
||||
/>
|
||||
</menu>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FFFFFFFF" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
||||
</vector>
|
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF757575" android:pathData="M19,13H5v-2h14v2z"/>
|
||||
</vector>
|
Loading…
Reference in New Issue