mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-08-13 17:03:49 -04:00
exchanged password font (now Adobe SourceCodePro-Regular)
added possibility to use Yubikey NEO with Static Password mode (requires to have PasswordActivity open with a non OTP-mode)
This commit is contained in:
parent
780007dd60
commit
6b4d31aa44
@ -0,0 +1,38 @@
|
|||||||
|
package keepass2android.yubiclip.scancode;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by dain on 2/17/14.
|
||||||
|
*/
|
||||||
|
public abstract class KeyboardLayout {
|
||||||
|
private static final Map<String, KeyboardLayout> layouts = new HashMap<String, KeyboardLayout>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
layouts.put("US", new USKeyboardLayout());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static KeyboardLayout forName(String name) {
|
||||||
|
return layouts.get(name.toUpperCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Set<String> availableLayouts() {
|
||||||
|
return new TreeSet<String>(layouts.keySet());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static final int SHIFT = 0x80;
|
||||||
|
|
||||||
|
protected abstract String fromScanCode(int code);
|
||||||
|
|
||||||
|
public final String fromScanCodes(byte[] bytes) {
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
for (byte b : bytes) {
|
||||||
|
buf.append(fromScanCode(b & 0xff));
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,141 @@
|
|||||||
|
package keepass2android.yubiclip.scancode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by dain on 2/17/14.
|
||||||
|
*/
|
||||||
|
public class USKeyboardLayout extends KeyboardLayout {
|
||||||
|
private static final String[] usb2key1 = new String[]{
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"a",
|
||||||
|
"b",
|
||||||
|
"c",
|
||||||
|
"d",
|
||||||
|
"e",
|
||||||
|
"f",
|
||||||
|
"g", /* 0xa */
|
||||||
|
"h",
|
||||||
|
"i",
|
||||||
|
"j",
|
||||||
|
"k",
|
||||||
|
"l",
|
||||||
|
"m",
|
||||||
|
"n",
|
||||||
|
"o",
|
||||||
|
"p",
|
||||||
|
"q", /* 0x14 */
|
||||||
|
"r",
|
||||||
|
"s",
|
||||||
|
"t",
|
||||||
|
"u",
|
||||||
|
"v",
|
||||||
|
"w",
|
||||||
|
"x",
|
||||||
|
"y",
|
||||||
|
"z",
|
||||||
|
"1", /* 0x1e */
|
||||||
|
"2",
|
||||||
|
"3",
|
||||||
|
"4",
|
||||||
|
"5",
|
||||||
|
"6",
|
||||||
|
"7",
|
||||||
|
"8",
|
||||||
|
"9",
|
||||||
|
"0",
|
||||||
|
"\n", /* 0x28 */
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"\t",
|
||||||
|
" ",
|
||||||
|
"-",
|
||||||
|
"=",
|
||||||
|
"[",
|
||||||
|
"]",
|
||||||
|
"",
|
||||||
|
"\\",
|
||||||
|
";",
|
||||||
|
"'",
|
||||||
|
"`",
|
||||||
|
",",
|
||||||
|
".",
|
||||||
|
"/", /* 0x38 */
|
||||||
|
};
|
||||||
|
private static final String[] usb2key2 = new String[]{
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"A",
|
||||||
|
"B",
|
||||||
|
"C",
|
||||||
|
"D",
|
||||||
|
"E",
|
||||||
|
"F",
|
||||||
|
"G", /* 0x8a */
|
||||||
|
"H",
|
||||||
|
"I",
|
||||||
|
"J",
|
||||||
|
"K",
|
||||||
|
"L",
|
||||||
|
"M",
|
||||||
|
"N",
|
||||||
|
"O",
|
||||||
|
"P",
|
||||||
|
"Q", /* 0x94 */
|
||||||
|
"R",
|
||||||
|
"S",
|
||||||
|
"T",
|
||||||
|
"U",
|
||||||
|
"V",
|
||||||
|
"W",
|
||||||
|
"X",
|
||||||
|
"Y",
|
||||||
|
"Z",
|
||||||
|
"!",
|
||||||
|
"@",
|
||||||
|
"#",
|
||||||
|
"$",
|
||||||
|
"%",
|
||||||
|
"^",
|
||||||
|
"&",
|
||||||
|
"*",
|
||||||
|
"(",
|
||||||
|
")",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"_",
|
||||||
|
"+",
|
||||||
|
"{",
|
||||||
|
"}",
|
||||||
|
"",
|
||||||
|
"|",
|
||||||
|
":",
|
||||||
|
"\"",
|
||||||
|
"~",
|
||||||
|
"<",
|
||||||
|
">",
|
||||||
|
"?",
|
||||||
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String fromScanCode(int code) {
|
||||||
|
if (code < SHIFT) {
|
||||||
|
if (code < usb2key1.length) {
|
||||||
|
return usb2key1[code];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
code = code ^ SHIFT;
|
||||||
|
if (code < usb2key2.length) {
|
||||||
|
return usb2key2[code];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
93
src/keepass2android/Assets/LICENSE_SourceCodePro.txt
Normal file
93
src/keepass2android/Assets/LICENSE_SourceCodePro.txt
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
|
||||||
|
|
||||||
|
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||||
|
|
||||||
|
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
|
||||||
|
|
||||||
|
|
||||||
|
-----------------------------------------------------------
|
||||||
|
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||||
|
-----------------------------------------------------------
|
||||||
|
|
||||||
|
PREAMBLE
|
||||||
|
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||||
|
development of collaborative font projects, to support the font creation
|
||||||
|
efforts of academic and linguistic communities, and to provide a free and
|
||||||
|
open framework in which fonts may be shared and improved in partnership
|
||||||
|
with others.
|
||||||
|
|
||||||
|
The OFL allows the licensed fonts to be used, studied, modified and
|
||||||
|
redistributed freely as long as they are not sold by themselves. The
|
||||||
|
fonts, including any derivative works, can be bundled, embedded,
|
||||||
|
redistributed and/or sold with any software provided that any reserved
|
||||||
|
names are not used by derivative works. The fonts and derivatives,
|
||||||
|
however, cannot be released under any other type of license. The
|
||||||
|
requirement for fonts to remain under this license does not apply
|
||||||
|
to any document created using the fonts or their derivatives.
|
||||||
|
|
||||||
|
DEFINITIONS
|
||||||
|
"Font Software" refers to the set of files released by the Copyright
|
||||||
|
Holder(s) under this license and clearly marked as such. This may
|
||||||
|
include source files, build scripts and documentation.
|
||||||
|
|
||||||
|
"Reserved Font Name" refers to any names specified as such after the
|
||||||
|
copyright statement(s).
|
||||||
|
|
||||||
|
"Original Version" refers to the collection of Font Software components as
|
||||||
|
distributed by the Copyright Holder(s).
|
||||||
|
|
||||||
|
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||||
|
or substituting -- in part or in whole -- any of the components of the
|
||||||
|
Original Version, by changing formats or by porting the Font Software to a
|
||||||
|
new environment.
|
||||||
|
|
||||||
|
"Author" refers to any designer, engineer, programmer, technical
|
||||||
|
writer or other person who contributed to the Font Software.
|
||||||
|
|
||||||
|
PERMISSION & CONDITIONS
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||||
|
redistribute, and sell modified and unmodified copies of the Font
|
||||||
|
Software, subject to the following conditions:
|
||||||
|
|
||||||
|
1) Neither the Font Software nor any of its individual components,
|
||||||
|
in Original or Modified Versions, may be sold by itself.
|
||||||
|
|
||||||
|
2) Original or Modified Versions of the Font Software may be bundled,
|
||||||
|
redistributed and/or sold with any software, provided that each copy
|
||||||
|
contains the above copyright notice and this license. These can be
|
||||||
|
included either as stand-alone text files, human-readable headers or
|
||||||
|
in the appropriate machine-readable metadata fields within text or
|
||||||
|
binary files as long as those fields can be easily viewed by the user.
|
||||||
|
|
||||||
|
3) No Modified Version of the Font Software may use the Reserved Font
|
||||||
|
Name(s) unless explicit written permission is granted by the corresponding
|
||||||
|
Copyright Holder. This restriction only applies to the primary font name as
|
||||||
|
presented to the users.
|
||||||
|
|
||||||
|
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||||
|
Software shall not be used to promote, endorse or advertise any
|
||||||
|
Modified Version, except to acknowledge the contribution(s) of the
|
||||||
|
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||||
|
permission.
|
||||||
|
|
||||||
|
5) The Font Software, modified or unmodified, in part or in whole,
|
||||||
|
must be distributed entirely under this license, and must not be
|
||||||
|
distributed under any other license. The requirement for fonts to
|
||||||
|
remain under this license does not apply to any document created
|
||||||
|
using the Font Software.
|
||||||
|
|
||||||
|
TERMINATION
|
||||||
|
This license becomes null and void if any of the above conditions are
|
||||||
|
not met.
|
||||||
|
|
||||||
|
DISCLAIMER
|
||||||
|
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||||
|
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||||
|
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||||
|
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||||
|
OTHER DEALINGS IN THE FONT SOFTWARE.
|
@ -1,99 +0,0 @@
|
|||||||
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
|
|
||||||
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
|
|
||||||
|
|
||||||
Bitstream Vera Fonts Copyright
|
|
||||||
------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is
|
|
||||||
a trademark of Bitstream, Inc.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of the fonts accompanying this license ("Fonts") and associated
|
|
||||||
documentation files (the "Font Software"), to reproduce and distribute the
|
|
||||||
Font Software, including without limitation the rights to use, copy, merge,
|
|
||||||
publish, distribute, and/or sell copies of the Font Software, and to permit
|
|
||||||
persons to whom the Font Software is furnished to do so, subject to the
|
|
||||||
following conditions:
|
|
||||||
|
|
||||||
The above copyright and trademark notices and this permission notice shall
|
|
||||||
be included in all copies of one or more of the Font Software typefaces.
|
|
||||||
|
|
||||||
The Font Software may be modified, altered, or added to, and in particular
|
|
||||||
the designs of glyphs or characters in the Fonts may be modified and
|
|
||||||
additional glyphs or characters may be added to the Fonts, only if the fonts
|
|
||||||
are renamed to names not containing either the words "Bitstream" or the word
|
|
||||||
"Vera".
|
|
||||||
|
|
||||||
This License becomes null and void to the extent applicable to Fonts or Font
|
|
||||||
Software that has been modified and is distributed under the "Bitstream
|
|
||||||
Vera" names.
|
|
||||||
|
|
||||||
The Font Software may be sold as part of a larger software package but no
|
|
||||||
copy of one or more of the Font Software typefaces may be sold by itself.
|
|
||||||
|
|
||||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,
|
|
||||||
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME
|
|
||||||
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING
|
|
||||||
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
|
|
||||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
||||||
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE
|
|
||||||
FONT SOFTWARE.
|
|
||||||
|
|
||||||
Except as contained in this notice, the names of Gnome, the Gnome
|
|
||||||
Foundation, and Bitstream Inc., shall not be used in advertising or
|
|
||||||
otherwise to promote the sale, use or other dealings in this Font Software
|
|
||||||
without prior written authorization from the Gnome Foundation or Bitstream
|
|
||||||
Inc., respectively. For further information, contact: fonts at gnome dot
|
|
||||||
org.
|
|
||||||
|
|
||||||
Arev Fonts Copyright
|
|
||||||
------------------------------
|
|
||||||
|
|
||||||
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
a copy of the fonts accompanying this license ("Fonts") and
|
|
||||||
associated documentation files (the "Font Software"), to reproduce
|
|
||||||
and distribute the modifications to the Bitstream Vera Font Software,
|
|
||||||
including without limitation the rights to use, copy, merge, publish,
|
|
||||||
distribute, and/or sell copies of the Font Software, and to permit
|
|
||||||
persons to whom the Font Software is furnished to do so, subject to
|
|
||||||
the following conditions:
|
|
||||||
|
|
||||||
The above copyright and trademark notices and this permission notice
|
|
||||||
shall be included in all copies of one or more of the Font Software
|
|
||||||
typefaces.
|
|
||||||
|
|
||||||
The Font Software may be modified, altered, or added to, and in
|
|
||||||
particular the designs of glyphs or characters in the Fonts may be
|
|
||||||
modified and additional glyphs or characters may be added to the
|
|
||||||
Fonts, only if the fonts are renamed to names not containing either
|
|
||||||
the words "Tavmjong Bah" or the word "Arev".
|
|
||||||
|
|
||||||
This License becomes null and void to the extent applicable to Fonts
|
|
||||||
or Font Software that has been modified and is distributed under the
|
|
||||||
"Tavmjong Bah Arev" names.
|
|
||||||
|
|
||||||
The Font Software may be sold as part of a larger software package but
|
|
||||||
no copy of one or more of the Font Software typefaces may be sold by
|
|
||||||
itself.
|
|
||||||
|
|
||||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
||||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
|
|
||||||
TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
||||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
||||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
||||||
|
|
||||||
Except as contained in this notice, the name of Tavmjong Bah shall not
|
|
||||||
be used in advertising or otherwise to promote the sale, use or other
|
|
||||||
dealings in this Font Software without prior written authorization
|
|
||||||
from Tavmjong Bah. For further information, contact: tavmjong @ free
|
|
||||||
. fr.
|
|
||||||
|
|
||||||
$Id: LICENSE 2133 2007-11-28 02:46:28Z lechimp $
|
|
BIN
src/keepass2android/Assets/SourceCodePro-Regular.ttf
Normal file
BIN
src/keepass2android/Assets/SourceCodePro-Regular.ttf
Normal file
Binary file not shown.
@ -816,7 +816,7 @@ namespace keepass2android
|
|||||||
{
|
{
|
||||||
if (_passwordFont == null)
|
if (_passwordFont == null)
|
||||||
{
|
{
|
||||||
_passwordFont = Typeface.CreateFromAsset(Assets, "DejaVuSansMono.ttf");
|
_passwordFont = Typeface.CreateFromAsset(Assets, "SourceCodePro-Regular.ttf");
|
||||||
}
|
}
|
||||||
textView.Typeface = _passwordFont;
|
textView.Typeface = _passwordFont;
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,12 @@ using System;
|
|||||||
using Android.App;
|
using Android.App;
|
||||||
using Android.Content;
|
using Android.Content;
|
||||||
using Android.Content.PM;
|
using Android.Content.PM;
|
||||||
|
using Android.Nfc;
|
||||||
using Android.OS;
|
using Android.OS;
|
||||||
using Android.Widget;
|
using Android.Widget;
|
||||||
|
using Java.Util;
|
||||||
using Java.Util.Regex;
|
using Java.Util.Regex;
|
||||||
|
using Keepass2android.Yubiclip.Scancode;
|
||||||
|
|
||||||
namespace keepass2android
|
namespace keepass2android
|
||||||
{
|
{
|
||||||
@ -31,11 +34,24 @@ namespace keepass2android
|
|||||||
String otp = matcher.Group(1);
|
String otp = matcher.Group(1);
|
||||||
return otp;
|
return otp;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IParcelable[] raw = Intent.GetParcelableArrayExtra(NfcAdapter.ExtraNdefMessages);
|
||||||
|
|
||||||
|
byte[] bytes = ((NdefMessage) raw[0]).ToByteArray();
|
||||||
|
bytes = Arrays.CopyOfRange(bytes, DATA_OFFSET, bytes.Length);
|
||||||
|
String layout = "US";
|
||||||
|
KeyboardLayout kbd = KeyboardLayout.ForName(layout);
|
||||||
|
String otp = kbd.FromScanCodes(bytes);
|
||||||
|
return otp;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static readonly Java.Util.Regex.Pattern OtpPattern = Java.Util.Regex.Pattern.Compile("^https://my\\.yubico\\.com/neo/(.+)$");
|
//private static readonly Java.Util.Regex.Pattern OtpPattern = Java.Util.Regex.Pattern.Compile("^https://my\\.yubico\\.com/neo/(.+)$");
|
||||||
|
private static readonly Java.Util.Regex.Pattern OtpPattern = Java.Util.Regex.Pattern.Compile("^https://my\\.yubico\\.com/neo/([a-zA-Z0-9!]+)$");
|
||||||
|
private const int DATA_OFFSET = 23;
|
||||||
|
|
||||||
private ActivityDesign _design;
|
private ActivityDesign _design;
|
||||||
|
|
||||||
|
@ -844,7 +844,7 @@ namespace keepass2android
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//user obviously wants to use OTP:
|
//assume user wants to use OTP (for static password, they need to open KP2A first and select the key provider type, then see OnNewIntent)
|
||||||
_keyFileOrProvider = KeyProviderIdOtp;
|
_keyFileOrProvider = KeyProviderIdOtp;
|
||||||
|
|
||||||
if (savedInstanceState == null) //only when not re-creating
|
if (savedInstanceState == null) //only when not re-creating
|
||||||
@ -1349,39 +1349,51 @@ namespace keepass2android
|
|||||||
if ((intent != null) && (intent.HasExtra(Intents.OtpExtraKey)))
|
if ((intent != null) && (intent.HasExtra(Intents.OtpExtraKey)))
|
||||||
{
|
{
|
||||||
string otp = intent.GetStringExtra(Intents.OtpExtraKey);
|
string otp = intent.GetStringExtra(Intents.OtpExtraKey);
|
||||||
_keepPasswordInOnResume = true;
|
|
||||||
if (_otpInfo == null)
|
if (this.KeyProviderType == KeyProviders.Otp)
|
||||||
{
|
{
|
||||||
//Entering OTPs not yet initialized:
|
_keepPasswordInOnResume = true;
|
||||||
_pendingOtps.Add(otp);
|
|
||||||
UpdateKeyProviderUiState();
|
if (_otpInfo == null)
|
||||||
|
{
|
||||||
|
//Entering OTPs not yet initialized:
|
||||||
|
_pendingOtps.Add(otp);
|
||||||
|
UpdateKeyProviderUiState();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Entering OTPs is initialized. Write OTP into first empty field:
|
||||||
|
bool foundEmptyField = false;
|
||||||
|
foreach (int otpId in _otpTextViewIds)
|
||||||
|
{
|
||||||
|
EditText otpEdit = FindViewById<EditText>(otpId);
|
||||||
|
if ((otpEdit.Visibility == ViewStates.Visible) && String.IsNullOrEmpty(otpEdit.Text))
|
||||||
|
{
|
||||||
|
otpEdit.Text = otp;
|
||||||
|
foundEmptyField = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//did we find a field?
|
||||||
|
if (!foundEmptyField)
|
||||||
|
{
|
||||||
|
Toast.MakeText(this, GetString(Resource.String.otp_discarded_no_space), ToastLength.Long).Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Spinner passwordModeSpinner = FindViewById<Spinner>(Resource.Id.password_mode_spinner);
|
||||||
|
if (passwordModeSpinner.SelectedItemPosition != (int)KeyProviders.Otp)
|
||||||
|
{
|
||||||
|
passwordModeSpinner.SetSelection((int)KeyProviders.Otp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Entering OTPs is initialized. Write OTP into first empty field:
|
//assume the key should be used as static password
|
||||||
bool foundEmptyField = false;
|
FindViewById<EditText>(Resource.Id.password).Text += otp;
|
||||||
foreach (int otpId in _otpTextViewIds)
|
|
||||||
{
|
|
||||||
EditText otpEdit = FindViewById<EditText>(otpId);
|
|
||||||
if ((otpEdit.Visibility == ViewStates.Visible) && String.IsNullOrEmpty(otpEdit.Text))
|
|
||||||
{
|
|
||||||
otpEdit.Text = otp;
|
|
||||||
foundEmptyField = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//did we find a field?
|
|
||||||
if (!foundEmptyField)
|
|
||||||
{
|
|
||||||
Toast.MakeText(this, GetString(Resource.String.otp_discarded_no_space), ToastLength.Long).Show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Spinner passwordModeSpinner = FindViewById<Spinner>(Resource.Id.password_mode_spinner);
|
|
||||||
if (passwordModeSpinner.SelectedItemPosition != (int) KeyProviders.Otp)
|
|
||||||
{
|
|
||||||
passwordModeSpinner.SetSelection((int)KeyProviders.Otp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -222,8 +222,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\xml\searchable.xml" />
|
<AndroidResource Include="Resources\xml\searchable.xml" />
|
||||||
<AndroidAsset Include="Assets\fontawesome-webfont.ttf" />
|
<AndroidAsset Include="Assets\fontawesome-webfont.ttf" />
|
||||||
<AndroidAsset Include="Assets\DejaVuSansMono.ttf" />
|
<AndroidAsset Include="Assets\SourceCodePro-Regular.ttf" />
|
||||||
<AndroidAsset Include="Assets\LICENSE_dejavu" />
|
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="Resources\AboutResources.txt" />
|
<None Include="Resources\AboutResources.txt" />
|
||||||
<None Include="filelist.txt">
|
<None Include="filelist.txt">
|
||||||
@ -1101,4 +1100,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\drawable\ic_storage_content.png" />
|
<AndroidResource Include="Resources\drawable\ic_storage_content.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidAsset Include="Assets\LICENSE_SourceCodePro.txt" />
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user