Skip to content

Commit

Permalink
Adaptive icon (#6)
Browse files Browse the repository at this point in the history
Update to sdk 27
  • Loading branch information
VladimirWrites committed Jan 16, 2018
1 parent 19be391 commit d5c06da
Show file tree
Hide file tree
Showing 19 changed files with 124 additions and 38 deletions.
8 changes: 4 additions & 4 deletions lemniscate/build.gradle
Expand Up @@ -2,12 +2,12 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
minSdkVersion 14
targetSdkVersion 26
targetSdkVersion 27
versionCode 141
versionName "1.4.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -25,7 +25,7 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:appcompat-v7:27.0.2'

testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:2.11.0'
Expand Down
12 changes: 6 additions & 6 deletions sample/build.gradle
Expand Up @@ -3,15 +3,15 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
compileSdkVersion 27
buildToolsVersion "27.0.3"

defaultConfig {
applicationId "com.vlad1m1r.lemniscate.sample"
minSdkVersion 14
targetSdkVersion 26
versionCode 120
versionName "1.2.0"
targetSdkVersion 27
versionCode 121
versionName "1.2.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -27,7 +27,7 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'me.relex:circleindicator:1.2.2@aar'
testCompile 'junit:junit:4.12'
compile project(':lemniscate')
Expand Down
1 change: 1 addition & 0 deletions sample/src/main/AndroidManifest.xml
Expand Up @@ -5,6 +5,7 @@
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
Expand Down
Expand Up @@ -69,8 +69,8 @@ class FragmentCurve : Fragment() {
}
}

override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val root = inflater!!.inflate(R.layout.fragment_curve, container, false) as ViewGroup
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val root = inflater.inflate(R.layout.fragment_curve, container, false) as ViewGroup

curveName = root.findViewById(R.id.textCurveName)
layoutViewHolder = root.findViewById(R.id.layoutViewHolder)
Expand All @@ -87,22 +87,22 @@ class FragmentCurve : Fragment() {

private fun getViewForPosition(position: Int): BaseCurveProgressView {
when (position) {
0 -> return BernoullisProgressView(context)
1 -> return GeronosProgressView(context)
2 -> return BernoullisBowProgressView(context)
3 -> return BernoullisSharpProgressView(context)
0 -> return BernoullisProgressView(context!!)
1 -> return GeronosProgressView(context!!)
2 -> return BernoullisBowProgressView(context!!)
3 -> return BernoullisSharpProgressView(context!!)

4 -> return EpitrochoidProgressView(context)
5 -> return HypotrochoidProgressView(context)
4 -> return EpitrochoidProgressView(context!!)
5 -> return HypotrochoidProgressView(context!!)

6 -> return XProgressView(context)
6 -> return XProgressView(context!!)

7 -> return RoundScribbleProgressView(context)
8 -> return ScribbleProgressView(context)
7 -> return RoundScribbleProgressView(context!!)
8 -> return ScribbleProgressView(context!!)

9 -> return CannabisProgressView(context)
10 -> return HeartProgressView(context)
else -> return BernoullisProgressView(context)
9 -> return CannabisProgressView(context!!)
10 -> return HeartProgressView(context!!)
else -> return BernoullisProgressView(context!!)
}
}

Expand All @@ -127,8 +127,8 @@ class FragmentCurve : Fragment() {
}


override fun onSaveInstanceState(outState: Bundle?) {
outState!!.putInt(KEY_POSITION, position)
override fun onSaveInstanceState(outState: Bundle) {
outState.putInt(KEY_POSITION, position)
super.onSaveInstanceState(outState)
}

Expand Down
Expand Up @@ -39,16 +39,16 @@ class FragmentSettings : Fragment(), SeekBar.OnSeekBarChangeListener, CompoundBu
private lateinit var curveData: CurveData
private var baseCurveProgressView: BaseCurveProgressView? = null

override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater!!.inflate(R.layout.fragment_settings, container, false)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.fragment_settings, container, false)
}

override fun onViewCreated(view: View?, savedInstanceState: Bundle?) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
curveData = if(savedInstanceState != null && savedInstanceState.containsKey("curve_data")) {
savedInstanceState.getParcelable("curve_data")
} else {
CurveData(color = ContextCompat.getColor(context, R.color.picker_color_1))
CurveData(color = ContextCompat.getColor(context!!, R.color.picker_color_1))
}

setupViews()
Expand Down Expand Up @@ -208,19 +208,19 @@ class FragmentSettings : Fragment(), SeekBar.OnSeekBarChangeListener, CompoundBu

override fun onClick(v: View) {
when (v.id) {
R.id.viewColor1 -> curveData.color = ContextCompat.getColor(context, R.color.picker_color_1)
R.id.viewColor2 -> curveData.color = ContextCompat.getColor(context, R.color.picker_color_2)
R.id.viewColor3 -> curveData.color = ContextCompat.getColor(context, R.color.picker_color_3)
R.id.viewColor4 -> curveData.color = ContextCompat.getColor(context, R.color.picker_color_4)
R.id.viewColor5 -> curveData.color = ContextCompat.getColor(context, R.color.picker_color_5)
R.id.viewColor6 -> curveData.color = ContextCompat.getColor(context, R.color.picker_color_6)
R.id.viewColor1 -> curveData.color = ContextCompat.getColor(context!!, R.color.picker_color_1)
R.id.viewColor2 -> curveData.color = ContextCompat.getColor(context!!, R.color.picker_color_2)
R.id.viewColor3 -> curveData.color = ContextCompat.getColor(context!!, R.color.picker_color_3)
R.id.viewColor4 -> curveData.color = ContextCompat.getColor(context!!, R.color.picker_color_4)
R.id.viewColor5 -> curveData.color = ContextCompat.getColor(context!!, R.color.picker_color_5)
R.id.viewColor6 -> curveData.color = ContextCompat.getColor(context!!, R.color.picker_color_6)
}
invalidateView(baseCurveProgressView)
}

override fun onSaveInstanceState(outState: Bundle?) {
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState?.putParcelable("curve_data", curveData)
outState.putParcelable("curve_data", curveData)
}
}

Expand Down
10 changes: 10 additions & 0 deletions sample/src/main/res/drawable-v26/ic_launcher_background.xml
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<vector
android:height="108dp"
android:width="108dp"
android:viewportHeight="108"
android:viewportWidth="108"
xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/color_primary"
android:pathData="M0,0h108v108h-108z"/>
</vector>
65 changes: 65 additions & 0 deletions sample/src/main/res/drawable-v26/ic_launcher_foreground.xml
@@ -0,0 +1,65 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108.0"
android:viewportHeight="108.0">
<path
android:pathData="m85.76,70.11c0.16,-0.08 0.62,-0.33 0.48,-0.23 -0.26,0.18 -1.06,0.67 -0.82,0.47 0.33,-0.28 0.73,-0.46 1.09,-0.7 0.48,-0.32 0.95,-0.64 1.42,-0.97 2.12,-1.46 1.64,-1.13 3.87,-2.73 3.19,-2.37 6.3,-4.91 8.86,-7.97 1.8,-2.15 1.95,-2.62 3.38,-4.99 1.25,-2.45 2.19,-5.04 2.71,-7.75 0.16,-0.84 0.24,-1.69 0.36,-2.54 0,0 1.49,-0.73 1.49,-0.73v0c-0.12,0.85 -0.2,1.71 -0.36,2.56 -0.52,2.72 -1.47,5.34 -2.72,7.81 -1.42,2.38 -1.59,2.87 -3.38,5.03 -2.54,3.06 -5.63,5.6 -8.8,7.98 -2.36,1.71 -1.56,1.15 -3.78,2.7 -1.71,1.19 -3.43,2.38 -5.32,3.28 0,0 1.51,-1.2 1.51,-1.2z"
android:strokeLineCap="square"
android:fillAlpha="0"
android:strokeColor="#00000000"
android:fillColor="#000000"
android:strokeWidth="1.51181102"
android:strokeLineJoin="miter"
android:strokeAlpha="0.5"/>
<path
android:pathData="m101.76,107.99 l-27.78,-0.09 -45.61,-45.61 11.63,3.12 11.09,-8.09 50.68,50.68v0"
android:strokeLineCap="butt"
android:fillAlpha="0.14117648"
android:strokeColor="#00000000"
android:fillColor="#000000"
android:strokeWidth="1"
android:strokeLineJoin="miter"
android:strokeAlpha="1"/>
<path
android:pathData="m51.09,57.31 l-13.77,-13.77 -7.66,2.05 -3.13,11.68 6.97,6.97h9.72z"
android:strokeLineCap="butt"
android:fillAlpha="0.08058824"
android:strokeColor="#00000000"
android:fillColor="#000000"
android:strokeWidth="1"
android:strokeLineJoin="miter"
android:strokeAlpha="1"/>
<path
android:pathData="m56.79,50.81 l13.61,13.57 7.3,-1.93 3.23,-12.07 -8.08,-8.08 -10.91,2.92z"
android:strokeLineCap="butt"
android:fillAlpha="0.08058824"
android:strokeColor="#00000000"
android:fillColor="#000000"
android:strokeWidth="1"
android:strokeLineJoin="miter"
android:strokeAlpha="1"/>
<path
android:pathData="m70.4,64.38 l37.67,37.67v6.07l-6.31,-0.14 -64.44,-64.44 7.15,2.11 17.52,17.52z"
android:strokeLineCap="butt"
android:fillAlpha="0.08058824"
android:strokeColor="#00000000"
android:fillColor="#000000"
android:strokeWidth="1"
android:strokeLineJoin="miter"
android:strokeAlpha="1"/>
<path
android:pathData="m80.01,46.12 l27.98,27.98 0.09,27.95 -37.67,-37.67 8.52,-3.09 2.67,-9.96z"
android:strokeLineCap="butt"
android:fillAlpha="0.14117647"
android:strokeColor="#00000000"
android:fillColor="#000000"
android:strokeWidth="1"
android:strokeLineJoin="miter"
android:strokeAlpha="1"/>

<path
android:pathData="m70.11,41.31c-5.48,0 -9.58,3.84 -12.87,6.93l-0.36,0.36c-0.64,0.6 -0.67,1.6 -0.06,2.23 0.6,0.63 1.61,0.66 2.25,0.06l0.36,-0.36c3.18,-2.98 6.47,-6.07 10.68,-6.07 4.56,0 9.28,3.57 9.28,9.54 0,5.97 -4.72,9.54 -9.28,9.54C63.64,63.54 55.96,53.83 55.06,52.8 54.24,51.88 46.11,41.31 37.89,41.31 31.77,41.31 25.44,46.05 25.44,54c0,7.95 6.33,12.69 12.46,12.69 5.48,0 9.58,-3.84 12.87,-6.93l0.28,-0.26c0.64,-0.6 0.67,-1.6 0.06,-2.23 -0.6,-0.63 -1.61,-0.66 -2.25,-0.06l-0.28,0.27c-3.18,2.98 -6.47,6.07 -10.68,6.07 -4.56,0 -9.28,-3.57 -9.28,-9.54 0,-5.97 4.72,-9.54 9.28,-9.54 6.57,0 13.91,9.44 14.74,10.38C53.53,55.87 62,66.69 70.11,66.69 76.23,66.69 82.56,61.95 82.56,54c0,-7.95 -6.33,-12.69 -12.46,-12.69z"
android:fillColor="#ffffff"/>

</vector>
5 changes: 5 additions & 0 deletions sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
5 changes: 5 additions & 0 deletions sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
Binary file modified sample/src/main/res/mipmap-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample/src/main/res/mipmap-mdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample/src/main/res/mipmap-xhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample/src/main/res/mipmap-xxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d5c06da

Please sign in to comment.