Add pattern protection
This commit is contained in:
1 parent
81428446d9
commit
7626c8e89e
18 files changed
+1718
-9
No files matched your search
@@ -93,6 +93,12 @@
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:label="@string/filter"/>
|
||||
|
||||
<activity
|
||||
android:name="com.hippo.ehviewer.ui.SetSecurityActivity"
|
||||
android:configChanges="screenSize|uiMode"
|
||||
android:theme="@style/AppTheme.NoActionBar"
|
||||
android:label="@string/set_pattern_protection"/>
|
||||
|
||||
<service
|
||||
android:name="com.hippo.ehviewer.download.DownloadService"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
|
||||
@@ -680,6 +680,17 @@ public class Settings {
|
||||
putBoolean(KEY_SAVE_PARSE_ERROR_BODY, value);
|
||||
}
|
||||
|
||||
public static final String KEY_SECURITY = "security";
|
||||
public static final String DEFAULT_SECURITY = "";
|
||||
|
||||
public static String getSecurity() {
|
||||
return getString(KEY_SECURITY, DEFAULT_SECURITY);
|
||||
}
|
||||
|
||||
public static void putSecurity(String value) {
|
||||
putString(KEY_SECURITY, value);
|
||||
}
|
||||
|
||||
/********************
|
||||
****** Guide
|
||||
********************/
|
||||
|
||||
@@ -58,6 +58,7 @@ import com.hippo.ehviewer.ui.scene.GalleryPreviewsScene;
|
||||
import com.hippo.ehviewer.ui.scene.HistoryScene;
|
||||
import com.hippo.ehviewer.ui.scene.ProgressScene;
|
||||
import com.hippo.ehviewer.ui.scene.QuickSearchScene;
|
||||
import com.hippo.ehviewer.ui.scene.SecurityScene;
|
||||
import com.hippo.ehviewer.ui.scene.SelectSiteScene;
|
||||
import com.hippo.ehviewer.ui.scene.SignInScene;
|
||||
import com.hippo.ehviewer.ui.scene.WarningScene;
|
||||
@@ -76,15 +77,14 @@ public final class MainActivity extends StageActivity
|
||||
|
||||
private static final int PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE = 0;
|
||||
|
||||
private static final int REQUEST_CODE_UPDATE_PROFILE = 0;
|
||||
|
||||
private static final String KEY_NAV_CHECKED_ITEM = "nav_checked_item";
|
||||
|
||||
public static final int CHECK_STEP_WARNING = 0;
|
||||
public static final int CHECK_STEP_ANALYTICS = 1;
|
||||
public static final int CHECK_STEP_CRASH = 2;
|
||||
public static final int CHECK_STEP_SIGN_IN = 3;
|
||||
public static final int CHECK_STEP_SELECT_SITE = 4;
|
||||
public static final int CHECK_STEP_SECURITY = 0;
|
||||
public static final int CHECK_STEP_WARNING = 1;
|
||||
public static final int CHECK_STEP_ANALYTICS = 2;
|
||||
public static final int CHECK_STEP_CRASH = 3;
|
||||
public static final int CHECK_STEP_SIGN_IN = 4;
|
||||
public static final int CHECK_STEP_SELECT_SITE = 5;
|
||||
|
||||
public static final String KEY_TARGET_SCENE = "target_scene";
|
||||
public static final String KEY_TARGET_ARGS = "target_args";
|
||||
@@ -106,6 +106,7 @@ public final class MainActivity extends StageActivity
|
||||
private int mNavCheckedItem = 0;
|
||||
|
||||
static {
|
||||
registerLaunchMode(SecurityScene.class, SceneFragment.LAUNCH_MODE_SINGLE_TASK);
|
||||
registerLaunchMode(WarningScene.class, SceneFragment.LAUNCH_MODE_SINGLE_TASK);
|
||||
registerLaunchMode(AnalyticsScene.class, SceneFragment.LAUNCH_MODE_SINGLE_TASK);
|
||||
registerLaunchMode(CrashScene.class, SceneFragment.LAUNCH_MODE_SINGLE_TASK);
|
||||
@@ -128,6 +129,11 @@ public final class MainActivity extends StageActivity
|
||||
|
||||
public void startSceneForCheckStep(int checkStep, Bundle args) {
|
||||
switch (checkStep) {
|
||||
case CHECK_STEP_SECURITY:
|
||||
if (Settings.getShowWarning()) {
|
||||
startScene(new Announcer(WarningScene.class).setArgs(args));
|
||||
break;
|
||||
}
|
||||
case CHECK_STEP_WARNING:
|
||||
if (Settings.getAskAnalytics()) {
|
||||
startScene(new Announcer(AnalyticsScene.class).setArgs(args));
|
||||
@@ -184,7 +190,9 @@ public final class MainActivity extends StageActivity
|
||||
@Nullable
|
||||
@Override
|
||||
protected Announcer getLaunchAnnouncer() {
|
||||
if (Settings.getShowWarning()) {
|
||||
if (!TextUtils.isEmpty(Settings.getSecurity())) {
|
||||
return new Announcer(SecurityScene.class);
|
||||
} else if (Settings.getShowWarning()) {
|
||||
return new Announcer(WarningScene.class);
|
||||
} else if (Settings.getAskAnalytics()) {
|
||||
return new Announcer(AnalyticsScene.class);
|
||||
@@ -204,7 +212,12 @@ public final class MainActivity extends StageActivity
|
||||
// Sometimes scene can't show directly
|
||||
private Announcer processAnnouncer(Announcer announcer) {
|
||||
if (0 == getSceneCount()) {
|
||||
if (Settings.getShowWarning()) {
|
||||
if (!TextUtils.isEmpty(Settings.getSecurity())) {
|
||||
Bundle newArgs = new Bundle();
|
||||
newArgs.putString(KEY_TARGET_SCENE, announcer.getClazz().getName());
|
||||
newArgs.putBundle(KEY_TARGET_ARGS, announcer.getArgs());
|
||||
return new Announcer(SecurityScene.class).setArgs(newArgs);
|
||||
} else if (Settings.getShowWarning()) {
|
||||
Bundle newArgs = new Bundle();
|
||||
newArgs.putString(KEY_TARGET_SCENE, announcer.getClazz().getName());
|
||||
newArgs.putBundle(KEY_TARGET_ARGS, announcer.getArgs());
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.widget.lockpattern.LockPatternUtils;
|
||||
import com.hippo.widget.lockpattern.LockPatternView;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
|
||||
public class SetSecurityActivity extends ToolbarActivity implements View.OnClickListener {
|
||||
|
||||
@Nullable
|
||||
private LockPatternView mPatternView;
|
||||
@Nullable
|
||||
private View mCancel;
|
||||
@Nullable
|
||||
private View mSet;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_set_security);
|
||||
setNavigationIcon(R.drawable.v_arrow_left_dark_x24);
|
||||
|
||||
mPatternView = (LockPatternView) ViewUtils.$$(this, R.id.pattern_view);
|
||||
mCancel = ViewUtils.$$(this, R.id.cancel);
|
||||
mSet = ViewUtils.$$(this, R.id.set);
|
||||
|
||||
String pattern = Settings.getSecurity();
|
||||
if (!TextUtils.isEmpty(pattern)) {
|
||||
mPatternView.setPattern(LockPatternView.DisplayMode.Correct,
|
||||
LockPatternUtils.stringToPattern(pattern));
|
||||
}
|
||||
|
||||
mCancel.setOnClickListener(this);
|
||||
mSet.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
mPatternView = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v == mCancel) {
|
||||
finish();
|
||||
} else if (v == mSet) {
|
||||
if (null != mPatternView) {
|
||||
String security;
|
||||
if (mPatternView.getCellSize() <= 1) {
|
||||
security = "";
|
||||
} else {
|
||||
security = mPatternView.getPatternString();
|
||||
}
|
||||
Settings.putSecurity(security);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,11 +20,13 @@ import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.hippo.ehviewer.AppConfig;
|
||||
import com.hippo.ehviewer.EhApplication;
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.util.LogCat;
|
||||
import com.hippo.util.ReadableTime;
|
||||
|
||||
@@ -34,6 +36,7 @@ public class AdvancedFragment extends PreferenceFragment implements Preference.O
|
||||
|
||||
private static final String KEY_DUMP_LOGCAT = "dump_logcat";
|
||||
private static final String KEY_CLEAR_MEMORY_CACHE = "clear_memory_cache";
|
||||
private static final String KEY_PATTERN_PROTECTION = "pattern_protection";
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
@@ -47,6 +50,16 @@ public class AdvancedFragment extends PreferenceFragment implements Preference.O
|
||||
clearMemoryCache.setOnPreferenceClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
Preference patternProtection = findPreference(KEY_PATTERN_PROTECTION);
|
||||
patternProtection.setSummary(TextUtils.isEmpty(Settings.getSecurity()) ?
|
||||
R.string.settings_advanced_pattern_protection_not_set :
|
||||
R.string.settings_advanced_pattern_protection_set);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
String key = preference.getKey();
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* 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.scene;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.hippo.ehviewer.R;
|
||||
import com.hippo.ehviewer.Settings;
|
||||
import com.hippo.ehviewer.ui.MainActivity;
|
||||
import com.hippo.widget.lockpattern.LockPatternUtils;
|
||||
import com.hippo.widget.lockpattern.LockPatternView;
|
||||
import com.hippo.yorozuya.ObjectUtils;
|
||||
import com.hippo.yorozuya.ViewUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SecurityScene extends BaseScene implements LockPatternView.OnPatternListener {
|
||||
|
||||
private static final int MAX_RETRY_TIMES = 5;
|
||||
|
||||
private static final String KEY_RETRY_TIMES = "retry_times";
|
||||
|
||||
@Nullable
|
||||
private LockPatternView mPatternView;
|
||||
|
||||
private int mRetryTimes;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (null == savedInstanceState) {
|
||||
mRetryTimes = MAX_RETRY_TIMES;
|
||||
} else {
|
||||
mRetryTimes = savedInstanceState.getInt(KEY_RETRY_TIMES);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putInt(KEY_RETRY_TIMES, mRetryTimes);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater,
|
||||
@Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.scene_security, container, false);
|
||||
|
||||
mPatternView = (LockPatternView) ViewUtils.$$(view, R.id.pattern_view);
|
||||
mPatternView.setOnPatternListener(this);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
mPatternView = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPatternStart() {}
|
||||
|
||||
@Override
|
||||
public void onPatternCleared() {}
|
||||
|
||||
@Override
|
||||
public void onPatternCellAdded(List<LockPatternView.Cell> pattern) {}
|
||||
|
||||
@Override
|
||||
public void onPatternDetected(List<LockPatternView.Cell> pattern) {
|
||||
MainActivity activity = getActivity2();
|
||||
if (null == activity || null == mPatternView) {
|
||||
return;
|
||||
}
|
||||
|
||||
String enteredPatter = LockPatternUtils.patternToString(pattern);
|
||||
String targetPatter = Settings.getSecurity();
|
||||
|
||||
if (ObjectUtils.equal(enteredPatter, targetPatter)) {
|
||||
activity.startSceneForCheckStep(MainActivity.CHECK_STEP_SECURITY, getArguments());
|
||||
finish();
|
||||
} else {
|
||||
mPatternView.setDisplayMode(LockPatternView.DisplayMode.Wrong);
|
||||
mRetryTimes--;
|
||||
if (mRetryTimes <= 0) {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2007 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.
|
||||
*/
|
||||
|
||||
package com.hippo.widget.lockpattern;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Utilities for the lock pattern and its settings.
|
||||
*/
|
||||
public class LockPatternUtils {
|
||||
|
||||
/**
|
||||
* Deserialize a pattern.
|
||||
* @param string The pattern serialized with {@link #patternToString}
|
||||
* @return The pattern.
|
||||
*/
|
||||
public static List<LockPatternView.Cell> stringToPattern(String string) {
|
||||
List<LockPatternView.Cell> result = new ArrayList<>();
|
||||
|
||||
final byte[] bytes = string.getBytes();
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
byte b = bytes[i];
|
||||
result.add(LockPatternView.Cell.of(b / 3, b % 3));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize a pattern.
|
||||
* @param pattern The pattern.
|
||||
* @return The pattern in string form.
|
||||
*/
|
||||
public static String patternToString(List<LockPatternView.Cell> pattern) {
|
||||
if (pattern == null) {
|
||||
return "";
|
||||
}
|
||||
final int patternSize = pattern.size();
|
||||
|
||||
byte[] res = new byte[patternSize];
|
||||
for (int i = 0; i < patternSize; i++) {
|
||||
LockPatternView.Cell cell = pattern.get(i);
|
||||
res[i] = (byte) (cell.getRow() * 3 + cell.getColumn());
|
||||
}
|
||||
return new String(res);
|
||||
}
|
||||
|
||||
public static boolean isPatternVaild(String pattern) {
|
||||
byte[] bytes = pattern.getBytes();
|
||||
if (bytes.length <= 9 && bytes.length >= 2) {
|
||||
for (byte b : bytes) {
|
||||
if (b >= 9 || b < 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:text="@string/set_pattern_protection_tip"
|
||||
android:padding="@dimen/keyline_margin"
|
||||
android:gravity="center"/>
|
||||
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:gravity="bottom"
|
||||
style="?attr/buttonBarStyle">
|
||||
|
||||
<Button
|
||||
android:id="@+id/cancel"
|
||||
style="?attr/buttonBarNegativeButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@android:string/cancel"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/set"
|
||||
style="?attr/buttonBarPositiveButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/set"/>
|
||||
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<com.hippo.widget.lockpattern.LockPatternView
|
||||
android:id="@+id/pattern_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
android:text="@string/set_pattern_protection_tip"
|
||||
android:padding="@dimen/keyline_margin"
|
||||
android:gravity="center"/>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<com.hippo.widget.MaxSizeContainer
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="32dp"
|
||||
app:maxWidth="320dp"
|
||||
app:maxHeight="320dp">
|
||||
|
||||
<com.hippo.widget.lockpattern.LockPatternView
|
||||
android:id="@+id/pattern_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</com.hippo.widget.MaxSizeContainer>
|
||||
</FrameLayout>
|
||||
|
||||
<android.support.v7.widget.ButtonBarLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/buttonPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingBottom="4dp"
|
||||
android:gravity="bottom"
|
||||
style="?attr/buttonBarStyle">
|
||||
|
||||
<Button
|
||||
android:id="@+id/cancel"
|
||||
style="?attr/buttonBarNegativeButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@android:string/cancel"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/set"
|
||||
style="?attr/buttonBarPositiveButtonStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/set"/>
|
||||
|
||||
</android.support.v7.widget.ButtonBarLayout>
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.hippo.widget.MaxSizeContainer
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="32dp"
|
||||
app:maxWidth="320dp"
|
||||
app:maxHeight="320dp">
|
||||
|
||||
<com.hippo.widget.lockpattern.LockPatternView
|
||||
android:id="@+id/pattern_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</com.hippo.widget.MaxSizeContainer>
|
||||
</FrameLayout>
|
||||
@@ -300,6 +300,11 @@
|
||||
<string name="delete_filter">删除过滤项:%s?</string>
|
||||
<string name="filter_tip">标题过滤项:排除标题含有该关键字的画廊。\n\n上传者过滤项:排除该上传者上传的画廊。\n\n标签过滤项:排除包含该关键字的画廊,这会使获取画廊列表花费更多时间。</string>
|
||||
|
||||
<!-- Set Security -->
|
||||
<string name="set_pattern_protection">设置图案保护</string>
|
||||
<string name="set_pattern_protection_tip">绘制图案来设置图案保护\n留空来取消图案保护</string>
|
||||
<string name="set">设置</string>
|
||||
|
||||
<!-- Gallery Activity -->
|
||||
<string name="page_menu_title">第 %d 页</string>
|
||||
<string name="page_menu_refresh">@string/refresh</string>
|
||||
@@ -385,6 +390,9 @@
|
||||
<string name="settings_advanced_clear_download_path_cache_message">清除画廊下载路径缓存?</string>
|
||||
<string name="settings_advanced_clear_memory_cache">清理内存缓存</string>
|
||||
<string name="settings_advanced_clear_memory_cache_summary">清理缩略图、画廊信息的内存缓存</string>
|
||||
<string name="settings_advanced_pattern_protection_title">图案保护</string>
|
||||
<string name="settings_advanced_pattern_protection_not_set">未设置图案保护</string>
|
||||
<string name="settings_advanced_pattern_protection_set">已设置图案保护</string>
|
||||
|
||||
<string name="settings_about">关于</string>
|
||||
<string name="settings_about_author">作者</string>
|
||||
|
||||
@@ -300,6 +300,11 @@
|
||||
<string name="delete_filter">刪除過濾項:%s?</string>
|
||||
<string name="filter_tip">標題過濾項:排除標題含有該關鍵字的畫廊。\n\n上傳者過濾項:排除該上傳者上傳的畫廊。\n\n標籤過濾項:排除包含該關鍵字的畫廊,這會使獲取畫廊列表花費更多時間。</string>
|
||||
|
||||
<!-- Set Security -->
|
||||
<string name="set_pattern_protection">設置圖案保護</string>
|
||||
<string name="set_pattern_protection_tip">繪製圖案來設置圖案保護\n留空來取消圖案保護</string>
|
||||
<string name="set">設置</string>
|
||||
|
||||
<!-- Gallery Activity -->
|
||||
<string name="page_menu_title">第 %d 頁</string>
|
||||
<string name="page_menu_refresh">@string/refresh</string>
|
||||
@@ -385,6 +390,9 @@
|
||||
<string name="settings_advanced_clear_download_path_cache_message">清除畫廊下載路徑緩存?</string>
|
||||
<string name="settings_advanced_clear_memory_cache">清理內存緩存</string>
|
||||
<string name="settings_advanced_clear_memory_cache_summary">清理縮略圖、畫廊信息的內存緩存</string>
|
||||
<string name="settings_advanced_pattern_protection_title">圖案保護</string>
|
||||
<string name="settings_advanced_pattern_protection_not_set">未設置圖案保護</string>
|
||||
<string name="settings_advanced_pattern_protection_set">已設置圖案保護</string>
|
||||
|
||||
<string name="settings_about">關於</string>
|
||||
<string name="settings_about_author">作者</string>
|
||||
|
||||
@@ -300,6 +300,11 @@
|
||||
<string name="delete_filter">刪除過濾項:%s?</string>
|
||||
<string name="filter_tip">標題過濾項:排除標題含有該關鍵字的畫廊。\n\n上傳者過濾項:排除該上傳者上傳的畫廊。\n\n標籤過濾項:排除包含該關鍵字的畫廊,這會使獲取畫廊列表花費更多時間。</string>
|
||||
|
||||
<!-- Set Security -->
|
||||
<string name="set_pattern_protection">設定圖案保護</string>
|
||||
<string name="set_pattern_protection_tip">繪製圖案來設定圖案保護\n留空來取消圖案保護</string>
|
||||
<string name="set">設定</string>
|
||||
|
||||
<!-- Gallery Activity -->
|
||||
<string name="page_menu_title">第 %d 頁</string>
|
||||
<string name="page_menu_refresh">@string/refresh</string>
|
||||
@@ -385,6 +390,9 @@
|
||||
<string name="settings_advanced_clear_download_path_cache_message">清除畫廊下載路徑快取?</string>
|
||||
<string name="settings_advanced_clear_memory_cache">清理記憶體快取</string>
|
||||
<string name="settings_advanced_clear_memory_cache_summary">清理縮圖、畫廊資訊的記憶體快取</string>
|
||||
<string name="settings_advanced_pattern_protection_title">圖案保護</string>
|
||||
<string name="settings_advanced_pattern_protection_not_set">未設定圖案保護</string>
|
||||
<string name="settings_advanced_pattern_protection_set">已設定圖案保護</string>
|
||||
|
||||
<string name="settings_about">關於</string>
|
||||
<string name="settings_about_author">作者</string>
|
||||
|
||||
@@ -109,4 +109,9 @@
|
||||
|
||||
<color name="guide_bg">#e5009688</color>
|
||||
|
||||
<!-- Lock pattern view -->
|
||||
<color name="lock_pattern_view_regular_color">#8a000000</color>
|
||||
<color name="lock_pattern_view_success_color">@color/colorPrimary</color>
|
||||
<color name="lock_pattern_view_error_color">@color/red_500</color>
|
||||
|
||||
</resources>
|
||||
@@ -102,4 +102,9 @@
|
||||
|
||||
<dimen name="gallery_guide_divider_width">3dp</dimen>
|
||||
|
||||
<!-- Lock pattern view -->
|
||||
<dimen name="lock_pattern_dot_line_width">3dp</dimen>
|
||||
<dimen name="lock_pattern_dot_size">12dp</dimen>
|
||||
<dimen name="lock_pattern_dot_size_activated">28dp</dimen>
|
||||
|
||||
</resources>
|
||||
@@ -343,6 +343,11 @@
|
||||
<string name="filter_text">Filter text</string>
|
||||
<string name="filter_tip">Title Filter: exclude the gallery whose title contains the word.\n\nUploader Filter: exclude the gallery which was uploaded by the uploader.\n\nTag Filter: exclude the gallery which contain the tag, it takes more time to get gallery list.</string>
|
||||
|
||||
<!-- Set Security -->
|
||||
<string name="set_pattern_protection">Set pattern protection</string>
|
||||
<string name="set_pattern_protection_tip">Draw a pattern to set pattern protection\nLeave blank to clear pattern protection</string>
|
||||
<string name="set">Set</string>
|
||||
|
||||
<!-- Gallery Activity -->
|
||||
<string name="page_menu_title">Page %d</string>
|
||||
<string name="page_menu_refresh">@string/refresh</string>
|
||||
@@ -427,6 +432,9 @@
|
||||
<string name="settings_advanced_clear_download_path_cache_message">Clear download path cache?</string>
|
||||
<string name="settings_advanced_clear_memory_cache">Clear memory cache</string>
|
||||
<string name="settings_advanced_clear_memory_cache_summary">Clear thumb, gallery info memory cache</string>
|
||||
<string name="settings_advanced_pattern_protection_title">Pattern protection</string>
|
||||
<string name="settings_advanced_pattern_protection_not_set">Pattern protection has not been set</string>
|
||||
<string name="settings_advanced_pattern_protection_set">Pattern protection has been set</string>
|
||||
|
||||
<string name="settings_about">About</string>
|
||||
<string name="settings_about_author">Author</string>
|
||||
|
||||
@@ -39,4 +39,10 @@
|
||||
android:title="@string/settings_advanced_clear_memory_cache"
|
||||
android:summary="@string/settings_advanced_clear_memory_cache_summary"/>
|
||||
|
||||
<com.hippo.preference.ActivityPreference
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:key="pattern_protection"
|
||||
android:title="@string/settings_advanced_pattern_protection_title"
|
||||
app:activity="com.hippo.ehviewer.ui.SetSecurityActivity"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
Reference in new issue
Block a user