This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cyrilmottier.android.citybikes.provider; | |
import android.net.Uri; | |
import com.cyrilmottier.android.avelov.BuildConfig; | |
/** | |
* @author Cyril Mottier | |
*/ | |
public class CityBikesContract { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cyrilmottier.android.resourcesadditions; | |
import android.content.res.Resources; | |
import android.content.res.XmlResourceParser; | |
import android.os.Bundle; | |
import org.xmlpull.v1.XmlPullParser; | |
import org.xmlpull.v1.XmlPullParserException; | |
/** | |
* @author Cyril Mottier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cyrilmottier.android.citybikes; | |
import android.os.Bundle; | |
import com.cyrilmottier.android.avelov.R; | |
import com.cyrilmottier.android.citybikes.app.BaseActivity; | |
public class LicensesActivity extends BaseActivity { | |
private WebView mWebView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.cyrilmottier.android.anapp"> | |
<!-- ... --> | |
<application | |
android:icon="@drawable/ic_launcher" | |
android:label="@string/config_app_name" | |
android:theme="@style/Theme.AnApp" > |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.cyrilmottier.android.androidtips; | |
import android.content.BroadcastReceiver; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.content.IntentFilter; | |
import android.content.res.Configuration; | |
import android.os.Build; | |
import android.util.AttributeSet; | |
import android.view.View; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<string name="config_app_name">AVélib</string> | |
<string name="config_authority">com.cyrilmottier.android.avelib.citybikes</string> | |
<string name="config_com.google.android.maps.v2.api_key">XXX</string> | |
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val colorCount = RAINBOW_COLORS.size | |
val colors = IntArray(colorCount * 2) | |
val stops = FloatArray(colorCount * 2) | |
for (i in 0 until colorCount) { | |
colors[i * 2] = ContextCompat.getColor(context, RAINBOW_COLORS[i]) | |
colors[i * 2 + 1] = colors[i * 2] | |
stops[i * 2] = (i / colorCount.toFloat() + RAINBOW_EPSILON).coerceAtLeast(0f) | |
stops[i * 2 + 1] = ((i + 1) / colorCount.toFloat() - RAINBOW_EPSILON).coerceAtMost(1f) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return object : Drawable() { | |
private val paint = Paint() | |
init { | |
val scaledWidth = RAINBOW_WIDTH * context.resources.displayMetrics.density | |
val y1 = (Math.sin(2 * RAINBOW_ANGLE) / 2 * scaledWidth).toFloat() | |
val x1 = (scaledWidth - Math.tan(RAINBOW_ANGLE) * y1).toFloat() | |
paint.shader = LinearGradient( | |
0f, 0f, | |
x1, y1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val colorCount = RAINBOW_COLORS.size | |
val colors = IntArray(colorCount * 2) | |
val stops = FloatArray(colorCount * 2) | |
for (i in 0 until colorCount) { | |
colors[i * 2] = ContextCompat.getColor(context, RAINBOW_COLORS[i]) | |
colors[i * 2 + 1] = colors[i * 2] | |
stops[i * 2] = i / colorCount.toFloat() | |
stops[i * 2 + 1] = (i + 1) / colorCount.toFloat() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ColorRes | |
private val RAINBOW_COLORS = intArrayOf( | |
R.color.pink, | |
R.color.orange, | |
R.color.yellow, | |
R.color.green, | |
R.color.emerald_green, | |
R.color.azur_blue, | |
R.color.blue, | |
R.color.cerulean_blue, |
NewerOlder