书籍长按菜单重做

pull/5/head
fengyuecanzhu 4 years ago
parent 8b30c0a72b
commit 233ab6d229
  1. 9
      app/src/main/java/xyz/fycz/myreader/ui/adapter/BookcaseAdapter.java
  2. 2
      app/src/main/java/xyz/fycz/myreader/ui/presenter/BookcasePresenter.java
  3. 1
      app/src/main/java/xyz/fycz/myreader/util/help/JsExtensions.java
  4. 1163
      app/src/main/java/xyz/fycz/myreader/widget/SwitchButton.java
  5. 10
      app/src/main/res/drawable/ic_top.xml
  6. 15
      app/src/main/res/layout/menu_book.xml
  7. 6
      app/src/main/res/layout/menu_book_local.xml
  8. 28
      app/src/main/res/values/styles.xml

@ -52,6 +52,7 @@ import xyz.fycz.myreader.util.utils.ShareBookUtil;
import xyz.fycz.myreader.webapi.crawler.ReadCrawlerUtil;
import xyz.fycz.myreader.webapi.crawler.base.ReadCrawler;
import xyz.fycz.myreader.widget.CoverImageView;
import xyz.fycz.myreader.widget.SwitchButton;
import xyz.fycz.myreader.widget.custom.DragAdapter;
import xyz.fycz.myreader.greendao.entity.Book;
import xyz.fycz.myreader.greendao.entity.Chapter;
@ -397,7 +398,7 @@ public abstract class BookcaseAdapter extends RecyclerView.Adapter<BookcaseAdapt
private TextView tvBookName;
private TextView tvBookAuthor;
private TextView tvTop;
private SwitchCompat scIsUpdate;
private SwitchButton sbIsUpdate;
private TextView tvDownload;
private TextView tvExport;
private TextView tvChangeSource;
@ -425,7 +426,7 @@ public abstract class BookcaseAdapter extends RecyclerView.Adapter<BookcaseAdapt
}
private void bindView(View v) {
scIsUpdate = v.findViewById(R.id.sc_is_update);
sbIsUpdate = v.findViewById(R.id.sb_is_update);
tvDownload = v.findViewById(R.id.tv_download);
tvExport = v.findViewById(R.id.tv_export_cathe);
tvChangeSource = v.findViewById(R.id.tv_change_source);
@ -437,8 +438,8 @@ public abstract class BookcaseAdapter extends RecyclerView.Adapter<BookcaseAdapt
}
private void bindEvent() {
scIsUpdate.setChecked(!mBook.getIsCloseUpdate());
scIsUpdate.setOnCheckedChangeListener((buttonView, isChecked) -> {
sbIsUpdate.setChecked(!mBook.getIsCloseUpdate());
sbIsUpdate.setOnCheckedChangeListener((buttonView, isChecked) -> {
mBook.setIsCloseUpdate(!mBook.getIsCloseUpdate());
mBookService.updateEntity(mBook);
});

@ -696,7 +696,7 @@ public class BookcasePresenter implements BasePresenter {
@Override
public void addGroup() {
mBookcaseFragment.getmBtnAddGroup().performClick();
BookcasePresenter.this.addGroup(book);
}
});
}

@ -33,7 +33,6 @@ import xyz.fycz.myreader.util.utils.OkHttpUtils;
import xyz.fycz.myreader.util.utils.StringUtils;
@Keep
@SuppressWarnings({"unused"})
public interface JsExtensions {
String TAG = JsExtensions.class.getSimpleName();

File diff suppressed because it is too large Load Diff

@ -4,12 +4,6 @@
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#FF000000"
android:pathData="M192,106.67m32,0l576,0q32,0 32,32l0,0q0,32 -32,32l-576,0q-32,0 -32,-32l0,0q0,-32 32,-32Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M544,248.36m0,32l0,576q0,32 -32,32l0,0q-32,0 -32,-32l0,-576q0,-32 32,-32l0,0q32,0 32,32Z"/>
<path
android:fillColor="#FF000000"
android:pathData="M489.39,251.56a32,32 0,0 1,41.64 -3.07l3.58,3.07 232.32,232.32a32,32 0,0 1,-41.69 48.34l-3.58,-3.11L512,319.45l-209.66,209.66a32,32 0,0 1,-41.69 3.11l-3.58,-3.11a32,32 0,0 1,-3.07 -41.64l3.07,-3.58 232.32,-232.32z"/>
android:pathData="M855.87,106.43a42.46,42.46 0,0 1,-42.46 42.46L203.44,148.9a42.46,42.46 0,0 1,0 -84.93h609.97a42.46,42.46 0,0 1,42.46 42.46zM511.82,264.35a42.46,42.46 0,0 0,-42.46 42.46v609.97a42.46,42.46 0,0 0,84.93 0L554.29,306.82a42.46,42.46 0,0 0,-42.46 -42.46zM541.97,233.02c-16.59,-16.58 -42.53,-17.54 -57.92,-2.13L171.23,543.68c-15.41,15.41 -14.45,41.34 2.13,57.92 16.59,16.59 42.51,17.54 57.92,2.13l312.8,-312.78c15.39,-15.41 14.45,-41.34 -2.13,-57.92zM481.7,233.02c-16.58,16.58 -17.54,42.51 -2.13,57.92l312.8,312.8c15.39,15.39 41.33,14.45 57.92,-2.14 16.58,-16.58 17.52,-42.51 2.11,-57.92L539.62,230.9c-15.41,-15.41 -41.34,-14.45 -57.92,2.13z"
android:fillColor="#000000"/>
</vector>

@ -4,15 +4,15 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="10dp"
android:paddingHorizontal="10dp">
android:layout_marginBottom="15dp"
android:paddingHorizontal="15dp">
<RelativeLayout
android:id="@+id/rl_book_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingVertical="5dp">
android:paddingVertical="10dp">
<LinearLayout
android:id="@+id/ll_book_item"
@ -99,10 +99,11 @@
android:layout_weight="1"
android:orientation="vertical">
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/sc_is_update"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<xyz.fycz.myreader.widget.SwitchButton
android:id="@+id/sb_is_update"
android:layout_width="48dp"
android:layout_height="28dp"
app:sb_checked_color="@color/colorAccent"
android:layout_gravity="center_horizontal" />
<TextView

@ -4,15 +4,15 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="10dp"
android:paddingHorizontal="10dp">
android:layout_marginBottom="15dp"
android:paddingHorizontal="15dp">
<RelativeLayout
android:id="@+id/rl_book_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingVertical="5dp">
android:paddingVertical="10dp">
<LinearLayout
android:id="@+id/ll_book_item"

@ -238,4 +238,32 @@
<item name="android:textColor">@color/textPrimary</item>
<item name="android:textSize">@dimen/text_small_size</item>
</style>
<!-- SwitchButton -->
<declare-styleable name="SwitchButton">
<attr name="sb_shadow_radius" format="reference|dimension"/>
<attr name="sb_shadow_offset" format="reference|dimension"/>
<attr name="sb_shadow_color" format="reference|color"/>
<attr name="sb_uncheck_color" format="reference|color"/>
<attr name="sb_checked_color" format="reference|color"/>
<attr name="sb_border_width" format="reference|dimension"/>
<attr name="sb_checkline_color" format="reference|color"/>
<attr name="sb_checkline_width" format="reference|dimension"/>
<attr name="sb_uncheckcircle_color" format="reference|color"/>
<attr name="sb_uncheckcircle_width" format="reference|dimension"/>
<attr name="sb_uncheckcircle_radius" format="reference|dimension"/>
<attr name="sb_checked" format="reference|boolean"/>
<attr name="sb_shadow_effect" format="reference|boolean"/>
<attr name="sb_effect_duration" format="reference|integer"/>
<attr name="sb_button_color" format="reference|color"/>
<attr name="sb_show_indicator" format="reference|boolean"/>
<attr name="sb_background" format="reference|color"/>
<attr name="sb_enable_effect" format="reference|boolean"/>
<attr name="sb_checkedbutton_color" format="reference|color"/>
<attr name="sb_uncheckbutton_color" format="reference|color"/>
</declare-styleable>
</resources>

Loading…
Cancel
Save