update file storage selection to use icon from https://developers.google.com/drive/api/v3/branding
This commit is contained in:
@@ -117,34 +117,20 @@ namespace keepass2android
|
|||||||
|
|
||||||
Button btn;
|
Button btn;
|
||||||
|
|
||||||
var protocolId = _displayedProtocolIds[position];
|
if (convertView == null)
|
||||||
string firstProtocolInList = protocolId.Split(",").First();
|
|
||||||
String title =
|
|
||||||
protocolId == "kp2a" ? App.Kp2a.GetResourceString("get_regular_version")
|
|
||||||
:
|
|
||||||
App.Kp2a.GetStorageMainTypeDisplayName(firstProtocolInList);
|
|
||||||
|
|
||||||
if (convertView == null)
|
|
||||||
{ // if it's not recycled, initialize some attributes
|
{ // if it's not recycled, initialize some attributes
|
||||||
|
|
||||||
btn = new Button(_context);
|
btn = new Button(_context);
|
||||||
btn.LayoutParameters = new GridView.LayoutParams((int)convertDpToPixel(250, _context), (int)convertDpToPixel(45, _context));
|
btn.LayoutParameters = new GridView.LayoutParams((int)convertDpToPixel(90, _context), (int)convertDpToPixel(110, _context));
|
||||||
btn.SetBackgroundColor(Color.White);
|
btn.SetBackgroundResource(Resource.Drawable.storagetype_button_bg);
|
||||||
if (title == "Google Drive")
|
btn.SetPadding((int)convertDpToPixel(4, _context),
|
||||||
btn.SetPadding((int)convertDpToPixel(0, _context),
|
(int)convertDpToPixel(20, _context),
|
||||||
(int)convertDpToPixel(0, _context),
|
|
||||||
(int)convertDpToPixel(0, _context),
|
|
||||||
(int)convertDpToPixel(0, _context));
|
|
||||||
else
|
|
||||||
|
|
||||||
btn.SetPadding((int)convertDpToPixel(12, _context),
|
|
||||||
(int)convertDpToPixel(12, _context),
|
|
||||||
(int)convertDpToPixel(4, _context),
|
(int)convertDpToPixel(4, _context),
|
||||||
(int)convertDpToPixel(4, _context));
|
(int)convertDpToPixel(4, _context));
|
||||||
btn.SetTextSize(ComplexUnitType.Sp, 14);
|
btn.SetTextSize(ComplexUnitType.Sp, 11);
|
||||||
btn.SetTextColor(new Color(115, 115, 115));
|
btn.SetTextColor(new Color(115, 115, 115));
|
||||||
btn.SetSingleLine(true);
|
btn.SetSingleLine(false);
|
||||||
btn.Gravity = GravityFlags.Left;
|
btn.Gravity = GravityFlags.Center;
|
||||||
btn.Click += (sender, args) => _context.OnItemSelected( (string) ((Button)sender).Tag);
|
btn.Click += (sender, args) => _context.OnItemSelected( (string) ((Button)sender).Tag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -152,32 +138,23 @@ namespace keepass2android
|
|||||||
btn = (Button)convertView;
|
btn = (Button)convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var protocolId = _displayedProtocolIds[position];
|
||||||
btn.Tag = protocolId;
|
btn.Tag = protocolId;
|
||||||
|
|
||||||
|
string firstProtocolInList = protocolId.Split(",").First();
|
||||||
|
|
||||||
|
|
||||||
Drawable drawable = App.Kp2a.GetStorageIcon(firstProtocolInList);
|
Drawable drawable = App.Kp2a.GetStorageIcon(firstProtocolInList);
|
||||||
|
|
||||||
bool isdrive = (title == "Google Drive");
|
String title =
|
||||||
|
protocolId == "kp2a" ? App.Kp2a.GetResourceString("get_regular_version")
|
||||||
|
:
|
||||||
if (title == "Google Drive")
|
App.Kp2a.GetStorageMainTypeDisplayName(firstProtocolInList);
|
||||||
title = "";
|
var str = new SpannableString(title);
|
||||||
|
|
||||||
var str = new SpannableString(" " + title);
|
|
||||||
|
|
||||||
|
|
||||||
btn.TextFormatted = str;
|
btn.TextFormatted = str;
|
||||||
//var drawable = ContextCompat.GetDrawable(context, Resource.Drawable.Icon);
|
//var drawable = ContextCompat.GetDrawable(context, Resource.Drawable.Icon);
|
||||||
if (!isdrive)
|
btn.SetCompoundDrawablesWithIntrinsicBounds(null, drawable, null, null);
|
||||||
{
|
|
||||||
drawable.SetBounds(0, 0, 75, 75);
|
|
||||||
btn.SetCompoundDrawables(drawable, null, null, null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
|
|
||||||
btn.SetCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
|
|
||||||
|
|
||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -26,8 +26,8 @@
|
|||||||
android:layout_marginRight="16dp"
|
android:layout_marginRight="16dp"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
android:layout_marginTop="0dp"
|
android:layout_marginTop="0dp"
|
||||||
android:columnWidth="500dp"
|
android:columnWidth="90dp"
|
||||||
android:numColumns="1"
|
android:numColumns="auto_fit"
|
||||||
android:verticalSpacing="10dp"
|
android:verticalSpacing="10dp"
|
||||||
android:horizontalSpacing="10dp"
|
android:horizontalSpacing="10dp"
|
||||||
android:stretchMode="columnWidth"
|
android:stretchMode="columnWidth"
|
||||||
|
|||||||
@@ -454,6 +454,7 @@
|
|||||||
<AndroidResource Include="Resources\drawable-mdpi\ic_storage_file.png" />
|
<AndroidResource Include="Resources\drawable-mdpi\ic_storage_file.png" />
|
||||||
<AndroidResource Include="Resources\drawable-mdpi\ic_storage_ftp.png" />
|
<AndroidResource Include="Resources\drawable-mdpi\ic_storage_ftp.png" />
|
||||||
<AndroidResource Include="Resources\drawable-mdpi\ic_storage_ftps.png" />
|
<AndroidResource Include="Resources\drawable-mdpi\ic_storage_ftps.png" />
|
||||||
|
<AndroidResource Include="Resources\drawable-mdpi\ic_storage_gdrive.png" />
|
||||||
<AndroidResource Include="Resources\drawable-mdpi\ic_storage_http.png" />
|
<AndroidResource Include="Resources\drawable-mdpi\ic_storage_http.png" />
|
||||||
<AndroidResource Include="Resources\drawable-mdpi\ic_storage_https.png" />
|
<AndroidResource Include="Resources\drawable-mdpi\ic_storage_https.png" />
|
||||||
<AndroidResource Include="Resources\drawable-mdpi\ic_storage_owncloud.png" />
|
<AndroidResource Include="Resources\drawable-mdpi\ic_storage_owncloud.png" />
|
||||||
@@ -1074,6 +1075,9 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\drawable-xhdpi\ic_storage_ftps.png" />
|
<AndroidResource Include="Resources\drawable-xhdpi\ic_storage_ftps.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidResource Include="Resources\drawable-xhdpi\ic_storage_gdrive.png" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\drawable-xhdpi\ic_storage_http.png" />
|
<AndroidResource Include="Resources\drawable-xhdpi\ic_storage_http.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@@ -1914,9 +1918,6 @@
|
|||||||
<Name>ZlibAndroid</Name>
|
<Name>ZlibAndroid</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<AndroidResource Include="Resources\drawable-xhdpi\ic_storage_gdrive.png" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
Reference in New Issue
Block a user