Skip to content

Commit

Permalink
fix problems with themes dark
Browse files Browse the repository at this point in the history
  • Loading branch information
rigo9412 committed Jan 25, 2019
1 parent 25cdf65 commit f7536f8
Show file tree
Hide file tree
Showing 16 changed files with 133 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ class MainActivity : AppCompatActivity() {
arrayListOf("1","2","3"), arrayListOf())


//val field2 = Field(arrayListOf("apellido_paterno"),"Apellido Paterno*",true, TypeField.TEXT,"Campo requerido",140)
val field3 = FieldText(arrayListOf("apellido_paterno"),"Apellido Paterno*",true, TypeField.TEXT,"Campo requerido",140)
val field32 = FieldText(arrayListOf("apellido_paterno"),"Apellido Paterno*",true, TypeField.TEXT,"Campo requerido",140)
//val field3 = Field(arrayListOf("apellido_materno"),"Apellido Materno*",true, TypeField.TEXT,"Campo requerido",140)
val form = Form("1","Informacion Personal", arrayListOf(field1,field2,fieldTipoFlotilla))
val form = Form("1","Informacion Personal", arrayListOf(field1,field2,fieldTipoFlotilla,field3,field32))


val i = Intent(this, FormsActivity::class.java)
i.putExtra(FormsActivity.EXTRA_FORMS, arrayListOf(form))
i.putExtra(FormsActivity.EXTRA_THEME,R.style.AppTheme)
i.putExtra(FormsActivity.EXTRA_BACKGROUND_COLOR,R.color.colorBackgroud)
i.putExtra(FormsActivity.EXTRA_THEME,R.style.ThemeDark)
i.putExtra(FormsActivity.EXTRA_BACKGROUND_COLOR,R.color.blue_normal)
startActivityForResult(i,FORM_ACTIVITY)
}
}
Expand Down
14 changes: 13 additions & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,19 @@
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="colorAccent">#fc5f00</color>

<color name="colorBackgroud">#2E7D32</color>

<color name="black">#000000</color>
<color name="white">#FFFFFF</color>
<color name="white_ligth">#fafafa</color>
<color name="white_dark">#f5f5f5</color>

<color name="blue_dark">#051F33</color>
<color name="blue_normal">#13334c</color>
<color name="blue_light">#415c78</color>
<color name="orange_dark">#C44900</color>
<color name="orange_normal">#fc5f00</color>
<color name="orange_ligth">#ff913e</color>
</resources>
32 changes: 32 additions & 0 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,36 @@
<item name="colorAccent">@color/colorAccent</item>
</style>


<!-- Base application theme. -->
<style name="ThemeDark" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="colorPrimary">@color/blue_normal</item>
<item name="colorPrimaryDark">@color/blue_dark</item>
<item name="colorAccent">@color/orange_normal</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="android:textColorSecondary">@color/white</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorControlNormal">@color/white</item>
<item name="colorControlHighlight">@color/orange_ligth</item>
<item name="colorControlActivated">@color/orange_ligth</item>
</style>


<style name="ThemeLight" parent="Theme.MaterialComponents.Light">
<item name="colorPrimary">@color/white</item>
<item name="colorPrimaryDark">@color/white_dark</item>
<item name="colorAccent">@color/orange_normal</item>
<item name="android:textColorPrimary">@color/blue_dark</item>
<item name="android:textColorSecondary">@color/blue_light</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorControlNormal">@color/blue_light</item>
<item name="colorControlHighlight">@color/blue_light</item>
<item name="colorControlActivated">@color/orange_normal</item>
</style>




</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ abstract class Field :Parcelable{
fun createTextviewLabel(context: Context) : TextView{
val textView = TextView(context)
textView.text = title
textView.setTextAppearance(context,R.style.TextView_InputLabel)
//textView.setTextAppearance(context,R.style.TextView_InputLabel)
textView.setPadding(24,0,0,0)
textView.setTextColor(context.resources.getColor(R.color.gray))
return textView
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class FieldOptions() : Field() {
val li = LayoutInflater.from(context)
val spinner = li.inflate(R.layout.template_spinner, null) as Spinner

spinner.adapter = ArrayAdapter(context, android.R.layout.simple_spinner_dropdown_item, options)
spinner.adapter = ArrayAdapter(context, R.layout.item_spinner, options)
spinner.tag = index
var defaultValue = 0

Expand Down
7 changes: 2 additions & 5 deletions formslibrary/src/main/res/drawable/background_imageview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@

<item>
<shape>
<solid
android:color="#33F2F2F2">
</solid>

<solid android:color="#0D000000"/>
<corners android:radius="10dp" />
<stroke
android:width="1dp"
android:color="?colorPrimaryDark"/>
android:color="?colorControlNormal"/>
</shape>
</item>

Expand Down
11 changes: 11 additions & 0 deletions formslibrary/src/main/res/drawable/edt_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<stroke android:width="2dp" android:color="@color/gray" />
<corners android:radius="10dp"/>
<solid android:color="@android:color/transparent"/>
<padding android:bottom="3dp" android:left="3dp" android:right="3dp" android:top="3dp" />
</shape>
</item>
</selector>
29 changes: 7 additions & 22 deletions formslibrary/src/main/res/drawable/spinner_backgroud.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item><layer-list>
<item>
<shape>
<solid
android:color="#33FFFFFF">
</solid>

<corners android:radius="5dp" />

<padding
android:left="6dp"
android:right="6dp" />
<stroke
android:width="1dp"
android:color="?colorPrimaryDark"/>
</shape>
</item>
<item >
<bitmap android:gravity="right|center_vertical"
android:src="@drawable/ic_arrow_drop_down" />
</item>
</layer-list></item>
<item>
<shape>
<stroke android:width="1dp" android:color="@color/gray" />
<corners android:radius="4dp"/>
<padding android:bottom="3dp" android:left="3dp" android:right="3dp" android:top="3dp" />
</shape>
</item>
</selector>
33 changes: 16 additions & 17 deletions formslibrary/src/main/res/layout/activity_forms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,37 @@

<ImageButton
android:id="@+id/btnBack"
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="48dp"
android:layout_height="wrap_content"
android:layout_gravity="top|start"
android:layout_margin="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:tint="?colorAccent"
android:tint="@color/gray"
android:src="@drawable/ic_arrow_back_black_24dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/tvSteps"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:text="1 de 5"
android:textColor="?colorAccent"
android:textSize="18dp"
app:layout_constraintBottom_toBottomOf="@+id/btnBack"
app:layout_constraintEnd_toStartOf="@+id/btnActionSave"
app:layout_constraintHorizontal_bias="0.6"
app:layout_constraintStart_toEndOf="@+id/btnBack"
app:layout_constraintTop_toTopOf="@+id/btnBack"
app:layout_constraintVertical_bias="0.53" />
android:id="@+id/tvSteps"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:text="1 de 5"
android:textSize="18dp"
android:textColor="@color/gray"
app:layout_constraintBottom_toBottomOf="@+id/btnBack"
app:layout_constraintEnd_toStartOf="@+id/btnActionSave"
app:layout_constraintHorizontal_bias="0.603"
app:layout_constraintStart_toEndOf="@+id/btnBack"
android:layout_marginBottom="8dp"/>


<Button
android:id="@+id/btnActionSave"
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
style="@style/Base.Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
Expand Down
2 changes: 1 addition & 1 deletion formslibrary/src/main/res/layout/fragment_form.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:keepScreenOn="true"
android:padding="8dp"
android:text="Titulo"
android:textColor="@color/design_default_color_primary_dark"
android:textColor="?android:textColorPrimary"
android:textSize="36sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
Expand Down
9 changes: 9 additions & 0 deletions formslibrary/src/main/res/layout/item_spinner.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textColor="?android:textColorPrimary"
android:gravity="left"
android:padding="5dip"/>
4 changes: 1 addition & 3 deletions formslibrary/src/main/res/layout/picker_image.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
android:padding="16dp"
android:drawableStart="@drawable/ic_image_black_24dp"
android:drawablePadding="24dp"
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
style="@style/Base.TextAppearance.AppCompat.Title"
style="@style/Base.TextAppearance.AppCompat.Title.Inverse"
android:textColor="#1a1a1a"
android:text="Galeria"
android:focusable="true" />
Expand All @@ -37,7 +36,6 @@
android:padding="16dp"
android:drawableStart="@drawable/ic_photo_camera_black_24dp"
android:drawablePadding="24dp"
android:foreground="?android:attr/selectableItemBackground"
android:clickable="true"
style="@style/Base.TextAppearance.AppCompat.Title"
android:textColor="#1a1a1a"
Expand Down
4 changes: 3 additions & 1 deletion formslibrary/src/main/res/layout/template_spinner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/spinner_backgroud" />
android:foreground="#0D000000"
android:popupBackground="?colorPrimary"
style="@style/Widget.AppCompat.Spinner.Underlined" />
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
android:paddingStart="4dp"
style="@style/TextInputLayoutAppearance"
xmlns:android="http://schemas.android.com/apk/res/android" />
4 changes: 3 additions & 1 deletion formslibrary/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<resources>
<resources xmlns:tools="http://schemas.android.com/tools">

<color name="black_overlay">#e0d7d7d7</color>
<color name="colorWhite">#FFFF</color>
<color name="colorDarkGrey">#757575</color>
<color name="gray">#bdbdbd</color>

<color name="mtrl_textinput_default_box_stroke_color" tools:override="true">#e0e0e0</color>
</resources>
27 changes: 24 additions & 3 deletions formslibrary/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@


<style name="TextView.InputLabel" parent="TextAppearance.AppCompat.Caption">
<item name="android:textColor">?android:textColorHint</item>
<item name="android:paddingBottom">8dp</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:textColor">@color/gray</item>
<item name="android:paddingBottom">2dp</item>
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">4dp</item>
<item name="android:layout_marginStart">16dp</item>
</style>


Expand All @@ -41,7 +42,27 @@
<style name="BottomSheetDialogTheme" parent="BaseBottomSheetDialog" />


<style name="ErrorText" parent="TextAppearance.AppCompat">
<item name="android:textColor">#f44336</item>
<item name="android:textSize">16sp</item>
</style>

<style name="HintText" parent="TextAppearance.AppCompat">
<item name="android:textColor">@color/gray</item>
<item name="android:textSize">14sp</item>
</style>


<style name="TextInputLayoutAppearance" parent="Widget.MaterialComponents.TextInputLayout.FilledBox.Dense">
<!-- reference our hint & error styles -->
<item name="hintTextAppearance">@style/HintText</item>
<item name="errorTextAppearance">@style/ErrorText</item>
<item name="android:textColorHint">@color/gray</item>
<item name="android:textColor">@color/gray</item>
<item name="boxStrokeColor">@color/gray</item>
<item name="boxStrokeWidth">2dp</item>
<item name="android:layout_margin">8dp</item>
</style>


</resources>

0 comments on commit f7536f8

Please sign in to comment.