使用 L 风格 Dialog
No files matched your search
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 960 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 935 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 874 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 876 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 921 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 826 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 888 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 866 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 854 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 851 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 822 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 822 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 943 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 861 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 749 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 688 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 948 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 934 B After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2014 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.
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="false" android:state_checked="true">
|
||||
<bitmap android:src="@drawable/btn_radio_on_disabled" />
|
||||
</item>
|
||||
<item android:state_enabled="false">
|
||||
<bitmap android:src="@drawable/btn_radio_off_disabled" />
|
||||
</item>
|
||||
<item android:state_checked="true">
|
||||
<bitmap android:src="@drawable/btn_radio_to_on_mtrl_015" />
|
||||
</item>
|
||||
<item>
|
||||
<bitmap android:src="@drawable/btn_radio_to_off_mtrl_015" />
|
||||
</item>
|
||||
</selector>
|
||||
@@ -14,7 +14,10 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ListView
|
||||
android:id="@+id/list"
|
||||
@@ -33,4 +36,4 @@
|
||||
android:checked="false"
|
||||
android:text="@string/set_default_favorite" />
|
||||
|
||||
</merge>
|
||||
</LinearLayout>
|
||||
@@ -55,8 +55,7 @@
|
||||
<com.hippo.ehviewer.widget.NonScrollableListView
|
||||
android:id="@+id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:isScrollContainer="false" />
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
style="@style/SearchCategory"
|
||||
android:layout_width="0.0dp"
|
||||
android:layout_marginRight="6.0dp"
|
||||
android:background="@color/doujinshi_bg"
|
||||
android:textColor="@color/doujinshi_bg"
|
||||
android:text="@string/doujinshi" />
|
||||
|
||||
<com.hippo.ehviewer.widget.CheckTextView
|
||||
@@ -31,7 +31,7 @@
|
||||
style="@style/SearchCategory"
|
||||
android:layout_width="0.0dp"
|
||||
android:layout_marginLeft="6.0dp"
|
||||
android:background="@color/manga_bg"
|
||||
android:textColor="@color/manga_bg"
|
||||
android:text="@string/manga" />
|
||||
</TableRow>
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
style="@style/SearchCategory"
|
||||
android:layout_width="0.0dp"
|
||||
android:layout_marginRight="6.0dp"
|
||||
android:background="@color/artist_cg_bg"
|
||||
android:textColor="@color/artist_cg_bg"
|
||||
android:text="@string/artist_cg" />
|
||||
|
||||
<com.hippo.ehviewer.widget.CheckTextView
|
||||
@@ -50,7 +50,7 @@
|
||||
style="@style/SearchCategory"
|
||||
android:layout_width="0.0dp"
|
||||
android:layout_marginLeft="6.0dp"
|
||||
android:background="@color/game_cg_bg"
|
||||
android:textColor="@color/game_cg_bg"
|
||||
android:text="@string/game_cg" />
|
||||
</TableRow>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
style="@style/SearchCategory"
|
||||
android:layout_width="0.0dp"
|
||||
android:layout_marginRight="6.0dp"
|
||||
android:background="@color/western_bg"
|
||||
android:textColor="@color/western_bg"
|
||||
android:text="@string/western" />
|
||||
|
||||
<com.hippo.ehviewer.widget.CheckTextView
|
||||
@@ -69,7 +69,7 @@
|
||||
style="@style/SearchCategory"
|
||||
android:layout_width="0.0dp"
|
||||
android:layout_marginLeft="6.0dp"
|
||||
android:background="@color/non_h_bg"
|
||||
android:textColor="@color/non_h_bg"
|
||||
android:text="@string/non_h" />
|
||||
</TableRow>
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
style="@style/SearchCategory"
|
||||
android:layout_width="0.0dp"
|
||||
android:layout_marginRight="6.0dp"
|
||||
android:background="@color/image_set_bg"
|
||||
android:textColor="@color/image_set_bg"
|
||||
android:text="@string/image_set" />
|
||||
|
||||
<com.hippo.ehviewer.widget.CheckTextView
|
||||
@@ -88,7 +88,7 @@
|
||||
style="@style/SearchCategory"
|
||||
android:layout_width="0.0dp"
|
||||
android:layout_marginLeft="6.0dp"
|
||||
android:background="@color/cosplay_bg"
|
||||
android:textColor="@color/cosplay_bg"
|
||||
android:text="@string/cosplay" />
|
||||
</TableRow>
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
style="@style/SearchCategory"
|
||||
android:layout_width="0.0dp"
|
||||
android:layout_marginRight="6.0dp"
|
||||
android:background="@color/asian_porn_bg"
|
||||
android:textColor="@color/asian_porn_bg"
|
||||
android:text="@string/asian_porn" />
|
||||
|
||||
<com.hippo.ehviewer.widget.CheckTextView
|
||||
@@ -107,7 +107,7 @@
|
||||
style="@style/SearchCategory"
|
||||
android:layout_width="0.0dp"
|
||||
android:layout_marginLeft="6.0dp"
|
||||
android:background="@color/misc_bg"
|
||||
android:textColor="@color/misc_bg"
|
||||
android:text="@string/misc" />
|
||||
</TableRow>
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/list_jump_sum"
|
||||
android:textAppearance="@style/TextAppearance.DialogMessage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
@@ -35,6 +36,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/list_jump_to"
|
||||
android:textAppearance="@style/TextAppearance.DialogMessage"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp" />
|
||||
@@ -45,10 +47,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="number"
|
||||
android:singleLine="true" >
|
||||
android:singleLine="true"
|
||||
android:textSize="@dimen/text_little_large"
|
||||
android:textColor="@color/secondary_text_dark" />
|
||||
|
||||
<requestFocus />
|
||||
</EditText>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -25,9 +25,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="48dp"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="@dimen/text_little_large"
|
||||
android:textAppearance="@style/TextAppearance.DialogMessage"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="16dip"
|
||||
android:paddingEnd="16dip"
|
||||
android:paddingLeft="16dip"
|
||||
android:paddingRight="16dip"
|
||||
android:ellipsize="marquee" />
|
||||
@@ -19,11 +19,9 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="48dp"
|
||||
android:textColor="@color/primary_text_dark"
|
||||
android:textSize="@dimen/text_little_large"
|
||||
android:textAppearance="@style/TextAppearance.DialogMessage"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="12dip"
|
||||
android:paddingRight="7dip"
|
||||
android:checkMark="@drawable/btn_radio_material"
|
||||
android:ellipsize="marquee"
|
||||
/>
|
||||
android:checkMark="@drawable/btn_radio_dialog_material"
|
||||
android:ellipsize="marquee" />
|
||||
@@ -14,7 +14,10 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
@@ -28,6 +31,7 @@
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textAppearance="@style/TextAppearance.DialogMessage"
|
||||
android:text="@string/content" />
|
||||
|
||||
<Spinner
|
||||
@@ -52,6 +56,7 @@
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textAppearance="@style/TextAppearance.DialogMessage"
|
||||
android:text="@string/api" />
|
||||
|
||||
<Spinner
|
||||
@@ -76,6 +81,7 @@
|
||||
android:layout_weight="1"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:textAppearance="@style/TextAppearance.DialogMessage"
|
||||
android:text="@string/lofi_resolution" />
|
||||
|
||||
<Spinner
|
||||
@@ -87,4 +93,4 @@
|
||||
android:layout_gravity="center"
|
||||
android:entries="@array/lofi_resolution_list" />
|
||||
</LinearLayout>
|
||||
</merge>
|
||||
</LinearLayout>
|
||||
@@ -30,6 +30,7 @@
|
||||
android:layout_margin="12dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:textAppearance="@style/TextAppearance.DialogMessage"
|
||||
android:text="@string/portrait" />
|
||||
|
||||
<EditText
|
||||
@@ -38,6 +39,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="@dimen/text_little_large"
|
||||
android:textColor="@color/secondary_text_dark"
|
||||
android:inputType="number" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -52,6 +55,7 @@
|
||||
android:layout_margin="12dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:textAppearance="@style/TextAppearance.DialogMessage"
|
||||
android:text="@string/landscape" />
|
||||
|
||||
<EditText
|
||||
@@ -60,6 +64,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="12dp"
|
||||
android:layout_weight="1"
|
||||
android:textSize="@dimen/text_little_large"
|
||||
android:textColor="@color/secondary_text_dark"
|
||||
android:inputType="number" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -16,22 +16,23 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="12dp" >
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:textAppearance="@style/TextAppearance.DialogMessage"
|
||||
android:text="@string/tag_name" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/set_name_edit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="text"
|
||||
android:singleLine="true" >
|
||||
</EditText>
|
||||
android:singleLine="true"
|
||||
android:textSize="@dimen/text_little_large"
|
||||
android:textColor="@color/secondary_text_dark" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -81,4 +81,6 @@
|
||||
|
||||
<color name="material_progress_blue">#ff40c4ff</color>
|
||||
|
||||
<color name="edit_text_gb">#11000000</color>
|
||||
|
||||
</resources>
|
||||
@@ -55,6 +55,9 @@
|
||||
<item name="@android:textSize">@dimen/text_little_large</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.DropDownItem" parent="TextAppearance.DialogMessage">
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.SuperButton">
|
||||
<item name="@android:fontFamily">sans-serif-medium</item>
|
||||
<item name="@android:textAllCaps">true</item>
|
||||
@@ -181,8 +184,8 @@
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.SearchCategory">
|
||||
<item name="@android:textColor">@color/primary_text_light</item>
|
||||
<item name="android:textSize">@dimen/text_little_large</item>
|
||||
<item name="@android:textStyle">bold</item>
|
||||
<item name="@android:textSize">@dimen/text_little_large</item>
|
||||
<item name="@android:singleLine">true</item>
|
||||
</style>
|
||||
|
||||
@@ -212,4 +215,13 @@
|
||||
<item name="@android:gravity">center</item>
|
||||
</style>
|
||||
|
||||
<style name="DropDownItem" parent="@android:Widget.DropDownItem">
|
||||
<item name="android:textAppearance">@style/TextAppearance.DropDownItem</item>
|
||||
<item name="android:paddingLeft">8dp</item>
|
||||
<item name="android:paddingRight">8dp</item>
|
||||
</style>
|
||||
|
||||
<style name="DropDownItem.Spinner">
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -28,8 +28,12 @@
|
||||
<item name="@android:homeAsUpIndicator">@drawable/ic_ab_back</item>
|
||||
<item name="@android:windowActionBarOverlay">true</item>
|
||||
|
||||
<item name="@android:listChoiceIndicatorSingle">@drawable/btn_radio_material_anim</item>
|
||||
<!-- <item name="@android:listChoiceIndicatorSingle">@drawable/btn_radio_material_anim</item> -->
|
||||
<item name="@android:listChoiceIndicatorMultiple">@drawable/btn_check_material_anim</item>
|
||||
|
||||
<!-- spinner -->
|
||||
<item name="@android:spinnerDropDownItemStyle">@style/DropDownItem.Spinner</item>
|
||||
<item name="@android:spinnerItemStyle">@style/DropDownItem.Spinner</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Normal">
|
||||
|
||||
@@ -36,8 +36,7 @@
|
||||
<CheckBoxPreference
|
||||
android:key="gallery_show_clock"
|
||||
android:title="@string/gallery_show_clock_title"
|
||||
android:defaultValue="true"
|
||||
android:enabled="false" />
|
||||
android:defaultValue="true" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="gallery_show_battery"
|
||||
|
||||
@@ -19,6 +19,8 @@ package com.hippo.ehviewer.app;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
@@ -44,14 +46,15 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
private final Builder mBuilder;
|
||||
|
||||
private View mRootView;
|
||||
private TextView mTitle;
|
||||
private Button mActionButton;
|
||||
private Button mPositiveButton;
|
||||
private Button mNegativeButton;
|
||||
private Button mNeutralButton;
|
||||
|
||||
private MaterialAlertDialog(Builder builder) {
|
||||
super(builder.mContext);
|
||||
|
||||
//super(builder.mContext);
|
||||
super(new ContextThemeWrapper(builder.mContext, R.style.AppTheme_Main));
|
||||
mContext = builder.mContext;
|
||||
mBuilder = builder;
|
||||
|
||||
@@ -64,11 +67,11 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
R.layout.alert_dialog_material, null);
|
||||
|
||||
// Title
|
||||
TextView title = (TextView) mRootView.findViewById(R.id.title);
|
||||
mTitle = (TextView) mRootView.findViewById(R.id.title);
|
||||
if (mBuilder.mTitle == null)
|
||||
title.setVisibility(View.GONE);
|
||||
mTitle.setVisibility(View.GONE);
|
||||
else
|
||||
title.setText(mBuilder.mTitle);
|
||||
mTitle.setText(mBuilder.mTitle);
|
||||
|
||||
TextView message = (TextView) mRootView.findViewById(R.id.message);
|
||||
ListView list = (ListView) mRootView.findViewById(R.id.list);
|
||||
@@ -82,6 +85,7 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
lp = new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||
LinearLayout.LayoutParams.WRAP_CONTENT);
|
||||
mBuilder.mCustomView.setId(R.id.custom);
|
||||
topPanel.addView(mBuilder.mCustomView, lp);
|
||||
} else if (mBuilder.mAdapter != null) {
|
||||
// List
|
||||
@@ -154,6 +158,8 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
setView(mRootView);
|
||||
|
||||
setCancelable(mBuilder.mCancelable);
|
||||
if (mBuilder.mOnDismissListener != null)
|
||||
setOnDismissListener(mBuilder.mOnDismissListener);
|
||||
|
||||
// Try to keep title visible
|
||||
final ScrollView sv = ((ScrollView) mRootView.findViewById(R.id.scrollView));
|
||||
@@ -166,6 +172,16 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTitle(CharSequence title) {
|
||||
mTitle.setText(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTitle(int resId) {
|
||||
setTitle(getContext().getString(resId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean close = true;
|
||||
@@ -224,6 +240,8 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
private int mCheckedItem;
|
||||
private boolean mIsSingleChoice;
|
||||
|
||||
private DialogInterface.OnDismissListener mOnDismissListener;
|
||||
|
||||
public Builder(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
@@ -360,6 +378,11 @@ public class MaterialAlertDialog extends AlertDialog implements View.OnClickList
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setOnDismissListener(DialogInterface.OnDismissListener l) {
|
||||
mOnDismissListener = l;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MaterialAlertDialog create() {
|
||||
return new MaterialAlertDialog(this);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ public class EditTextPreference extends DialogPreference {
|
||||
protected View onCreateDialogView() {
|
||||
EditText et = new EditText(getContext());
|
||||
et.setId(R.id.edittextpreference_edittext);
|
||||
et.setTextColor(getContext().getResources().getColor(R.color.secondary_text_dark));
|
||||
return et;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.hippo.ehviewer.preference;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.util.AttributeSet;
|
||||
@@ -76,8 +77,9 @@ public class NumberOfColumnsPreference extends DialogPreference {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressLint("InflateParams")
|
||||
protected View onCreateDialogView() {
|
||||
LayoutInflater inflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
return inflater.inflate(R.layout.set_column_number, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@ import android.animation.ValueAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActionBar;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
@@ -38,7 +38,6 @@ import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.util.Log;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -85,9 +84,7 @@ import com.hippo.ehviewer.util.Favorite;
|
||||
import com.hippo.ehviewer.util.Theme;
|
||||
import com.hippo.ehviewer.util.Ui;
|
||||
import com.hippo.ehviewer.util.ViewUtils;
|
||||
import com.hippo.ehviewer.widget.AlertButton;
|
||||
import com.hippo.ehviewer.widget.AutoWrapLayout;
|
||||
import com.hippo.ehviewer.widget.DialogBuilder;
|
||||
import com.hippo.ehviewer.widget.LinkifyTextView;
|
||||
import com.hippo.ehviewer.widget.LoadImageView;
|
||||
import com.hippo.ehviewer.widget.MaterialProgress;
|
||||
@@ -170,8 +167,6 @@ public class GalleryDetailActivity extends AbsActivity
|
||||
private Drawable mRateDrawable;
|
||||
private Drawable mCheckmarkDrawable;
|
||||
|
||||
private Dialog mCommentLongClickDialog;
|
||||
|
||||
private CommentAdapter mCommentAdapter;
|
||||
|
||||
private int mThemeColor;
|
||||
@@ -179,12 +174,15 @@ public class GalleryDetailActivity extends AbsActivity
|
||||
private boolean mShowPreview = false;
|
||||
private boolean mGetPreview = false;
|
||||
|
||||
private String mOldReply;
|
||||
private boolean mReplyPositive;
|
||||
|
||||
private AlertDialog createGoToDialog() {
|
||||
CharSequence[] items = new CharSequence[((PreviewImpl)mGalleryInfo).getPreviewPageNum()];
|
||||
for (int i = 0; i < items.length; i++)
|
||||
items[i] = Integer.toString(i + 1);
|
||||
|
||||
Log.d(TAG, "items = " + items.length);
|
||||
// TODO too slow
|
||||
|
||||
return new MaterialAlertDialog.Builder(this).setTitle(R.string.jump)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
@@ -890,30 +888,54 @@ public class GalleryDetailActivity extends AbsActivity
|
||||
animation.start();
|
||||
mRunningAnimateNum++;
|
||||
} else if (v == mReply) {
|
||||
mReplyPositive = false;
|
||||
final EditText et = new EditText(this);
|
||||
et.setGravity(Gravity.TOP);
|
||||
et.setBackgroundDrawable(null);
|
||||
new DialogBuilder(this, mThemeColor).setTitle(R.string.reply).setView(et, new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT, 600), true).setSimpleNegativeButton()
|
||||
.setPositiveButton(android.R.string.ok, new View.OnClickListener() {
|
||||
et.setTextColor(getResources().getColor(R.color.secondary_text_dark));
|
||||
et.setBackgroundDrawable(new ColorDrawable(
|
||||
getResources().getColor(R.color.edit_text_gb)));
|
||||
et.setText(mOldReply);
|
||||
if (mOldReply != null)
|
||||
et.setSelection(mOldReply.length());
|
||||
|
||||
new MaterialAlertDialog.Builder(this).setTitle(R.string.reply)
|
||||
.setView(et, new LinearLayout.LayoutParams(
|
||||
LinearLayout.LayoutParams.MATCH_PARENT, 600))
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setPositiveButton(android.R.string.ok)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
mClient.comment(EhClient.getDetailUrl(mGalleryInfo.gid,
|
||||
mGalleryInfo.token, 0, Config.getApiMode()), et.getText().toString(),
|
||||
new EhClient.OnCommentListener() {
|
||||
@Override
|
||||
public void onSuccess(List<Comment> comments) {
|
||||
((GalleryDetail)mGalleryInfo).comments = comments;
|
||||
mCommentAdapter.notifyDataSetChanged();
|
||||
}
|
||||
@Override
|
||||
public void onFailure(String eMsg) {
|
||||
MaterialToast.showToast(eMsg);
|
||||
}
|
||||
});
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which) {
|
||||
if (which == MaterialAlertDialog.POSITIVE) {
|
||||
mReplyPositive = true;
|
||||
mClient.comment(EhClient.getDetailUrl(mGalleryInfo.gid,
|
||||
mGalleryInfo.token, 0, Config.getApiMode()), et.getText().toString(),
|
||||
new EhClient.OnCommentListener() {
|
||||
@Override
|
||||
public void onSuccess(List<Comment> comments) {
|
||||
((GalleryDetail)mGalleryInfo).comments = comments;
|
||||
mCommentAdapter.notifyDataSetChanged();
|
||||
mOldReply = null;
|
||||
}
|
||||
@Override
|
||||
public void onFailure(String eMsg) {
|
||||
MaterialToast.showToast(eMsg);
|
||||
mOldReply = et.getText().toString();
|
||||
}
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}).create().show();
|
||||
}).setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
if (mReplyPositive)
|
||||
mOldReply = null;
|
||||
else
|
||||
mOldReply = et.getText().toString();
|
||||
}
|
||||
}).show();
|
||||
|
||||
} else if (v == mPreviewPage) {
|
||||
if (mGalleryInfo instanceof PreviewImpl &&
|
||||
((PreviewImpl)mGalleryInfo).getPreviewPageNum() != Integer.MAX_VALUE &&
|
||||
@@ -1041,13 +1063,12 @@ public class GalleryDetailActivity extends AbsActivity
|
||||
public boolean onItemLongClick(AdapterView<?> parent, View view,
|
||||
int position, long id) {
|
||||
final Comment c = (Comment)parent.getItemAtPosition(position);
|
||||
mCommentLongClickDialog = new DialogBuilder(this, mThemeColor)
|
||||
.setTitle(R.string.what_to_do).setItems(R.array.comment_long_click,
|
||||
new AdapterView.OnItemClickListener() {
|
||||
|
||||
new MaterialAlertDialog.Builder(this).setTitle(R.string.what_to_do)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setItems(R.array.comment_long_click, new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view,
|
||||
int position, long id) {
|
||||
mCommentLongClickDialog.dismiss();
|
||||
public boolean onClick(MaterialAlertDialog dialog, int position) {
|
||||
switch (position) {
|
||||
case 0:
|
||||
ClipboardManager cm = (ClipboardManager)getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
@@ -1063,9 +1084,9 @@ public class GalleryDetailActivity extends AbsActivity
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}).setSimpleNegativeButton().create();
|
||||
mCommentLongClickDialog.show();
|
||||
}).show();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,6 @@ import com.hippo.ehviewer.util.Ui;
|
||||
import com.hippo.ehviewer.util.Utils;
|
||||
import com.hippo.ehviewer.widget.AlertButton;
|
||||
import com.hippo.ehviewer.widget.CategoryTable;
|
||||
import com.hippo.ehviewer.widget.DialogBuilder;
|
||||
import com.hippo.ehviewer.widget.LoadImageView;
|
||||
import com.hippo.ehviewer.widget.MaterialToast;
|
||||
import com.hippo.ehviewer.widget.RatingView;
|
||||
@@ -276,24 +275,32 @@ public class GalleryListActivity extends AbsGalleryActivity
|
||||
}).create();
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
private AlertDialog createModeDialog() {
|
||||
DialogBuilder db = new DialogBuilder(this);
|
||||
db.setTitle(R.string.mode).setView(R.layout.select_mode, true);
|
||||
LinearLayout customLayout = db.getCustomLayout();
|
||||
final Spinner modeSpinner = (Spinner)customLayout.findViewById(R.id.mode_list);
|
||||
|
||||
LayoutInflater inflater = (LayoutInflater) getSystemService(
|
||||
Context.LAYOUT_INFLATER_SERVICE);
|
||||
View cv = inflater.inflate(R.layout.select_mode, null);
|
||||
|
||||
final Spinner modeSpinner = (Spinner) cv.findViewById(R.id.mode_list);
|
||||
modeSpinner.setSelection(Config.getMode());
|
||||
final Spinner apiModeSpinner = (Spinner)customLayout.findViewById(R.id.api_mode_list);
|
||||
final Spinner apiModeSpinner = (Spinner) cv.findViewById(R.id.api_mode_list);
|
||||
apiModeSpinner.setSelection(Config.getApiMode());
|
||||
final Spinner lofiResolutionSpinner = (Spinner)customLayout.findViewById(R.id.lofi_resolution_list);
|
||||
final Spinner lofiResolutionSpinner = (Spinner) cv.findViewById(R.id.lofi_resolution_list);
|
||||
lofiResolutionSpinner.setSelection(Config.getLofiResolution() - 1);
|
||||
return db.setSimpleNegativeButton()
|
||||
.setPositiveButton(android.R.string.ok, new View.OnClickListener() {
|
||||
|
||||
return new MaterialAlertDialog.Builder(this).setTitle(R.string.mode)
|
||||
.setView(cv).setPositiveButton(android.R.string.ok)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
Config.setMode(modeSpinner.getSelectedItemPosition());
|
||||
Config.setApiMode(apiModeSpinner.getSelectedItemPosition());
|
||||
Config.setLofiResolution(lofiResolutionSpinner.getSelectedItemPosition() + 1);
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which) {
|
||||
if (which == MaterialAlertDialog.POSITIVE) {
|
||||
Config.setMode(modeSpinner.getSelectedItemPosition());
|
||||
Config.setApiMode(apiModeSpinner.getSelectedItemPosition());
|
||||
Config.setLofiResolution(lofiResolutionSpinner.getSelectedItemPosition() + 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}).create();
|
||||
}
|
||||
@@ -372,74 +379,78 @@ public class GalleryListActivity extends AbsGalleryActivity
|
||||
mSearchImageText = (TextView)view.findViewById(R.id.target_image);
|
||||
handleSearchView(view);
|
||||
|
||||
return new DialogBuilder(this).setTitle(android.R.string.search_go)
|
||||
.setView(view, false)
|
||||
.setAction(new View.OnClickListener() {
|
||||
return new MaterialAlertDialog.Builder(this).setTitle(android.R.string.search_go)
|
||||
.setView(view).setActionButton(R.string.mode)
|
||||
.setPositiveButton(android.R.string.ok)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setNeutralButton(R.string.add)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (searchNormal.getVisibility() == View.VISIBLE) {
|
||||
searchNormal.setVisibility(View.GONE);
|
||||
searchTag.setVisibility(View.VISIBLE);
|
||||
} else if (searchTag.getVisibility() == View.VISIBLE) {
|
||||
searchTag.setVisibility(View.GONE);
|
||||
searchImage.setVisibility(View.VISIBLE);
|
||||
} else if (searchImage.getVisibility() == View.VISIBLE) {
|
||||
searchImage.setVisibility(View.GONE);
|
||||
searchNormal.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}).setPositiveButton(android.R.string.ok, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ListUrls listUrls = getLus(mSearchDialog);
|
||||
if (listUrls == null)
|
||||
return;
|
||||
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
lus = listUrls;
|
||||
refresh();
|
||||
showContent();
|
||||
|
||||
// Get title
|
||||
String search = lus.getSearch();
|
||||
switch(lus.getMode()) {
|
||||
case ListUrls.MODE_IMAGE_SEARCH:
|
||||
mTitle = getString(R.string.image_search);
|
||||
break;
|
||||
case ListUrls.MODE_UPLOADER:
|
||||
mTitle = search;
|
||||
break;
|
||||
case ListUrls.MODE_TAG:
|
||||
mTitle = lus.getTag();
|
||||
break;
|
||||
case ListUrls.MODE_POPULAR:
|
||||
mTitle = getString(R.string.popular);
|
||||
case ListUrls.MODE_NORMAL:
|
||||
default:
|
||||
if (search == null || search.isEmpty())
|
||||
mTitle = getString(android.R.string.search_go);
|
||||
else
|
||||
mTitle = search;
|
||||
break;
|
||||
}
|
||||
setTitle(mTitle);
|
||||
}
|
||||
}).setSimpleNegativeButton()
|
||||
.setNeutralButton(R.string.add, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
if (searchImage.getVisibility() == View.VISIBLE)
|
||||
return;
|
||||
createSetNameDialog(null, null, new OnSetNameListener() {
|
||||
@Override
|
||||
public void onSetVaildName(String newName) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
mData.addTag(new Tag(newName, getLus(mSearchDialog)));
|
||||
listMenuTag.add(newName);
|
||||
tagsAdapter.addId(newName);
|
||||
tagsAdapter.notifyDataSetChanged();
|
||||
public boolean onClick(final MaterialAlertDialog dialog, int which) {
|
||||
switch (which) {
|
||||
case MaterialAlertDialog.ACTION:
|
||||
if (searchNormal.getVisibility() == View.VISIBLE) {
|
||||
searchNormal.setVisibility(View.GONE);
|
||||
searchTag.setVisibility(View.VISIBLE);
|
||||
} else if (searchTag.getVisibility() == View.VISIBLE) {
|
||||
searchTag.setVisibility(View.GONE);
|
||||
searchImage.setVisibility(View.VISIBLE);
|
||||
} else if (searchImage.getVisibility() == View.VISIBLE) {
|
||||
searchImage.setVisibility(View.GONE);
|
||||
searchNormal.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}).show();
|
||||
return false;
|
||||
case MaterialAlertDialog.POSITIVE:
|
||||
ListUrls listUrls = getLus(mSearchDialog);
|
||||
if (listUrls == null)
|
||||
return true;
|
||||
|
||||
lus = listUrls;
|
||||
refresh();
|
||||
showContent();
|
||||
|
||||
// Get title
|
||||
String search = lus.getSearch();
|
||||
switch(lus.getMode()) {
|
||||
case ListUrls.MODE_IMAGE_SEARCH:
|
||||
mTitle = getString(R.string.image_search);
|
||||
break;
|
||||
case ListUrls.MODE_UPLOADER:
|
||||
mTitle = search;
|
||||
break;
|
||||
case ListUrls.MODE_TAG:
|
||||
mTitle = lus.getTag();
|
||||
break;
|
||||
case ListUrls.MODE_POPULAR:
|
||||
mTitle = getString(R.string.popular);
|
||||
case ListUrls.MODE_NORMAL:
|
||||
default:
|
||||
if (search == null || search.isEmpty())
|
||||
mTitle = getString(android.R.string.search_go);
|
||||
else
|
||||
mTitle = search;
|
||||
break;
|
||||
}
|
||||
setTitle(mTitle);
|
||||
return true;
|
||||
case MaterialAlertDialog.NEUTRAL:
|
||||
if (searchImage.getVisibility() == View.VISIBLE)
|
||||
return false;
|
||||
createSetNameDialog(null, null, new OnSetNameListener() {
|
||||
@Override
|
||||
public void onSetVaildName(String newName) {
|
||||
mData.addTag(new Tag(newName, getLus(mSearchDialog)));
|
||||
listMenuTag.add(newName);
|
||||
tagsAdapter.addId(newName);
|
||||
tagsAdapter.notifyDataSetChanged();
|
||||
|
||||
dialog.dismiss();
|
||||
}
|
||||
}).show();
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}).create();
|
||||
}
|
||||
@@ -548,38 +559,28 @@ public class GalleryListActivity extends AbsGalleryActivity
|
||||
}
|
||||
|
||||
private AlertDialog createLongClickDialog() {
|
||||
return new DialogBuilder(this).setTitle(R.string.what_to_do)
|
||||
.setItems(R.array.list_item_long_click,
|
||||
new AdapterView.OnItemClickListener() {
|
||||
return new MaterialAlertDialog.Builder(this).setTitle(R.string.what_to_do)
|
||||
.setItems(R.array.list_item_long_click, new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1,
|
||||
int position, long arg3) {
|
||||
final GalleryInfo gi;
|
||||
public boolean onClick(MaterialAlertDialog dialog, int position) {
|
||||
final GalleryInfo gi = getGalleryInfo(longClickItemIndex);
|
||||
switch (position) {
|
||||
case 0: // Add favourite item
|
||||
gi = getGalleryInfo(longClickItemIndex);
|
||||
Favorite.addToFavorite(GalleryListActivity.this, gi);
|
||||
break;
|
||||
case 1:
|
||||
gi = getGalleryInfo(longClickItemIndex);
|
||||
Intent it = new Intent(GalleryListActivity.this, DownloadService.class);
|
||||
startService(it);
|
||||
mServiceConn.getService().add(gi);
|
||||
MaterialToast.showToast(R.string.toast_add_download);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
longClickDialog.dismiss();
|
||||
return true;
|
||||
}
|
||||
}).setNegativeButton(android.R.string.cancel, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
}
|
||||
}).create();
|
||||
}).setNegativeButton(android.R.string.cancel).create();
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
private AlertDialog createJumpDialog() {
|
||||
LayoutInflater inflater = this.getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.jump, null);
|
||||
@@ -591,30 +592,27 @@ public class GalleryListActivity extends AbsGalleryActivity
|
||||
tv.setText(R.string.jump_to);
|
||||
final EditText et = (EditText)view.findViewById(R.id.list_jump_edit);
|
||||
|
||||
return new DialogBuilder(this).setTitle(R.string.jump)
|
||||
.setView(view, true)
|
||||
.setPositiveButton(android.R.string.ok,
|
||||
new View.OnClickListener() {
|
||||
return new MaterialAlertDialog.Builder(this).setTitle(R.string.jump)
|
||||
.setView(view).setPositiveButton(android.R.string.ok)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int targetPage;
|
||||
try{
|
||||
targetPage = Integer.parseInt(et.getText().toString()) - 1;
|
||||
if (targetPage < 0 || targetPage >= getPageNum())
|
||||
throw new Exception();
|
||||
} catch(Exception e) {
|
||||
MaterialToast.showToast(R.string.toast_invalid_page);
|
||||
return;
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which) {
|
||||
if (which == MaterialAlertDialog.POSITIVE) {
|
||||
int targetPage;
|
||||
try{
|
||||
targetPage = Integer.parseInt(et.getText().toString()) - 1;
|
||||
if (targetPage < 0 || targetPage >= getPageNum())
|
||||
throw new Exception();
|
||||
} catch(Exception e) {
|
||||
MaterialToast.showToast(R.string.toast_invalid_page);
|
||||
return false;
|
||||
}
|
||||
jumpTo(targetPage);
|
||||
return true;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
jumpTo(targetPage);
|
||||
}
|
||||
}).setNegativeButton(android.R.string.cancel,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
}
|
||||
}).create();
|
||||
}
|
||||
@@ -630,6 +628,7 @@ public class GalleryListActivity extends AbsGalleryActivity
|
||||
* @param oldStr string can be oldstr, even it is in listMenuTitle
|
||||
* @param listener what to do when set right text
|
||||
*/
|
||||
@SuppressLint("InflateParams")
|
||||
private AlertDialog createSetNameDialog(final String hint, final String oldStr, final OnSetNameListener listener) {
|
||||
LayoutInflater inflater = this.getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.set_name, null);
|
||||
@@ -637,29 +636,30 @@ public class GalleryListActivity extends AbsGalleryActivity
|
||||
if (hint != null)
|
||||
et.setText(hint);
|
||||
|
||||
return new DialogBuilder(this).setTitle(R.string.add_tag)
|
||||
.setView(view, true).setPositiveButton(android.R.string.ok,
|
||||
new View.OnClickListener(){
|
||||
return new MaterialAlertDialog.Builder(this).setTitle(R.string.add_tag)
|
||||
.setView(view).setPositiveButton(android.R.string.ok)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String key = et.getText().toString();
|
||||
if (key.length() == 0)
|
||||
MaterialToast.showToast(R.string.tag_name_empty);
|
||||
else if (listMenuTag.contains(key) && !key.equals(oldStr))
|
||||
MaterialToast.showToast(R.string.tag_name_empty);
|
||||
else {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
if (listener != null) {
|
||||
listener.onSetVaildName(key);
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which) {
|
||||
if (which == MaterialAlertDialog.POSITIVE) {
|
||||
String key = et.getText().toString();
|
||||
if (key.length() == 0) {
|
||||
MaterialToast.showToast(R.string.tag_name_empty);
|
||||
return false;
|
||||
} else if (listMenuTag.contains(key) && !key.equals(oldStr)) {
|
||||
MaterialToast.showToast(R.string.tag_name_empty);
|
||||
return false;
|
||||
} else {
|
||||
if (listener != null) {
|
||||
listener.onSetVaildName(key);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}).setNegativeButton(android.R.string.cancel,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
}
|
||||
}).create();
|
||||
}
|
||||
|
||||
@@ -668,62 +668,62 @@ public class GalleryListActivity extends AbsGalleryActivity
|
||||
final View view = inflater.inflate(R.layout.search, null);
|
||||
final View searchNormal = view.findViewById(R.id.search_normal);
|
||||
final View searchTag = view.findViewById(R.id.search_tag);
|
||||
final View searchImage = view.findViewById(R.id.search_image);
|
||||
handleSearchView(view);
|
||||
|
||||
ListUrls listUrls = mData.getTag(position);
|
||||
setFilterView(view, listUrls);
|
||||
|
||||
return new DialogBuilder(this).setTitle(listMenuTag.get(position))
|
||||
.setView(view, false)
|
||||
.setAction(new View.OnClickListener() {
|
||||
return new MaterialAlertDialog.Builder(this).setTitle(listMenuTag.get(position))
|
||||
.setView(view).setActionButton(R.string.mode)
|
||||
.setPositiveButton(android.R.string.ok)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setNeutralButton(R.string.tag_change_name)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (searchNormal.getVisibility() == View.GONE) {
|
||||
searchNormal.setVisibility(View.VISIBLE);
|
||||
searchTag.setVisibility(View.GONE);
|
||||
} else {
|
||||
searchNormal.setVisibility(View.GONE);
|
||||
searchTag.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}).setPositiveButton(android.R.string.ok, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
ListUrls listUrls = getLus(view);
|
||||
if (newTagName != null) {
|
||||
mData.setTag(position, new Tag(newTagName, listUrls));
|
||||
tagsAdapter.set(listMenuTag.get(position), newTagName);
|
||||
listMenuTag.set(position, newTagName);
|
||||
tagsAdapter.notifyDataSetChanged();
|
||||
|
||||
newTagName = null;
|
||||
} else
|
||||
mData.setTag(position, new Tag(listMenuTag.get(position), listUrls));
|
||||
}
|
||||
}).setNegativeButton(android.R.string.cancel, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
newTagName = null;
|
||||
}
|
||||
}).setNeutralButton(R.string.tag_change_name, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
String hint = newTagName == null ? listMenuTag.get(position) : newTagName;
|
||||
createSetNameDialog(hint, listMenuTag.get(position), new OnSetNameListener(){
|
||||
@Override
|
||||
public void onSetVaildName(String newName) {
|
||||
if (newName.equals(listMenuTag.get(position))) // If new is old name
|
||||
SuperDialogUtil.setTitle(((AlertButton)v).dialog,
|
||||
listMenuTag.get(position));
|
||||
else {
|
||||
newTagName = newName;
|
||||
SuperDialogUtil.setTitle(((AlertButton)v).dialog,
|
||||
String.format(getString(R.string.new_tag_name), newTagName));
|
||||
}
|
||||
public boolean onClick(final MaterialAlertDialog dialog, int which) {
|
||||
switch (which) {
|
||||
case MaterialAlertDialog.ACTION:
|
||||
if (searchNormal.getVisibility() == View.GONE) {
|
||||
searchNormal.setVisibility(View.VISIBLE);
|
||||
searchTag.setVisibility(View.GONE);
|
||||
searchImage.setVisibility(View.GONE);
|
||||
} else {
|
||||
searchNormal.setVisibility(View.GONE);
|
||||
searchTag.setVisibility(View.VISIBLE);
|
||||
searchImage.setVisibility(View.GONE);
|
||||
}
|
||||
}).show();
|
||||
return false;
|
||||
case MaterialAlertDialog.POSITIVE:
|
||||
ListUrls listUrls = getLus(view);
|
||||
if (newTagName != null) {
|
||||
mData.setTag(position, new Tag(newTagName, listUrls));
|
||||
tagsAdapter.set(listMenuTag.get(position), newTagName);
|
||||
listMenuTag.set(position, newTagName);
|
||||
tagsAdapter.notifyDataSetChanged();
|
||||
newTagName = null;
|
||||
} else {
|
||||
mData.setTag(position, new Tag(listMenuTag.get(position), listUrls));
|
||||
}
|
||||
return true;
|
||||
case MaterialAlertDialog.NEUTRAL:
|
||||
String hint = newTagName == null ? listMenuTag.get(position) : newTagName;
|
||||
createSetNameDialog(hint, listMenuTag.get(position), new OnSetNameListener(){
|
||||
@Override
|
||||
public void onSetVaildName(String newName) {
|
||||
if (newName.equals(listMenuTag.get(position))) { // If new is old name
|
||||
dialog.setTitle(listMenuTag.get(position));
|
||||
} else {
|
||||
newTagName = newName;
|
||||
dialog.setTitle(String.format(getString(R.string.new_tag_name), newTagName));
|
||||
}
|
||||
}
|
||||
}).show();
|
||||
return false;
|
||||
case MaterialAlertDialog.NEGATIVE:
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}).create();
|
||||
}
|
||||
|
||||
@@ -41,12 +41,9 @@ import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TextView;
|
||||
@@ -72,7 +69,6 @@ import com.hippo.ehviewer.util.Ui;
|
||||
import com.hippo.ehviewer.util.Utils;
|
||||
import com.hippo.ehviewer.widget.AlertButton;
|
||||
import com.hippo.ehviewer.widget.CategoryTable;
|
||||
import com.hippo.ehviewer.widget.DialogBuilder;
|
||||
import com.hippo.ehviewer.widget.FileExplorerView;
|
||||
import com.hippo.ehviewer.widget.MaterialToast;
|
||||
import com.hippo.ehviewer.widget.ProgressDialogBulider;
|
||||
@@ -362,54 +358,61 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
final CategoryTable ct = new CategoryTable(mActivity);
|
||||
ct.setCategory(defaultCat);
|
||||
|
||||
new DialogBuilder(mActivity)
|
||||
.setTitle(R.string.list_default_category_title)
|
||||
.setView(ct, 12).setSimpleNegativeButton()
|
||||
.setPositiveButton(android.R.string.ok, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
int defaultCat = ct.getCategory();
|
||||
Config.setDefaultCat(defaultCat);
|
||||
EhInfo.getInstance(mActivity).setDefaultCat(defaultCat);
|
||||
}
|
||||
}).create().show();
|
||||
new MaterialAlertDialog.Builder(mActivity)
|
||||
.setTitle(R.string.list_default_category_title)
|
||||
.setView(ct).setPositiveButton(android.R.string.ok)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which) {
|
||||
if (which == MaterialAlertDialog.POSITIVE) {
|
||||
int defaultCat = ct.getCategory();
|
||||
Config.setDefaultCat(defaultCat);
|
||||
EhInfo.getInstance(mActivity).setDefaultCat(defaultCat);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}).show();
|
||||
|
||||
} else if (KEY_EXCULDE_TAG_GROUP.equals(key)) {
|
||||
LayoutInflater inflater = LayoutInflater.from(mActivity);
|
||||
final TableLayout tl = (TableLayout)inflater.inflate(R.layout.exculde_tag_group, null);
|
||||
setExculdeTagGroup(tl, Config.getExculdeTagGroup());
|
||||
|
||||
new DialogBuilder(mActivity)
|
||||
.setTitle(R.string.exculde_tag_group_title)
|
||||
.setView(tl, 12).setSimpleNegativeButton()
|
||||
.setPositiveButton(android.R.string.ok, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
int newValue = getExculdeTagGroup(tl);
|
||||
Config.setExculdeTagGroup(newValue);
|
||||
EhInfo.getInstance(mActivity).setExculdeTagGroup(newValue);
|
||||
}
|
||||
}).create().show();
|
||||
new MaterialAlertDialog.Builder(mActivity)
|
||||
.setTitle(R.string.exculde_tag_group_title)
|
||||
.setView(tl).setPositiveButton(android.R.string.ok)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public boolean onClick(MaterialAlertDialog dialog,
|
||||
int which) {
|
||||
int newValue = getExculdeTagGroup(tl);
|
||||
Config.setExculdeTagGroup(newValue);
|
||||
EhInfo.getInstance(mActivity).setExculdeTagGroup(newValue);
|
||||
return true;
|
||||
}
|
||||
}).show();
|
||||
|
||||
} else if (KEY_EXCULDE_LANGUAGE.equals(key)) {
|
||||
LayoutInflater inflater = LayoutInflater.from(mActivity);
|
||||
final TableLayout tl = (TableLayout)inflater.inflate(R.layout.exculde_language, null);
|
||||
setExculdeLanguage(tl, Config.getExculdeLanguage());
|
||||
|
||||
new DialogBuilder(mActivity)
|
||||
.setTitle(R.string.exculde_language_title)
|
||||
.setView(tl, 12).setSimpleNegativeButton()
|
||||
.setPositiveButton(android.R.string.ok, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((AlertButton)v).dialog.dismiss();
|
||||
String newValue = getExculdeLanguage(tl);
|
||||
Config.setExculdeLanguage(newValue);
|
||||
EhInfo.getInstance(mActivity).setExculdeLanguage(newValue);
|
||||
}
|
||||
}).create().show();
|
||||
new MaterialAlertDialog.Builder(mActivity)
|
||||
.setTitle(R.string.exculde_language_title)
|
||||
.setView(tl).setPositiveButton(android.R.string.ok)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public boolean onClick(MaterialAlertDialog dialog,
|
||||
int which) {
|
||||
String newValue = getExculdeLanguage(tl);
|
||||
Config.setExculdeLanguage(newValue);
|
||||
EhInfo.getInstance(mActivity).setExculdeLanguage(newValue);
|
||||
return true;
|
||||
}
|
||||
}).show();
|
||||
|
||||
} else if (KEY_CLEAR_SUGGESTIONS.equals(key)) {
|
||||
SearchRecentSuggestions suggestions = SuggestionHelper.getInstance (
|
||||
@@ -683,6 +686,59 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
(TextView)view.findViewById(R.id.warning);
|
||||
|
||||
String downloadPath = Config.getDownloadPath();
|
||||
fileExplorerView.setPath(downloadPath);
|
||||
fileExplorerView.setOnItemClickListener(
|
||||
new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view,
|
||||
int position, long id) {
|
||||
fileExplorerView.onItemClick(parent, view, position, id);
|
||||
mDirSelectDialog.setTitle(fileExplorerView.getCurPath());
|
||||
if (fileExplorerView.canWrite())
|
||||
warning.setVisibility(View.GONE);
|
||||
else
|
||||
warning.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
if (fileExplorerView.canWrite())
|
||||
warning.setVisibility(View.GONE);
|
||||
else
|
||||
warning.setVisibility(View.VISIBLE);
|
||||
|
||||
mDirSelectDialog = new MaterialAlertDialog.Builder(mActivity).setTitle(downloadPath)
|
||||
.setView(view).setActionButton("New") // TODO
|
||||
.setPositiveButton(android.R.string.ok)
|
||||
.setNegativeButton(android.R.string.cancel)
|
||||
.setButtonListener(new MaterialAlertDialog.OnClickListener() {
|
||||
@Override
|
||||
public boolean onClick(MaterialAlertDialog dialog, int which) {
|
||||
switch (which) {
|
||||
case MaterialAlertDialog.ACTION:
|
||||
return false;
|
||||
case MaterialAlertDialog.POSITIVE:
|
||||
if (!fileExplorerView.canWrite()) {
|
||||
MaterialToast.showToast(R.string.cur_dir_not_writable);
|
||||
return false;
|
||||
}
|
||||
String downloadPath = fileExplorerView.getCurPath();
|
||||
// Update .nomedia file
|
||||
// TODO Should I delete .nomedia in old download dir ?
|
||||
if (!Config.getMediaScan()) {
|
||||
try {
|
||||
new File(Config.getDownloadPath(), ".nomedia").createNewFile();
|
||||
} catch (IOException e) {}
|
||||
}
|
||||
Config.setDownloadPath(downloadPath);
|
||||
mDownloadPath.setSummary(downloadPath);
|
||||
return true;
|
||||
case MaterialAlertDialog.NEGATIVE:
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}).create();
|
||||
mDirSelectDialog.show();
|
||||
/*
|
||||
DialogBuilder dialogBuilder = new DialogBuilder(mActivity)
|
||||
.setView(view, new LinearLayout.LayoutParams(
|
||||
LayoutParams.MATCH_PARENT, Ui.dp2pix(360)), false)
|
||||
@@ -763,7 +819,7 @@ public class SettingsActivity extends AbsPreferenceActivity {
|
||||
});
|
||||
|
||||
mDirSelectDialog = dialogBuilder.create();
|
||||
mDirSelectDialog.show();
|
||||
mDirSelectDialog.show();*/
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -16,21 +16,22 @@
|
||||
|
||||
package com.hippo.ehviewer.util;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.app.MaterialAlertDialog;
|
||||
import com.hippo.ehviewer.data.Data;
|
||||
import com.hippo.ehviewer.data.GalleryInfo;
|
||||
import com.hippo.ehviewer.ehclient.EhClient;
|
||||
import com.hippo.ehviewer.widget.DialogBuilder;
|
||||
import com.hippo.ehviewer.widget.MaterialToast;
|
||||
|
||||
public class Favorite {
|
||||
@@ -78,13 +79,15 @@ public class Favorite {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
public static AlertDialog getAddToFavoriteDialog(final Context context, final GalleryInfo gi) {
|
||||
DialogBuilder db = new DialogBuilder(context).setView(R.layout.add_to_favorite, false);
|
||||
db.setTitle(R.string.where_to_add);
|
||||
db.setSimpleNegativeButton();
|
||||
ViewGroup vg = db.getCustomLayout();
|
||||
final CheckBox cb = (CheckBox)vg.findViewById(R.id.set_default);
|
||||
ListView lv = (ListView)vg.findViewById(R.id.list);
|
||||
|
||||
// TODO List do not work final
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
View view = inflater.inflate(R.layout.add_to_favorite, null);
|
||||
final CheckBox cb = (CheckBox) view.findViewById(R.id.set_default);
|
||||
ListView lv = (ListView) view.findViewById(R.id.list);
|
||||
lv.setAdapter(new ArrayAdapter<String>(mContext,
|
||||
R.layout.list_item_text, FAVORITE_TITLES));
|
||||
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@@ -117,6 +120,10 @@ public class Favorite {
|
||||
}
|
||||
}
|
||||
});
|
||||
return lastAddToFavoriteDialog = db.create();
|
||||
|
||||
return lastAddToFavoriteDialog = new MaterialAlertDialog.Builder(context)
|
||||
.setTitle(R.string.where_to_add)
|
||||
.setView(view).setNegativeButton(android.R.string.cancel)
|
||||
.setPositiveButton(android.R.string.ok).create();
|
||||
}
|
||||
}
|
||||