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 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
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
A data-binding Presentation Model(MVVM) framework for the Android platform.

PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED. As personal time contraints, I am currently unable to keep up. Please use official android da

RoboBinding open source 1.3k Dec 9, 2022
Membuat Aplikasi Github User MVVM dengan Android Studio

Membuat Aplikasi Github User MVVM dengan Android Studio. Ini hanya untuk referensi bagi kalian yang mengikuti Submission Dicoding Github User App.

Azhar Rivaldi 8 Nov 4, 2022
Tutorial MVVM Fast Android Networking

MVVM-FAN Tutorial MVVM Fast Android Networking Tutorial Build with Android Studio https://youtu.be/nXX-NQIoGjk Tutorial Build with Step by Step https:

Azhar Rivaldi 7 Dec 6, 2022
🧬 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
LukohSplash is based on Android latest architectural components,Jetpack, and follows MVVM design pattern.

?? The LukohSplash by open-source contributor, Lukoh. LukohSplash LukohSplash is based on Android latest architectural components,Jetpack, and follows

Lukoh-Nam 86 Dec 20, 2022
Android Jetpack MVVM Boilerplate. Integrated with Jetpack dependencies, Hilt, Room, Okhttp, Retrofit, etc.

Android Jetpack MVVM Boilerplate Android Jetpack MVVM Boilerplate a Jetpack based, MVVM boilerplate template project for Modern Android. Features Here

Johnny Miller 12 Jul 7, 2022
An Android Template with MVVM and Clean Architecture

MVVMTemplate ??‍ A simple Android template that lets you create an Android project quickly. How to use ?? Just click on button to create a new repo st

Hossein Abbasi 561 Jan 8, 2023
Simple Recipe/Dish list Android App that uses Compose, MVVM & Hilt.

Simple Recipe/Dish list Android App that uses Compose, MVVM & Hilt. This is the codebase that I am working on during my Youtube Live Stream (Link below...)

Benjamin Kadel 16 Oct 10, 2022
GraphQLTrial is a demo application based on modern Android application tech-stacks and MVVM architecture.

GraphQLTrial is a demo application based on modern Android application tech-stacks and MVVM architecture. App fetching data from the netw

Emre YILMAZ 6 Aug 19, 2022
Playground project built with MVVM with Clean Artchitect to try out new tech in Android 🌍

Clean-MVVM-Playground Playground project built with MVVM with Clean Artchitect to try out new tech in Android ?? Features ?? 100% Kotlin Following MVV

Somesh Kumar 8 Dec 9, 2022
Exploring and learning Android MVVM

Android App Architecture in The App Factory Authors Marshall Ladd The MVVM Design Pattern Contents Introduction How to Use This Guide MVVM What is MVV

null 1 Oct 11, 2021
A simple Android Application with MVVM Architecture, Coroutine, Retrofit2

Retrofit with Coroutines and MVVM Architecture. A simple Android Application with MVVM Architecture Developed Using LiveData. MVVM Architecture. Retro

Ahmed Eid 0 Oct 12, 2021
🎯 Einsen is a prioritization app that uses Eisenhower matrix technique as workflow to prioritize a list of tasks & built to Demonstrate use of Jetpack Compose with Modern Android Architecture Components & MVVM Architecture.

?? Einsen Einsen is a prioritization app that uses Eisenhower matrix technique as workflow to prioritize a list of tasks & built to Demonstrate use of

Sanju S 840 Jan 2, 2023
Keep My Notes App Android MVVM architecture

Keep My Notes My Notes. lien PlayStore Screenshots Architecture This app implements the MVVM architectural . Built with ViewModel - A class designed t

Riadh Yousfi 1 Nov 4, 2021