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
| # .gitignore for Android projects | |
| # | |
| # Ignore all IDE specific files. | |
| # Old Eclipse files (.project, bin/, ...) should be deleted. | |
| .DS_Store | |
| # Android | |
| local.properties |
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
| /* | |
| * Copyright 2014 Google Inc. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
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
| /** | |
| * Copy file from {@code src} to {@code dest}. | |
| * | |
| * @param src | |
| * Source. | |
| * @param dest | |
| * Destination. | |
| * | |
| * @throws IOException | |
| */ |
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
| /** | |
| * Three different methods to get unique identifier on Android, they are all not the perfect solutions however could be used under project restriction limit. | |
| * | |
| * @author Xinyue Zhao | |
| */ | |
| public class DeviceUniqueUtil { | |
| /** | |
| * Android UUID method. It could be an unique solution. | |
| * See. http://developer.android.com/reference/java/util/UUID.html | |
| */ |
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
| //Also been posted http://stackoverflow.com/a/28944297/1835650 | |
| //R.id.parent_view: The parent ScrollView. | |
| //R.id.child_view: A scrollable object like RecycleView, ScrollView or ListView. | |
| findViewById(R.id.parent_view).setOnTouchListener(new View.OnTouchListener() { | |
| public boolean onTouch(View v, MotionEvent event) { | |
| View childV = findViewById(R.id.child_view); | |
| if (childV != null) { | |
| int[] l = new int[2]; | |
| childV.getLocationOnScreen(l); | |
| RectF rect = new RectF(l[0], l[1], l[0] + childV.getWidth(), l[1] + childV.getHeight()); |
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
| /* | |
| * Copyright (C) 2013 Square, Inc. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
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
| Locale.getDefault().getLanguage() ---> en | |
| Locale.getDefault().getISO3Language() ---> eng | |
| Locale.getDefault().getCountry() ---> US | |
| Locale.getDefault().getISO3Country() ---> USA | |
| Locale.getDefault().getDisplayCountry() ---> United States | |
| Locale.getDefault().getDisplayName() ---> English (United States) | |
| Locale.getDefault().toString() ---> en_US | |
| Locale.getDefault().getDisplayLanguage()---> English |
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 String readFromInputStream(InputStream is) throws IOException { | |
| BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | |
| StringBuilder builder = new StringBuilder(); | |
| String line; | |
| while ((line = reader.readLine()) != null) { | |
| builder.append(line); | |
| } | |
| return builder.toString(); | |
| } |
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
| var escapes = { | |
| "'": "'", | |
| '\\': '\\', | |
| '\r': 'r', | |
| '\n': 'n', | |
| '\u2028': 'u2028', | |
| '\u2029': 'u2029' | |
| }; | |
| var escapeMap = { |
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 = false | |
| def puts(s) | |
| print("@Tool@: ") | |
| super | |
| end | |
| def help |