Skip to content

Commit

Permalink
Merge pull request #26 from Telefonica/apps/new-controls
Browse files Browse the repository at this point in the history
Control specifications
  • Loading branch information
gmerinojimenez authored Oct 27, 2020
2 parents fc0a415 + 0b4f4b5 commit f659001
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Just set your App or any specific activity to use any of the following:
* [Sections](library/src/main/java/com/telefonica/mistica/section)
* [Chips](library/src/main/java/com/telefonica/mistica/chips)
* [Highlighted Cards](library/src/main/java/com/telefonica/mistica/highlightedcard)
* [Controls](library/src/main/java/com/telefonica/mistica/control)

## Text Presets Styles

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class CatalogMainActivity : AppCompatActivity() {
SectionItem("Lists", R.drawable.ic_lists, Section.LISTS),
SectionItem("Headers", R.drawable.ic_headers, Section.HEADERS),
SectionItem("Highlighted Cards", R.drawable.ic_cards, Section.HIGHLIGHTED_CARDS),
SectionItem("Controls", R.drawable.ic_feedbacks, Section.CONTROLS), //Pending icon
SectionItem("Others", R.drawable.ic_others, Section.OTHERS)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class ComponentCatalogActivity : AppCompatActivity() {
Section.LISTS -> ListsCatalogFragment()
Section.HEADERS -> HeadersCatalogFragment()
Section.HIGHLIGHTED_CARDS -> HighlightedCardsCatalogFragment()
Section.CONTROLS -> ControlsCatalogFragment()
else -> OthersCatalogFragment()
}

Expand Down Expand Up @@ -68,5 +69,6 @@ enum class Section {
LISTS,
HEADERS,
HIGHLIGHTED_CARDS,
CONTROLS,
OTHERS,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.telefonica.mistica.catalog.ui.fragment

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.telefonica.mistica.button.ProgressButton
import com.telefonica.mistica.catalog.R

class ControlsCatalogFragment : Fragment() {

override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
super.onCreateView(inflater, container, savedInstanceState)
return layoutInflater.inflate(R.layout.screen_controls_catalog, container, false)
}
}
50 changes: 50 additions & 0 deletions catalog/src/main/res/layout/screen_controls_catalog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="16dp">

<com.telefonica.mistica.section.SectionTitleView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:text="Controls" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:background="?colorBackground"
android:gravity="center_horizontal"
android:orientation="vertical">

<androidx.appcompat.widget.SwitchCompat
android:id="@+id/switch1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Switch" />

<androidx.appcompat.widget.AppCompatCheckBox
android:id="@+id/checkBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="CheckBox" />

<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/radiobutton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Radio button" />

</LinearLayout>

</LinearLayout>

</ScrollView>
23 changes: 23 additions & 0 deletions library/src/main/java/com/telefonica/mistica/control/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Controls

Switches, Checkboxes and Radiobuttons are implemented using Material components and using our theme to tint them. To use them, just add the Material components:

```xml
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/switch1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Switch" />

<androidx.appcompat.widget.AppCompatCheckBox
android:id="@+id/checkBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="CheckBox" />

<androidx.appcompat.widget.AppCompatRadioButton
android:id="@+id/radiobutton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Radio button" />
```

0 comments on commit f659001

Please sign in to comment.