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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
# Due to bugs in android resouce remover, the unused layout files is not removed | |
import xml.etree.ElementTree as ET | |
import os | |
import fnmatch |
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
# install android-resource-remover | |
pip install android-resource-remover | |
# there's some issue on remover currently, need to move manifest manually | |
cp ./<pathToManifest>/AndroidManifest.xml AndroidManifest.xml | |
android-resource-remover --xml <yourLintReport> |
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
./gradlew clean lint |
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"?> | |
<rotate | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:drawable="@drawable/original_image" | |
android:fromDegrees="90" | |
android:pivotX="50%" | |
android:pivotY="50%"/> | |
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
// the textview to show the image | |
TextView tv1=(TextView)findViewById(R.id.textview); | |
Typeface typeface=Typeface.createFromAsset(getAssets(),"fonts/iconfont.ttf"); | |
tv1.setTypeface(typeface); | |
// the unicode you add in tff | |
// instead of hard code it here, you should put it to your string file or make it to constant, so that it can be managed better. | |
tv1.setText("\ue600"); |
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
android { | |
defaultConfig { | |
... | |
vectorDrawables.useSupportLibrary = true | |
} | |
} |
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
<ImageView | |
android:layout_height="wrap_content" | |
android:layout_width="wrap_content" | |
app:srcCompat="@drawable/myimage" /> |
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
// Map for the version code that gives each ABI a value. | |
ext.abiCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2, 'x86': 3] | |
import com.android.build.OutputFile | |
android.applicationVariants.all { variant -> | |
variant.outputs.each { output -> | |
// Stores the value of ext.abiCodes that is associated with the ABI for this variant. | |
def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI)) | |
// Assigns a different version code for each output APK other than the universal APK. |
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
./gradlew -PsplitApks clean assembleRcRelease |
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
android.applicationVariants.all { variant -> | |
variant.outputs.each { output -> | |
// Stores the value of ext.abiCodes that is associated with the ABI for this variant. | |
def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI)) | |
// Assigns a different version code for each output APK other than the universal APK. | |
if (baseAbiVersionCode != null) { | |
output.versionCodeOverride = baseAbiVersionCode * 1000 + variant.versionCode | |
} | |
} |