2015-02-26 01:32:51 +00:00
|
|
|
/*
|
2015-10-29 17:10:07 +00:00
|
|
|
* This is the source code of Telegram for Android v. 3.x.x
|
2015-02-26 01:32:51 +00:00
|
|
|
* It is licensed under GNU GPL v. 2 or later.
|
|
|
|
* You should have received a copy of the license in this archive (see LICENSE).
|
|
|
|
*
|
2017-03-30 23:58:05 +00:00
|
|
|
* Copyright Nikolai Kudashov, 2013-2017.
|
2015-02-26 01:32:51 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
package org.telegram.ui;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.DialogInterface;
|
|
|
|
import android.content.res.Configuration;
|
2017-03-30 23:58:05 +00:00
|
|
|
import android.graphics.PorterDuff;
|
|
|
|
import android.graphics.PorterDuffColorFilter;
|
2015-02-26 01:32:51 +00:00
|
|
|
import android.graphics.Typeface;
|
2017-03-30 23:58:05 +00:00
|
|
|
import android.graphics.drawable.Drawable;
|
2015-02-26 01:32:51 +00:00
|
|
|
import android.os.Build;
|
|
|
|
import android.os.Vibrator;
|
|
|
|
import android.text.Editable;
|
|
|
|
import android.text.InputFilter;
|
|
|
|
import android.text.InputType;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.TextWatcher;
|
|
|
|
import android.text.method.DigitsKeyListener;
|
|
|
|
import android.text.method.PasswordTransformationMethod;
|
|
|
|
import android.util.TypedValue;
|
|
|
|
import android.view.ActionMode;
|
|
|
|
import android.view.Gravity;
|
|
|
|
import android.view.KeyEvent;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.MenuItem;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.ViewTreeObserver;
|
|
|
|
import android.view.inputmethod.EditorInfo;
|
|
|
|
import android.widget.FrameLayout;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import android.widget.Toast;
|
|
|
|
|
2015-09-24 20:52:02 +00:00
|
|
|
import org.telegram.messenger.AndroidUtilities;
|
|
|
|
import org.telegram.messenger.LocaleController;
|
|
|
|
import org.telegram.messenger.NotificationCenter;
|
2015-02-26 01:32:51 +00:00
|
|
|
import org.telegram.messenger.ApplicationLoader;
|
|
|
|
import org.telegram.messenger.FileLog;
|
|
|
|
import org.telegram.messenger.R;
|
|
|
|
import org.telegram.messenger.UserConfig;
|
|
|
|
import org.telegram.messenger.Utilities;
|
2017-03-30 23:58:05 +00:00
|
|
|
import org.telegram.messenger.support.fingerprint.FingerprintManagerCompat;
|
|
|
|
import org.telegram.messenger.support.widget.LinearLayoutManager;
|
|
|
|
import org.telegram.messenger.support.widget.RecyclerView;
|
2015-02-26 01:32:51 +00:00
|
|
|
import org.telegram.ui.ActionBar.ActionBar;
|
|
|
|
import org.telegram.ui.ActionBar.ActionBarMenu;
|
|
|
|
import org.telegram.ui.ActionBar.ActionBarMenuItem;
|
2017-03-30 23:58:05 +00:00
|
|
|
import org.telegram.ui.ActionBar.AlertDialog;
|
2015-02-26 01:32:51 +00:00
|
|
|
import org.telegram.ui.ActionBar.BaseFragment;
|
2017-03-30 23:58:05 +00:00
|
|
|
import org.telegram.ui.ActionBar.Theme;
|
|
|
|
import org.telegram.ui.ActionBar.ThemeDescription;
|
2015-02-26 01:32:51 +00:00
|
|
|
import org.telegram.ui.Cells.TextCheckCell;
|
|
|
|
import org.telegram.ui.Cells.TextInfoPrivacyCell;
|
|
|
|
import org.telegram.ui.Cells.TextSettingsCell;
|
2017-12-08 17:35:59 +00:00
|
|
|
import org.telegram.ui.Components.EditTextBoldCursor;
|
2015-05-03 11:48:36 +00:00
|
|
|
import org.telegram.ui.Components.LayoutHelper;
|
2015-02-26 01:32:51 +00:00
|
|
|
import org.telegram.ui.Components.NumberPicker;
|
2017-03-30 23:58:05 +00:00
|
|
|
import org.telegram.ui.Components.RecyclerListView;
|
2015-02-26 01:32:51 +00:00
|
|
|
|
|
|
|
public class PasscodeActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
|
|
|
|
|
|
|
private ListAdapter listAdapter;
|
2017-03-30 23:58:05 +00:00
|
|
|
private RecyclerListView listView;
|
2015-02-26 01:32:51 +00:00
|
|
|
private TextView titleTextView;
|
2017-12-08 17:35:59 +00:00
|
|
|
private EditTextBoldCursor passwordEditText;
|
2015-02-26 01:32:51 +00:00
|
|
|
private TextView dropDown;
|
|
|
|
private ActionBarMenuItem dropDownContainer;
|
2017-03-30 23:58:05 +00:00
|
|
|
private Drawable dropDownDrawable;
|
2015-02-26 01:32:51 +00:00
|
|
|
|
|
|
|
private int type;
|
|
|
|
private int currentPasswordType = 0;
|
2015-09-24 20:52:02 +00:00
|
|
|
private int passcodeSetStep = 0;
|
2015-02-26 01:32:51 +00:00
|
|
|
private String firstPassword;
|
|
|
|
|
|
|
|
private int passcodeRow;
|
|
|
|
private int changePasscodeRow;
|
|
|
|
private int passcodeDetailRow;
|
2017-03-30 23:58:05 +00:00
|
|
|
private int captureRow;
|
|
|
|
private int captureDetailRow;
|
2015-10-29 17:10:07 +00:00
|
|
|
private int fingerprintRow;
|
2015-02-26 01:32:51 +00:00
|
|
|
private int autoLockRow;
|
|
|
|
private int autoLockDetailRow;
|
|
|
|
private int rowCount;
|
|
|
|
|
|
|
|
private final static int done_button = 1;
|
|
|
|
private final static int pin_item = 2;
|
|
|
|
private final static int password_item = 3;
|
|
|
|
|
|
|
|
public PasscodeActivity(int type) {
|
|
|
|
super();
|
|
|
|
this.type = type;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onFragmentCreate() {
|
|
|
|
super.onFragmentCreate();
|
|
|
|
updateRows();
|
|
|
|
if (type == 0) {
|
|
|
|
NotificationCenter.getInstance().addObserver(this, NotificationCenter.didSetPasscode);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFragmentDestroy() {
|
|
|
|
super.onFragmentDestroy();
|
|
|
|
if (type == 0) {
|
|
|
|
NotificationCenter.getInstance().removeObserver(this, NotificationCenter.didSetPasscode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-07-22 18:56:37 +00:00
|
|
|
public View createView(Context context) {
|
2015-04-09 18:00:14 +00:00
|
|
|
if (type != 3) {
|
|
|
|
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
|
|
|
}
|
|
|
|
actionBar.setAllowOverlayTitle(false);
|
|
|
|
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
|
|
|
@Override
|
|
|
|
public void onItemClick(int id) {
|
|
|
|
if (id == -1) {
|
|
|
|
finishFragment();
|
|
|
|
} else if (id == done_button) {
|
2015-09-24 20:52:02 +00:00
|
|
|
if (passcodeSetStep == 0) {
|
2015-04-09 18:00:14 +00:00
|
|
|
processNext();
|
2015-09-24 20:52:02 +00:00
|
|
|
} else if (passcodeSetStep == 1) {
|
2015-04-09 18:00:14 +00:00
|
|
|
processDone();
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2015-04-09 18:00:14 +00:00
|
|
|
} else if (id == pin_item) {
|
|
|
|
currentPasswordType = 0;
|
|
|
|
updateDropDownTextView();
|
|
|
|
} else if (id == password_item) {
|
|
|
|
currentPasswordType = 1;
|
|
|
|
updateDropDownTextView();
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2015-04-09 18:00:14 +00:00
|
|
|
}
|
|
|
|
});
|
2015-02-26 01:32:51 +00:00
|
|
|
|
2015-04-09 18:00:14 +00:00
|
|
|
fragmentView = new FrameLayout(context);
|
|
|
|
FrameLayout frameLayout = (FrameLayout) fragmentView;
|
2015-02-26 01:32:51 +00:00
|
|
|
|
2015-04-09 18:00:14 +00:00
|
|
|
if (type != 0) {
|
|
|
|
ActionBarMenu menu = actionBar.createMenu();
|
|
|
|
menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
|
2015-02-26 01:32:51 +00:00
|
|
|
|
2015-04-09 18:00:14 +00:00
|
|
|
titleTextView = new TextView(context);
|
2017-03-30 23:58:05 +00:00
|
|
|
titleTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText6));
|
2015-04-09 18:00:14 +00:00
|
|
|
if (type == 1) {
|
|
|
|
if (UserConfig.passcodeHash.length() != 0) {
|
2015-02-26 01:32:51 +00:00
|
|
|
titleTextView.setText(LocaleController.getString("EnterNewPasscode", R.string.EnterNewPasscode));
|
|
|
|
} else {
|
2015-04-09 18:00:14 +00:00
|
|
|
titleTextView.setText(LocaleController.getString("EnterNewFirstPasscode", R.string.EnterNewFirstPasscode));
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2015-04-09 18:00:14 +00:00
|
|
|
} else {
|
|
|
|
titleTextView.setText(LocaleController.getString("EnterCurrentPasscode", R.string.EnterCurrentPasscode));
|
|
|
|
}
|
|
|
|
titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
|
|
|
titleTextView.setGravity(Gravity.CENTER_HORIZONTAL);
|
2017-03-30 23:58:05 +00:00
|
|
|
frameLayout.addView(titleTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL, 0, 38, 0, 0));
|
2015-04-09 18:00:14 +00:00
|
|
|
|
2017-12-08 17:35:59 +00:00
|
|
|
passwordEditText = new EditTextBoldCursor(context);
|
2015-04-09 18:00:14 +00:00
|
|
|
passwordEditText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 20);
|
2017-03-30 23:58:05 +00:00
|
|
|
passwordEditText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
passwordEditText.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
|
2015-04-09 18:00:14 +00:00
|
|
|
passwordEditText.setMaxLines(1);
|
|
|
|
passwordEditText.setLines(1);
|
|
|
|
passwordEditText.setGravity(Gravity.CENTER_HORIZONTAL);
|
|
|
|
passwordEditText.setSingleLine(true);
|
|
|
|
if (type == 1) {
|
2015-09-24 20:52:02 +00:00
|
|
|
passcodeSetStep = 0;
|
2015-04-09 18:00:14 +00:00
|
|
|
passwordEditText.setImeOptions(EditorInfo.IME_ACTION_NEXT);
|
|
|
|
} else {
|
2015-09-24 20:52:02 +00:00
|
|
|
passcodeSetStep = 1;
|
2015-04-09 18:00:14 +00:00
|
|
|
passwordEditText.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
|
|
|
}
|
|
|
|
passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
|
|
|
|
passwordEditText.setTypeface(Typeface.DEFAULT);
|
2017-12-08 17:35:59 +00:00
|
|
|
passwordEditText.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
passwordEditText.setCursorSize(AndroidUtilities.dp(20));
|
|
|
|
passwordEditText.setCursorWidth(1.5f);
|
2017-03-30 23:58:05 +00:00
|
|
|
frameLayout.addView(passwordEditText, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 36, Gravity.TOP | Gravity.LEFT, 40, 90, 40, 0));
|
2015-04-09 18:00:14 +00:00
|
|
|
passwordEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
|
|
|
|
@Override
|
|
|
|
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
|
2015-09-24 20:52:02 +00:00
|
|
|
if (passcodeSetStep == 0) {
|
2015-04-09 18:00:14 +00:00
|
|
|
processNext();
|
|
|
|
return true;
|
2015-09-24 20:52:02 +00:00
|
|
|
} else if (passcodeSetStep == 1) {
|
2015-04-09 18:00:14 +00:00
|
|
|
processDone();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2015-04-09 18:00:14 +00:00
|
|
|
});
|
|
|
|
passwordEditText.addTextChangedListener(new TextWatcher() {
|
|
|
|
@Override
|
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void afterTextChanged(Editable s) {
|
|
|
|
if (passwordEditText.length() == 4) {
|
|
|
|
if (type == 2 && UserConfig.passcodeType == 0) {
|
2015-02-26 01:32:51 +00:00
|
|
|
processDone();
|
2015-04-09 18:00:14 +00:00
|
|
|
} else if (type == 1 && currentPasswordType == 0) {
|
2015-09-24 20:52:02 +00:00
|
|
|
if (passcodeSetStep == 0) {
|
2015-04-09 18:00:14 +00:00
|
|
|
processNext();
|
2015-09-24 20:52:02 +00:00
|
|
|
} else if (passcodeSetStep == 1) {
|
2015-04-09 18:00:14 +00:00
|
|
|
processDone();
|
|
|
|
}
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2015-04-09 18:00:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2015-02-26 01:32:51 +00:00
|
|
|
|
2016-06-24 10:27:15 +00:00
|
|
|
passwordEditText.setCustomSelectionActionModeCallback(new ActionMode.Callback() {
|
|
|
|
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
|
|
|
|
return false;
|
|
|
|
}
|
2015-02-26 01:32:51 +00:00
|
|
|
|
2016-06-24 10:27:15 +00:00
|
|
|
public void onDestroyActionMode(ActionMode mode) {
|
|
|
|
}
|
2015-02-26 01:32:51 +00:00
|
|
|
|
2016-06-24 10:27:15 +00:00
|
|
|
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2015-02-26 01:32:51 +00:00
|
|
|
|
2015-04-09 18:00:14 +00:00
|
|
|
if (type == 1) {
|
2017-03-30 23:58:05 +00:00
|
|
|
frameLayout.setTag(Theme.key_windowBackgroundWhite);
|
|
|
|
dropDownContainer = new ActionBarMenuItem(context, menu, 0, 0);
|
2015-04-09 18:00:14 +00:00
|
|
|
dropDownContainer.setSubMenuOpenSide(1);
|
2017-03-30 23:58:05 +00:00
|
|
|
dropDownContainer.addSubItem(pin_item, LocaleController.getString("PasscodePIN", R.string.PasscodePIN));
|
|
|
|
dropDownContainer.addSubItem(password_item, LocaleController.getString("PasscodePassword", R.string.PasscodePassword));
|
|
|
|
actionBar.addView(dropDownContainer, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, AndroidUtilities.isTablet() ? 64 : 56, 0, 40, 0));
|
2015-04-09 18:00:14 +00:00
|
|
|
dropDownContainer.setOnClickListener(new View.OnClickListener() {
|
2015-02-26 01:32:51 +00:00
|
|
|
@Override
|
2015-04-09 18:00:14 +00:00
|
|
|
public void onClick(View view) {
|
|
|
|
dropDownContainer.toggleSubMenu();
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-04-09 18:00:14 +00:00
|
|
|
dropDown = new TextView(context);
|
|
|
|
dropDown.setGravity(Gravity.LEFT);
|
|
|
|
dropDown.setSingleLine(true);
|
|
|
|
dropDown.setLines(1);
|
|
|
|
dropDown.setMaxLines(1);
|
|
|
|
dropDown.setEllipsize(TextUtils.TruncateAt.END);
|
2017-03-30 23:58:05 +00:00
|
|
|
dropDown.setTextColor(Theme.getColor(Theme.key_actionBarDefaultTitle));
|
2015-04-09 18:00:14 +00:00
|
|
|
dropDown.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
2017-03-30 23:58:05 +00:00
|
|
|
dropDownDrawable = context.getResources().getDrawable(R.drawable.ic_arrow_drop_down).mutate();
|
|
|
|
dropDownDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_actionBarDefaultTitle), PorterDuff.Mode.MULTIPLY));
|
|
|
|
dropDown.setCompoundDrawablesWithIntrinsicBounds(null, null, dropDownDrawable, null);
|
2015-04-09 18:00:14 +00:00
|
|
|
dropDown.setCompoundDrawablePadding(AndroidUtilities.dp(4));
|
|
|
|
dropDown.setPadding(0, 0, AndroidUtilities.dp(10), 0);
|
2017-03-30 23:58:05 +00:00
|
|
|
dropDownContainer.addView(dropDown, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, 16, 0, 0, 1));
|
2015-04-09 18:00:14 +00:00
|
|
|
} else {
|
|
|
|
actionBar.setTitle(LocaleController.getString("Passcode", R.string.Passcode));
|
|
|
|
}
|
2015-02-26 01:32:51 +00:00
|
|
|
|
2015-04-09 18:00:14 +00:00
|
|
|
updateDropDownTextView();
|
|
|
|
} else {
|
|
|
|
actionBar.setTitle(LocaleController.getString("Passcode", R.string.Passcode));
|
2017-03-30 23:58:05 +00:00
|
|
|
frameLayout.setTag(Theme.key_windowBackgroundGray);
|
|
|
|
frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
|
|
|
|
listView = new RecyclerListView(context);
|
|
|
|
listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) {
|
|
|
|
@Override
|
|
|
|
public boolean supportsPredictiveItemAnimations() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2015-04-09 18:00:14 +00:00
|
|
|
listView.setVerticalScrollBarEnabled(false);
|
2017-03-30 23:58:05 +00:00
|
|
|
listView.setItemAnimator(null);
|
|
|
|
listView.setLayoutAnimation(null);
|
|
|
|
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
|
2015-04-09 18:00:14 +00:00
|
|
|
listView.setAdapter(listAdapter = new ListAdapter(context));
|
2017-03-30 23:58:05 +00:00
|
|
|
listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
|
2015-04-09 18:00:14 +00:00
|
|
|
@Override
|
2017-03-30 23:58:05 +00:00
|
|
|
public void onItemClick(View view, final int position) {
|
|
|
|
if (!view.isEnabled()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (position == changePasscodeRow) {
|
2015-04-09 18:00:14 +00:00
|
|
|
presentFragment(new PasscodeActivity(1));
|
2017-03-30 23:58:05 +00:00
|
|
|
} else if (position == passcodeRow) {
|
2015-04-09 18:00:14 +00:00
|
|
|
TextCheckCell cell = (TextCheckCell) view;
|
|
|
|
if (UserConfig.passcodeHash.length() != 0) {
|
|
|
|
UserConfig.passcodeHash = "";
|
|
|
|
UserConfig.appLocked = false;
|
|
|
|
UserConfig.saveConfig(false);
|
|
|
|
int count = listView.getChildCount();
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
View child = listView.getChildAt(a);
|
|
|
|
if (child instanceof TextSettingsCell) {
|
|
|
|
TextSettingsCell textCell = (TextSettingsCell) child;
|
2017-03-30 23:58:05 +00:00
|
|
|
textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText7));
|
2015-04-09 18:00:14 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cell.setChecked(UserConfig.passcodeHash.length() != 0);
|
|
|
|
NotificationCenter.getInstance().postNotificationName(NotificationCenter.didSetPasscode);
|
|
|
|
} else {
|
|
|
|
presentFragment(new PasscodeActivity(1));
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2017-03-30 23:58:05 +00:00
|
|
|
} else if (position == autoLockRow) {
|
2015-04-09 18:00:14 +00:00
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2015-04-09 18:00:14 +00:00
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder.setTitle(LocaleController.getString("AutoLock", R.string.AutoLock));
|
|
|
|
final NumberPicker numberPicker = new NumberPicker(getParentActivity());
|
|
|
|
numberPicker.setMinValue(0);
|
|
|
|
numberPicker.setMaxValue(4);
|
|
|
|
if (UserConfig.autoLockIn == 0) {
|
|
|
|
numberPicker.setValue(0);
|
|
|
|
} else if (UserConfig.autoLockIn == 60) {
|
|
|
|
numberPicker.setValue(1);
|
|
|
|
} else if (UserConfig.autoLockIn == 60 * 5) {
|
|
|
|
numberPicker.setValue(2);
|
|
|
|
} else if (UserConfig.autoLockIn == 60 * 60) {
|
|
|
|
numberPicker.setValue(3);
|
|
|
|
} else if (UserConfig.autoLockIn == 60 * 60 * 5) {
|
|
|
|
numberPicker.setValue(4);
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2015-04-09 18:00:14 +00:00
|
|
|
numberPicker.setFormatter(new NumberPicker.Formatter() {
|
|
|
|
@Override
|
|
|
|
public String format(int value) {
|
|
|
|
if (value == 0) {
|
2016-04-22 13:49:00 +00:00
|
|
|
return LocaleController.getString("AutoLockDisabled", R.string.AutoLockDisabled);
|
2015-04-09 18:00:14 +00:00
|
|
|
} else if (value == 1) {
|
|
|
|
return LocaleController.formatString("AutoLockInTime", R.string.AutoLockInTime, LocaleController.formatPluralString("Minutes", 1));
|
|
|
|
} else if (value == 2) {
|
|
|
|
return LocaleController.formatString("AutoLockInTime", R.string.AutoLockInTime, LocaleController.formatPluralString("Minutes", 5));
|
|
|
|
} else if (value == 3) {
|
|
|
|
return LocaleController.formatString("AutoLockInTime", R.string.AutoLockInTime, LocaleController.formatPluralString("Hours", 1));
|
|
|
|
} else if (value == 4) {
|
|
|
|
return LocaleController.formatString("AutoLockInTime", R.string.AutoLockInTime, LocaleController.formatPluralString("Hours", 5));
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2015-04-09 18:00:14 +00:00
|
|
|
return "";
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2015-04-09 18:00:14 +00:00
|
|
|
});
|
|
|
|
builder.setView(numberPicker);
|
|
|
|
builder.setNegativeButton(LocaleController.getString("Done", R.string.Done), new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
which = numberPicker.getValue();
|
|
|
|
if (which == 0) {
|
|
|
|
UserConfig.autoLockIn = 0;
|
|
|
|
} else if (which == 1) {
|
|
|
|
UserConfig.autoLockIn = 60;
|
|
|
|
} else if (which == 2) {
|
|
|
|
UserConfig.autoLockIn = 60 * 5;
|
|
|
|
} else if (which == 3) {
|
|
|
|
UserConfig.autoLockIn = 60 * 60;
|
|
|
|
} else if (which == 4) {
|
|
|
|
UserConfig.autoLockIn = 60 * 60 * 5;
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2017-03-30 23:58:05 +00:00
|
|
|
listAdapter.notifyItemChanged(position);
|
2015-04-09 18:00:14 +00:00
|
|
|
UserConfig.saveConfig(false);
|
|
|
|
}
|
|
|
|
});
|
2015-05-21 21:27:27 +00:00
|
|
|
showDialog(builder.create());
|
2017-03-30 23:58:05 +00:00
|
|
|
} else if (position == fingerprintRow) {
|
2015-10-29 17:10:07 +00:00
|
|
|
UserConfig.useFingerprint = !UserConfig.useFingerprint;
|
|
|
|
UserConfig.saveConfig(false);
|
|
|
|
((TextCheckCell) view).setChecked(UserConfig.useFingerprint);
|
2017-03-30 23:58:05 +00:00
|
|
|
} else if (position == captureRow) {
|
|
|
|
UserConfig.allowScreenCapture = !UserConfig.allowScreenCapture;
|
|
|
|
UserConfig.saveConfig(false);
|
|
|
|
((TextCheckCell) view).setChecked(UserConfig.allowScreenCapture);
|
|
|
|
NotificationCenter.getInstance().postNotificationName(NotificationCenter.didSetPasscode);
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2015-04-09 18:00:14 +00:00
|
|
|
}
|
|
|
|
});
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2015-04-09 18:00:14 +00:00
|
|
|
|
2015-02-26 01:32:51 +00:00
|
|
|
return fragmentView;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
if (listAdapter != null) {
|
|
|
|
listAdapter.notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
if (type != 0) {
|
|
|
|
AndroidUtilities.runOnUIThread(new Runnable() {
|
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
if (passwordEditText != null) {
|
|
|
|
passwordEditText.requestFocus();
|
|
|
|
AndroidUtilities.showKeyboard(passwordEditText);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 200);
|
|
|
|
}
|
|
|
|
fixLayoutInternal();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void didReceivedNotification(int id, Object... args) {
|
|
|
|
if (id == NotificationCenter.didSetPasscode) {
|
|
|
|
if (type == 0) {
|
|
|
|
updateRows();
|
|
|
|
if (listAdapter != null) {
|
|
|
|
listAdapter.notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updateRows() {
|
|
|
|
rowCount = 0;
|
|
|
|
passcodeRow = rowCount++;
|
|
|
|
changePasscodeRow = rowCount++;
|
|
|
|
passcodeDetailRow = rowCount++;
|
|
|
|
if (UserConfig.passcodeHash.length() > 0) {
|
2015-10-29 17:10:07 +00:00
|
|
|
try {
|
|
|
|
if (Build.VERSION.SDK_INT >= 23) {
|
|
|
|
FingerprintManagerCompat fingerprintManager = FingerprintManagerCompat.from(ApplicationLoader.applicationContext);
|
|
|
|
if (fingerprintManager.isHardwareDetected()) {
|
|
|
|
fingerprintRow = rowCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (Throwable e) {
|
2017-03-30 23:58:05 +00:00
|
|
|
FileLog.e(e);
|
2015-10-29 17:10:07 +00:00
|
|
|
}
|
2015-02-26 01:32:51 +00:00
|
|
|
autoLockRow = rowCount++;
|
|
|
|
autoLockDetailRow = rowCount++;
|
2017-03-30 23:58:05 +00:00
|
|
|
captureRow = rowCount++;
|
|
|
|
captureDetailRow = rowCount++;
|
2015-02-26 01:32:51 +00:00
|
|
|
} else {
|
2017-03-30 23:58:05 +00:00
|
|
|
captureRow = -1;
|
|
|
|
captureDetailRow = -1;
|
2015-10-29 17:10:07 +00:00
|
|
|
fingerprintRow = -1;
|
2015-02-26 01:32:51 +00:00
|
|
|
autoLockRow = -1;
|
|
|
|
autoLockDetailRow = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onConfigurationChanged(android.content.res.Configuration newConfig) {
|
|
|
|
super.onConfigurationChanged(newConfig);
|
|
|
|
if (listView != null) {
|
|
|
|
ViewTreeObserver obs = listView.getViewTreeObserver();
|
|
|
|
obs.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
|
|
|
|
@Override
|
|
|
|
public boolean onPreDraw() {
|
|
|
|
listView.getViewTreeObserver().removeOnPreDrawListener(this);
|
|
|
|
fixLayoutInternal();
|
2015-06-29 17:12:11 +00:00
|
|
|
return true;
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-10-29 17:10:07 +00:00
|
|
|
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
|
|
|
|
if (isOpen && type != 0) {
|
2015-02-26 01:32:51 +00:00
|
|
|
AndroidUtilities.showKeyboard(passwordEditText);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updateDropDownTextView() {
|
|
|
|
if (dropDown != null) {
|
|
|
|
if (currentPasswordType == 0) {
|
|
|
|
dropDown.setText(LocaleController.getString("PasscodePIN", R.string.PasscodePIN));
|
|
|
|
} else if (currentPasswordType == 1) {
|
|
|
|
dropDown.setText(LocaleController.getString("PasscodePassword", R.string.PasscodePassword));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (type == 1 && currentPasswordType == 0 || type == 2 && UserConfig.passcodeType == 0) {
|
|
|
|
InputFilter[] filterArray = new InputFilter[1];
|
|
|
|
filterArray[0] = new InputFilter.LengthFilter(4);
|
|
|
|
passwordEditText.setFilters(filterArray);
|
|
|
|
passwordEditText.setInputType(InputType.TYPE_CLASS_PHONE);
|
2015-02-26 14:36:15 +00:00
|
|
|
passwordEditText.setKeyListener(DigitsKeyListener.getInstance("1234567890"));
|
2015-02-26 01:32:51 +00:00
|
|
|
} else if (type == 1 && currentPasswordType == 1 || type == 2 && UserConfig.passcodeType == 1) {
|
|
|
|
passwordEditText.setFilters(new InputFilter[0]);
|
|
|
|
passwordEditText.setKeyListener(null);
|
|
|
|
passwordEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
|
|
|
}
|
|
|
|
passwordEditText.setTransformationMethod(PasswordTransformationMethod.getInstance());
|
|
|
|
}
|
|
|
|
|
|
|
|
private void processNext() {
|
|
|
|
if (passwordEditText.getText().length() == 0 || currentPasswordType == 0 && passwordEditText.getText().length() != 4) {
|
|
|
|
onPasscodeError();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (currentPasswordType == 0) {
|
|
|
|
actionBar.setTitle(LocaleController.getString("PasscodePIN", R.string.PasscodePIN));
|
|
|
|
} else {
|
|
|
|
actionBar.setTitle(LocaleController.getString("PasscodePassword", R.string.PasscodePassword));
|
|
|
|
}
|
|
|
|
dropDownContainer.setVisibility(View.GONE);
|
|
|
|
titleTextView.setText(LocaleController.getString("ReEnterYourPasscode", R.string.ReEnterYourPasscode));
|
|
|
|
firstPassword = passwordEditText.getText().toString();
|
|
|
|
passwordEditText.setText("");
|
2015-09-24 20:52:02 +00:00
|
|
|
passcodeSetStep = 1;
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void processDone() {
|
|
|
|
if (passwordEditText.getText().length() == 0) {
|
|
|
|
onPasscodeError();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (type == 1) {
|
|
|
|
if (!firstPassword.equals(passwordEditText.getText().toString())) {
|
|
|
|
try {
|
|
|
|
Toast.makeText(getParentActivity(), LocaleController.getString("PasscodeDoNotMatch", R.string.PasscodeDoNotMatch), Toast.LENGTH_SHORT).show();
|
|
|
|
} catch (Exception e) {
|
2017-03-30 23:58:05 +00:00
|
|
|
FileLog.e(e);
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2015-09-24 20:52:02 +00:00
|
|
|
AndroidUtilities.shakeView(titleTextView, 2, 0);
|
2015-02-26 01:32:51 +00:00
|
|
|
passwordEditText.setText("");
|
|
|
|
return;
|
|
|
|
}
|
2015-05-21 21:27:27 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
UserConfig.passcodeSalt = new byte[16];
|
|
|
|
Utilities.random.nextBytes(UserConfig.passcodeSalt);
|
|
|
|
byte[] passcodeBytes = firstPassword.getBytes("UTF-8");
|
|
|
|
byte[] bytes = new byte[32 + passcodeBytes.length];
|
|
|
|
System.arraycopy(UserConfig.passcodeSalt, 0, bytes, 0, 16);
|
|
|
|
System.arraycopy(passcodeBytes, 0, bytes, 16, passcodeBytes.length);
|
|
|
|
System.arraycopy(UserConfig.passcodeSalt, 0, bytes, passcodeBytes.length + 16, 16);
|
|
|
|
UserConfig.passcodeHash = Utilities.bytesToHex(Utilities.computeSHA256(bytes, 0, bytes.length));
|
|
|
|
} catch (Exception e) {
|
2017-03-30 23:58:05 +00:00
|
|
|
FileLog.e(e);
|
2015-05-21 21:27:27 +00:00
|
|
|
}
|
|
|
|
|
2015-02-26 01:32:51 +00:00
|
|
|
UserConfig.passcodeType = currentPasswordType;
|
|
|
|
UserConfig.saveConfig(false);
|
|
|
|
finishFragment();
|
|
|
|
NotificationCenter.getInstance().postNotificationName(NotificationCenter.didSetPasscode);
|
|
|
|
passwordEditText.clearFocus();
|
|
|
|
AndroidUtilities.hideKeyboard(passwordEditText);
|
|
|
|
} else if (type == 2) {
|
2015-05-21 21:27:27 +00:00
|
|
|
if (!UserConfig.checkPasscode(passwordEditText.getText().toString())) {
|
2015-02-26 01:32:51 +00:00
|
|
|
passwordEditText.setText("");
|
|
|
|
onPasscodeError();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
passwordEditText.clearFocus();
|
|
|
|
AndroidUtilities.hideKeyboard(passwordEditText);
|
|
|
|
presentFragment(new PasscodeActivity(0), true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void onPasscodeError() {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Vibrator v = (Vibrator) getParentActivity().getSystemService(Context.VIBRATOR_SERVICE);
|
|
|
|
if (v != null) {
|
|
|
|
v.vibrate(200);
|
|
|
|
}
|
2015-09-24 20:52:02 +00:00
|
|
|
AndroidUtilities.shakeView(titleTextView, 2, 0);
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private void fixLayoutInternal() {
|
|
|
|
if (dropDownContainer != null) {
|
|
|
|
if (!AndroidUtilities.isTablet()) {
|
|
|
|
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) dropDownContainer.getLayoutParams();
|
|
|
|
layoutParams.topMargin = (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0);
|
|
|
|
dropDownContainer.setLayoutParams(layoutParams);
|
|
|
|
}
|
|
|
|
if (!AndroidUtilities.isTablet() && ApplicationLoader.applicationContext.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
|
|
|
dropDown.setTextSize(18);
|
|
|
|
} else {
|
|
|
|
dropDown.setTextSize(20);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-30 23:58:05 +00:00
|
|
|
private class ListAdapter extends RecyclerListView.SelectionAdapter {
|
|
|
|
|
2015-02-26 01:32:51 +00:00
|
|
|
private Context mContext;
|
|
|
|
|
|
|
|
public ListAdapter(Context context) {
|
|
|
|
mContext = context;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-03-30 23:58:05 +00:00
|
|
|
public boolean isEnabled(RecyclerView.ViewHolder holder) {
|
|
|
|
int position = holder.getAdapterPosition();
|
|
|
|
return position == passcodeRow || position == fingerprintRow || position == autoLockRow || position == captureRow || UserConfig.passcodeHash.length() != 0 && position == changePasscodeRow;
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-03-30 23:58:05 +00:00
|
|
|
public int getItemCount() {
|
2015-02-26 01:32:51 +00:00
|
|
|
return rowCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-03-30 23:58:05 +00:00
|
|
|
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
|
|
View view;
|
|
|
|
switch (viewType) {
|
|
|
|
case 0:
|
|
|
|
view = new TextCheckCell(mContext);
|
|
|
|
view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
view = new TextSettingsCell(mContext);
|
|
|
|
view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
default:
|
|
|
|
view = new TextInfoPrivacyCell(mContext);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return new RecyclerListView.Holder(view);
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-03-30 23:58:05 +00:00
|
|
|
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
|
|
|
switch (holder.getItemViewType()) {
|
|
|
|
case 0: {
|
|
|
|
TextCheckCell textCell = (TextCheckCell) holder.itemView;
|
|
|
|
if (position == passcodeRow) {
|
|
|
|
textCell.setTextAndCheck(LocaleController.getString("Passcode", R.string.Passcode), UserConfig.passcodeHash.length() > 0, true);
|
|
|
|
} else if (position == fingerprintRow) {
|
|
|
|
textCell.setTextAndCheck(LocaleController.getString("UnlockFingerprint", R.string.UnlockFingerprint), UserConfig.useFingerprint, true);
|
|
|
|
} else if (position == captureRow) {
|
|
|
|
textCell.setTextAndCheck(LocaleController.getString("ScreenCapture", R.string.ScreenCapture), UserConfig.allowScreenCapture, false);
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2017-03-30 23:58:05 +00:00
|
|
|
break;
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2017-03-30 23:58:05 +00:00
|
|
|
case 1: {
|
|
|
|
TextSettingsCell textCell = (TextSettingsCell) holder.itemView;
|
|
|
|
if (position == changePasscodeRow) {
|
|
|
|
textCell.setText(LocaleController.getString("ChangePasscode", R.string.ChangePasscode), false);
|
|
|
|
if (UserConfig.passcodeHash.length() == 0) {
|
|
|
|
textCell.setTag(Theme.key_windowBackgroundWhiteGrayText7);
|
|
|
|
textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText7));
|
|
|
|
} else {
|
|
|
|
textCell.setTag(Theme.key_windowBackgroundWhiteBlackText);
|
|
|
|
textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
}
|
|
|
|
} else if (position == autoLockRow) {
|
|
|
|
String val;
|
|
|
|
if (UserConfig.autoLockIn == 0) {
|
|
|
|
val = LocaleController.formatString("AutoLockDisabled", R.string.AutoLockDisabled);
|
|
|
|
} else if (UserConfig.autoLockIn < 60 * 60) {
|
|
|
|
val = LocaleController.formatString("AutoLockInTime", R.string.AutoLockInTime, LocaleController.formatPluralString("Minutes", UserConfig.autoLockIn / 60));
|
|
|
|
} else if (UserConfig.autoLockIn < 60 * 60 * 24) {
|
|
|
|
val = LocaleController.formatString("AutoLockInTime", R.string.AutoLockInTime, LocaleController.formatPluralString("Hours", (int) Math.ceil(UserConfig.autoLockIn / 60.0f / 60)));
|
|
|
|
} else {
|
|
|
|
val = LocaleController.formatString("AutoLockInTime", R.string.AutoLockInTime, LocaleController.formatPluralString("Days", (int) Math.ceil(UserConfig.autoLockIn / 60.0f / 60 / 24)));
|
|
|
|
}
|
|
|
|
textCell.setTextAndValue(LocaleController.getString("AutoLock", R.string.AutoLock), val, true);
|
|
|
|
textCell.setTag(Theme.key_windowBackgroundWhiteBlackText);
|
|
|
|
textCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
}
|
|
|
|
break;
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2017-03-30 23:58:05 +00:00
|
|
|
case 2: {
|
|
|
|
TextInfoPrivacyCell cell = (TextInfoPrivacyCell) holder.itemView;
|
|
|
|
if (position == passcodeDetailRow) {
|
|
|
|
cell.setText(LocaleController.getString("ChangePasscodeInfo", R.string.ChangePasscodeInfo));
|
|
|
|
if (autoLockDetailRow != -1) {
|
|
|
|
cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
|
|
|
|
} else {
|
|
|
|
cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
|
|
|
|
}
|
|
|
|
} else if (position == autoLockDetailRow) {
|
|
|
|
cell.setText(LocaleController.getString("AutoLockInfo", R.string.AutoLockInfo));
|
|
|
|
cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
|
|
|
|
} else if (position == captureDetailRow) {
|
|
|
|
cell.setText(LocaleController.getString("ScreenCaptureInfo", R.string.ScreenCaptureInfo));
|
|
|
|
cell.setBackgroundDrawable(Theme.getThemedDrawable(mContext, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
2017-03-30 23:58:05 +00:00
|
|
|
break;
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-03-30 23:58:05 +00:00
|
|
|
public int getItemViewType(int position) {
|
|
|
|
if (position == passcodeRow || position == fingerprintRow || position == captureRow) {
|
2015-02-26 01:32:51 +00:00
|
|
|
return 0;
|
2017-03-30 23:58:05 +00:00
|
|
|
} else if (position == changePasscodeRow || position == autoLockRow) {
|
2015-02-26 01:32:51 +00:00
|
|
|
return 1;
|
2017-03-30 23:58:05 +00:00
|
|
|
} else if (position == passcodeDetailRow || position == autoLockDetailRow || position == captureDetailRow) {
|
2015-02-26 01:32:51 +00:00
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2017-03-30 23:58:05 +00:00
|
|
|
}
|
2015-02-26 01:32:51 +00:00
|
|
|
|
2017-03-30 23:58:05 +00:00
|
|
|
@Override
|
|
|
|
public ThemeDescription[] getThemeDescriptions() {
|
|
|
|
return new ThemeDescription[]{
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{TextCheckCell.class, TextSettingsCell.class}, null, null, null, Theme.key_windowBackgroundWhite),
|
|
|
|
new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND | ThemeDescription.FLAG_CHECKTAG, null, null, null, null, Theme.key_windowBackgroundWhite),
|
|
|
|
new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND | ThemeDescription.FLAG_CHECKTAG, null, null, null, null, Theme.key_windowBackgroundGray),
|
|
|
|
|
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault),
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault),
|
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon),
|
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle),
|
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector),
|
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUBACKGROUND, null, null, null, null, Theme.key_actionBarDefaultSubmenuBackground),
|
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM, null, null, null, null, Theme.key_actionBarDefaultSubmenuItem),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{View.class}, Theme.dividerPaint, null, null, Theme.key_divider),
|
|
|
|
|
|
|
|
new ThemeDescription(titleTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText6),
|
|
|
|
new ThemeDescription(passwordEditText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText),
|
|
|
|
new ThemeDescription(passwordEditText, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField),
|
|
|
|
new ThemeDescription(passwordEditText, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated),
|
|
|
|
new ThemeDescription(dropDown, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle),
|
|
|
|
new ThemeDescription(dropDown, 0, null, null, new Drawable[]{dropDownDrawable}, null, Theme.key_actionBarDefaultTitle),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextCheckCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchThumb),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchTrack),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchThumbChecked),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchTrackChecked),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextSettingsCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText),
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextSettingsCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText7),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextSettingsCell.class}, new String[]{"valueTextView"}, null, null, null, Theme.key_windowBackgroundWhiteValueText),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{TextInfoPrivacyCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText4),
|
|
|
|
};
|
2015-02-26 01:32:51 +00:00
|
|
|
}
|
|
|
|
}
|