Filter settings refactored
This commit is contained in:
10 files changed
+175
-312
No files matched your search
@@ -23,7 +23,8 @@
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="28" />
|
||||
android:maxSdkVersion="28"
|
||||
tools:ignore="ScopedStorage" />
|
||||
|
||||
<uses-feature
|
||||
android:glEsVersion="0x00020000"
|
||||
@@ -146,11 +147,6 @@
|
||||
android:label="@string/settings"
|
||||
android:theme="@style/AppTheme.Toolbar" />
|
||||
|
||||
<activity
|
||||
android:name="com.hippo.ehviewer.ui.FilterActivity"
|
||||
android:configChanges="screenSize|uiMode"
|
||||
android:label="@string/filter"
|
||||
android:theme="@style/AppTheme.Toolbar" />
|
||||
<activity
|
||||
android:name="com.hippo.ehviewer.ui.UConfigActivity"
|
||||
android:configChanges="screenSize|uiMode"
|
||||
|
||||
+99
-105
@@ -1,27 +1,12 @@
|
||||
/*
|
||||
* Copyright 2016 Hippo Seven
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.hippo.ehviewer.ui;
|
||||
package com.hippo.ehviewer.ui.fragment;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -30,27 +15,34 @@ import android.widget.ImageView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.recyclerview.widget.DefaultItemAnimator;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.google.android.material.checkbox.MaterialCheckBox;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
import com.hippo.android.resource.AttrResources;
|
||||
import com.hippo.easyrecyclerview.EasyRecyclerView;
|
||||
import com.hippo.easyrecyclerview.LinearDividerItemDecoration;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.client.EhFilter;
|
||||
import com.hippo.ehviewer.dao.Filter;
|
||||
import com.hippo.util.DrawableManager;
|
||||
import com.hippo.view.ViewTransition;
|
||||
import com.hippo.yorozuya.LayoutUtils;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FilterActivity extends ToolbarActivity {
|
||||
public class FilterFragment extends Fragment {
|
||||
|
||||
@Nullable
|
||||
private EasyRecyclerView mRecyclerView;
|
||||
@Nullable
|
||||
private ViewTransition mViewTransition;
|
||||
@Nullable
|
||||
@@ -59,30 +51,59 @@ public class FilterActivity extends ToolbarActivity {
|
||||
private FilterList mFilterList;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_filter);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.activity_filter, container, false);
|
||||
setTitle(R.string.filter);
|
||||
setNavigationIcon(R.drawable.v_arrow_left_dark_x24);
|
||||
|
||||
mFilterList = new FilterList();
|
||||
|
||||
mRecyclerView = (EasyRecyclerView) ViewUtils.$$(this, R.id.recycler_view);
|
||||
TextView tip = (TextView) ViewUtils.$$(this, R.id.tip);
|
||||
mViewTransition = new ViewTransition(mRecyclerView, tip);
|
||||
RecyclerView recyclerView = (EasyRecyclerView) ViewUtils.$$(view, R.id.recycler_view);
|
||||
TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
|
||||
mViewTransition = new ViewTransition(recyclerView, tip);
|
||||
FloatingActionButton fab = view.findViewById(R.id.fab);
|
||||
|
||||
Drawable drawable = DrawableManager.getVectorDrawable(this, R.drawable.big_filter);
|
||||
Drawable drawable = DrawableManager.getVectorDrawable(requireActivity(), R.drawable.big_filter);
|
||||
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
||||
tip.setCompoundDrawables(null, drawable, null, null);
|
||||
|
||||
mAdapter = new FilterAdapter();
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mRecyclerView.setClipToPadding(false);
|
||||
mRecyclerView.setClipChildren(false);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
mRecyclerView.hasFixedSize();
|
||||
mRecyclerView.setItemAnimator(null);
|
||||
mAdapter.setHasStableIds(true);
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
recyclerView.setClipToPadding(false);
|
||||
recyclerView.setClipChildren(false);
|
||||
LinearDividerItemDecoration decoration = new LinearDividerItemDecoration(
|
||||
LinearDividerItemDecoration.VERTICAL,
|
||||
AttrResources.getAttrColor(requireActivity(), R.attr.dividerColor),
|
||||
LayoutUtils.dp2pix(requireActivity(), 1));
|
||||
decoration.setShowLastDivider(true);
|
||||
recyclerView.addItemDecoration(decoration);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||
recyclerView.setHasFixedSize(true);
|
||||
DefaultItemAnimator defaultItemAnimator = (DefaultItemAnimator) recyclerView.getItemAnimator();
|
||||
if (defaultItemAnimator != null) {
|
||||
defaultItemAnimator.setSupportsChangeAnimations(false);
|
||||
}
|
||||
recyclerView.setPadding(
|
||||
recyclerView.getPaddingLeft(),
|
||||
recyclerView.getPaddingTop(),
|
||||
recyclerView.getPaddingRight(),
|
||||
recyclerView.getPaddingBottom() + getResources().getDimensionPixelOffset(R.dimen.gallery_padding_bottom_fab));
|
||||
|
||||
fab.setOnClickListener(v -> showAddFilterDialog());
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
updateView(false);
|
||||
}
|
||||
|
||||
@@ -99,48 +120,40 @@ public class FilterActivity extends ToolbarActivity {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
mRecyclerView = null;
|
||||
mViewTransition = null;
|
||||
mAdapter = null;
|
||||
mFilterList = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
super.onCreateOptionsMenu(menu);
|
||||
getMenuInflater().inflate(R.menu.activity_filter, menu);
|
||||
return true;
|
||||
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
inflater.inflate(R.menu.activity_filter, menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
case R.id.action_add:
|
||||
showAddFilterDialog();
|
||||
return true;
|
||||
case R.id.action_tip:
|
||||
showTipDialog();
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == R.id.action_tip) {
|
||||
showTipDialog();
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void showTipDialog() {
|
||||
new MaterialAlertDialogBuilder(this)
|
||||
new MaterialAlertDialogBuilder(requireActivity())
|
||||
.setTitle(R.string.filter)
|
||||
.setMessage(R.string.filter_tip)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
private void showAddFilterDialog() {
|
||||
AlertDialog dialog = new MaterialAlertDialogBuilder(this)
|
||||
AlertDialog dialog = new MaterialAlertDialogBuilder(requireActivity())
|
||||
.setTitle(R.string.add_filter)
|
||||
.setView(R.layout.dialog_add_filter)
|
||||
.setPositiveButton(R.string.add, null)
|
||||
@@ -152,7 +165,7 @@ public class FilterActivity extends ToolbarActivity {
|
||||
|
||||
private void showDeleteFilterDialog(final Filter filter) {
|
||||
String message = getString(R.string.delete_filter, filter.text);
|
||||
new MaterialAlertDialogBuilder(this)
|
||||
new MaterialAlertDialogBuilder(requireActivity())
|
||||
.setMessage(message)
|
||||
.setPositiveButton(R.string.delete, (dialog, which) -> {
|
||||
if (DialogInterface.BUTTON_POSITIVE != which || null == mFilterList) {
|
||||
@@ -224,41 +237,17 @@ public class FilterActivity extends ToolbarActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private class FilterHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
private static class FilterHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private final MaterialCheckBox checkbox;
|
||||
private final TextView text;
|
||||
private final ImageView icon;
|
||||
private final ImageView delete;
|
||||
|
||||
public FilterHolder(View itemView) {
|
||||
super(itemView);
|
||||
text = (TextView) ViewUtils.$$(itemView, R.id.text);
|
||||
icon = itemView.findViewById(R.id.icon);
|
||||
|
||||
if (null != icon) {
|
||||
icon.setOnClickListener(this);
|
||||
}
|
||||
// click on the filter text to enable/disable it
|
||||
text.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int position = getAdapterPosition();
|
||||
if (position < 0 || null == mFilterList) {
|
||||
return;
|
||||
}
|
||||
Filter filter = mFilterList.get(position);
|
||||
if (FilterList.MODE_HEADER != filter.mode) {
|
||||
if (v instanceof ImageView) {
|
||||
showDeleteFilterDialog(filter);
|
||||
} else if (v instanceof TextView) {
|
||||
mFilterList.trigger(filter);
|
||||
|
||||
//for updating delete line on filter text
|
||||
mAdapter.notifyItemChanged(getAdapterPosition());
|
||||
}
|
||||
|
||||
}
|
||||
checkbox = itemView.findViewById(R.id.checkbox);
|
||||
text = itemView.findViewById(R.id.text);
|
||||
delete = itemView.findViewById(R.id.delete);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,8 +269,9 @@ public class FilterActivity extends ToolbarActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public FilterHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
public FilterHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
int layoutId;
|
||||
switch (viewType) {
|
||||
default:
|
||||
@@ -293,18 +283,11 @@ public class FilterActivity extends ToolbarActivity {
|
||||
break;
|
||||
}
|
||||
|
||||
FilterHolder holder = new FilterHolder(getLayoutInflater().inflate(layoutId, parent, false));
|
||||
|
||||
if (R.layout.item_filter == layoutId) {
|
||||
holder.icon.setImageDrawable(
|
||||
DrawableManager.getVectorDrawable(FilterActivity.this, R.drawable.v_delete_x24));
|
||||
}
|
||||
|
||||
return holder;
|
||||
return new FilterHolder(getLayoutInflater().inflate(layoutId, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(FilterHolder holder, int position) {
|
||||
public void onBindViewHolder(@NonNull FilterHolder holder, int position) {
|
||||
if (null == mFilterList) {
|
||||
return;
|
||||
}
|
||||
@@ -313,13 +296,17 @@ public class FilterActivity extends ToolbarActivity {
|
||||
if (FilterList.MODE_HEADER == filter.mode) {
|
||||
holder.text.setText(filter.text);
|
||||
} else {
|
||||
holder.text.setText(filter.text);
|
||||
// add a delete line if the filter is disabled
|
||||
if (!filter.enable) {
|
||||
holder.text.setPaintFlags(holder.text.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
|
||||
} else {
|
||||
holder.text.setPaintFlags(holder.text.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
|
||||
}
|
||||
holder.checkbox.setText(filter.text);
|
||||
holder.checkbox.setChecked(filter.enable);
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
mFilterList.trigger(filter);
|
||||
|
||||
//for updating delete line on filter text
|
||||
if (mAdapter != null) {
|
||||
mAdapter.notifyItemChanged(position);
|
||||
}
|
||||
});
|
||||
holder.delete.setOnClickListener(v -> showDeleteFilterDialog(filter));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,6 +314,11 @@ public class FilterActivity extends ToolbarActivity {
|
||||
public int getItemCount() {
|
||||
return null != mFilterList ? mFilterList.size() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return null != mFilterList ? mFilterList.get(position).text.hashCode() : 0;
|
||||
}
|
||||
}
|
||||
|
||||
private class FilterList {
|
||||
@@ -441,8 +433,6 @@ public class FilterActivity extends ToolbarActivity {
|
||||
return getTagNamespaceHeader();
|
||||
} else if (index <= size) {
|
||||
return mTagNamespaceFilterList.get(index - 1);
|
||||
} else {
|
||||
index -= size + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,4 +451,8 @@ public class FilterActivity extends ToolbarActivity {
|
||||
mEhFilter.triggerFilter(filter);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTitle(@StringRes int string) {
|
||||
requireActivity().setTitle(string);
|
||||
}
|
||||
}
|
||||
@@ -22,12 +22,13 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
import com.hippo.android.resource.AttrResources;
|
||||
import com.hippo.easyrecyclerview.EasyRecyclerView;
|
||||
import com.hippo.easyrecyclerview.LinearDividerItemDecoration;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.Hosts;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.view.ViewTransition;
|
||||
import com.hippo.yorozuya.LayoutUtils;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -44,8 +45,7 @@ public class HostsFragment extends Fragment
|
||||
private Hosts hosts;
|
||||
private List<Pair<String, String>> data;
|
||||
|
||||
private EasyRecyclerView recyclerView;
|
||||
private View tip;
|
||||
private ViewTransition mViewTransition;
|
||||
private HostsAdapter adapter;
|
||||
|
||||
@Override
|
||||
@@ -61,8 +61,9 @@ public class HostsFragment extends Fragment
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.activity_hosts, container, false);
|
||||
setTitle(R.string.hosts);
|
||||
recyclerView = view.findViewById(R.id.recycler_view);
|
||||
tip = view.findViewById(R.id.tip);
|
||||
RecyclerView recyclerView = view.findViewById(R.id.recycler_view);
|
||||
TextView tip = (TextView) ViewUtils.$$(view, R.id.tip);
|
||||
mViewTransition = new ViewTransition(recyclerView, tip);
|
||||
FloatingActionButton fab = view.findViewById(R.id.fab);
|
||||
|
||||
adapter = new HostsAdapter();
|
||||
@@ -83,12 +84,17 @@ public class HostsFragment extends Fragment
|
||||
|
||||
fab.setOnClickListener(this);
|
||||
|
||||
recyclerView.setVisibility(data.isEmpty() ? View.GONE : View.VISIBLE);
|
||||
tip.setVisibility(data.isEmpty() ? View.VISIBLE : View.GONE);
|
||||
updateView(false);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
updateView(false);
|
||||
}
|
||||
|
||||
public boolean onItemClick(int position) {
|
||||
Pair<String, String> pair = data.get(position);
|
||||
Bundle args = new Bundle();
|
||||
@@ -107,10 +113,17 @@ public class HostsFragment extends Fragment
|
||||
new AddHostDialogFragment().show(getChildFragmentManager(), DIALOG_TAG_ADD_HOST);
|
||||
}
|
||||
|
||||
private void notifyHostsChanges() {
|
||||
private void updateView(boolean animation) {
|
||||
if (null == mViewTransition) {
|
||||
return;
|
||||
}
|
||||
|
||||
data = hosts.getAll();
|
||||
recyclerView.setVisibility(data.isEmpty() ? View.GONE : View.VISIBLE);
|
||||
tip.setVisibility(data.isEmpty() ? View.VISIBLE : View.GONE);
|
||||
if (data.isEmpty()) {
|
||||
mViewTransition.showView(1, animation);
|
||||
} else {
|
||||
mViewTransition.showView(0, animation);
|
||||
}
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@@ -172,7 +185,7 @@ public class HostsFragment extends Fragment
|
||||
}
|
||||
|
||||
hostsFragment.hosts.put(hostString, ipString);
|
||||
hostsFragment.notifyHostsChanges();
|
||||
hostsFragment.updateView(true);
|
||||
|
||||
dialog.dismiss();
|
||||
}
|
||||
@@ -185,7 +198,7 @@ public class HostsFragment extends Fragment
|
||||
String hostString = host.getText().toString().trim().toLowerCase(Locale.US);
|
||||
|
||||
hostsFragment.hosts.delete(hostString);
|
||||
hostsFragment.notifyHostsChanges();
|
||||
hostsFragment.updateView(true);
|
||||
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
<com.hippo.easyrecyclerview.EasyRecyclerView
|
||||
android:id="@+id/recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/keyline_margin" />
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tip"
|
||||
@@ -34,4 +33,22 @@
|
||||
android:gravity="center_horizontal"
|
||||
android:text="@string/no_filter" />
|
||||
|
||||
<com.hippo.widget.FabLayout
|
||||
android:id="@+id/fab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingRight="@dimen/corner_fab_margin"
|
||||
android:paddingBottom="@dimen/corner_fab_margin">
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/fab"
|
||||
style="@style/Widget.MaterialComponents.FloatingActionButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:backgroundTint="?attr/widgetColorThemePrimary"
|
||||
app:srcCompat="@drawable/v_plus_dark_x24"
|
||||
app:tint="#fff" />
|
||||
|
||||
</com.hippo.widget.FabLayout>
|
||||
|
||||
</FrameLayout>
|
||||
@@ -1,69 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright 2018 Hippo Seven
|
||||
~
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false">
|
||||
|
||||
<com.hippo.widget.ShadowLinearLayout
|
||||
android:id="@+id/swipe_handler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/contentColorPrimary"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/delete"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
app:srcCompat="@drawable/v_delete_x24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/text_little_small" />
|
||||
|
||||
<ImageView xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/drag_handler"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
app:srcCompat="@drawable/v_reorder_x24" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
</com.hippo.widget.ShadowLinearLayout>
|
||||
</FrameLayout>
|
||||
@@ -17,45 +17,32 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false">
|
||||
android:background="?selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:paddingHorizontal="@dimen/keyline_margin">
|
||||
|
||||
<com.hippo.widget.ShadowLinearLayout
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:id="@+id/checkbox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/contentColorPrimary"
|
||||
android:orientation="vertical">
|
||||
android:background="@android:color/transparent"
|
||||
android:clickable="false"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:focusable="false"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="24dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
app:srcCompat="@drawable/v_copy_x24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/text_little_small" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
</com.hippo.widget.ShadowLinearLayout>
|
||||
</FrameLayout>
|
||||
<ImageView xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/delete"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:padding="4dp"
|
||||
android:layout_gravity="end|center_vertical"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:clickable="true"
|
||||
android:contentDescription="@string/delete"
|
||||
android:focusable="true"
|
||||
app:srcCompat="@drawable/v_delete_x24" />
|
||||
</FrameLayout>
|
||||
@@ -19,6 +19,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="8dp"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Title"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
android:paddingHorizontal="16dp"
|
||||
android:paddingVertical="8dp"
|
||||
android:textAppearance="@style/TextAppearance.MaterialComponents.Headline6" />
|
||||
@@ -1,69 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ Copyright 2018 Hippo Seven
|
||||
~
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false">
|
||||
|
||||
<com.hippo.widget.ShadowLinearLayout
|
||||
android:id="@+id/swipe_handler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/contentColorPrimary"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/delete"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
app:srcCompat="@drawable/v_delete_x24" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/text_little_small" />
|
||||
|
||||
<ImageView xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/drag_handler"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
app:srcCompat="@drawable/v_reorder_x24" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dividerColor" />
|
||||
|
||||
</com.hippo.widget.ShadowLinearLayout>
|
||||
</FrameLayout>
|
||||
@@ -17,12 +17,6 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_add"
|
||||
android:icon="@drawable/v_plus_dark_x24"
|
||||
android:title="@string/add"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_tip"
|
||||
android:icon="@drawable/v_info_outline_dark_x24"
|
||||
|
||||
@@ -144,11 +144,11 @@
|
||||
app:iconSpaceReserved="false"
|
||||
app:url="@string/settings_eh_tag_translations_source_url" />
|
||||
|
||||
<com.hippo.preference.ActivityPreference
|
||||
<Preference
|
||||
android:key="filter"
|
||||
android:summary="@string/settings_eh_filter_summary"
|
||||
android:title="@string/settings_eh_filter"
|
||||
app:activity="com.hippo.ehviewer.ui.FilterActivity"
|
||||
android:fragment="com.hippo.ehviewer.ui.fragment.FilterFragment"
|
||||
app:iconSpaceReserved="false" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
|
||||
Reference in new issue
Block a user