mirror of
https://github.com/moparisthebest/keepass2android
synced 2024-11-15 05:55:05 -05:00
fixed quick search issue
This commit is contained in:
parent
5de1e2be83
commit
7e593960bd
@ -43,7 +43,15 @@ namespace keepass2android
|
||||
//[MetaData("android.app.default_searchable",Value="keepass2android.search.SearchResults")]
|
||||
[IntentFilter(new[] { "android.intent.action.SEARCH" })]
|
||||
[MetaData("android.app.default_searchable", Value = "MaterialTest2.EntryEditActivity")]
|
||||
[MetaData("android.app.searchable", Resource = "@xml/searchable_mattest")]
|
||||
#if NoNet
|
||||
[MetaData("android.app.searchable", Resource = "@xml/searchable_offline")]
|
||||
#else
|
||||
#if DEBUG
|
||||
[MetaData("android.app.searchable", Resource = "@xml/searchable_debug")]
|
||||
#else
|
||||
[MetaData("android.app.searchable", Resource = "@xml/searchable")]
|
||||
#endif
|
||||
#endif
|
||||
[IntentFilter(new string[]{"android.intent.action.SEARCH"})]
|
||||
[MetaData("android.app.searchable",Resource=AppNames.Searchable)]
|
||||
public class GroupActivity : GroupBaseActivity {
|
||||
|
@ -1,29 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
|
||||
This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin.
|
||||
|
||||
Keepass2Android is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Keepass2Android is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:label="@string/search_label"
|
||||
android:label="@string/app_name"
|
||||
android:hint="@string/search_hint"
|
||||
android:searchSettingsDescription="Search database"
|
||||
android:searchMode="showSearchLabelAsBadge"
|
||||
android:searchSuggestAuthority="keepass2android.keepass2android.SearchProvider"
|
||||
android:searchSuggestSelection=" ?"
|
||||
android:searchSuggestThreshold="2"
|
||||
android:searchSuggestAuthority="kp2a.keepass2android.SearchProvider"
|
||||
android:searchSuggestIntentAction="android.intent.action.VIEW"
|
||||
android:searchSuggestIntentData="content://keepass2android.EntryActivity"
|
||||
/>
|
||||
android:searchSuggestSelection=" ?"
|
||||
android:searchSuggestThreshold="2" />
|
@ -1,29 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
|
||||
This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin.
|
||||
|
||||
Keepass2Android is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Keepass2Android is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:label="@string/search_label"
|
||||
android:label="@string/app_name"
|
||||
android:hint="@string/search_hint"
|
||||
android:searchSettingsDescription="Search database"
|
||||
android:searchMode="showSearchLabelAsBadge"
|
||||
android:searchSuggestAuthority="keepass2android.keepass2android_debug.SearchProvider"
|
||||
android:searchSuggestSelection=" ?"
|
||||
android:searchSuggestThreshold="2"
|
||||
android:searchSuggestAuthority="kp2a.keepass2android_debug.SearchProvider"
|
||||
android:searchSuggestIntentAction="android.intent.action.VIEW"
|
||||
android:searchSuggestIntentData="content://keepass2android.EntryActivity"
|
||||
/>
|
||||
android:searchSuggestSelection=" ?"
|
||||
android:searchSuggestThreshold="2" />
|
@ -3,10 +3,8 @@
|
||||
android:label="@string/app_name"
|
||||
android:hint="@string/search_hint"
|
||||
android:searchSettingsDescription="Search database"
|
||||
|
||||
android:searchMode="showSearchLabelAsBadge"
|
||||
|
||||
android:searchSuggestAuthority="keepass2android.keepass2android_debug.SearchProvider"
|
||||
android:searchSuggestAuthority="kp2a.keepass2android_debug.SearchProvider"
|
||||
android:searchSuggestIntentAction="android.intent.action.VIEW"
|
||||
android:searchSuggestSelection=" ?"
|
||||
android:searchSuggestThreshold="2" />
|
@ -1,29 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
|
||||
|
||||
This file is part of Keepass2Android, Copyright 2013 Philipp Crocoll. This file is based on Keepassdroid, Copyright Brian Pellin.
|
||||
|
||||
Keepass2Android is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Keepass2Android is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Keepass2Android. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:label="@string/search_label"
|
||||
android:label="@string/app_name"
|
||||
android:hint="@string/search_hint"
|
||||
android:searchSettingsDescription="Search database"
|
||||
android:searchMode="showSearchLabelAsBadge"
|
||||
android:searchSuggestAuthority="keepass2android.keepass2android_nonet.SearchProvider"
|
||||
android:searchSuggestSelection=" ?"
|
||||
android:searchSuggestThreshold="2"
|
||||
android:searchSuggestAuthority="kp2a.keepass2android_nonet.SearchProvider"
|
||||
android:searchSuggestIntentAction="android.intent.action.VIEW"
|
||||
android:searchSuggestIntentData="content://keepass2android.EntryActivity"
|
||||
/>
|
||||
android:searchSuggestSelection=" ?"
|
||||
android:searchSuggestThreshold="2" />
|
@ -42,7 +42,7 @@ namespace keepass2android.search
|
||||
GetIcon,
|
||||
GetSuggestions
|
||||
}
|
||||
public const String Authority = "keepass2android." + AppNames.PackagePart + ".SearchProvider";
|
||||
public const String Authority = "kp2a." + AppNames.PackagePart + ".SearchProvider";
|
||||
|
||||
private const string GetIconPathQuery = "get_icon";
|
||||
private const string IconIdParameter = "IconId";
|
||||
@ -103,6 +103,15 @@ namespace keepass2android.search
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static float convertDpToPixel(float dp, Context context)
|
||||
{
|
||||
Resources resources = context.Resources;
|
||||
Android.Util.DisplayMetrics metrics = resources.DisplayMetrics;
|
||||
float px = dp * metrics.Density;
|
||||
return px;
|
||||
}
|
||||
|
||||
public override ParcelFileDescriptor OpenFile(Android.Net.Uri uri, string mode)
|
||||
{
|
||||
switch ((UriMatches)UriMatcher.Match(uri))
|
||||
@ -119,7 +128,23 @@ namespace keepass2android.search
|
||||
|
||||
ThreadPool.QueueUserWorkItem(state =>
|
||||
{
|
||||
iconDrawable.Bitmap.Compress(Bitmap.CompressFormat.Png, 100, outStream);
|
||||
var original = iconDrawable.Bitmap;
|
||||
Bitmap copy = Bitmap.CreateBitmap(original.Width, original.Height, original.GetConfig());
|
||||
Canvas copiedCanvas = new Canvas(copy);
|
||||
copiedCanvas.DrawBitmap(original, 0f, 0f, null);
|
||||
|
||||
var bitmap = copy;
|
||||
float maxSize = convertDpToPixel(60, App.Context);
|
||||
float scale = Math.Min(maxSize / bitmap.Width, maxSize / bitmap.Height);
|
||||
var scaleWidth = (int)(bitmap.Width * scale);
|
||||
var scaleHeight = (int)(bitmap.Height * scale);
|
||||
var scaledBitmap = Bitmap.CreateScaledBitmap(bitmap, scaleWidth, scaleHeight, true);
|
||||
Bitmap newRectBitmap = Bitmap.CreateBitmap((int)maxSize, (int)maxSize, Bitmap.Config.Argb8888);
|
||||
|
||||
Canvas c = new Canvas(newRectBitmap);
|
||||
c.DrawBitmap(scaledBitmap, (maxSize - scaledBitmap.Width) / 2.0f, (maxSize - scaledBitmap.Height) / 2.0f, null);
|
||||
bitmap = newRectBitmap;
|
||||
bitmap.Compress(Bitmap.CompressFormat.Png, 100, outStream);
|
||||
outStream.Close();
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user