下面是我的.xml
<data>
<variable
name="featureProductModel"
type="com.mca.craftisans.models.viewmodels.Dashboard.responce.HomeFeatureProductListModel" />
<variable
name="handlerFP"
type="com.mca.craftisans.controllers.Dashboard.ClickHandler.FeatureProductClickHandler" />
</data>
以下是我的数据模型:
import android.os.Parcel;导入android.os.Parcelable;公开课 HomeFeatureProductListModel实现可打包{
public static final Creator<HomeFeatureProductListModel> CREATOR = new Creator<HomeFeatureProductListModel>() { @Override public HomeFeatureProductListModel createFromParcel(Parcel in) { return new HomeFeatureProductListModel(in); } @Override public HomeFeatureProductListModel[] newArray(int size) { return new HomeFeatureProductListModel[size]; } }; private long ProductID; private String ProductName; private String ShortDescription; private Long Price1; private Long Price2; private Long StrikePrice1; private Long StrikePrice2; private String Slug; private int SiteVisitorWishListID; private String FullImagePath; private String ProductUrl; public HomeFeatureProductListModel() { } protected HomeFeatureProductListModel(Parcel in) { ProductID = in.readLong(); ProductName = in.readString(); ShortDescription = in.readString(); Price1 = in.readLong(); Price2 = in.readLong(); StrikePrice1 = in.readLong(); StrikePrice2 = in.readLong(); Slug = in.readString(); SiteVisitorWishListID = in.readInt(); FullImagePath = in.readString(); ProductUrl = in.readString(); } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeLong(ProductID); dest.writeString(ProductName); dest.writeString(ShortDescription); dest.writeLong(Price1); dest.writeLong(Price2); dest.writeLong(StrikePrice1); dest.writeLong(StrikePrice2); dest.writeString(Slug); dest.writeInt(SiteVisitorWishListID); dest.writeString(FullImagePath); dest.writeString(ProductUrl); } @Override public int describeContents() { return 0; } public long getProductID() { return ProductID; } public void setProductID(long productID) { ProductID = productID; } public String getProductName() { return ProductName; } public void setProductName(String productName) { ProductName = productName; } public String getShortDescription() { return ShortDescription; } public void setShortDescription(String shortDescription) { ShortDescription = shortDescription; } public Long getPrice1() { return Price1; } public void setPrice1(Long price1) { Price1 = price1; } public String getPrice1New() { String sss = "₹ " + String.valueOf(Price1); return sss; } public Long getPrice2() { return Price2; } public void setPrice2(Long price2) { Price2 = price2; } public Long getStrikePrice1() { return StrikePrice1; } public void setStrikePrice1(Long strikePrice1) { StrikePrice1 = strikePrice1; } public Long getStrikePrice2() { return StrikePrice2; } public void setStrikePrice2(Long strikePrice2) { StrikePrice2 = strikePrice2; } public String getSlug() { return Slug; } public void setSlug(String slug) { Slug = slug; } public int getSiteVisitorWishListID() { return SiteVisitorWishListID; } public void setSiteVisitorWishListID(int siteVisitorWishListID) { SiteVisitorWishListID = siteVisitorWishListID; } public String getFullImagePath() { return FullImagePath; } public void setFullImagePath(String fullImagePath) { FullImagePath = fullImagePath; } public String getProductUrl() { return ProductUrl; } public void setProductUrl(String productUrl) { ProductUrl = productUrl; } }
以下是我的模块级别build.gradle
buildscript {
repositories { google() maven { url "https://maven.google.com" } jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.2.1' classpath 'com.google.gms:google-services:3.0.0' classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' } } allprojects { repositories { google() maven { url "https://maven.google.com" } jcenter() mavenCentral() maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } maven { url 'http://lorenzo.villani.me/android-cropimage/' } maven { url 'https://zendesk.jfrog.io/zendesk/repo' } maven { url "https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/" } } } task clean(type: Delete) { delete rootProject.buildDir }
以下是我的应用程序级别build.gradle
应用插件:“ com.android.application”
android { compileSdkVersion 28
defaultConfig { applicationId "com.mca.craftisans" minSdkVersion 16 targetSdkVersion 28 versionCode 3 versionName "1.0.2" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" buildConfigField "boolean", "ALLOW_DATABASE", "false" multiDexEnabled true flavorDimensions "server" javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } } } dataBinding { enabled = true } dexOptions { javaMaxHeapSize "4g" } buildTypes { debug { signingConfig signingConfigs.kaira minifyEnabled false buildConfigField "boolean", "ALLOW_DATABASE", "true" proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } release { signingConfig signingConfigs.kaira minifyEnabled false buildConfigField "boolean", "ALLOW_DATABASE", "false" proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } }
ext {
supportLibVersion = '25.2.0' playServiceLibVersion = '9.6.1'
}
依赖项{ 实现'com.android.support.constraint:constraint-layout:1.1.2' 实现fileTree(include:['* .jar'],dir:'libs')
testImplementation 'junit:junit:4.12' implementation 'io.reactivex.rxjava2:rxjava:2.1.9' implementation 'io.reactivex.rxjava2:rxandroid:2.0.1' implementation 'com.jakewharton.rxbinding2:rxbinding-recyclerview-v7:2.0.0' implementation 'com.jakewharton.rxbinding2:rxbinding-support-v4:2.0.0' implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.0.0' implementation 'com.jakewharton.rxbinding2:rxbinding-design:2.0.0' implementation 'com.squareup.retrofit2:retrofit:2.0.2' implementation 'com.squareup.retrofit2:converter-gson:2.0.2' implementation 'com.squareup.okhttp3:logging-interceptor:3.2.0' implementation 'com.google.code.gson:gson:2.3'
}应用插件:“ com.google.gms.google-services”