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
| AlertDialog dialog = new AlertDialog.Builder(this).create(); | |
| dialog.show(); | |
| Window window = dialog.getWindow(); | |
| window.clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); | |
| window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); |
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
| # default.custom.yaml | |
| # save it to: | |
| # ~/.config/ibus/rime (linux) | |
| # ~/Library/Rime (macos) | |
| # %APPDATA%\Rime (windows) | |
| patch: | |
| schema_list: | |
| - schema: luna_pinyin # 朙月拼音 | |
| - schema: luna_pinyin_simp # 朙月拼音 简化字模式 |
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 class Singleton { | |
| private static class Loader { | |
| private static final Singleton INSTANCE = new Singleton(); | |
| } | |
| private Singleton() { | |
| } | |
| public static Singleton getInstance() { |
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
| " ---------------------- USABILITY CONFIGURATION ---------------------- | |
| " Basic and pretty much needed settings to provide a solid base for | |
| " source code editting | |
| " don't make vim compatible with vi | |
| set nocompatible | |
| " turn on syntax highlighting | |
| syntax on | |
| " and show line numbers |
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
| function formatDate(date, format) { | |
| var map = { | |
| 'y': date.getFullYear(), | |
| 'M': date.getMonth() + 1, | |
| 'd': date.getDate(), | |
| 'H': date.getHours(), | |
| 'm': date.getMinutes(), | |
| 's': date.getSeconds() | |
| } |
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 class ValidateUtils { | |
| /** | |
| * 判断邮箱地址是否正确 | |
| * | |
| * @param email | |
| * @return | |
| */ | |
| public static boolean isValidEmail(String email) { | |
| if (TextUtils.isEmpty(email)) { | |
| return false; |
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
| set nocompatible " do not compatible to vi | |
| set history=50 " keep 50 lines of command line history | |
| set ruler " show the cursor position all the time | |
| set number " show line number | |
| set autoindent " auto indent | |
| set tabstop=4 softtabstop=4 shiftwidth=4 expandtab " set tab as 4 spaces | |
| set hidden " allow switching buffers without saving | |
| set laststatus=2 | |
| if !has('gui_running') | |
| set t_Co=256 |
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
| // uninstall a package | |
| Intent uninstallIntent = new Intent(Intent.ACTION_DELETE); | |
| uninstallIntent.setData(Uri.parse("package:com.example.app")); | |
| startActivity(uninstallIntent); | |
| // install a package | |
| Intent installIntent = new Intent(Intent.ACTION_INSTALL_PACKAGE); | |
| Uri uri = Uri.parse("file://" + Environment.getExternalStorageDirectory() + "/download/test.apk"); | |
| installIntent.setData(uri); |
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 class StringUtils { | |
| /** | |
| * convert input stream to string | |
| * | |
| * @param inputStream | |
| * @param encodings | |
| * @return | |
| * @throws IOException | |
| */ | |
| public static String convertStreamToString(InputStream inputStream, String... encodings) 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
| public void showDialog(View view) { | |
| final AlertDialog dialog = new AlertDialog.Builder(this).create(); | |
| dialog.show(); | |
| Window window = dialog.getWindow(); | |
| WindowManager.LayoutParams lp = window.getAttributes(); | |
| lp.width = WindowManager.LayoutParams.MATCH_PARENT; | |
| lp.height = WindowManager.LayoutParams.WRAP_CONTENT; | |
| lp.gravity = Gravity.BOTTOM; | |
| window.setAttributes(lp); | |
| window.setWindowAnimations(R.style.DialogAnimation); |