A data-binding Presentation Model(MVVM) framework for the Android platform.

Related tags

MVVM/MVP RoboBinding
Overview

PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED.

As personal time contraints, I am currently unable to keep up. Please use official android databinding instead.

robobinding logo RoboBinding

A data-binding Presentation Model (MVVM) framework for the Android platform. RoboBinding helps you write UI code that is easier to read, test and maintain without performance compromise (code generation instead of java reflection).

  • removes - lots of unnecessary code(e.g., addXXListener(), findViewById()…​) - by binding.

  • turns - hard to unit tests and Android unit tests running for ages which makes unit tests impractical - into pure POJO PresentationModels with normal JUnit tests.

  • provides the object cursor as a replacement to - the relational cursor but we are used to operating objects.

  • it is easy to implement attribute bindings for any custom components, third-party components or Android widgets, which simplifies the code and produces more maintainable code base.

Let’s watch an introductory video and then get started from here.

RoboBinding values code quality. The framework source code is very readable and comes with a complete set of tests, which makes contributing easy and enjoyable. Want to contribute? Start here.

RoboBinding loves to hear any voices (negative or positive) or suggestions and invite you to post into RoboBinding Google group.

download Download: releases on Maven Central and latest snapshots on Sonatype OSS Repo.

Google groups Questions and Discussions: Google group

Twitter logo blue Twitter: @robobinding

Build and tested on CloudBees DEV@cloud

Android Arsenal
Comments
  • Compiler error

    Compiler error

    Sudden I'm getting: Caused by: java.lang.NoClassDefFoundError: com/google/common/collect/Sets at org.robobinding.codegen.presentationmodel.processor.PresentationModelProcessor.init(PresentationModelProcessor.java:43) at com.sun.tools.javac.processing.JavacProcessingEnvironment$ProcessorState.(JavacProcessingEnvironment.java:500) at com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors$ProcessorStateIterator.next(JavacProcessingEnvironment.java:597) at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:690) at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91) at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035) at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176) at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856) at com.sun.tools.javac.main.Main.compile(Main.java:523)

    opened by JohnnyTwoShoes 35
  • Problem with preinitialization of views

    Problem with preinitialization of views

    Hi,

    I have a problem with ViewBinder when it's created with preinitialization flag set to false.

    My fragment calls ViewBinder.inflateAndBind(..) in onCreateView. In that moment, I don't have data yet, so I'm disabling preinitialization (the view is invisible under progress bar). Some time later, after data is fetched, I call PresentationModelChangeSupport.refreshPresentationModel() to update displayed values in views. Some simple views seem to work, but the problem is with ListView - it has a proper number of items, but all items are empty.

    I've checked that ItemPresentationModel.updateData(..) method is called, but getters of bindable properties are never called. In debug I've seen that DataSetAdapter.preInitializeViews boolean field prevents views from refreshing.

    Is this a bug or am I missing something? How can I achieve binding delayed until data is fetched?

    opened by zbigniew-malinowski 26
  • BindingAttributeMappings has changed package name?

    BindingAttributeMappings has changed package name?

    Hello, With the last snapshot, we found some classes have been changed to different packages (for example org.robobinding.viewattribute.BindingAttributeMappings has been changed to org.robobinding.viewbinding.BindingAttributeMappings and so on). That makes build errors in our project. When we solve all the issues, the app crashes at some point. Is it possible to use the original package rather than moving to the new one?

    opened by hankhongyi 19
  • Not working on AppCompatActivity

    Not working on AppCompatActivity

    working normally on Activity/FragmentActivity

    public abstract class AbstractActivity extends Activity {
       ...
    }
    

    but not working on AppCompatActivity (Android suport lib version 22.1.1)

    public abstract class AbstractActivity extends AppCompatActivity {
       ...
    }
    
    opened by ipopza 14
  • Lost theme and style with AppCompatActivity

    Lost theme and style with AppCompatActivity

    Hi cheng,

    Please advice when I use RoboBinding with AppCompatActivity, the theme and style are lost. For example the title and back icon become black as they all should be white, and the background of back icon is lost too. Here is code in my project: AndroidManifext.xml:

       <activity
           android:name=".activity.MvpActivity"
           android:configChanges="orientation|keyboardHidden|screenSize"
           android:label="@string/app_name"
           android:launchMode="singleTop"
           android:screenOrientation="portrait"
           android:theme="@style/AppTheme.NoActionBar"
           android:windowSoftInputMode="stateHidden|adjustPan">
           <intent-filter>
               <action android:name="android.intent.action.VIEW" />
    
               <category android:name="android.intent.category.DEFAULT" />
           </intent-filter>
       </activity>
    

    Activity:

    public class MvpActivity extends AppCompatActivity {

    private Toolbar mToolbar;

    @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MvpPresentationModel presentationModel = new MvpPresentationModel(); ViewBinder viewBinder = new BinderFactoryBuilder().build().createViewBinder(this); View rootView = viewBinder.inflateAndBind(R.layout.bk_mvp, presentationModel); // View rootView = Binders.inflateAndBindWithoutPreInitializingViews(this, R.layout.bk_mvp, presentationModel); setContentView(rootView);

       mToolbar = (Toolbar) findViewById(R.id.toolbar);
       setSupportActionBar(mToolbar);
       if (getSupportActionBar() != null) {
           getSupportActionBar().setDisplayHomeAsUpEnabled(true);
       }
    

    } }

    Layout(bk_mvp.xml):

    <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:fitsSystemWindows="true" android:theme="@style/AppTheme.AppBarOverlay">

       <android.support.v7.widget.Toolbar
           android:id="@+id/toolbar"
           android:layout_width="match_parent"
           android:layout_height="?attr/actionBarSize"
           android:background="?attr/colorPrimary"
           app:popupTheme="@style/AppTheme.PopupOverlay"
           app:title="@string/settings" />
    

    </android.support.design.widget.AppBarLayout>

       <LinearLayout
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:orientation="vertical">
    
           <TextView
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               bind:text="{hello}" />
    
           <Button
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:text="Say Hello"
               bind:onClick="sayHello" />
       </LinearLayout>
    

    Toolbar lost color with binding(It's white without binding): image

    opened by ccc-rrr 13
  • Robobinings + AspectJ build error

    Robobinings + AspectJ build error

    FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':app:compileDebugAspectJ'.

      build config error: bad sourceroot: /home/sapientech/Dev/android/ally/Ally/app/src/debug/java

    • Try: Run with --info or --debug option to get more log output.

    • Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugAspectJ'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:66) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:153) at org.gradle.internal.Factories$1.create(Factories.java:22) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:150) at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83) at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:99) at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:48) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46) at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51) at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28) at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43) at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:173) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:239) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:212) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:205) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169) at org.gradle.launcher.Main.doAction(Main.java:33) at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:55) at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:36) at org.gradle.launcher.GradleMain.main(GradleMain.java:23) at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61) Caused by: org.gradle.api.GradleException: build config error: bad sourceroot: /home/sapientech/Dev/android/ally/Ally/app/src/debug/java at org.robobinding.plugin.AspectJCompile.abartWhenError(AspectJCompile.java:74) at org.robobinding.plugin.AspectJCompile.compile(AspectJCompile.java:66) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:228) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221) at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:621) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:604) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61) ... 60 more

    BUILD FAILED

    Total time: 12.632 secs

    Compilation exited abnormally with code 1 at Sun Sep 11 17:21:58

    opened by dylanjeffers 12
  • java.lang.ClassNotFoundException: Didn't find class

    java.lang.ClassNotFoundException: Didn't find class "android.widget.fragment"

    When I've added fragment to my Activity layout xml using:

    I got error:

    Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: Didn't find class "android.widget.fragment" on path: DexPathList[[zip file "/data/app/net.droidlabs.myapp-1.apk"],nativeLibraryDirectories=[/data/app-lib/net.droidlabs.myapp-1, /system/lib]]
                at org.robobinding.ViewFactory.onCreateView(ViewFactory.java:38)
                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
    

    Is it possible to use fragments that way with RoboBinding?

    minSdkVersion = 14 targetSdkVersion = 21 robobindingVersion = '0.8.10-SNAPSHOT'

    opened by radzio 12
  • Imports in generated code disappear when a custom class is bound more than once

    Imports in generated code disappear when a custom class is bound more than once

    Consider the following case:

    You have a custom View and a Robobinding Attribute which operates on a custom class (say a button which has two images and the class will hold two different id's). Everything works properly when you have only one such property in your ViewModel, but as soon as you add another compilation fails with "cannot find symbol CustomClass" in the generated code.

    A workaround for this is to have the binding work on a generic wrapping the custom class (List<>, Optional<>) etc, but it's not ideal as you either need to always use generics for custom attributes or be ready to refactor as soon as you need to use another custom View in your layout.

    opened by gstepniewski 10
  • How to get it working with gradle

    How to get it working with gradle

    Hi, I stumbled upon this project and wanted to give it a try with Android Studio and Gradle.

    I have a simple Model:

    package de.stelleberatung.robobinder;
    
    import org.robobinding.presentationmodel.PresentationModel;
    
    import javax.annotation.concurrent.ThreadSafe;
    
    /**
     * Created by stas on 2/16/14.
     */
    @ThreadSafe
    @PresentationModel
    public class Model {
        private String status;
    
        public String getStatus() {
            return status;
        }
    
        public void setStatus(String status) {
            this.status = status;
        }
    }
    

    An activity:

    package de.stelleberatung.robobinder;
    
    import android.app.Activity;
    import android.os.Bundle;
    
    import org.robobinding.binder.Binders;
    
    public class MainActivity extends Activity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            Binders.bind(this, R.layout.activity_main, new Model());
        }
    }
    

    And a layout file:

    
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:bind="http://robobinding.org/android"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:gravity="center">
    
        <TextView
            android:id="@+id/mStatusText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            bind:text="{status}"
            android:text="@string/inittext" />
    
    
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center">
    
            <Button
                android:id="@+id/mUpdateButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/updatetext" />
    
            <Button
                android:id="@+id/mQuitButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/quit" />
    
        </LinearLayout>
    
    </LinearLayout>
    

    When I assemble this with gradle I get:

    
    I/ActivityManager(  598): Start proc de.stelleberatung.robobinder for activity de.stelleberatung.robobinder/.MainActivity: pid=12214 uid=10180 gids={50180}
    I/ActivityManager(  598): Killing 11313:org.leetzone.android.yatsewidgetfree/u0a118 (adj 15): empty #17
    W/MediaFocusControl(  598):   RemoteControlClient died
    D/AndroidRuntime(12214): Shutting down VM
    W/dalvikvm(12214): threadid=1: thread exiting with uncaught exception (group=0x4198aba8)
    E/AndroidRuntime(12214): FATAL EXCEPTION: main
    E/AndroidRuntime(12214): Process: de.stelleberatung.robobinder, PID: 12214
    E/AndroidRuntime(12214): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.stelleberatung.robobinder/de.stelleberatung.robobinder.MainActivity}: org.robobinding.binder.ViewHierarchyInflationErrorsException: -------------------------TextView(1 errors)-----------------------
    E/AndroidRuntime(12214): text: You are binding to property 'status' but presentation model 'de.stelleberatung.robobinder.Model' is not observable. You either have to annotate your presentation model with @PresentationModel or implement interface ObservableProperties
    E/AndroidRuntime(12214): 
    E/AndroidRuntime(12214): 
    E/AndroidRuntime(12214):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
    E/AndroidRuntime(12214):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
    E/AndroidRuntime(12214):    at android.app.ActivityThread.access$800(ActivityThread.java:135)
    E/AndroidRuntime(12214):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
    E/AndroidRuntime(12214):    at android.os.Handler.dispatchMessage(Handler.java:102)
    E/AndroidRuntime(12214):    at android.os.Looper.loop(Looper.java:136)
    E/AndroidRuntime(12214):    at android.app.ActivityThread.main(ActivityThread.java:5017)
    E/AndroidRuntime(12214):    at java.lang.reflect.Method.invokeNative(Native Method)
    E/AndroidRuntime(12214):    at java.lang.reflect.Method.invoke(Method.java:515)
    E/AndroidRuntime(12214):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
    E/AndroidRuntime(12214):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
    E/AndroidRuntime(12214):    at dalvik.system.NativeStart.main(Native Method)
    E/AndroidRuntime(12214): Caused by: org.robobinding.binder.ViewHierarchyInflationErrorsException: -------------------------TextView(1 errors)-----------------------
    E/AndroidRuntime(12214): text: You are binding to property 'status' but presentation model 'de.stelleberatung.robobinder.Model' is not observable. You either have to annotate your presentation model with @PresentationModel or implement interface ObservableProperties
    E/AndroidRuntime(12214): 
    E/AndroidRuntime(12214): 
    E/AndroidRuntime(12214):    at org.robobinding.binder.BindingViewInflater.inflateView(BindingViewInflater.java:63)
    E/AndroidRuntime(12214):    at org.robobinding.binder.BindingViewInflater.inflateView(BindingViewInflater.java:58)
    E/AndroidRuntime(12214):    at org.robobinding.binder.InternalBinder.inflateAndBind(InternalBinder.java:50)
    E/AndroidRuntime(12214):    at org.robobinding.ActivityBinder.inflateAndBind(ActivityBinder.java:37)
    E/AndroidRuntime(12214):    at org.robobinding.binder.Binders.bind(Binders.java:37)
    E/AndroidRuntime(12214):    at de.stelleberatung.robobinder.MainActivity.onCreate(MainActivity.java:13)
    E/AndroidRuntime(12214):    at android.app.Activity.performCreate(Activity.java:5231)
    E/AndroidRuntime(12214):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
    E/AndroidRuntime(12214):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
    E/AndroidRuntime(12214):    ... 11 more
    W/ActivityManager(  598):   Force finishing activity de.stelleberatung.robobinder/.MainActivity
    W/ActivityManager(  598): Activity pause timeout for ActivityRecord{422cdbf0 u0 de.stelleberatung.robobinder/.MainActivity t91 f}
    I/ActivityManager(  598): Killing 11483:com.google.android.deskclock/u0a14 (adj 15): empty #17
    
    

    I assume this is closely related to #99 . So I tried to enable AspectJ with this build using gradle. I followed this thread: http://stackoverflow.com/questions/17245402/android-new-build-system-gradle-and-aspectj To get a gradle build file which hopefully interweaves the required aspects. My gradle file looks like this at the moment:

    repositories {
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/groups/public" }
    }
    
    apply plugin: 'android'
    
    configurations {
        ajc
        aspects
        ajInpath
    }
    
    dependencies {
        ajc "org.aspectj:aspectjtools:1.7.3"
        compile "org.aspectj:aspectjrt:1.7.3"
        compile 'org.robobinding:robobinding:0.8.2-SNAPSHOT'
    }
    
    
    
    android {
        compileSdkVersion 19
        buildToolsVersion "19.0.1"
    
        defaultConfig {
            minSdkVersion 14
            targetSdkVersion 19
            versionCode 1
            versionName "1.0"
        }
    
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
        buildTypes {
            release {
                runProguard false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }
        }
    }
    
    
    android.applicationVariants.all { variant ->
    
        variant.javaCompile.doLast {
            def androidSdk = android.adbExe.parent + "/../platforms/" + android.compileSdkVersion + "/android.jar"
    
            def iajcClasspath = configurations.compile.asPath + ";" + androidSdk
            configurations.compile.dependencies.each { dep ->
                if(dep.hasProperty("dependencyProject")) {
                    iajcClasspath += ":" + dep.dependencyProject.buildDir + "/bundles/release/classes.jar"
                }
            }
    
            ant.taskdef( resource:"org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties", classpath: configurations.ajc.asPath)
            ant.iajc (
                    source:sourceCompatibility,
                    target:targetCompatibility,
                    destDir:"${project.buildDir}/classes/${variant.dirName}",
                    maxmem:"512m",
                    fork:"true",
                    aspectPath:configurations.aspects.asPath,
                    inpath:configurations.ajInpath.asPath,
                    sourceRootCopyFilter:"**/.svn/*,**/*.java",
                    classpath:iajcClasspath
            ){
                sourceroots{
                    android.sourceSets.main.java.srcDirs.each{
                        pathelement(location:it.absolutePath)
                    }
                    pathelement(location:"${project.buildDir}/source/r/${variant.dirName}")
                }
            }
        }
    }
    

    However, it is still not working. Im not that familiar with AspectJ. Most likely its just a detail that is missing. Anyone around here who got robobinding working with gradle?

    opened by aiQon 9
  • Support for cardslib and/or RecycleView?

    Support for cardslib and/or RecycleView?

    Hi,

    It is not a bug but more a question. I was wondering if it is possible to use RoboBinding with cardslib ( https://github.com/gabrielemariotti/cardslib ) ? If it is possible theoretically what to do you suggest - custom bindings?

    And another question - is RoboBind is supporting or will support RecycleView?

    Cheers and thanks for great work!

    opened by radzio 7
  • Code generation logs are interpreted as errors in Android Studio

    Code generation logs are interpreted as errors in Android Studio

    During code generation phase of each build, the plugin outputs logs like this: PresentationModel 'abc.xyz.SomePresentationModel$$PM' generated.

    Android Studio (1.4) picks them up as errors: Error:(15, 8) Note: PresentationModel 'abc.xyz.SomePresentationModel$$PM' generated.

    It's quite irritating, because it makes IDE automatically opening code of mentioned PM in new tab and real compilation errors are harder to spot.

    Is it possible to somehow turn this off in current version, or configure AS to ignore them? In future, I think it would be nice to log them in some less intrusive way.

    opened by zbigniew-malinowski 6
  • crashes with newest Android Studio 3.0, gradle 4, buildtools 26

    crashes with newest Android Studio 3.0, gradle 4, buildtools 26

    Hello!

    We use Robobinding extensively in our project (and it is great). But there is issue when upgrading to newest BuildTools/gradle/Android Studio. To experience it you can just update https://github.com/RoboBinding/RoboBinding-album-sample with build.gradle and gradle-wrapper.properties.properties

    It seams that robobing expects to find for every static resource like: bind:itemLayout="@layout/album_row", bind:emptyViewLayout="@layout/albums_empty_view" exact same string @layout/album_row, @layout/albums_empty_view. Unfortunately this values are replaced by resource ids like @7f010007 (from R class). It is the reason of runtime binding crashing error.

    I found one workaround. You can substitute pattern from class org.robobinding.attribute.StaticResource:

    - static final String PATTERN = "@([\\w\\.]+:)?(\\w+)/(\\w+)";
    + static final String PATTERN = "@?([\\w\\.]+:)?(\\w+)/(\\w+)";
    

    and in layout files use bind:itemLayout"layout/album_row". It's not pretty but it works. Maybe you have other ideas to fix? I would be happy to contribute.

    Best regards, Andrzej

    opened by AndrzejPw 2
  • aspectj + dagger2 compilation issues

    aspectj + dagger2 compilation issues

    Error:error at this.litComponent = DaggerLitApp_LitComponent.create(); ^^^^^^^^^^^^^^^^ /home/sapientech/Dev/android/lit-circle/app/src/main/java/com/newtech/lit/LitApp.java:24:0::0 DaggerLitApp_LitComponent cannot be resolved FAILURE: Build failed with an exception.

    • What went wrong: Execution failed for task ':app:compileDebugAspectJ'.

    DaggerLitApp_LitComponent cannot be resolved

    When i use robobinding without aspectj, the project compiles

    Any ideas?

    opened by dylanjeffers 1
  • ViewBindings on subclasses broken

    ViewBindings on subclasses broken

    ViewBindings doesn't seem to apply on sub-classes of views. As far as I can tell, this issue only affects custom viewbindings.

    Example:

    This one works

            <android.support.design.widget.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <EditText
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textEmailAddress"
                    android:hint="@string/login_username_hint"
                    tools:text="[email protected]"
                    tools:inputType="textEmailAddress"
                    bind:text="${username}"
                    style="@style/editTextInput" />
            </android.support.design.widget.TextInputLayout>
    

    While this one will not work.

            <android.support.design.widget.TextInputLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
                <android.support.design.widget.TextInputEditText
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:inputType="textEmailAddress"
                    android:hint="@string/login_username_hint"
                    tools:text="[email protected]"
                    tools:inputType="textEmailAddress"
                    bind:text="${username}"
                    style="@style/editTextInput" />
            </android.support.design.widget.TextInputLayout>
    

    The only difference between these two layouts are android.support.design.widget.TextInputEditText vs EditText. android.support.design.widget.TextInputEditText extends AppCompatEditText which in turn extends EditText.

    The problem field is bind:text - there are no errors, but the binding is never applied to the view. Neither OneWay nor TwoWay bindings seems to have any effect. Please note that I've overwritten text with my own binding (see https://github.com/Dellkan/Robobinding-helpers/blob/master/robobinding-helpers-common/src/main/java/com/dellkan/robobinding/helpers/common/viewattributes/EditText/EditTextExtensions.java)

    Also note that I've tried with WebView (to test the last pull request), and had the same issue when I tried to use a subclass of WebView. Neither bindings that should be inherited, nor bindings applied directly to the subClass was applied.

    I've run some tests, and found that this issue was introduced in 0.8.14, while 0.8.13 works completely as expected (and inherits bindings correctly).

    opened by Dellkan 15
  • #238: item view preinitialization by default, with possibility to override by @DoNotPreinitialize

    #238: item view preinitialization by default, with possibility to override by @DoNotPreinitialize

    Fix to the problem described in issue #238 - when layout with adapter view was inflated with delayed initialization (preinitialize=false), item views were not initialized until reuse.

    This change fixes the problem and sets item view preinitialization as default policy. Developer can change this behavior on ItemPresentationModel impl level using @DoNotPreinitialize annotation.

    opened by zbigniew-malinowski 1
Releases(v0.8.14)
  • v0.8.14(Jun 13, 2016)

    1. #238 - Problem with preinitialization of views. ItemPresentationModel defaults to PreInitializingViews.YES. Big thanks to @zbigniew-malinowski 's contribution on this. @zbigniew-malinowski made this feature available.
    2. #248 - Lost theme and style with AppCompatActivity.
    3. #253 - Prefer using view.setTag(id, value) After API 14 to avoid conflict with glide for example.
    4. Removed the dependency on Google Guava, which has caused a lot of difficulties for new users.
    Source code(tar.gz)
    Source code(zip)
  • v0.8.13(Jan 24, 2016)

  • v0.8.12(Dec 5, 2015)

    1. #241 Added Support for SwipRefreshLayout "onRefresh" event. Thanks for @pkliang 's contribution.
    2. #239 A workaround for - Code generation logs are interpreted as errors in Android Studio.
    3. A fix for RecyclerView IPM.updateData and value invocation order - https://github.com/RoboBinding/RoboBinding/commit/ec332cc5a4bd1b0f9eaf06ba4e474c6db7fa7909
    Source code(tar.gz)
    Source code(zip)
  • v0.8.11(Oct 26, 2015)

    1. @ItemPresenationModel now added ItemLayout selector to support multiple layouts: @ItemPresentationModel(value = StringItemPresentationModel.class, factoryMethod = "createDifferentStringItemPresentationModel", viewTypeSelector = "selectViewType") example - https://github.com/RoboBinding/RoboBinding-gallery/blob/master/app/src/main/java/org/robobinding/gallery/presentationmodel/AdapterViewPresentationModel.java
    2. Added RecyclerView support. You can apply same @ItemPresentationModel for RecyclerView. And It support List, TypedCursor and new DataSetObservable. Actually, All Adapter liked View automatically support the three DataSet types. Also if you read RecyclerViewBinding implemenation, you will know that you can easily implement any third party or not-yet implemented DataSet Views easily. RoboBinding is designed for extension.

    example: https://github.com/RoboBinding/RoboBinding-gallery/blob/master/app/src/main/res/layout/activity_recycler_view.xml https://github.com/RoboBinding/RoboBinding-gallery/blob/master/app/src/main/java/org/robobinding/gallery/activity/RecyclerViewActivity.java https://github.com/RoboBinding/RoboBinding-gallery/blob/master/app/src/main/java/org/robobinding/gallery/presentationmodel/RecyclerViewPresentationModel.java

    RecyclerViewBinding implemenation: https://github.com/RoboBinding/RoboBinding/tree/develop/extras/src/main/java/org/robobinding/supportwidget/recyclerview

    Source code(tar.gz)
    Source code(zip)
Owner
RoboBinding open source
RoboBinding open source
RoboBinding open source
A sample project in Kotlin to demonstrate AndroidX, MVVM, Coroutines, Hilt, Room, Data Binding, View Binding, Retrofit, Moshi, Leak Canary and Repository pattern.

This repository contains a sample project in Kotlin to demonstrate AndroidX, MVVM, Coroutines, Hilt, Room, Data Binding, View Binding, Retrofit, Moshi, Leak Canary and Repository pattern

Areg Petrosyan 42 Dec 23, 2022
A Model-View-Presenter / Model-View-Intent library for modern Android apps

Mosby A Model-View-Presenter and Model-View-Intent library for Android apps. Dependency dependencies { compile 'com.hannesdorfmann.mosby3:mvi:3.1.1

Hannes Dorfmann 5.5k Jan 5, 2023
🧬 Android DataBinding kit for notifying data changes from Model layers to UI layers on MVVM architecture.

?? Android DataBinding kit for notifying data changes from Model layers to UI layers on MVVM architecture.

Jaewoong Eum 275 Dec 21, 2022
Nucleus is an Android library, which utilizes the Model-View-Presenter pattern to properly connect background tasks with visual parts of an application.

Nucleus Deprecation notice Nucleus is not under develpment anymore. It turns out that Redux architecture scales way better than MVP/MVI/MVVM/MVxxx and

Konstantin Mikheev 2k Nov 18, 2022
Model-View-ViewModel architecture components for mobile (android & ios) Kotlin Multiplatform development

Mobile Kotlin Model-View-ViewModel architecture components This is a Kotlin Multiplatform library that provides architecture components of Model-View-

IceRock Development 638 Jan 2, 2023
Retrieve Data from an API using MVVM Clean Architecture and Jetpack Compose

MVVM Clean Architecture Demo Retrieve Data from an API using MVVM Clean Architecture and Jetpack Compose. It simply shows a list of movies fetched fro

Daniel Kago 2 Sep 16, 2022
🍿 A TV Showcase App using Jetpack libs and MVVM arch. Data provided by TV Maze API

TV Showcase A TV Showcase ?? Android App using Jetpack libraries and MVVM architecture. Data provided by TVMaze API. Release ?? Download here See how

Lucas Rafagnin 4 Sep 8, 2022
MVVM RECIPE ANDROID APP Is an app where I show how to use MVVM, retrofit, dagger hilt, coroutine, liveData, Kotlin, navigation component, and so on...

MVVM RECIPE ANDROID APP Is an app where I show how to use MVVM, retrofit, dagger hilt, coroutine, liveData, kotlin, navigation component, and so on...

Isaias Cuvula 23 Dec 5, 2022
Basic-MVVM-Example - Basic Android Application MVVM

Android's MVVM Architecture in Kotlin Why a simple app ? Because it's easier to

null 3 Dec 8, 2022
MVVM Redux is a lightweight lib to help you apply the redux concepts in your project based in MVVM.

MVVM Redux is a lightweight lib to help you apply the redux concepts in your project based in MVVM.

Gabriel Brasileiro 36 Oct 16, 2022
Chat App MVVM + Clean ArchitectureChat App MVVM + Clean Architecture

Chat App MVVM + Clean Architecture This Android application built using MVVM + Clean Architecture architecture approach and is written 100% in Kotlin.

null 4 Nov 29, 2022
A full-featured framework that allows building android applications following the principles of Clean Architecture.

EasyMVP A powerful, and very simple MVP library with annotation processing and bytecode weaving. EasyMVP eliminates the boilerplate code for dealing w

null 1.3k Nov 19, 2022
Extendable MVI framework for Kotlin Multiplatform with powerful debugging tools (logging and time travel), inspired by Badoo MVICore library

Should you have any questions or ideas please welcome to the Slack channel: #mvikotlin Inspiration This project is inspired by Badoo MVICore library.

Arkadii Ivanov 460 Dec 31, 2022
Unidirectional Data Flow in Kotlin - Port of https://github.com/ReSwift/ReSwift to Kotlin

ReKotlin Port of ReSwift to Kotlin, which corresponds to ReSwift/4.0.0 Introduction ReKotlin is a Redux-like implementation of the unidirectional data

null 538 Dec 13, 2022
Discover the most popular and top rated movies playing. Movies data fetched using tomdbapi.com API.

Movie-App A simple news app build using MVVM architecture. Discover the most popular and top rated movies playing. Movies data fetched using tomdbapi.

Mahmudul Hasan 5 Jan 3, 2023
Repository that showcases 3 Android app architectures: "Standard Android", MVP and MVVM. The exact same app is built 3 times following the different patterns.

Archi This repository showcases and compares different architectural patterns that can be used to build Android apps. The exact same sample app is bui

Iván Carballo 3.4k Dec 21, 2022
Android Clean Architecture💎 Base Project Android with Kotlin and MVVM applying clean architecture

Android Clean Architecture?? Base Project Android with Kotlin and MVVM applying clean architecture

Mina Mikhail 103 Dec 2, 2022
MVVM for Android

AndroidBinding MVVM for Android What's New Pre Compiled version available on root directory android-binding.gen.zip for activity/application template

Andy Tsui 350 Dec 17, 2022