For example, you want to set 40% alpha transparence to #000000
(black color), you need to add 66
like this #66000000
.
Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.
This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would
# Built application files | |
/*/build/ | |
# Crashlytics configuations | |
com_crashlytics_export_strings.xml | |
# Local configuration file (sdk path, etc) | |
local.properties | |
# Gradle generated files |
EDIT: You can find this same updated tutorial here -> Medium
Now I'm going to list how to publish an Android libray to jCenter and then syncronize it with Maven Central:
- I use "Android Studio" and I have this simple android lib that I would like to be available on maven: CircularImageView
/* | |
* Based on https://gist.github.com/jamiesanson/d1a3ed0910cd605e928572ce245bafc4 | |
* | |
* Refactored to use the preferred `DefaultLifecycleObserver` which does not rely on the annotation processor. | |
* See https://developer.android.com/reference/kotlin/androidx/lifecycle/Lifecycle#init | |
* | |
* Usage: | |
* `private var binding: TheViewBinding by viewLifecycle()` | |
*/ |
Android has a dedicated XML namespace intended for tools to be able to record information in XML files, and have that information stripped when the application is packaged such that there is no runtime or download size penalty. The namespace URI is http://schemas.android.com/tools and is usually bound to the tools: prefix:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
GsonBuilder().registerTypeAdapterFactory(NullStringToEmptyAdapterFactory()) | |
.create() | |
.run { | |
return fromJson(this@toObject, T::class.java) | |
} | |
class NullStringToEmptyAdapterFactory : TypeAdapterFactory { | |
override fun <T> create(gson: Gson, type: TypeToken<T>): TypeAdapter<T>? { | |
if (type.rawType != String::class.java) { |
package com.example; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import com.example.Foo; | |
import com.example.RecycledPagerAdapter; | |
public class FooAdapter extends RecycledPagerAdapter<FooViewHolder> { |
<component name="InspectionProjectProfileManager"> | |
<profile version="1.0"> | |
<option name="myName" value="Project Default" /> | |
<inspection_tool class="AndroidLintDrawAllocation" enabled="true" level="ERROR" enabled_by_default="true" /> | |
<inspection_tool class="SSBasedInspection" enabled="true" level="ERROR" enabled_by_default="true"> | |
<replaceConfiguration name="Escape apostrophes in Android string XMLs" text="<string $attributes$>$text$</string>" recursive="false" caseInsensitive="true" type="XML" reformatAccordingToStyle="true" shortenFQN="true" useStaticImport="true" replacement="<string $attributes$>$fixedText$</string>"> | |
<constraint name="attributes" minCount="0" maxCount="2147483647" within="" contains="" /> | |
<constraint name="text" regexp=".*[^\\]'.*" maxCount="2147483647" within="" contains="" /> | |
<variableDefinition name="fixedText" script=""text.getValue().replaceAll( "\\\\'|\'", "\\\\'" )"" /> | |
</replace |
// adapted from https://gist.github.com/dmarcato/d7c91b94214acd936e42 | |
def toCamelCase(String string) { | |
String result = "" | |
string.findAll("[^\\W]+") { String word -> | |
result += word.capitalize() | |
} | |
return result | |
} |