File tree 35 files changed +584
-0
lines changed
androidTest/java/com/jayfeng/lesscode/app
java/com/jayfeng/lesscode/app
androidTest/java/com/jayfeng/lesscode/core
java/com/jayfeng/lesscode/core
35 files changed +584
-0
lines changed Original file line number Diff line number Diff line change
1
+ # built application files
2
+ * .apk
3
+ * .ap_
4
+
5
+ # files for the dex VM
6
+ * .dex
7
+
8
+ # Java class files
9
+ * .class
10
+
11
+ # generated files
12
+ bin /
13
+ gen /
14
+
15
+ # Local configuration file (sdk path, etc)
16
+ local.properties
17
+
18
+ # Eclipse project files
19
+ .classpath
20
+ .project
21
+
22
+ # Android Studio
23
+ .idea /
24
+ .gradle
25
+ /* /local.properties
26
+ /* /out
27
+ build
28
+ /* /* /production
29
+ * .iml
30
+ * .iws
31
+ * .ipr
32
+ * ~
33
+ * .swp
Original file line number Diff line number Diff line change
1
+ /build
Original file line number Diff line number Diff line change
1
+ apply plugin : ' com.android.application'
2
+
3
+ android {
4
+ compileSdkVersion 21
5
+ buildToolsVersion " 21.1.2"
6
+
7
+ defaultConfig {
8
+ applicationId " com.jayfeng.lesscode.app"
9
+ minSdkVersion 11
10
+ targetSdkVersion 21
11
+ versionCode 1
12
+ versionName " 1.0"
13
+ }
14
+ buildTypes {
15
+ release {
16
+ minifyEnabled false
17
+ proguardFiles getDefaultProguardFile(' proguard-android.txt' ), ' proguard-rules.pro'
18
+ }
19
+ }
20
+ }
21
+
22
+ dependencies {
23
+ compile fileTree(dir : ' libs' , include : [' *.jar' ])
24
+ compile ' com.android.support:appcompat-v7:21.0.3'
25
+ compile project(' :core' )
26
+ }
Original file line number Diff line number Diff line change
1
+ # Add project specific ProGuard rules here.
2
+ # By default, the flags in this file are appended to flags specified
3
+ # in /home/jay/tools/android-sdk/tools/proguard/proguard-android.txt
4
+ # You can edit the include path and order by changing the proguardFiles
5
+ # directive in build.gradle.
6
+ #
7
+ # For more details, see
8
+ # http://developer.android.com/guide/developing/tools/proguard.html
9
+
10
+ # Add any project specific keep options here:
11
+
12
+ # If your project uses WebView with JS, uncomment the following
13
+ # and specify the fully qualified class name to the JavaScript interface
14
+ # class:
15
+ #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16
+ # public *;
17
+ #}
Original file line number Diff line number Diff line change
1
+ package com .jayfeng .lesscode .app ;
2
+
3
+ import android .app .Application ;
4
+ import android .test .ApplicationTestCase ;
5
+
6
+ /**
7
+ * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
8
+ */
9
+ public class ApplicationTest extends ApplicationTestCase <Application > {
10
+ public ApplicationTest () {
11
+ super (Application .class );
12
+ }
13
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <manifest xmlns : android =" http://schemas.android.com/apk/res/android"
3
+ package =" com.jayfeng.lesscode.app" >
4
+
5
+ <application
6
+ android : allowBackup =" true"
7
+ android : icon =" @drawable/ic_launcher"
8
+ android : label =" @string/app_name"
9
+ android : theme =" @style/AppTheme" >
10
+ <activity
11
+ android : name =" .MainActivity"
12
+ android : label =" @string/title_activity_main" >
13
+ <intent-filter >
14
+ <action android : name =" android.intent.action.MAIN" />
15
+
16
+ <category android : name =" android.intent.category.LAUNCHER" />
17
+ </intent-filter >
18
+ </activity >
19
+ </application >
20
+
21
+ </manifest >
Original file line number Diff line number Diff line change
1
+ package com .jayfeng .lesscode .app ;
2
+
3
+ import android .support .v7 .app .ActionBarActivity ;
4
+ import android .os .Bundle ;
5
+ import android .view .Menu ;
6
+ import android .view .MenuItem ;
7
+ import android .widget .TextView ;
8
+
9
+ import com .jayfeng .lesscode .core .ViewLess ;
10
+
11
+
12
+ public class MainActivity extends ActionBarActivity {
13
+
14
+ TextView textView ;
15
+
16
+ @ Override
17
+ protected void onCreate (Bundle savedInstanceState ) {
18
+ super .onCreate (savedInstanceState );
19
+ setContentView (R .layout .activity_main );
20
+
21
+ textView = ViewLess .$ (this , R .id .hello );
22
+ }
23
+
24
+
25
+ @ Override
26
+ public boolean onCreateOptionsMenu (Menu menu ) {
27
+ // Inflate the menu; this adds items to the action bar if it is present.
28
+ getMenuInflater ().inflate (R .menu .menu_main , menu );
29
+ return true ;
30
+ }
31
+
32
+ @ Override
33
+ public boolean onOptionsItemSelected (MenuItem item ) {
34
+ // Handle action bar item clicks here. The action bar will
35
+ // automatically handle clicks on the Home/Up button, so long
36
+ // as you specify a parent activity in AndroidManifest.xml.
37
+ int id = item .getItemId ();
38
+
39
+ //noinspection SimplifiableIfStatement
40
+ if (id == R .id .action_settings ) {
41
+ return true ;
42
+ }
43
+
44
+ return super .onOptionsItemSelected (item );
45
+ }
46
+ }
Original file line number Diff line number Diff line change
1
+ <RelativeLayout xmlns : android =" http://schemas.android.com/apk/res/android"
2
+ xmlns : tools =" http://schemas.android.com/tools"
3
+ android : layout_width =" match_parent"
4
+ android : layout_height =" match_parent"
5
+ tools : context =" com.jayfeng.lesscode.app.MainActivity" >
6
+
7
+ <TextView android : id =" @+id/hello"
8
+ android : layout_width =" wrap_content"
9
+ android : layout_height =" wrap_content"
10
+ android : text =" @string/hello_world" />
11
+
12
+ </RelativeLayout >
Original file line number Diff line number Diff line change
1
+ <menu xmlns : android =" http://schemas.android.com/apk/res/android"
2
+ xmlns : app =" http://schemas.android.com/apk/res-auto"
3
+ xmlns : tools =" http://schemas.android.com/tools"
4
+ tools : context =" com.jayfeng.lesscode.app.MainActivity" >
5
+ <item android : id =" @+id/action_settings" android : title =" @string/action_settings"
6
+ android : orderInCategory =" 100" app : showAsAction =" never" />
7
+ </menu >
Original file line number Diff line number Diff line change
1
+ <resources >
2
+ <!-- Example customization of dimensions originally defined in res/values/dimens.xml
3
+ (such as screen margins) for screens with more than 820dp of available width. This
4
+ would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
5
+ <dimen name =" activity_horizontal_margin" >64dp</dimen >
6
+ </resources >
Original file line number Diff line number Diff line change
1
+ <resources >
2
+ <!-- Default screen margins, per the Android Design guidelines. -->
3
+ <dimen name =" activity_horizontal_margin" >16dp</dimen >
4
+ <dimen name =" activity_vertical_margin" >16dp</dimen >
5
+ </resources >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <resources >
3
+
4
+ <string name =" app_name" >LessCode</string >
5
+ <string name =" title_activity_main" >MainActivity</string >
6
+ <string name =" hello_world" >Hello world!</string >
7
+ <string name =" action_settings" >Settings</string >
8
+
9
+ </resources >
Original file line number Diff line number Diff line change
1
+ <resources >
2
+
3
+ <!-- Base application theme. -->
4
+ <style name =" AppTheme" parent =" Theme.AppCompat.Light.DarkActionBar" >
5
+ <!-- Customize your theme here. -->
6
+ </style >
7
+
8
+ </resources >
Original file line number Diff line number Diff line change
1
+ // Top-level build file where you can add configuration options common to all sub-projects/modules.
2
+
3
+ buildscript {
4
+ repositories {
5
+ jcenter()
6
+ }
7
+ dependencies {
8
+ classpath ' com.android.tools.build:gradle:1.0.0'
9
+
10
+ // NOTE: Do not place your application dependencies here; they belong
11
+ // in the individual module build.gradle files
12
+ }
13
+ }
14
+
15
+ allprojects {
16
+ repositories {
17
+ jcenter()
18
+ }
19
+ }
Original file line number Diff line number Diff line change
1
+ /build
Original file line number Diff line number Diff line change
1
+ apply plugin : ' com.android.library'
2
+
3
+ android {
4
+ compileSdkVersion 21
5
+ buildToolsVersion " 21.1.2"
6
+
7
+ defaultConfig {
8
+ minSdkVersion 11
9
+ targetSdkVersion 21
10
+ versionCode 1
11
+ versionName " 1.0"
12
+ }
13
+ buildTypes {
14
+ release {
15
+ minifyEnabled false
16
+ proguardFiles getDefaultProguardFile(' proguard-android.txt' ), ' proguard-rules.pro'
17
+ }
18
+ }
19
+ }
20
+
21
+ dependencies {
22
+ compile fileTree(dir : ' libs' , include : [' *.jar' ])
23
+ compile ' com.android.support:appcompat-v7:21.0.3'
24
+ }
Original file line number Diff line number Diff line change
1
+ # Add project specific ProGuard rules here.
2
+ # By default, the flags in this file are appended to flags specified
3
+ # in /home/jay/tools/android-sdk/tools/proguard/proguard-android.txt
4
+ # You can edit the include path and order by changing the proguardFiles
5
+ # directive in build.gradle.
6
+ #
7
+ # For more details, see
8
+ # http://developer.android.com/guide/developing/tools/proguard.html
9
+
10
+ # Add any project specific keep options here:
11
+
12
+ # If your project uses WebView with JS, uncomment the following
13
+ # and specify the fully qualified class name to the JavaScript interface
14
+ # class:
15
+ #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16
+ # public *;
17
+ #}
Original file line number Diff line number Diff line change
1
+ package com .jayfeng .lesscode .core ;
2
+
3
+ import android .app .Application ;
4
+ import android .test .ApplicationTestCase ;
5
+
6
+ /**
7
+ * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
8
+ */
9
+ public class ApplicationTest extends ApplicationTestCase <Application > {
10
+ public ApplicationTest () {
11
+ super (Application .class );
12
+ }
13
+ }
Original file line number Diff line number Diff line change
1
+ <manifest xmlns : android =" http://schemas.android.com/apk/res/android"
2
+ package =" com.jayfeng.lesscode.core" >
3
+
4
+ <application android : allowBackup =" true" android : label =" @string/app_name"
5
+ android : icon =" @drawable/ic_launcher" >
6
+
7
+ </application >
8
+
9
+ </manifest >
Original file line number Diff line number Diff line change
1
+ package com .jayfeng .lesscode .core ;
2
+
3
+ import android .app .Activity ;
4
+ import android .view .View ;
5
+
6
+ public class ViewLess {
7
+
8
+ public static <T extends View > T $ (Activity activity , int viewId ) {
9
+ return (T )activity .findViewById (viewId );
10
+ }
11
+
12
+ public static <T extends View > T $ (View parent , int viewId ) {
13
+ return (T )parent .findViewById (viewId );
14
+ }
15
+ }
Original file line number Diff line number Diff line change
1
+ <resources >
2
+ <string name =" app_name" >Core</string >
3
+ </resources >
Original file line number Diff line number Diff line change
1
+ # Project-wide Gradle settings.
2
+
3
+ # IDE (e.g. Android Studio) users:
4
+ # Gradle settings configured through the IDE *will override*
5
+ # any settings specified in this file.
6
+
7
+ # For more details on how to configure your build environment visit
8
+ # http://www.gradle.org/docs/current/userguide/build_environment.html
9
+
10
+ # Specifies the JVM arguments used for the daemon process.
11
+ # The setting is particularly useful for tweaking memory settings.
12
+ # Default value: -Xmx10248m -XX:MaxPermSize=256m
13
+ # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14
+
15
+ # When configured, Gradle will run in incubating parallel mode.
16
+ # This option should only be used with decoupled projects. More details, visit
17
+ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18
+ # org.gradle.parallel=true
Original file line number Diff line number Diff line change
1
+ # Wed Apr 10 15:27:10 PDT 2013
2
+ distributionBase =GRADLE_USER_HOME
3
+ distributionPath =wrapper/dists
4
+ zipStoreBase =GRADLE_USER_HOME
5
+ zipStorePath =wrapper/dists
6
+ distributionUrl =https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
You can’t perform that action at this time.
0 commit comments