Posts

Showing posts from July, 2015

Begin to use vim in IntelliJ

Image
Install IdeadVim which is the most popular vim emulator in IntelliJ.

One of the most annoying thing using vim is the key esc. It's take 1-2 sec. to touche that esc key so I change it to j then k (my friend recommend this j,k key). The problems is I don't know how to change it until I found the answer in stackoverflow.



Study vim

openVim the interactive vim that gives you better exp. than just read the book.








Best way (for me) to paste the source code into the blog

I have search and found many tools and webs.

I decided to use hilite.me as my main tools

because it is beautiful, independent(no need to add code in to blogger's template)

the code look like this 


android { compileSdkVersion 18 buildToolsVersion "18.1.0"defversionPropsFile=file('version.properties') if (versionPropsFile.canRead()) { defProperties versionProps = new Properties() versionProps.load(new FileInputStream(versionPropsFile)) defcode= versionProps['VERSION_CODE'].toInteger() +1 versionProps['VERSION_CODE']=code.toString() versionProps.store(versionPropsFile.newWriter(), null) defaultConfig { versionCode code versionName "1.1" minSdkVersion 14 targetSdkVersion 18 } } else { throw new GradleException("Could not read version.properties!") } // rest of android block goes here }

[Android Gradle] Auto count the buildNumber and replaced in versionCode using gradle

Image
There are two methods.1. Modify the Android Manefist in gradle.buildtask('increaseVersionCode') << { defmanifestFile=file("AndroidManifest.xml") defpattern= Pattern.compile("versionCode=\"(\\d+)\"") defmanifestText= manifestFile.getText() defmatcher= pattern.matcher(manifestText) matcher.find() defversionCode= Integer.parseInt(matcher.group(1)) defmanifestContent= matcher.replaceAll("versionCode=\""+++versionCode +"\"") manifestFile.write(manifestContent) } tasks.whenTaskAdded { task ->if (task.name =='generateReleaseBuildConfig') { task.dependsOn 'increaseVersionCode' } }ref. stackoverflow2. Create modify the new files
android { compileSdkVersion 18 buildToolsVersion "18.1.0"defversionPropsFile=file('version.properties') if (versionPropsFile.canRead()) { defProperties versionProps = new Properties() ve…