Skip to content

Commit ebdceb2

Browse files
committed
Fallback to rowType to FormRowDescriptorTypeDetail
1 parent da4d5a9 commit ebdceb2

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:2.2.3'
9+
classpath 'com.android.tools.build:gradle:2.3.0'
1010
}
1111
}
1212

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ buildscript {
66
jcenter()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:2.2.3'
9+
classpath 'com.android.tools.build:gradle:2.3.0'
1010
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
1111

1212
// NOTE: Do not place your application dependencies here; they belong
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Fri Feb 24 15:17:40 CET 2017
1+
#Tue Mar 14 15:01:01 CET 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

lib/QMBForm/src/main/java/com/quemb/qmbform/CellViewFactory.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ public CellViewFactory() {
7676
int currentapiVersion = Build.VERSION.SDK_INT;
7777

7878
mViewRowTypeMap = new HashMap<String, Class<? extends FormBaseCell>>();
79+
80+
//---
81+
// Deprecated
82+
mViewRowTypeMap.put(RowDescriptor.FormRowDescriptorTypeName, FormDetailTextFieldCell.class);
83+
mViewRowTypeMap.put(RowDescriptor.FormRowDescriptorTypeNameVertical, FormDetailTextInlineFieldCell.class);
84+
// --
85+
7986
mViewRowTypeMap.put(RowDescriptor.FormRowDescriptorTypeDetailInline, FormDetailTextInlineFieldCell.class);
8087
mViewRowTypeMap.put(RowDescriptor.FormRowDescriptorTypeDetail, FormDetailTextFieldCell.class);
8188
mViewRowTypeMap.put(RowDescriptor.FormRowDescriptorTypeText, FormEditTextFieldCell.class);
@@ -129,7 +136,13 @@ public Cell createViewForFormItemDescriptor(Context context, FormItemDescriptor
129136
try {
130137
FormBaseCell formBaseCell;
131138

132-
formBaseCell = mViewRowTypeMap.get(row.getRowType()).getConstructor(Context.class, RowDescriptor.class).newInstance(
139+
// Fallback to FormRowDescriptorTypeDetail if no RowType is defined
140+
String rowType = row.getRowType();
141+
if (!mViewRowTypeMap.containsKey(rowType)){
142+
rowType = RowDescriptor.FormRowDescriptorTypeDetail;
143+
}
144+
145+
formBaseCell = mViewRowTypeMap.get(rowType).getConstructor(Context.class, RowDescriptor.class).newInstance(
133146
context, row);
134147
rowView = formBaseCell;
135148
} catch (InstantiationException e) {

0 commit comments

Comments
 (0)