This file contains hidden or 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
| data class Animal(val name: String) | |
| val animals = listOf(Animal("cat"), Animal("dog"), Animal("wolf")) | |
| fun main() { | |
| println("Hello, world!!!") | |
| println(animals.joinToString(",") { it.name }) | |
| } |
This file contains hidden or 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
| object FileUtils { | |
| fun readAssetFileToString(context: Context, assetFileName: String) | |
| = context.assets.open(assetFileName).bufferedReader().use { it.readText() } | |
| } |
This file contains hidden or 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
| public static List<String> githubList = new ArrayList<String>() {{ | |
| add("linkedin"); | |
| add("tumblr"); | |
| add("square"); | |
| add("google"); | |
| add("stripe"); | |
| add("angular"); | |
| add("facebook"); | |
| add("rails"); | |
| }}; |
This file contains hidden or 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
| Debug.dumpHprofData(heapDumpFile.getAbsolutePath()) |
This file contains hidden or 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
| final Toast toast = new Toast(context); | |
| toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0); | |
| toast.setDuration(Toast.LENGTH_LONG); | |
| LayoutInflater inflater = LayoutInflater.from(context); | |
| toast.setView(inflater.inflate(R.layout.leak_canary_heap_dump_toast, null)); | |
| toast.show(); |
This file contains hidden or 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
| @Override public boolean isDebuggerAttached() { | |
| return Debug.isDebuggerConnected(); | |
| } |
This file contains hidden or 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
| @Override | |
| public boolean isLeakStorageWritable() { | |
| if (!hasStoragePermission()) { | |
| return false; | |
| } | |
| String state = Environment.getExternalStorageState(); | |
| return Environment.MEDIA_MOUNTED.equals(state); | |
| } | |
| @TargetApi(M) |
This file contains hidden or 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
| <layout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:bind="http://schemas.android.com/apk/res-auto"> | |
| <data> | |
| <import type="com.liangfeizc.databindingsamples.basic.User" /> | |
| <variable | |
| name="user" | |
| type="User" /> |