Moving of elements uses colors from resources

This commit is contained in:
Philipp Crocoll 2013-09-01 22:12:48 +02:00
parent 2afbbb37fc
commit dd5710cf79
7 changed files with 32 additions and 10 deletions

View File

@ -196,6 +196,7 @@ namespace keepass2android
{
tv.Click += (sender, e) =>
{
AppTask.SetActivityResult(this, KeePass.ExitNormal);
Finish();
};
} else

View File

@ -165,8 +165,11 @@ namespace keepass2android
// aapt resource value: 0x7f060001
public const int candidate_recommended = 2131099649;
// aapt resource value: 0x7f06000e
public const int dark_gray = 2131099662;
// aapt resource value: 0x7f06000d
public const int dark_gray = 2131099661;
public const int element_being_moved = 2131099661;
// aapt resource value: 0x7f060009
public const int emphasis = 2131099657;

View File

@ -24,5 +24,7 @@
<color name="icon_text">#000000</color>
<color name="light_gray">#a8a8a8</color>
<color name="dark_gray">#303030</color>
<color name="element_being_moved">#a8a8a8</color>
</resources>

View File

@ -28,5 +28,7 @@
<color name="emphasis2">#4f7a8a</color>
<color name="bg_gray">#cecbce</color>
<color name="light_gray">#a8a8a8</color>
<color name="element_being_moved">#a8a8a8</color>
</resources>

View File

@ -600,7 +600,9 @@
<AndroidResource Include="Resources\values-v14\styles.xml" />
<AndroidResource Include="Resources\values-v14\colors.xml" />
<AndroidResource Include="Resources\layout-v14\entry_view_contents.xml" />
<AndroidResource Include="Resources\layout-v14\group_add_entry.xml" />
<AndroidResource Include="Resources\layout-v14\group_add_entry.xml">
<SubType>Designer</SubType>
</AndroidResource>
<AndroidResource Include="Resources\layout-v14\entry_view.xml" />
<AndroidResource Include="Resources\layout-v14\entry_edit.xml" />
<AndroidResource Include="Resources\layout-v14\SaveButton.xml" />

View File

@ -35,6 +35,8 @@ namespace keepass2android.view
private readonly TextView _textviewDetails;
private int _pos;
private int? _defaultTextColor;
readonly bool _showDetail;
private const int MenuOpen = Menu.First;
@ -98,15 +100,19 @@ namespace keepass2android.view
}
_textView.TextFormatted = str;
//todo: get colors from resources
if (_defaultTextColor == null)
_defaultTextColor = _textView.TextColors.DefaultColor;
if (_groupActivity.IsBeingMoved(_entry.Uuid))
_textView.SetTextColor(new Color(180,180,180));
{
int elementBeingMoved = Context.Resources.GetColor(Resource.Color.element_being_moved);
_textView.SetTextColor(new Color(elementBeingMoved));
}
else
_textView.SetTextColor(new Color(0,0,0));
_textView.SetTextColor(new Color((int)_defaultTextColor));
String detail = pw.Strings.ReadSafe(PwDefs.UserNameField);
if ((_showDetail == false) || (String.IsNullOrEmpty(detail)))
{
_textviewDetails.Visibility = ViewStates.Gone;

View File

@ -31,6 +31,7 @@ namespace keepass2android.view
private PwGroup _pwGroup;
private readonly GroupBaseActivity _groupBaseActivity;
private readonly TextView _textview;
private int? _defaultTextColor;
private const int MenuOpen = Menu.First;
private const int MenuDelete = MenuOpen + 1;
@ -75,11 +76,16 @@ namespace keepass2android.view
_textview.Text = pw.Name;
//todo: get colors from resources
if (_defaultTextColor == null)
_defaultTextColor = _textview.TextColors.DefaultColor;
if (_groupBaseActivity.IsBeingMoved(_pwGroup.Uuid))
_textview.SetTextColor(new Color(180, 180, 180));
{
int elementBeingMoved = Context.Resources.GetColor(Resource.Color.element_being_moved);
_textview.SetTextColor(new Color(elementBeingMoved));
}
else
_textview.SetTextColor(new Color(0, 0, 0));
_textview.SetTextColor(new Color((int)_defaultTextColor));
}
@ -91,7 +97,7 @@ namespace keepass2android.view
public override void OnClick() {
LaunchGroup();
}
private void LaunchGroup() {
GroupActivity.Launch(_groupBaseActivity, _pwGroup, _groupBaseActivity.AppTask);
_groupBaseActivity.OverridePendingTransition(Resource.Animation.anim_enter, Resource.Animation.anim_leave);