Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSY-494 / Iconography #43

Merged
merged 9 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ In construction

You can contribute submitting [pull requests](https://github.com/natura-cosmeticos/natds-android/pulls).

### How to add resource icons
It is preferable that the icon resources are saved as vectors (XML format). The nomenclature of drawables must be `ds_ic_<pack>_<scope>_<name withuot separators>`.

For instance: `ds_ic_outlined_navigation_arrowbottom.xml`

### How to create a new version
In the file **publish.gradle** update field in the method **getVersionName** with the new version number. Example, for the version 1.0.1:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class DsPrimaryButton @JvmOverloads constructor(
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {

// TODO remover esta classe pois android.support.design.button.MaterialButton ja atende
private val buttonLabel by lazy { findViewById<AppCompatTextView>(R.id.button_primary_text) }
private val buttonIconLeft by lazy { findViewById<FontIcon>(R.id.button_primary_icon_left) }
private val buttonIconRight by lazy { findViewById<FontIcon>(R.id.button_primary_icon_right) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class DsErrorDefault @JvmOverloads constructor(
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {

// TODO mover esta classe para com.natura.android.pattern
private val erroIcon by lazy { findViewById<AppCompatImageView>(R.id.ds_default_error_icon) }
private val errorLabel by lazy { findViewById<AppCompatTextView>(R.id.ds_default_error_label) }
private val errorButton by lazy { findViewById<DsPrimaryButton>(R.id.ds_default_error_button) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class FontIcon @JvmOverloads constructor(
defStyleAttr: Int = 0
) : AppCompatTextView(context, attrs, defStyleAttr) {

// TODO considerar usar esta classe como inner class de MenuView
private val natDsFontPath = "fonts/natds_icons.ttf"

init {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import android.view.inputmethod.EditorInfo
import android.widget.EditText
import android.widget.LinearLayout
import android.widget.TextView
import android.widget.Toast
import com.natura.android.R
import com.natura.android.icon.FontIcon

Expand All @@ -24,6 +23,7 @@ class TextFieldInput @JvmOverloads constructor(
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {

// TODO trocar FontIcon por AppCompatImageView
enum class State {
NONE, ERROR, SUCCESS
}
Expand Down
21 changes: 0 additions & 21 deletions designsystem/src/main/res/drawable/ds_ic_arrow_down.xml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M12,3a9,9 0,1 0,9 9,9 9,0 0,0 -9,-9zM16.35,15.65a0.48,0.48 0,0 1,0 0.7,0.48 0.48,0 0,1 -0.7,0L12,12.71l-3.65,3.64a0.48,0.48 0,0 1,-0.7 0,0.48 0.48,0 0,1 0,-0.7L11.29,12 7.65,8.35a0.49,0.49 0,0 1,0.7 -0.7L12,11.29l3.65,-3.64a0.49,0.49 0,0 1,0.7 0.7L12.71,12z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M12,3a9,9 0,1 0,9 9,9 9,0 0,0 -9,-9zM18.35,8.35l-7.56,7.57a0.51,0.51 0,0 1,-0.36 0.15,0.49 0.49,0 0,1 -0.35,-0.15l-4.43,-4.43a0.5,0.5 0,0 1,0 -0.71,0.5 0.5,0 0,1 0.7,0l4.08,4.08 7.22,-7.21a0.49,0.49 0,1 1,0.7 0.7z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M12,21.52c-7.328,0 -11.909,-7.933 -8.245,-14.28C7.42,0.893 16.58,0.893 20.245,7.24A9.525,9.525 0,0 1,21.52 12,9.531 9.531,0 0,1 12,21.52zM12,3.52c-6.528,0 -10.608,7.067 -7.344,12.72 3.264,5.653 11.424,5.653 14.688,0A8.481,8.481 0,0 0,12 3.52zM7.5,17a0.468,0.468 0,0 1,-0.35 -0.15,0.48 0.48,0 0,1 0,-0.7L11.3,12 7.15,7.85a0.495,0.495 0,0 1,0.7 -0.7L12,11.3l4.15,-4.15a0.495,0.495 0,0 1,0.7 0.7L12.7,12l4.15,4.15a0.48,0.48 0,0 1,0 0.7,0.468 0.468,0 0,1 -0.35,0.15 0.468,0.468 0,0 1,-0.35 -0.15L12,12.7l-4.15,4.15a0.468,0.468 0,0 1,-0.35 0.15z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M11.89,13.866L12.073,13.866C13.43,13.782 14.464,12.617 14.387,11.26L14.387,5.114C14.269,3.133 12.049,2.023 10.392,3.115C9.715,3.563 9.287,4.303 9.238,5.114L9.238,11.278C9.273,12.717 10.45,13.866 11.89,13.866ZM11.89,14.78C9.951,14.776 8.369,13.226 8.324,11.287L8.324,5.114C8.461,2.429 11.455,0.9 13.712,2.361C14.653,2.971 15.243,3.995 15.301,5.114L15.301,11.195C15.415,13.06 13.993,14.663 12.128,14.771L11.89,14.771ZM12.357,21.291L16.289,21.291C16.641,21.291 16.86,21.672 16.685,21.977C16.603,22.119 16.452,22.205 16.289,22.205L7.437,22.205C7.085,22.205 6.865,21.824 7.041,21.52C7.122,21.378 7.273,21.291 7.437,21.291L11.442,21.291L11.442,17.436C8.186,17.154 5.623,14.433 5.599,11.104L5.599,8.16C5.599,7.907 5.804,7.702 6.056,7.702C6.308,7.702 6.513,7.907 6.513,8.16L6.513,11.104C6.538,14.099 8.959,16.52 11.954,16.545L12.055,16.545C15.055,16.545 17.487,14.113 17.487,11.113L17.487,8.16C17.487,7.907 17.691,7.702 17.944,7.702C18.196,7.702 18.401,7.907 18.401,8.16L18.401,11.113C18.396,14.515 15.72,17.289 12.357,17.452Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M9.912,17.56C4.138,17.56 0.53,11.31 3.417,6.31C6.304,1.31 13.52,1.31 16.407,6.31C17.065,7.45 17.412,8.743 17.412,10.06C17.409,11.914 16.735,13.61 15.62,14.919L21.452,20.59C21.648,20.782 21.648,21.098 21.452,21.29C21.357,21.386 21.227,21.44 21.092,21.44C20.961,21.442 20.835,21.391 20.742,21.3L14.919,15.638C13.592,16.831 11.837,17.557 9.912,17.56ZM9.912,3.56C4.908,3.56 1.781,8.977 4.283,13.31C6.492,17.135 11.624,17.583 14.518,14.656C14.534,14.633 14.552,14.611 14.572,14.59C14.59,14.572 14.609,14.555 14.629,14.541C14.969,14.179 15.276,13.769 15.541,13.31C16.112,12.322 16.412,11.201 16.412,10.06C16.412,6.47 13.502,3.56 9.912,3.56Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M19.34,12.77C19.064,12.759 18.849,12.526 18.86,12.25C19.09,7.02 13.573,3.502 8.929,5.918C7.643,6.586 6.613,7.643 5.977,8.925L7.42,8.42C7.679,8.332 7.962,8.464 8.06,8.72C8.154,8.98 8.019,9.266 7.76,9.36L5.29,10.24L5.179,10.246C5.105,10.258 5.027,10.253 4.95,10.23C4.77,10.175 4.645,10.027 4.611,9.855L3.8,7.44C3.72,7.178 3.862,6.9 4.12,6.81C4.38,6.718 4.665,6.858 4.75,7.12L5.164,8.355C6.549,5.767 9.299,4.13 12.31,4.22C16.614,4.377 19.981,7.985 19.84,12.29C19.829,12.558 19.609,12.77 19.34,12.77ZM12,19.8L11.74,19.8C7.462,19.653 4.106,16.079 4.23,11.8C4.235,11.525 4.465,11.309 4.74,11.32C5.016,11.325 5.236,11.554 5.23,11.83C5.095,15.576 8.034,18.716 11.78,18.83C14.42,18.9 16.828,17.447 18.022,15.159L16.64,15.65C16.378,15.737 16.094,15.6 16,15.34C15.906,15.08 16.041,14.794 16.3,14.7L18.77,13.83C18.896,13.785 19.034,13.785 19.16,13.83C19.278,13.891 19.367,13.995 19.41,14.12L20.28,16.59C20.373,16.847 20.238,17.13 19.98,17.22C19.93,17.245 19.876,17.262 19.82,17.27C19.609,17.27 19.422,17.138 19.35,16.94L18.89,15.645C17.551,18.163 14.919,19.789 12,19.8ZM9.85,14.54C9.779,14.324 9.742,14.098 9.74,13.87C9.74,13.485 10.157,13.245 10.49,13.437C10.645,13.526 10.74,13.691 10.74,13.87C10.738,13.993 10.758,14.115 10.8,14.23C10.948,14.697 11.361,15.007 11.82,15.045C11.84,15.042 11.86,15.04 11.88,15.04C11.909,15.04 11.938,15.043 11.966,15.047C12.071,15.043 12.176,15.024 12.28,14.99C12.76,14.814 13.074,14.351 13.06,13.84C13.06,13.534 12.885,13.254 12.61,13.12L10.79,12.24C10.157,11.913 9.768,11.252 9.79,10.54C9.77,9.729 10.218,8.979 10.94,8.61C11.082,8.543 11.229,8.491 11.38,8.453L11.38,8C11.385,7.726 11.606,7.505 11.88,7.5C12.156,7.5 12.38,7.724 12.38,8L12.38,8.436C13.351,8.658 14.082,9.514 14.11,10.55C14.11,10.826 13.886,11.05 13.61,11.05C13.344,11.036 13.13,10.826 13.11,10.56C13.099,9.909 12.571,9.385 11.92,9.38C11.743,9.389 11.57,9.433 11.41,9.51C11.037,9.703 10.805,10.09 10.81,10.51C10.795,10.851 10.983,11.169 11.29,11.32L13.11,12.19C13.72,12.5 14.106,13.125 14.11,13.81C14.126,14.754 13.539,15.603 12.65,15.92C12.561,15.951 12.471,15.976 12.38,15.996L12.38,16.42C12.38,16.696 12.156,16.92 11.88,16.92C11.606,16.915 11.385,16.694 11.38,16.42L11.38,15.984C10.666,15.804 10.079,15.266 9.85,14.54Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M12.03,14.867C11.881,14.87 11.736,14.82 11.62,14.727L6.91,10.007C6.641,9.738 6.764,9.278 7.132,9.179C7.303,9.134 7.485,9.182 7.61,9.307L12,13.657L16.39,9.277C16.659,9.008 17.119,9.131 17.218,9.499C17.264,9.67 17.215,9.852 17.09,9.977L12.38,14.697C12.291,14.799 12.165,14.86 12.03,14.867Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M9.646,17.247a0.464,0.464 0,0 1,-0.35 -0.15,0.48 0.48,0 0,1 0,-0.7l4.35,-4.41 -4.35,-4.39a0.495,0.495 0,1 1,0.7 -0.7l4.72,4.71c0.09,0.094 0.141,0.22 0.14,0.35a0.641,0.641 0,0 1,-0.14 0.41l-4.72,4.71a0.485,0.485 0,0 1,-0.35 0.17z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M14.354,17.249a0.5,0.5 0,0 1,-0.35 -0.15l-4.71,-4.73a0.468,0.468 0,0 1,-0.15 -0.35,0.584 0.584,0 0,1 0.15,-0.41l4.71,-4.71a0.5,0.5 0,0 1,0.71 0c0.19,0.194 0.19,0.506 0,0.7l-4.39,4.39 4.39,4.39c0.19,0.194 0.19,0.506 0,0.7a0.512,0.512 0,0 1,-0.36 0.17z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M16.74,14.849C16.609,14.855 16.481,14.804 16.39,14.709L12,10.319L7.61,14.709C7.416,14.9 7.104,14.9 6.91,14.709C6.713,14.514 6.713,14.195 6.91,13.999L11.62,9.289C11.838,9.1 12.162,9.1 12.38,9.289L17.09,13.999C17.287,14.195 17.287,14.514 17.09,14.709C16.999,14.804 16.871,14.855 16.74,14.849Z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M5.605,18.892a0.473,0.473 0,0 1,-0.35 -0.14,0.5 0.5,0 0,1 0,-0.71l6.035,-6.04 -6.035,-6.04a0.5,0.5 0,0 1,0.7 -0.71l6.042,6.042 6.038,-6.042a0.51,0.51 0,0 1,0.71 0,0.5 0.5,0 0,1 0,0.71l-6.04,6.04 6.04,6.04a0.5,0.5 0,0 1,0 0.71,0.473 0.473,0 0,1 -0.35,0.14 0.501,0.501 0,0 1,-0.36 -0.14l-6.038,-6.042 -6.042,6.042a0.46,0.46 0,0 1,-0.35 0.14z"/>
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M19.654,12.494H5.534l6.68,6.68a0.51,0.51 0,0 1,0 0.71,0.54 0.54,0 0,1 -0.35,0.14 0.545,0.545 0,0 1,-0.36 -0.14l-7.51,-7.52a0.503,0.503 0,0 1,-0.148 -0.365,0.503 0.503,0 0,1 0.148,-0.365l7.51,-7.51a0.5,0.5 0,0 1,0.71 0.7l-6.652,6.67h14.092a0.5,0.5 0,0 1,0 1z"/>
</vector>
3 changes: 2 additions & 1 deletion designsystem/src/main/res/layout/ds_menu_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
app:layout_constraintBottom_toBottomOf="@id/ds_menu_label"
app:layout_constraintEnd_toEndOf="@+id/ds_menu_view_background"
app:layout_constraintTop_toTopOf="@id/ds_menu_label"
app:srcCompat="@drawable/ds_ic_arrow_down"
app:srcCompat="@drawable/ds_ic_outlined_navigation_arrowbottom"
app:tint="@color/colorBrdNatGray" />

</merge>
4 changes: 3 additions & 1 deletion sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
android:supportsRtl="true"
android:theme="@style/Theme.Natura">
<activity android:name=".components.ErrorActivity"></activity>
<activity android:name=".components.ButtonPrimaryActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -35,6 +34,9 @@
<activity
android:name=".components.IconActivity"
android:theme="@style/Theme.Natura" />
<activity
android:name=".components.DrawableActivity"
android:theme="@style/Theme.Natura" />
<activity
android:name=".components.LoadingActivity"
android:theme="@style/Theme.Natura" />
Expand Down
35 changes: 19 additions & 16 deletions sample/src/main/kotlin/com/natura/android/sample/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,29 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

// tokens
findViewById<Button>(R.id.btn_icons_font).setOnClickListener {
startActivity(Intent(this, IconActivity::class.java))
}

findViewById<Button>(R.id.btn_icons_drawables).setOnClickListener {
startActivity(Intent(this, DrawableActivity::class.java))
}

// components
findViewById<Button>(R.id.btn_textfield).setOnClickListener {
startActivity(Intent(this, TextFieldActivity::class.java))
}

findViewById<Button>(R.id.btn_input_text_highlight).setOnClickListener {
startActivity(Intent(this, ValueTextHighlightActivity::class.java))
}

findViewById<Button>(R.id.btn_style_buttons).setOnClickListener {
startActivity(Intent(this, StyleButtonActivity::class.java))
}

// patterns
findViewById<Button>(R.id.btn_submenu).setOnClickListener {
startActivity(Intent(this, SubmenuActivity::class.java))
}
Expand All @@ -28,29 +47,13 @@ class MainActivity : AppCompatActivity() {
startActivity(Intent(this, MenuActivity::class.java))
}

findViewById<Button>(R.id.btn_icons).setOnClickListener {
startActivity(Intent(this, IconActivity::class.java))
}

findViewById<Button>(R.id.btn_loading).setOnClickListener {
startActivity(Intent(this, LoadingActivity::class.java))
}

findViewById<Button>(R.id.btn_button_primary).setOnClickListener {
startActivity(Intent(this, ButtonPrimaryActivity::class.java))
}

findViewById<Button>(R.id.btn_error_default).setOnClickListener {
startActivity(Intent(this, ErrorActivity::class.java))
}

findViewById<Button>(R.id.btn_input_text_highlight).setOnClickListener {
startActivity(Intent(this, ValueTextHighlightActivity::class.java))
}

findViewById<Button>(R.id.btn_style_buttons).setOnClickListener {
startActivity(Intent(this, StyleButtonActivity::class.java))
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.natura.android.sample.components

import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.GridLayoutManager
import android.support.v7.widget.RecyclerView
import com.natura.android.sample.R

class DrawableActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_icon)

val iconGrid = findViewById<RecyclerView>(R.id.icon_grid)
iconGrid.layoutManager = GridLayoutManager(this, 2)

iconGrid.adapter = DrawableAdapter(this, recoverListIds(), recoverListNames())
}

private fun recoverListIds() = listOf(
R.drawable.ds_ic_filled_action_cancel,
R.drawable.ds_ic_filled_action_check,
R.drawable.ds_ic_outlined_action_cancel,
R.drawable.ds_ic_outlined_action_mic,
R.drawable.ds_ic_outlined_action_search,
R.drawable.ds_ic_outlined_finance_transfermoney,
R.drawable.ds_ic_outlined_navigation_arrowbottom,
R.drawable.ds_ic_outlined_navigation_arrowleft,
R.drawable.ds_ic_outlined_navigation_arrowright,
R.drawable.ds_ic_outlined_navigation_arrowtop,
R.drawable.ds_ic_outlined_navigation_close,
R.drawable.ds_ic_outlined_navigation_directionright
)

private fun recoverListNames() = listOf(
"ds_ic_filled_action_cancel",
"ds_ic_filled_action_check",
"ds_ic_outlined_action_cancel",
"ds_ic_outlined_action_mic",
"ds_ic_outlined_action_search",
"ds_ic_outlined_finance_transfermoney",
"ds_ic_outlined_navigation_arrowbottom",
"ds_ic_outlined_navigation_arrowleft",
"ds_ic_outlined_navigation_arrowright",
"ds_ic_outlined_navigation_arrowtop",
"ds_ic_outlined_navigation_close",
"ds_ic_outlined_navigation_directionright"
)
}
Loading