├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── dictionaries │ └── tyler.xml ├── encodings.xml ├── gradle.xml ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml ├── scopes │ └── scope_settings.xml └── vcs.xml ├── AngularAndroid.iml ├── LICENSE.txt ├── README-OLD.md ├── README.md ├── app ├── .gitignore ├── app-debug.apk ├── app.iml ├── build.gradle ├── manifest-merger-debug-report.txt ├── manifest-merger-release-report.txt ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── ngandroid │ │ └── demo │ │ ├── ApplicationTest.java │ │ ├── ModelTests.java │ │ └── ViewBindTests.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── ngandroid │ │ └── demo │ │ ├── model │ │ ├── DemoItem.java │ │ ├── NgMod.java │ │ ├── User.java │ │ └── test │ │ │ ├── Input.java │ │ │ ├── ModelTestScope.java │ │ │ ├── Note.java │ │ │ ├── TestBugScope.java │ │ │ ├── TestClass.java │ │ │ ├── TestJsonModel.java │ │ │ ├── TestModel.java │ │ │ ├── TestScope.java │ │ │ ├── TestSetterRequired.java │ │ │ ├── TestSubModel.java │ │ │ └── ViewScope.java │ │ ├── scope │ │ ├── DemoScope.java │ │ └── LoginScope.java │ │ └── ui │ │ └── pages │ │ ├── main │ │ ├── DemoActivity.java │ │ └── DemoAdapter.java │ │ ├── ngclick │ │ └── NgClickFragment.java │ │ └── ngmodel │ │ └── NgModelFragment.java │ └── res │ ├── drawable-hdpi │ └── ic_launcher.png │ ├── drawable-mdpi │ └── ic_launcher.png │ ├── drawable-xhdpi │ └── ic_launcher.png │ ├── drawable-xxhdpi │ └── ic_launcher.png │ ├── layout │ ├── activity_demo.xml │ ├── activity_ng_model.xml │ ├── fragment_ng_click.xml │ ├── login.xml │ ├── test_view.xml │ └── view_demo_item.xml │ ├── values-v16 │ └── styles.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lib ├── .gitignore ├── build.gradle ├── lib.iml ├── proguard-rules.pro └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── ngandroid │ │ │ └── lib │ │ │ ├── NgOptions.java │ │ │ ├── annotations │ │ │ ├── NgModel.java │ │ │ └── NgScope.java │ │ │ ├── exceptions │ │ │ └── NgException.java │ │ │ ├── ng │ │ │ ├── Controller.java │ │ │ └── ModelObserver.java │ │ │ └── utils │ │ │ ├── Blur.java │ │ │ ├── DefaultBlur.java │ │ │ ├── DefaultValueFormatter.java │ │ │ └── ValueFormatter.java │ └── res │ │ ├── attrs │ │ └── attrs.xml~ │ │ └── values │ │ └── attr.xml │ └── test │ └── java │ └── com │ └── ngandroid │ └── lib │ └── NgAndroidTest.java ├── ng-processor ├── .gitignore ├── build.gradle ├── ng-processor.iml └── src │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── github │ │ │ └── davityle │ │ │ └── ngprocessor │ │ │ ├── NgProcessor.java │ │ │ ├── attrcompiler │ │ │ ├── AttributeCompiler.java │ │ │ ├── GetExpressionVisitor.java │ │ │ ├── ObserveExpressionVisitor.java │ │ │ ├── SetExpressionVisitor.java │ │ │ ├── TypeCheckVisitor.java │ │ │ ├── Visitors.java │ │ │ ├── node │ │ │ │ ├── AVisitor.java │ │ │ │ ├── BinaryOperator.java │ │ │ │ ├── Expression.java │ │ │ │ ├── FunctionCall.java │ │ │ │ ├── FunctionName.java │ │ │ │ ├── IVisitor.java │ │ │ │ ├── Identifier.java │ │ │ │ ├── Node.java │ │ │ │ ├── NumberConstant.java │ │ │ │ ├── ObjectField.java │ │ │ │ ├── SpecialIdentifier.java │ │ │ │ ├── StringLiteral.java │ │ │ │ ├── TernaryOperator.java │ │ │ │ ├── UnaryOperator.java │ │ │ │ ├── ViewIdentifier.java │ │ │ │ └── XmlValue.java │ │ │ ├── parse │ │ │ │ ├── ParseException.java │ │ │ │ ├── Parser.java │ │ │ │ ├── State.java │ │ │ │ ├── StepResult.java │ │ │ │ ├── Token.java │ │ │ │ ├── TokenType.java │ │ │ │ └── Tokenizer.java │ │ │ └── sources │ │ │ │ └── Source.java │ │ │ ├── attributes │ │ │ ├── AttrDependency.java │ │ │ ├── AttrPackageResolver.java │ │ │ ├── Attribute.java │ │ │ ├── AttributeMap.java │ │ │ ├── Attributes.java │ │ │ └── ScopeAttrNameResolver.java │ │ │ ├── deps │ │ │ ├── AttrModule.java │ │ │ ├── DependencyComponent.java │ │ │ ├── LayoutModule.java │ │ │ └── UtilsModule.java │ │ │ ├── finders │ │ │ ├── AndroidManifestFinder.java │ │ │ ├── DefaultLayoutDirProvider.java │ │ │ ├── FileHelper.java │ │ │ ├── LayoutsFinder.java │ │ │ ├── ManifestFinder.java │ │ │ ├── NamespaceFinder.java │ │ │ └── OptionsHelper.java │ │ │ ├── map │ │ │ ├── LayoutScopeMapper.java │ │ │ └── ModelScopeMapper.java │ │ │ ├── model │ │ │ ├── Layout.java │ │ │ ├── Model.java │ │ │ └── Scope.java │ │ │ ├── source │ │ │ ├── SourceCreator.java │ │ │ ├── SourceField.java │ │ │ ├── linkers │ │ │ │ ├── ModelSourceLinker.java │ │ │ │ └── ScopeSourceLinker.java │ │ │ └── links │ │ │ │ ├── LayoutSourceLink.java │ │ │ │ ├── NgModelSourceLink.java │ │ │ │ ├── ScopeSourceLink.java │ │ │ │ └── SourceLink.java │ │ │ ├── util │ │ │ ├── CollectionUtils.java │ │ │ ├── ElementUtils.java │ │ │ ├── ManifestPackageUtils.java │ │ │ ├── MessageUtils.java │ │ │ ├── Option.java │ │ │ ├── PrimitiveUtils.java │ │ │ ├── ScopeUtils.java │ │ │ ├── Tuple.java │ │ │ ├── TypeUtils.java │ │ │ └── XmlNodeUtils.java │ │ │ └── xml │ │ │ ├── NamedNodeMapCollection.java │ │ │ ├── NodeCollection.java │ │ │ ├── NodeListCollection.java │ │ │ ├── XmlAttribute.java │ │ │ ├── XmlScope.java │ │ │ ├── XmlUtils.java │ │ │ └── XmlView.java │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ ├── javax.annotation.processing.Processor │ │ │ └── javax.annotation.processing.Processor~ │ │ ├── attributes │ │ ├── CompoundButtonInteractor.java │ │ ├── Executor.java │ │ ├── FireCheckObserver.java │ │ ├── NgBlur.java │ │ ├── NgChange.java │ │ ├── NgClick.java │ │ ├── NgDisabled.java │ │ ├── NgFocus.java │ │ ├── NgGone.java │ │ ├── NgIf.java │ │ ├── NgInvisible.java │ │ ├── NgLongClick.java │ │ ├── NgModel.java │ │ ├── NgText.java │ │ ├── SetTextModelObserver.java │ │ └── TextInteracter.java │ │ ├── attrs │ │ ├── attach │ │ │ ├── NgBlurAttach.java │ │ │ ├── NgChangeAttach.java │ │ │ ├── NgClickAttach.java │ │ │ ├── NgDisabledAttach.java │ │ │ ├── NgFocusAttach.java │ │ │ ├── NgGoneAttach.java │ │ │ ├── NgInvisibleAttach.java │ │ │ ├── NgLongClickAttach.java │ │ │ ├── NgModelAttach.java │ │ │ ├── NgScopeAttach.java │ │ │ └── NgTextAttach.java │ │ └── class │ │ │ ├── NgBlurClass.java │ │ │ ├── NgChangeClass.java │ │ │ ├── NgClickClass.java │ │ │ ├── NgDisabledClass.java │ │ │ ├── NgFocusClass.java │ │ │ ├── NgGoneClass.java │ │ │ ├── NgInvisibleClass.java │ │ │ ├── NgLongClickClass.java │ │ │ ├── NgModelClass.java │ │ │ ├── NgScopeClass.java │ │ │ └── NgTextClass.java │ │ ├── templates │ │ ├── layout.vm │ │ ├── ngmodel.vm │ │ └── scope.vm │ │ └── velocity.properties │ └── test │ ├── java │ └── com │ │ └── github │ │ └── davityle │ │ └── ngprocessor │ │ ├── CaseTest.java │ │ ├── DuplicateModelNameTest.java │ │ ├── DuplicateNameTest.java │ │ ├── InvalidModelTest.java │ │ ├── LoginTest.java │ │ ├── NestedClassesTest.java │ │ ├── NgProcessorTest.java │ │ ├── NonAccessableTest.java │ │ ├── R.java │ │ ├── attrcompiler │ │ ├── AttributeCompilerTest.java │ │ ├── parse │ │ │ ├── SyntaxParserTest.java │ │ │ └── TokenizerTest.java │ │ └── sources │ │ │ ├── BinaryOperatorSourceTest.java │ │ │ └── SourceTest.java │ │ └── util │ │ └── TypeUtilsTest.java │ └── resources │ ├── case_layouts │ └── case_test.xml │ ├── layouts │ └── ng_proc_test_layout.xml │ ├── test_login │ └── login.xml │ └── test_private_method │ └── test.xml ├── ngAndroid.iml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | 8 | *.apk 9 | *.ap_ 10 | *.dex 11 | *.class 12 | bin/ 13 | gen/ 14 | 15 | ng-processor/src/test/java/com/ngandroid/ 16 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | ngAndroid -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/dictionaries/tyler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 41 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AngularAndroid.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app-debug.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tyler-gh/ngAndroid/1497a9752cd3d4918035531cd072fd01576328e9/app/app-debug.apk -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.neenbedankt.android-apt' 3 | 4 | android { 5 | compileSdkVersion 22 6 | buildToolsVersion "20.0.0" 7 | 8 | defaultConfig { 9 | applicationId "com.ngandroid.angularandroid" 10 | minSdkVersion 15 11 | targetSdkVersion 22 12 | versionCode 1 13 | versionName "1.0" 14 | renderscriptTargetApi 19 15 | renderscriptSupportModeEnabled true 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | packagingOptions { 24 | exclude 'META-INF/LICENSE.txt' 25 | exclude 'META-INF/NOTICE.txt' 26 | exclude 'META-INF/services/javax.annotation.processing.Processor' 27 | } 28 | } 29 | 30 | dependencies { 31 | compile 'com.android.support:appcompat-v7:22.1.+' 32 | compile 'io.reactivex:rxandroid:1.0.1' 33 | compile project(':lib') 34 | compile project(':ng-processor') 35 | } 36 | -------------------------------------------------------------------------------- /app/manifest-merger-debug-report.txt: -------------------------------------------------------------------------------- 1 | -- Merging decision tree log --- 2 | manifest 3 | ADDED from AndroidManifest.xml:2:1 4 | package 5 | ADDED from AndroidManifest.xml:3:5 6 | INJECTED from AndroidManifest.xml:0:0 7 | INJECTED from AndroidManifest.xml:0:0 8 | android:versionName 9 | INJECTED from AndroidManifest.xml:0:0 10 | INJECTED from AndroidManifest.xml:0:0 11 | xmlns:android 12 | ADDED from AndroidManifest.xml:2:11 13 | android:versionCode 14 | INJECTED from AndroidManifest.xml:0:0 15 | INJECTED from AndroidManifest.xml:0:0 16 | application 17 | ADDED from AndroidManifest.xml:5:5 18 | MERGED from com.android.support:appcompat-v7:21.0.3:16:5 19 | MERGED from com.android.support:support-v4:21.0.3:16:5 20 | MERGED from com.android.support:appcompat-v7:21.0.3:16:5 21 | MERGED from com.android.support:support-v4:21.0.3:16:5 22 | android:label 23 | ADDED from AndroidManifest.xml:8:9 24 | android:allowBackup 25 | ADDED from AndroidManifest.xml:6:9 26 | android:icon 27 | ADDED from AndroidManifest.xml:7:9 28 | android:theme 29 | ADDED from AndroidManifest.xml:9:9 30 | activity#com.ngandroid.demo.DemoActivity 31 | ADDED from AndroidManifest.xml:10:9 32 | android:label 33 | ADDED from AndroidManifest.xml:12:13 34 | android:name 35 | ADDED from AndroidManifest.xml:11:13 36 | intent-filter#android.intent.action.MAIN+android.intent.category.LAUNCHER 37 | ADDED from AndroidManifest.xml:13:13 38 | action#android.intent.action.MAIN 39 | ADDED from AndroidManifest.xml:14:17 40 | android:name 41 | ADDED from AndroidManifest.xml:14:25 42 | category#android.intent.category.LAUNCHER 43 | ADDED from AndroidManifest.xml:16:17 44 | android:name 45 | ADDED from AndroidManifest.xml:16:27 46 | uses-sdk 47 | INJECTED from AndroidManifest.xml:0:0 reason: use-sdk injection requested 48 | MERGED from com.android.support:appcompat-v7:21.0.3:15:5 49 | MERGED from com.android.support:support-v4:21.0.3:15:5 50 | MERGED from AngularAndroid:lib:unspecified:8:5 51 | MERGED from com.android.support:appcompat-v7:21.0.3:15:5 52 | MERGED from com.android.support:support-v4:21.0.3:15:5 53 | android:targetSdkVersion 54 | INJECTED from AndroidManifest.xml:0:0 55 | INJECTED from AndroidManifest.xml:0:0 56 | android:minSdkVersion 57 | INJECTED from AndroidManifest.xml:0:0 58 | INJECTED from AndroidManifest.xml:0:0 59 | -------------------------------------------------------------------------------- /app/manifest-merger-release-report.txt: -------------------------------------------------------------------------------- 1 | -- Merging decision tree log --- 2 | manifest 3 | ADDED from AndroidManifest.xml:2:1 4 | package 5 | ADDED from AndroidManifest.xml:3:5 6 | INJECTED from AndroidManifest.xml:0:0 7 | INJECTED from AndroidManifest.xml:0:0 8 | android:versionName 9 | INJECTED from AndroidManifest.xml:0:0 10 | INJECTED from AndroidManifest.xml:0:0 11 | xmlns:android 12 | ADDED from AndroidManifest.xml:2:11 13 | android:versionCode 14 | INJECTED from AndroidManifest.xml:0:0 15 | INJECTED from AndroidManifest.xml:0:0 16 | application 17 | ADDED from AndroidManifest.xml:5:5 18 | android:label 19 | ADDED from AndroidManifest.xml:8:9 20 | android:allowBackup 21 | ADDED from AndroidManifest.xml:6:9 22 | android:icon 23 | ADDED from AndroidManifest.xml:7:9 24 | android:theme 25 | ADDED from AndroidManifest.xml:9:9 26 | activity#com.ngandroid.demo.DemoActivity 27 | ADDED from AndroidManifest.xml:10:9 28 | android:label 29 | ADDED from AndroidManifest.xml:12:13 30 | android:name 31 | ADDED from AndroidManifest.xml:11:13 32 | intent-filter#android.intent.action.MAIN+android.intent.category.LAUNCHER 33 | ADDED from AndroidManifest.xml:13:13 34 | action#android.intent.action.MAIN 35 | ADDED from AndroidManifest.xml:14:17 36 | android:name 37 | ADDED from AndroidManifest.xml:14:25 38 | category#android.intent.category.LAUNCHER 39 | ADDED from AndroidManifest.xml:16:17 40 | android:name 41 | ADDED from AndroidManifest.xml:16:27 42 | uses-sdk 43 | INJECTED from AndroidManifest.xml:0:0 reason: use-sdk injection requested 44 | MERGED from AngularAndroid:lib:unspecified:8:5 45 | android:targetSdkVersion 46 | INJECTED from AndroidManifest.xml:0:0 47 | INJECTED from AndroidManifest.xml:0:0 48 | android:minSdkVersion 49 | INJECTED from AndroidManifest.xml:0:0 50 | INJECTED from AndroidManifest.xml:0:0 51 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/davityle/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 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/ngandroid/demo/ViewBindTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Tyler Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.ngandroid.demo; 18 | 19 | import android.test.ActivityInstrumentationTestCase2; 20 | 21 | import com.ngandroid.demo.ui.pages.main.DemoActivity; 22 | 23 | /** 24 | * Created by tyler on 3/9/15. 25 | */ 26 | public class ViewBindTests extends ActivityInstrumentationTestCase2 { 27 | public ViewBindTests() { 28 | super(DemoActivity.class); 29 | } 30 | 31 | @Override 32 | protected void setUp() throws Exception { 33 | super.setUp(); 34 | 35 | } 36 | 37 | // @UiThreadTest 38 | // public void testSettingValuesAfterInflation(){ 39 | // ViewScope scope = new ViewScope(); 40 | // NgAndroid.getInstance().inflate(scope, LayoutInflater.from(getActivity()), R.layout.test_view, null); 41 | // scope.note.setId(100); 42 | // assertEquals(100, scope.note.getId()); 43 | // } 44 | // 45 | // public void testInflaterFactoryNotReCreated() throws NoSuchFieldException, IllegalAccessException { 46 | // LayoutInflater inflater = LayoutInflater.from(getActivity()); 47 | // 48 | // AttributeBinder attributeBinder = new AttributeBinder(inflater, new TestScope(), null); 49 | // Field f = AttributeBinder.class.getDeclaredField("mInflater"); 50 | // f.setAccessible(true); 51 | // LayoutInflater i1 = (LayoutInflater) f.get(attributeBinder); 52 | // assertEquals(inflater, i1); 53 | // BindingInflaterFactory factory1 = (BindingInflaterFactory) i1.getFactory(); 54 | // attributeBinder = new AttributeBinder(inflater, new TestScope(), null); 55 | // LayoutInflater i2 = (LayoutInflater) f.get(attributeBinder); 56 | // assertEquals(inflater, i2); 57 | // assertEquals(factory1, i2.getFactory()); 58 | // } 59 | 60 | 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/model/DemoItem.java: -------------------------------------------------------------------------------- 1 | package com.ngandroid.demo.model; 2 | 3 | import android.app.Fragment; 4 | 5 | public class DemoItem { 6 | private String text; 7 | private Class fragment; 8 | 9 | public DemoItem(){} 10 | public DemoItem(String text, Class fragment){ 11 | this.text = text; 12 | this.fragment = fragment; 13 | } 14 | 15 | public String getText() { 16 | return text; 17 | } 18 | 19 | public void setText(String text) { 20 | this.text = text; 21 | } 22 | 23 | public Class getFragment() { 24 | return fragment; 25 | } 26 | 27 | public void setFragment(Class fragment) { 28 | this.fragment = fragment; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/model/NgMod.java: -------------------------------------------------------------------------------- 1 | package com.ngandroid.demo.model; 2 | 3 | /** 4 | * Created by tyler on 4/28/15. 5 | */ 6 | public class NgMod { 7 | private String str; 8 | private int integer; 9 | private double dub; 10 | private float flt; 11 | private boolean bool; 12 | private long lon; 13 | 14 | public String getStr() { 15 | return str; 16 | } 17 | 18 | public void setStr(String str) { 19 | this.str = str; 20 | } 21 | 22 | public int getInteger() { 23 | return integer; 24 | } 25 | 26 | public void setInteger(int integer) { 27 | this.integer = integer; 28 | } 29 | 30 | public double getDub() { 31 | return dub; 32 | } 33 | 34 | public void setDub(double dub) { 35 | this.dub = dub; 36 | } 37 | 38 | public float getFlt() { 39 | return flt; 40 | } 41 | 42 | public void setFlt(float flt) { 43 | this.flt = flt; 44 | } 45 | 46 | public boolean getBool() { 47 | return bool; 48 | } 49 | 50 | public void setBool(boolean bool) { 51 | this.bool = bool; 52 | } 53 | 54 | public long getLon() { 55 | return lon; 56 | } 57 | 58 | public void setLon(long lon) { 59 | this.lon = lon; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/model/User.java: -------------------------------------------------------------------------------- 1 | package com.ngandroid.demo.model; 2 | 3 | public class User { 4 | 5 | private String username = "", password = ""; 6 | 7 | public String getUsername() { 8 | return username; 9 | } 10 | 11 | public void setUsername(String username) { 12 | this.username = username; 13 | } 14 | 15 | public String getPassword() { 16 | return password; 17 | } 18 | 19 | public void setPassword(String password) { 20 | this.password = password; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/model/test/Input.java: -------------------------------------------------------------------------------- 1 | package com.ngandroid.demo.model.test; 2 | 3 | public class Input { 4 | private String input; 5 | private int integer; 6 | private boolean disabled; 7 | private boolean gone; 8 | private boolean invisible; 9 | private boolean blur; 10 | private boolean focus; 11 | 12 | public String getInput() { 13 | return input; 14 | } 15 | 16 | public void setInput(String input) { 17 | this.input = input; 18 | } 19 | 20 | public int getInteger() { 21 | return integer; 22 | } 23 | 24 | public void setInteger(int integer) { 25 | this.integer = integer; 26 | } 27 | 28 | public boolean getDisabled() { 29 | return disabled; 30 | } 31 | 32 | public void setDisabled(boolean disabled) { 33 | this.disabled = disabled; 34 | } 35 | 36 | public boolean getGone() { 37 | return gone; 38 | } 39 | 40 | public void setGone(boolean gone) { 41 | this.gone = gone; 42 | } 43 | 44 | public boolean getInvisible() { 45 | return invisible; 46 | } 47 | 48 | public void setInvisible(boolean invisible) { 49 | this.invisible = invisible; 50 | } 51 | 52 | public boolean getBlur() { 53 | return blur; 54 | } 55 | 56 | public void setBlur(boolean blur) { 57 | this.blur = blur; 58 | } 59 | 60 | public boolean getFocus() { 61 | return focus; 62 | } 63 | 64 | public void setFocus(boolean focus) { 65 | this.focus = focus; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/model/test/ModelTestScope.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Tyler Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.ngandroid.demo.model.test; 18 | 19 | import com.ngandroid.lib.annotations.NgModel; 20 | import com.ngandroid.lib.annotations.NgScope; 21 | 22 | /** 23 | * Created by tyler on 3/23/15. 24 | */ 25 | @NgScope(name="ModelTestScope") 26 | public class ModelTestScope { 27 | // TODO throw an error in this situation @NgModel 28 | public TestSetterRequired testSetterRequired; 29 | @NgModel 30 | public TestJsonModel testJsonModel; 31 | @NgModel 32 | public TestSubModel testSubModel; 33 | @NgModel 34 | public TestClass TestClass; 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/model/test/Note.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Tyler Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.ngandroid.demo.model.test; 18 | 19 | public class Note { 20 | 21 | private long time; 22 | private int id; 23 | private String timeString; 24 | private String title; 25 | private String text; 26 | 27 | public long getTime() { 28 | return time; 29 | } 30 | 31 | public void setTime(long time) { 32 | this.time = time; 33 | } 34 | 35 | public int getId() { 36 | return id; 37 | } 38 | 39 | public void setId(int id) { 40 | this.id = id; 41 | } 42 | 43 | public String getTimeString() { 44 | return timeString; 45 | } 46 | 47 | public void setTimeString(String timeString) { 48 | this.timeString = timeString; 49 | } 50 | 51 | public String getTitle() { 52 | return title; 53 | } 54 | 55 | public void setTitle(String title) { 56 | this.title = title; 57 | } 58 | 59 | public String getText() { 60 | return text; 61 | } 62 | 63 | public void setText(String text) { 64 | this.text = text; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/model/test/TestBugScope.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Tyler Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.ngandroid.demo.model.test; 18 | 19 | import com.ngandroid.lib.annotations.NgModel; 20 | import com.ngandroid.lib.annotations.NgScope; 21 | 22 | /** 23 | * Created by tyler on 3/23/15. 24 | */ 25 | @NgScope(name="BugScope") 26 | public class TestBugScope { 27 | @NgModel 28 | public Input input; 29 | public void multiply(int x, int y){ 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/model/test/TestClass.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Tyler Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.ngandroid.demo.model.test; 18 | 19 | /** 20 | * Created by tyler on 4/1/15. 21 | */ 22 | public class TestClass { 23 | private int x; 24 | 25 | public void setX(int x) { 26 | this.x = x; 27 | } 28 | 29 | public int getX(){ 30 | return x; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/model/test/TestJsonModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Tyler Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.ngandroid.demo.model.test; 18 | 19 | /** 20 | * Created by tyler on 3/23/15. 21 | */ 22 | public class TestJsonModel { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/model/test/TestModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Tyler Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.ngandroid.demo.model.test; 18 | 19 | public class TestModel { 20 | 21 | private String joe; 22 | private boolean isInvisible; 23 | private int num; 24 | 25 | public String getJoe() { 26 | return joe; 27 | } 28 | 29 | public void setJoe(String joe) { 30 | this.joe = joe; 31 | } 32 | 33 | public boolean getIsInvisible() { 34 | return isInvisible; 35 | } 36 | 37 | public void setIsInvisible(boolean isInvisible) { 38 | this.isInvisible = isInvisible; 39 | } 40 | 41 | public int getNum() { 42 | return num; 43 | } 44 | 45 | public void setNum(int num) { 46 | this.num = num; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/model/test/TestScope.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Tyler Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.ngandroid.demo.model.test; 18 | 19 | import com.ngandroid.lib.annotations.NgModel; 20 | import com.ngandroid.lib.annotations.NgScope; 21 | 22 | /** 23 | * Created by tyler on 3/23/15. 24 | */ 25 | @NgScope(name="TestScope") 26 | public class TestScope { 27 | @NgModel 28 | public TestModel modelName; 29 | private void method(){ 30 | } 31 | private void method(String value){ 32 | System.out.println(value); 33 | } 34 | private void method(int value){ 35 | System.out.println(value); 36 | } 37 | private String getStringValue(){ 38 | return "This is a string value "; 39 | } 40 | private int getIntValue(){ 41 | return 42; 42 | } 43 | private boolean isTrue(){ 44 | return true; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/model/test/TestSetterRequired.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Tyler Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.ngandroid.demo.model.test; 18 | 19 | /** 20 | * Created by tyler on 3/23/15. 21 | */ 22 | public interface TestSetterRequired { 23 | 24 | public int getX(); 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/model/test/TestSubModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Tyler Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.ngandroid.demo.model.test; 18 | 19 | public class TestSubModel { 20 | public TestJsonModel jsonModel; 21 | 22 | public TestJsonModel getJsonModel() { 23 | return jsonModel; 24 | } 25 | 26 | public void setJsonModel(TestJsonModel jsonModel) { 27 | this.jsonModel = jsonModel; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/model/test/ViewScope.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Tyler Davis 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.ngandroid.demo.model.test; 18 | 19 | import com.ngandroid.lib.annotations.NgModel; 20 | import com.ngandroid.lib.annotations.NgScope; 21 | 22 | /** 23 | * Created by tyler on 3/23/15. 24 | */ 25 | @NgScope(name="ViewScope") 26 | public class ViewScope { 27 | @NgModel 28 | public Note note; 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/scope/DemoScope.java: -------------------------------------------------------------------------------- 1 | package com.ngandroid.demo.scope; 2 | 3 | import android.app.Fragment; 4 | 5 | import com.ngandroid.demo.model.DemoItem; 6 | import com.ngandroid.lib.annotations.NgModel; 7 | import com.ngandroid.lib.annotations.NgScope; 8 | 9 | @NgScope(name="DemoScope") 10 | public class DemoScope { 11 | @NgModel 12 | DemoItem item; 13 | 14 | private final FragmentSelectedListener fragmentSelectedListener; 15 | 16 | public DemoScope(FragmentSelectedListener fragmentSelectedListener){ 17 | this.fragmentSelectedListener = fragmentSelectedListener; 18 | } 19 | 20 | public void setItem(DemoItem item) { 21 | this.item.setText(item.getText()); 22 | this.item.setFragment(item.getFragment()); 23 | } 24 | 25 | public void showFragment(Class fragment){ 26 | fragmentSelectedListener.onFragmentSelected(fragment); 27 | } 28 | 29 | public interface FragmentSelectedListener { 30 | void onFragmentSelected(Class fragment); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/scope/LoginScope.java: -------------------------------------------------------------------------------- 1 | package com.ngandroid.demo.scope; 2 | 3 | import android.app.ProgressDialog; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | 7 | import com.ngandroid.demo.model.User; 8 | import com.ngandroid.demo.ui.pages.main.DemoActivity; 9 | import com.ngandroid.lib.annotations.NgModel; 10 | import com.ngandroid.lib.annotations.NgScope; 11 | 12 | import java.util.concurrent.TimeUnit; 13 | 14 | import rx.Observable; 15 | import rx.Subscriber; 16 | import rx.android.schedulers.AndroidSchedulers; 17 | import rx.schedulers.Schedulers; 18 | 19 | @NgScope(name="Login") 20 | public class LoginScope { 21 | 22 | @NgModel 23 | User user; 24 | 25 | void onSubmit(final Context context) { 26 | final ProgressDialog dialog = new ProgressDialog(context); 27 | dialog.setCancelable(false); 28 | dialog.setMessage("Logging in"); 29 | dialog.show(); 30 | Observable.timer(4, TimeUnit.SECONDS) 31 | .subscribeOn(Schedulers.io()) 32 | .observeOn(AndroidSchedulers.mainThread()) 33 | .subscribe(new Subscriber() { 34 | @Override 35 | public void onCompleted() { 36 | dialog.dismiss(); 37 | context.startActivity(new Intent(context, DemoActivity.class)); 38 | } 39 | 40 | @Override 41 | public void onError(Throwable e) { 42 | } 43 | 44 | @Override 45 | public void onNext(Long aLong) { 46 | } 47 | }); 48 | } 49 | 50 | void intArg(int i) { 51 | 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/ui/pages/main/DemoAdapter.java: -------------------------------------------------------------------------------- 1 | package com.ngandroid.demo.ui.pages.main; 2 | 3 | import android.app.Activity; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseAdapter; 8 | 9 | import com.ngandroid.demo.model.DemoItem; 10 | import com.ngandroid.demo.scope.DemoScope; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * Created by tyler on 4/23/15. 16 | */ 17 | class DemoAdapter extends BaseAdapter { 18 | 19 | // private final NgAndroid ngAndroid = NgAndroid.getInstance(); 20 | private final LayoutInflater inflater; 21 | private final DemoScope.FragmentSelectedListener fragmentSelectedListener; 22 | private final List items; 23 | 24 | DemoAdapter(Activity activity, DemoScope.FragmentSelectedListener fragmentSelectedListener, List items) { 25 | this.inflater = activity.getLayoutInflater(); 26 | this.fragmentSelectedListener = fragmentSelectedListener; 27 | this.items = items; 28 | } 29 | 30 | @Override 31 | public int getCount() { 32 | return items.size(); 33 | } 34 | 35 | @Override 36 | public Object getItem(int position) { 37 | return items.get(position); 38 | } 39 | 40 | @Override 41 | public long getItemId(int position) { 42 | return position; 43 | } 44 | 45 | @Override 46 | public View getView(int position, View convertView, ViewGroup parent) { 47 | if(convertView == null) { 48 | // DemoScope demoScope = new DemoScope(fragmentSelectedListener); 49 | convertView = new View(parent.getContext()); 50 | // convertView = ngAndroid.inflate(demoScope, inflater, R.layout.view_demo_item, parent, false); 51 | // convertView.setTag(demoScope); 52 | } 53 | // ((DemoScope)convertView.getTag()).setItem(items.get(position)); 54 | return convertView; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/ui/pages/ngclick/NgClickFragment.java: -------------------------------------------------------------------------------- 1 | package com.ngandroid.demo.ui.pages.ngclick; 2 | 3 | 4 | import android.app.Fragment; 5 | import android.os.Bundle; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.Toast; 10 | 11 | import com.ngandroid.demo.R; 12 | import com.ngandroid.demo.scope.LoginScope; 13 | import com.ngandroid.lib.NgOptions; 14 | import com.ngandroid.lib.annotations.NgModel; 15 | import com.ngandroid.lib.annotations.NgScope; 16 | 17 | import ng.layout.LoginController; 18 | 19 | /** 20 | * A simple {@link Fragment} subclass. 21 | */ 22 | @NgScope(name="ClickFragment") 23 | public class NgClickFragment extends Fragment { 24 | 25 | public NgClickFragment() { 26 | } 27 | 28 | @Override 29 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 30 | // View v = inflater.inflate(R.layout.fragment_ng_click, container, false); 31 | // new FragmentNgClickController(new NgOptions.Builder().build(), this).attach(v); 32 | 33 | View v = inflater.inflate(R.layout.login, container, false); 34 | new LoginController(new NgOptions.Builder().build(), new LoginScope()).attach(v); 35 | 36 | return v; 37 | } 38 | 39 | @NgModel 40 | Inv inv; 41 | 42 | public static class Inv { 43 | private boolean invisible, gone, disabled, focus, focus1; 44 | 45 | public boolean getInvisible() { 46 | return invisible; 47 | } 48 | 49 | public void setInvisible(boolean invisible) { 50 | this.invisible = invisible; 51 | } 52 | 53 | public boolean getGone() { 54 | return gone; 55 | } 56 | 57 | public void setGone(boolean gone) { 58 | this.gone = gone; 59 | } 60 | 61 | public boolean getDisabled() { 62 | return disabled; 63 | } 64 | 65 | public void setDisabled(boolean disabled) { 66 | this.disabled = disabled; 67 | } 68 | 69 | public boolean getFocus() { 70 | return focus; 71 | } 72 | 73 | public void setFocus(boolean focus) { 74 | this.focus = focus; 75 | } 76 | 77 | public boolean getFocus1() { 78 | return focus1; 79 | } 80 | 81 | public void setFocus1(boolean focus1) { 82 | this.focus1 = focus1; 83 | } 84 | } 85 | 86 | void makeToast(String value){ 87 | Toast.makeText(getActivity(), value, Toast.LENGTH_SHORT).show(); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /app/src/main/java/com/ngandroid/demo/ui/pages/ngmodel/NgModelFragment.java: -------------------------------------------------------------------------------- 1 | package com.ngandroid.demo.ui.pages.ngmodel; 2 | 3 | import android.app.Fragment; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | import com.ngandroid.demo.R; 11 | import com.ngandroid.demo.model.NgMod; 12 | import com.ngandroid.lib.NgOptions; 13 | import com.ngandroid.lib.annotations.NgModel; 14 | import com.ngandroid.lib.annotations.NgScope; 15 | 16 | import ng.layout.ActivityNgModelController; 17 | 18 | @NgScope(name="ModelFragment") 19 | public class NgModelFragment extends Fragment { 20 | @NgModel 21 | NgMod mod; 22 | 23 | @Nullable 24 | @Override 25 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 26 | View v = inflater.inflate(R.layout.activity_ng_model, container, false); 27 | new ActivityNgModelController(new NgOptions.Builder().build(), this).attach(v); 28 | return v; 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tyler-gh/ngAndroid/1497a9752cd3d4918035531cd072fd01576328e9/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tyler-gh/ngAndroid/1497a9752cd3d4918035531cd072fd01576328e9/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tyler-gh/ngAndroid/1497a9752cd3d4918035531cd072fd01576328e9/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tyler-gh/ngAndroid/1497a9752cd3d4918035531cd072fd01576328e9/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_demo.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 15 | 16 | 20 | 21 | 22 | 27 | 28 | 29 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_ng_click.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 |