MVVM for Android

Overview

AndroidBinding

MVVM for Android

What's New

  • Pre Compiled version available on root directory
  • android-binding.gen.zip for activity/application template code generation

Quick start

  • Download android-binding-version.jar and place under lib of your project
  • Unzip android-binding.gen.zip to root directory of your project
  • run the wizard.xml to generate application and activity codes

Markup Demo

  • Under Demo/MarkupDemoICS folder
  • The best way to start learning the framework!
Comments
  • Add MIT License to Repository

    Add MIT License to Repository

    On Google Code, this project is listed as having a MIT license. Without a LICENSE file checked into the repository, or it being mentioned in the README, it's hard to tell if it's still under the MIT license.

    I'd gladly submit a pull request, but I'm unsure of who the copyright should belong to.

    Thanks!

    opened by sghill 5
  • added Android Spinner support with SpinnerViewProvider

    added Android Spinner support with SpinnerViewProvider

    I added Spinner "entries" property support as I wanted to be able to give entries for a Spinner from my ViewModels.

    ViewModel:

    public IObservableCollection testList = new ArrayListObservable( String.class, new String[] {new String("A"), new String("C")} );

    View:

    opened by kosiara 1
  • NullPointerException on Android 4.3 (binding:selectedObject on AdapterView)

    NullPointerException on Android 4.3 (binding:selectedObject on AdapterView)

    NullPointerException on Android 4.3 if

    "binding:itemSource="" and "binding:selectedObject=""

    are used together on an AdapterView.

    opened by dommel81 0
  • fixed to don't notify observer objects that have been collected by GC

    fixed to don't notify observer objects that have been collected by GC

    In rare cases, when a value is set to an observable object, NullPointerException occurs.

    In the WeakList#toArray method, itemArray[i].get() may return null if the GC is executed between A and B.

    public Object[] toArray() {
      synchronized(this){
        removeReleased();  
        @SuppressWarnings("unchecked")
        WeakReference<E>[] itemArray = items.toArray(new WeakReference[0]); // (A)
        int len = itemArray.length;
        Object[] eArray = new Object[len];
        for(int i=0; i<len; i++){  // (B)
          eArray[i] = itemArray[i].get();  // may return null
        }
        return eArray;
      }
    }
    
    opened by eji 0
  • ClassCastException: androidx.appcompat.app.AppCompatDelegateImpl cannot be cast to gueei.binding.ViewFactory

    ClassCastException: androidx.appcompat.app.AppCompatDelegateImpl cannot be cast to gueei.binding.ViewFactory

    has custom bindable lib - https://github.com/gueei/AndroidBinding

    package gueei.binding;
    
    import android.content.Context;
    import android.util.AttributeSet;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.LayoutInflater.Factory;
    import java.util.ArrayList;
    
    public class ViewFactory implements import android.view.LayoutInflater.Factory; {
    
    }
    

    Here my snippet:

    import gueei.binding.Binder;
    import gueei.binding.Binder.InflateResult;
    import gueei.binding.ViewFactory;
    import androidx.fragment.app.FragmentActivity;
    
    LayoutInflater layoutInflater = LayoutInflater.from(context)
                    .cloneInContext(context);
            LayoutInflater.Factory layoutInflaterFactory = layoutInflater
                    .getFactory();
            ViewFactory bindingViewFactory = null;
            if (!(layoutInflaterFactory instanceof FragmentActivity)) {
                bindingViewFactory = (ViewFactory) layoutInflaterFactory;
            }
            if (bindingViewFactory == null) {
                bindingViewFactory = new ViewFactory(layoutInflater);
                layoutInflater.setFactory(bindingViewFactory);
    }
    

    And when I use android.support.v4.app.FragmentActivity my code work fine.

    But now I upgrade android project to use androidx.appcompat.app.AppCompatActivity;

    and as result in line:

    bindingViewFactory = (ViewFactory) layoutInflaterFactory; I has runtime error:

     FATAL EXCEPTION: main
     Process: com.myproject.tango.debug, PID: 10249
     java.lang.ClassCastException: androidx.appcompat.app.AppCompatDelegateImpl cannot be cast to gueei.binding.ViewFactory
        at com.myproject.binding.widget.BindableWidgetHelper.bindv4Fragment(BindableWidgetHelper.java:138)
        at com.myproject.commons.LayoutService.addView(LayoutService.java:128)
        at com.myproject.commons.LayoutService.addBody(LayoutService.java:150)
        at com.myproject.tango.widget.banner.BannerFragment.prepareChild(BannerFragment.java:211)
        at com.myproject.commons.roots.RootFragment.onCreateView(RootFragment.java:103)
        at com.myproject.tango.widget.banner.BannerFragment_.onCreateView(BannerFragment_.java:42)
        at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2612)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:874)
        at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1228)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1293)
    
    opened by alexei-28 1
  • How use this lib via gradle?

    How use this lib via gradle?

    I migrate my android project from Eclipse to Android Studio. In Eclipse I use lib androidbinding.jar And it's work fine. Nice.

    But now on Android Studio I use gradle to load all libs. How I can load lib AndroidBindingvia gradle?

    opened by alexei-28 1
  • android-binding-v0.6-build718.jar embeds android-support-v4...

    android-binding-v0.6-build718.jar embeds android-support-v4...

    The built JAR file provided in the root of this enlistment embeds instead of references Google's android-support-v4 library (as opposed to the earlier released android-binding-v30-0.52.jar which does not). This difference makes it difficult to build a project that references both the android-bindings JAR and the app compat library (com.android.support:appcompat-v7) due to duplicate errors raised during DEX-ing. BTW, I noticed that the ".fatjar" file under androidbindingv30 does attempt to exclude android-support-v4: excludes=<jar|android-support-v4.jar>;<jar|annotations.jar> but for some reason this didn't seem to stick...

    Could you update the published binary to not include the external bits?

    opened by CosminRadu 2
  • Support of FragmentActivity

    Support of FragmentActivity

    Hi @gueei ,

    I like your project and it saves me time. Thanks for that.

    I was wondering if you are planning to add support for FragmentActivities. I need them for my project. If you don't have the time or don't want to implement it, please let me know. With some instructions I can try to implement this if you want.

    Very nice project, keep up the good work :+1:

    opened by arnoldpistorius 0
  • Culd not find class problem

    Culd not find class problem

    Hi,

    I tryed to use your library in my project, and all was fine. But when i sturt to use BindableLinearLayout I give the next runtime errors:

    10-21 15:27:31.111: W/dalvikvm(15077): Link of class 'Lgueei/binding/v30/viewAttributes/absListView/MultiChoiceMode;' failed 10-21 15:27:31.111: E/dalvikvm(15077): Could not find class 'gueei.binding.v30.viewAttributes.absListView.MultiChoiceMode', referenced from method gueei.binding.v30.bindingProviders.ListViewProviderV30.createAttributeForView 10-21 15:27:31.121: W/dalvikvm(15077): VFY: unable to resolve new-instance 648 (Lgueei/binding/v30/viewAttributes/absListView/MultiChoiceMode;) in Lgueei/binding/v30/bindingProviders/ListViewProviderV30; 10-21 15:27:31.121: W/dalvikvm(15077): Link of class 'Lgueei/binding/v30/viewAttributes/absListView/ModalCheckedItemPositions;' failed 10-21 15:27:31.121: E/dalvikvm(15077): Could not find class 'gueei.binding.v30.viewAttributes.absListView.ModalCheckedItemPositions', referenced from method gueei.binding.v30.bindingProviders.ListViewProviderV30.createAttributeForView 10-21 15:27:31.121: W/dalvikvm(15077): VFY: unable to resolve new-instance 645 (Lgueei/binding/v30/viewAttributes/absListView/ModalCheckedItemPositions;) in Lgueei/binding/v30/bindingProviders/ListViewProviderV30; 10-21 15:27:31.121: W/dalvikvm(15077): Link of class 'Lgueei/binding/v30/viewAttributes/OnAttachViewAttributeV30;' failed 10-21 15:27:31.121: E/dalvikvm(15077): Could not find class 'gueei.binding.v30.viewAttributes.OnAttachViewAttributeV30', referenced from method gueei.binding.v30.bindingProviders.ViewProviderV30.createAttributeForView 10-21 15:27:31.121: W/dalvikvm(15077): VFY: unable to resolve new-instance 641 (Lgueei/binding/v30/viewAttributes/OnAttachViewAttributeV30;) in Lgueei/binding/v30/bindingProviders/ViewProviderV30; 10-21 15:27:31.121: W/dalvikvm(15077): Link of class 'Lgueei/binding/v30/viewAttributes/OnDetachViewAttributeV30;' failed 10-21 15:27:31.121: E/dalvikvm(15077): Could not find class 'gueei.binding.v30.viewAttributes.OnDetachViewAttributeV30', referenced from method gueei.binding.v30.bindingProviders.ViewProviderV30.createAttributeForView 10-21 15:27:31.121: W/dalvikvm(15077): VFY: unable to resolve new-instance 642 (Lgueei/binding/v30/viewAttributes/OnDetachViewAttributeV30;) in Lgueei/binding/v30/bindingProviders/ViewProviderV30; 10-21 15:27:31.141: W/dalvikvm(15077): VFY: unable to resolve virtual method 3874: Lgueei/binding/v30/app/BindingActivityV30;.getActionBar ()Landroid/app/ActionBar; 10-21 15:27:31.161: W/dalvikvm(15077): VFY: unable to resolve virtual method 3879: Lgueei/binding/v30/app/BindingActivityV30;.invalidateOptionsMenu ()V 10-21 15:27:31.171: W/dalvikvm(15077): threadid=1: thread exiting with uncaught exception (group=0x40020ac0) 10-21 15:27:31.181: E/AndroidRuntime(15077): FATAL EXCEPTION: main 10-21 15:27:31.181: E/AndroidRuntime(15077): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.alexdov.carprods/com.alexdov.carprods.MainActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class binding.BindableLinearLayout 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663) 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.os.Handler.dispatchMessage(Handler.java:99) 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.os.Looper.loop(Looper.java:123) 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.app.ActivityThread.main(ActivityThread.java:4627) 10-21 15:27:31.181: E/AndroidRuntime(15077): at java.lang.reflect.Method.invokeNative(Native Method) 10-21 15:27:31.181: E/AndroidRuntime(15077): at java.lang.reflect.Method.invoke(Method.java:521) 10-21 15:27:31.181: E/AndroidRuntime(15077): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878) 10-21 15:27:31.181: E/AndroidRuntime(15077): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636) 10-21 15:27:31.181: E/AndroidRuntime(15077): at dalvik.system.NativeStart.main(Native Method) 10-21 15:27:31.181: E/AndroidRuntime(15077): Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class binding.BindableLinearLayout 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576) 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618) 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.view.LayoutInflater.inflate(LayoutInflater.java:407) 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.view.LayoutInflater.inflate(LayoutInflater.java:320) 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.view.LayoutInflater.inflate(LayoutInflater.java:276) 10-21 15:27:31.181: E/AndroidRuntime(15077): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198) 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.app.Activity.setContentView(Activity.java:1647) 10-21 15:27:31.181: E/AndroidRuntime(15077): at com.alexdov.carprods.MainActivity.onCreate(MainActivity.java:14) 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 10-21 15:27:31.181: E/AndroidRuntime(15077): ... 11 more 10-21 15:27:31.181: E/AndroidRuntime(15077): Caused by: java.lang.ClassNotFoundException: binding.BindableLinearLayout in loader dalvik.system.PathClassLoader[/data/app/com.alexdov.carprods-2.apk] 10-21 15:27:31.181: E/AndroidRuntime(15077): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243) 10-21 15:27:31.181: E/AndroidRuntime(15077): at java.lang.ClassLoader.loadClass(ClassLoader.java:573) 10-21 15:27:31.181: E/AndroidRuntime(15077): at java.lang.ClassLoader.loadClass(ClassLoader.java:532) 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.view.LayoutInflater.createView(LayoutInflater.java:466) 10-21 15:27:31.181: E/AndroidRuntime(15077): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565) 10-21 15:27:31.181: E/AndroidRuntime(15077): ... 20 more Can you help me? Regards Alexey Dovgan.

    opened by AlexDovgan 1
  • Still alive?

    Still alive?

    Hi, there!

    Are you still supporting and developing this library? Because I found a few places with getting-started tutorials and I can see they must be old or something because using the current jar is published here (BTW: is that library compiled with the last codebase?) things seem to be different...

    Thanks

    opened by supermarcos 7
Owner
Andy Tsui
Andy Tsui
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
MVVM framework for Android

RoboMVVM - MVVM Framework For Android RoboMVVM is an open source library that facilitates the use of the MVVM pattern in Android apps. The MVVM patter

Debdatta Basu 55 Nov 24, 2020
Android part of the Android Studio(IntellijIDEA) OkHttp Profiler plugin

OkHttpProfiler Android Library Created by LocaleBro.com - Android Localization Platform The OkHttp Profiler plugin can show requests from the OkHttp l

Ievgenii 261 Dec 8, 2022
Android common lib, include ImageCache, HttpCache, DropDownListView, DownloadManager, Utils and so on

android-common-lib 关于我,欢迎关注 微博:Trinea 主页:trinea.cn 邮箱:trinea.cn#gmail.com 微信:codek2 主要包括:缓存(图片缓存、预取缓存、网络缓存)、公共View(下拉及底部加载更多ListView、底部加载更多ScrollView、

Trinea 5k Dec 30, 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 Dec 25, 2022
dexposed enable 'god' mode for single android application.

What is it? Dexposed is a powerful yet non-invasive runtime AOP (Aspect-oriented Programming) framework for Android app development, based on the work

Alibaba 4.5k Dec 28, 2022
A small, yet full-featured framework that allows building View-based Android applications

Conductor A small, yet full-featured framework that allows building View-based Android applications. Conductor provides a light-weight wrapper around

BlueLine Labs 3.9k Jan 6, 2023
A Job Queue specifically written for Android to easily schedule jobs (tasks) that run in the background, improving UX and application stability.

This Project is Deprecated! Thanks to everybody who've used Android Priority JobQueue. It was designed in a world where there was no JobScheduler, RxJ

Yigit Boyar 3.4k Dec 31, 2022
A plugin system that runs like a browser, but instead of load web pages, it load apk plugins which runs natively on Android system.

Android Dynamic Loader Android Dynamic Loader is a plugin system. The host application is like a browser, but instead of load web pages, it load plugi

Tu Yimin 1.4k Dec 28, 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
LiteOrm is a fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line of code efficiently.

#LiteOrm:Android高性能数据库框架 A fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line

马天宇 1.5k Nov 19, 2022
🚀Plugin for Android Studio And IntelliJ Idea to generate Kotlin data class code from JSON text ( Json to Kotlin )

JsonToKotlinClass Hi, Welcome! This is a plugin to generate Kotlin data class from JSON string, in another word, a plugin that converts JSON string to

Seal 2.8k Jan 3, 2023
Kick-starts Android application development.

Synopsis If you've made it here, chances are you are not quite as satisfied with the Android application framework as you could be. Same for us, that'

Matthias Käppler 1.3k Dec 4, 2022
Rosie is an Android framework to create applications following the principles of Clean Architecture.

Rosie The only way to make the deadline—the only way to go fast—is to keep the code as clean as possible at all times. — Robert C. Martin in Clean Cod

Karumi 1.8k Dec 28, 2022
Create kotlin android project with one line of command.

README This is an android application template project built with kotlin language and some useful libraries. It provides a creator script to quickly c

nekocode 1.6k Dec 20, 2022
Moxy is MVP library for Android

Moxy This Moxy repository is deprecated and no longer supported. Please migrate to the actual version of the Moxy framework at Moxy communuty repo. De

Arello Mobile 1.6k Dec 28, 2022
Minimal UI library for Android inspired by React

Anvil - reactive views for Android Anvil is a small Java library for creating reactive user interfaces. Originally inspired by React, it suits well as

null 1.4k Dec 23, 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
a MVP library for Android favoring a stateful Presenter

DEPRECATED - no longer actively maintained ThirtyInch - a MVP library for Android This library adds Presenters to Activities and Fragments. It favors

HCI @ gcx 1k Dec 15, 2022