Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Committed changes from James M. for Android restyling
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebluestein committed Jan 20, 2014
1 parent f40e940 commit 83541e6
Show file tree
Hide file tree
Showing 165 changed files with 1,332 additions and 58 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
198 changes: 198 additions & 0 deletions MyCompany.Visitors.Client.Droid/Extensions/RobotoTextView.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
/*
* Copyright (C) 2013 @JamesMontemagno http://www.montemagno.com http://www.refractored.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System;
using System.Collections.Generic;

using Android.Content;
using Android.Content.Res;
using Android.Graphics;
using Android.Runtime;
using Android.Util;
using Android.Widget;
using MyCompany.Visitors.Client.Droid;

namespace com.refractored.controls
{
public class RobotoTextView : TextView
{
private const int RobotoThin = 0;
private const int RobotoThinItalic = 1;
private const int RobotoLight = 2;
private const int RobotoLightItalic = 3;
private const int RobotoRegular = 4;
private const int RobotoItalic = 5;
private const int RobotoMedium = 6;
private const int RobotoMediumItalic = 7;
private const int RobotoBold = 8;
private const int RobotoBoldItalic = 9;
private const int RobotoBlack = 10;
private const int RobotoBlackItalic = 11;
private const int RobotoCondensed = 12;
private const int RobotoCondensedItalic = 13;
private const int RobotoCondensedBold = 14;
private const int RobotoCondensedBoldItalic = 15;

private TypefaceStyle m_Style = TypefaceStyle.Normal;

private static readonly Dictionary<int, Typeface> Typefaces = new Dictionary<int, Typeface>(16);

public RobotoTextView(Context context) :
base(context)
{
}

protected RobotoTextView(IntPtr javaReference, JniHandleOwnership transfer)
: base(javaReference, transfer)
{
}


public RobotoTextView(Context context, IAttributeSet attrs) :
base(context, attrs)
{
this.Initialize(context, attrs);
}

public RobotoTextView(Context context, IAttributeSet attrs, int defStyle) :
base(context, attrs, defStyle)
{
this.Initialize(context, attrs);
}

private void Initialize(Context context, IAttributeSet attrs)
{


try
{
TypedArray values = context.ObtainStyledAttributes(attrs, Resource.Styleable.RobotoTextView);

int typefaceValue = values.GetInt(Resource.Styleable.RobotoTextView_typeface, 4);
values.Recycle();
var font = this.ObtainTypeface(context, typefaceValue);
this.SetTypeface(font, this.m_Style);
}
catch (Exception)
{

}

}

private Typeface ObtainTypeface(Context context, int typefaceValue)
{
try
{

Typeface typeface = null;
if (Typefaces.ContainsKey(typefaceValue))
typeface = Typefaces[typefaceValue];

if (typeface == null)
{
typeface = this.CreateTypeface(context, typefaceValue);
Typefaces.Add(typefaceValue, typeface);
}
return typeface;
}
catch (Exception ex)
{

}

return null;
}
private Typeface CreateTypeface(Context context, int typefaceValue)
{
try
{

Typeface typeface;
switch (typefaceValue)
{
case RobotoThin:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-Thin.ttf");
break;
case RobotoThinItalic:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-ThinItalic.ttf");
m_Style = TypefaceStyle.Italic;
break;
case RobotoLight:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-Light.ttf");
break;
case RobotoLightItalic:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-LightItalic.ttf");
m_Style = TypefaceStyle.Italic;
break;
case RobotoRegular:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-Regular.ttf");
break;
case RobotoItalic:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-Italic.ttf");
m_Style = TypefaceStyle.Italic;
break;
case RobotoMedium:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-Medium.ttf");
break;
case RobotoMediumItalic:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-MediumItalic.ttf");
m_Style = TypefaceStyle.Italic;
break;
case RobotoBold:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-Bold.ttf");
m_Style = TypefaceStyle.Bold;
break;
case RobotoBoldItalic:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-BoldItalic.ttf");
m_Style = TypefaceStyle.BoldItalic;
break;
case RobotoBlack:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-Black.ttf");
break;
case RobotoBlackItalic:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-BlackItalic.ttf");
m_Style = TypefaceStyle.Italic;
break;
case RobotoCondensed:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-Condensed.ttf");
break;
case RobotoCondensedItalic:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-CondensedItalic.ttf");
m_Style = TypefaceStyle.Italic;
break;
case RobotoCondensedBold:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-BoldCondensed.ttf");
m_Style = TypefaceStyle.Bold;
break;
case RobotoCondensedBoldItalic:
typeface = Typeface.CreateFromAsset(context.Assets, "fonts/Roboto-BoldCondensedItalic.ttf");
m_Style = TypefaceStyle.BoldItalic;
break;
default:
throw new ArgumentException("Unknown typeface attribute value " + typefaceValue);
}
return typeface;

}
catch (Exception)
{
}

return null;
}
}
}
Empty file modified MyCompany.Visitors.Client.Droid/Resources/Drawable/Icon.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- File created by the Android Action Bar Style Generator
Copyright (C) 2012 readyState Software Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/ab_texture_tile_myvisitor"
android:tileMode="repeat" />
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- File created by the Android Action Bar Style Generator
Copyright (C) 2011 The Android Open Source Project
Copyright (C) 2012 readyState Software Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true"
android:drawable="@drawable/btn_cab_done_pressed_myvisitor" />
<item android:state_focused="true" android:state_enabled="true"
android:drawable="@drawable/btn_cab_done_focused_myvisitor" />
<item android:state_enabled="true"
android:drawable="@drawable/btn_cab_done_default_myvisitor" />
</selector>
Empty file modified MyCompany.Visitors.Client.Droid/Resources/Drawable/no_photo.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- File created by the Android Action Bar Style Generator
Copyright (C) 2011 The Android Open Source Project
Copyright (C) 2012 readyState Software Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

<item android:id="@android:id/background"
android:drawable="@drawable/progress_bg_myvisitor" />

<item android:id="@android:id/secondaryProgress">
<scale android:scaleWidth="100%"
android:drawable="@drawable/progress_secondary_myvisitor" />
</item>

<item android:id="@android:id/progress">
<scale android:scaleWidth="100%"
android:drawable="@drawable/progress_primary_myvisitor" />
</item>

</layer-list>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- File created by the Android Action Bar Style Generator
Copyright (C) 2011 The Android Open Source Project
Copyright (C) 2012 readyState Software Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_mediumAnimTime" >
<item android:state_pressed="false" android:state_focused="true" android:drawable="@drawable/list_focused_myvisitor" />
<item android:state_pressed="true" android:drawable="@drawable/list_pressed_myvisitor" />
<item android:drawable="@android:color/transparent" />
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- File created by the Android Action Bar Style Generator
Copyright (C) 2011 The Android Open Source Project
Copyright (C) 2012 readyState Software Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:drawable="@drawable/spinner_ab_disabled_myvisitor" />
<item android:state_pressed="true"
android:drawable="@drawable/spinner_ab_pressed_myvisitor" />
<item android:state_pressed="false" android:state_focused="true"
android:drawable="@drawable/spinner_ab_focused_myvisitor" />
<item android:drawable="@drawable/spinner_ab_default_myvisitor" />
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- File created by the Android Action Bar Style Generator
Copyright (C) 2011 The Android Open Source Project
Copyright (C) 2012 readyState Software Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false" android:state_pressed="false" android:drawable="@android:color/transparent" />
<item android:state_focused="false" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_myvisitor" />

<!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="false" android:drawable="@drawable/tab_unselected_focused_myvisitor" />
<item android:state_focused="true" android:state_selected="true" android:state_pressed="false" android:drawable="@drawable/tab_selected_focused_myvisitor" />

<!-- Pressed -->
<!-- Non focused states -->
<item android:state_focused="false" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed_myvisitor" />
<item android:state_focused="false" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed_myvisitor" />

<!-- Focused states -->
<item android:state_focused="true" android:state_selected="false" android:state_pressed="true" android:drawable="@drawable/tab_unselected_pressed_myvisitor" />
<item android:state_focused="true" android:state_selected="true" android:state_pressed="true" android:drawable="@drawable/tab_selected_pressed_myvisitor" />
</selector>
Loading

0 comments on commit 83541e6

Please sign in to comment.