Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added SuppressWarning to please travis-ci #26

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
package com.quemb.qmbform.sample.controller;

import com.quemb.qmbform.FormManager;
import com.quemb.qmbform.OnFormRowClickListener;
import com.quemb.qmbform.annotation.FormDescriptorAnnotationFactory;
import com.quemb.qmbform.descriptor.CellDescriptor;
import com.quemb.qmbform.descriptor.FormDescriptor;
import com.quemb.qmbform.descriptor.FormItemDescriptor;
import com.quemb.qmbform.descriptor.OnFormRowValueChangedListener;
import com.quemb.qmbform.descriptor.RowDescriptor;
import com.quemb.qmbform.descriptor.Value;
import com.quemb.qmbform.sample.R;
import com.quemb.qmbform.sample.model.Entry;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
Expand All @@ -23,6 +11,17 @@
import android.view.ViewGroup;
import android.widget.ListView;

import com.quemb.qmbform.FormManager;
import com.quemb.qmbform.OnFormRowClickListener;
import com.quemb.qmbform.annotation.FormDescriptorAnnotationFactory;
import com.quemb.qmbform.descriptor.FormDescriptor;
import com.quemb.qmbform.descriptor.FormItemDescriptor;
import com.quemb.qmbform.descriptor.OnFormRowValueChangedListener;
import com.quemb.qmbform.descriptor.RowDescriptor;
import com.quemb.qmbform.descriptor.Value;
import com.quemb.qmbform.sample.R;
import com.quemb.qmbform.sample.model.Entry;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
Expand Down Expand Up @@ -135,7 +134,7 @@ public void onFormRowClick(FormItemDescriptor itemDescriptor) {
}

@Override
public void onValueChanged(RowDescriptor rowDescriptor, Value<?> oldValue, Value<?> newValue) {
public void onValueChanged(RowDescriptor<?> rowDescriptor, Value<?> oldValue, Value<?> newValue) {
Log.d(TAG, "Value Changed: " + rowDescriptor.getTitle());
// Log.d(TAG, "Old Value: "+oldValue);
// Log.d(TAG, "New Value: "+newValue);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
package com.quemb.qmbform.sample.controller;

import com.quemb.qmbform.descriptor.CellDescriptor;
import com.quemb.qmbform.descriptor.DataSource;
import com.quemb.qmbform.FormManager;
import com.quemb.qmbform.OnFormRowClickListener;
import com.quemb.qmbform.descriptor.DataSourceListener;
import com.quemb.qmbform.descriptor.FormDescriptor;
import com.quemb.qmbform.descriptor.FormItemDescriptor;
import com.quemb.qmbform.descriptor.OnFormRowChangeListener;
import com.quemb.qmbform.descriptor.OnFormRowValueChangedListener;
import com.quemb.qmbform.descriptor.RowDescriptor;
import com.quemb.qmbform.descriptor.SectionDescriptor;
import com.quemb.qmbform.descriptor.Value;
import com.quemb.qmbform.sample.R;

import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
Expand All @@ -27,6 +13,20 @@
import android.view.ViewGroup;
import android.widget.ListView;

import com.quemb.qmbform.FormManager;
import com.quemb.qmbform.OnFormRowClickListener;
import com.quemb.qmbform.descriptor.CellDescriptor;
import com.quemb.qmbform.descriptor.DataSource;
import com.quemb.qmbform.descriptor.DataSourceListener;
import com.quemb.qmbform.descriptor.FormDescriptor;
import com.quemb.qmbform.descriptor.FormItemDescriptor;
import com.quemb.qmbform.descriptor.OnFormRowChangeListener;
import com.quemb.qmbform.descriptor.OnFormRowValueChangedListener;
import com.quemb.qmbform.descriptor.RowDescriptor;
import com.quemb.qmbform.descriptor.SectionDescriptor;
import com.quemb.qmbform.descriptor.Value;
import com.quemb.qmbform.sample.R;

import java.util.ArrayList;
import java.util.HashMap;

Expand Down Expand Up @@ -69,6 +69,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
}

@Override
@SuppressWarnings("unchecked")
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);

Expand Down Expand Up @@ -184,7 +185,7 @@ public void onFormRowClick(FormItemDescriptor itemDescriptor) {
}

@Override
public void onValueChanged(RowDescriptor rowDescriptor, Value<?> oldValue, Value<?> newValue) {
public void onValueChanged(RowDescriptor<?> rowDescriptor, Value<?> oldValue, Value<?> newValue) {

Log.d(TAG, "Value Changed: " + rowDescriptor.getTitle());
//
Expand All @@ -201,17 +202,17 @@ private void updateSaveItem() {
}

@Override
public void onRowAdded(RowDescriptor rowDescriptor, SectionDescriptor sectionDescriptor) {
public void onRowAdded(RowDescriptor<?> rowDescriptor, SectionDescriptor sectionDescriptor) {

}

@Override
public void onRowRemoved(RowDescriptor rowDescriptor, SectionDescriptor sectionDescriptor) {
public void onRowRemoved(RowDescriptor<?> rowDescriptor, SectionDescriptor sectionDescriptor) {

}

@Override
public void onRowChanged(RowDescriptor rowDescriptor, SectionDescriptor sectionDescriptor) {
public void onRowChanged(RowDescriptor<?> rowDescriptor, SectionDescriptor sectionDescriptor) {

}

Expand Down Expand Up @@ -241,6 +242,7 @@ protected ArrayList<String> doInBackground(DataSourceListener... listeners) {
}

@Override
@SuppressWarnings("unchecked")
protected void onPostExecute(ArrayList<String> strings) {
super.onPostExecute(strings);
mProgressDialog.dismiss();
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/form_sample.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#b5b5b5"
android:descendantFocusability="beforeDescendants" />
android:descendantFocusability="beforeDescendants"/>

</RelativeLayout>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ allprojects {
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked"
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
}
22 changes: 10 additions & 12 deletions lib/QMBForm/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

plugins {
id "org.sonarqube" version "1.0"
}
Expand Down Expand Up @@ -46,16 +45,6 @@ android {
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'info.hoang8f:android-segmented:1.0.5'

testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-core:1.2.1'
testCompile 'org.robolectric:robolectric:3.0'
}

apply plugin: 'idea'

idea {
Expand Down Expand Up @@ -83,7 +72,6 @@ sonarqube {
}
}


apply plugin: "jacoco"

jacoco {
Expand Down Expand Up @@ -123,3 +111,13 @@ task jacocoTestReport(type: JacocoReport ) {
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'info.hoang8f:android-segmented:1.0.5'

testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-core:1.2.1'
testCompile 'org.robolectric:robolectric:3.0'
}
15 changes: 8 additions & 7 deletions lib/QMBForm/src/main/java/com/quemb/qmbform/CellViewFactory.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.quemb.qmbform;

import android.content.Context;
import android.os.Build;
import android.util.Log;

import com.quemb.qmbform.descriptor.FormItemDescriptor;
import com.quemb.qmbform.descriptor.RowDescriptor;
import com.quemb.qmbform.descriptor.SectionDescriptor;
Expand All @@ -11,6 +15,7 @@
import com.quemb.qmbform.view.FormCheckFieldCell;
import com.quemb.qmbform.view.FormDateDialogFieldCell;
import com.quemb.qmbform.view.FormDateInlineFieldCell;
import com.quemb.qmbform.view.FormDateTimeInlineFieldCell;
import com.quemb.qmbform.view.FormDetailHtmlTextVerticalFieldCell;
import com.quemb.qmbform.view.FormDetailTextFieldCell;
import com.quemb.qmbform.view.FormDetailTextInlineFieldCell;
Expand Down Expand Up @@ -44,10 +49,6 @@
import com.quemb.qmbform.view.SectionCell;
import com.quemb.qmbform.view.SeperatorSectionCell;

import android.content.Context;
import android.os.Build;
import android.util.Log;

import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;

Expand All @@ -68,7 +69,7 @@ public static CellViewFactory getInstance() {
return instance;
}

public static void addFormRowDescriptor(String descriptorName, Class descriptorClass) {
public static void addFormRowDescriptor(String descriptorName, Class<? extends FormBaseCell> descriptorClass) {
getInstance().mViewRowTypeMap.put(descriptorName, descriptorClass);
}

Expand All @@ -92,6 +93,7 @@ public CellViewFactory() {
mViewRowTypeMap.put(RowDescriptor.FormRowDescriptorTypeDateInline, FormDateInlineFieldCell.class);
mViewRowTypeMap.put(RowDescriptor.FormRowDescriptorTypeTime, FormTimeDialogFieldCell.class);
mViewRowTypeMap.put(RowDescriptor.FormRowDescriptorTypeTimeInline, FormTimeInlineFieldCell.class);
mViewRowTypeMap.put(RowDescriptor.FormRowDescriptorTypeDateTimeInline, FormDateTimeInlineFieldCell.class);
mViewRowTypeMap.put(RowDescriptor.FormRowDescriptorTypeNumber, FormEditNumberFieldCell.class);
mViewRowTypeMap.put(RowDescriptor.FormRowDescriptorTypeNumberInline, FormEditNumberInlineFieldCell.class);
mViewRowTypeMap.put(RowDescriptor.FormRowDescriptorTypeCurrency, FormEditCurrencyFieldCell.class);
Expand Down Expand Up @@ -123,8 +125,7 @@ public Cell createViewForFormItemDescriptor(Context context, FormItemDescriptor

if (descriptor instanceof SectionDescriptor) {

SectionCell sectionCell = new SectionCell(context, (SectionDescriptor) descriptor);
rowView = sectionCell;
rowView = new SectionCell(context, (SectionDescriptor) descriptor);

} else if (descriptor instanceof RowDescriptor) {
RowDescriptor row = (RowDescriptor) descriptor;
Expand Down
49 changes: 49 additions & 0 deletions lib/QMBForm/src/main/java/com/quemb/qmbform/DatePickerInline.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.quemb.qmbform;

import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.ViewParent;
import android.widget.DatePicker;

/**
* DatePicker to be used inline in a scrolling view (ex: ListView)
* to prevent interaction between view and picker scrolls.
* Created by MTL / PTN on 19/07/16.
*/
public class DatePickerInline extends DatePicker
{
public DatePickerInline(Context context) {
super(context);
}

public DatePickerInline(Context context, AttributeSet attrs) {
super(context, attrs);
}

public DatePickerInline(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public DatePickerInline(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}

/**
* Stop ScrollView from getting involved once you interact with the View
*/
@Override
public boolean onInterceptTouchEvent(MotionEvent ev)
{
if (ev.getActionMasked() == MotionEvent.ACTION_DOWN)
{
ViewParent p = getParent();
if (p != null)
p.requestDisallowInterceptTouchEvent(true);
}
return false;
}
}
24 changes: 12 additions & 12 deletions lib/QMBForm/src/main/java/com/quemb/qmbform/FormManager.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
package com.quemb.qmbform;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;

import com.quemb.qmbform.adapter.FormAdapter;
import com.quemb.qmbform.descriptor.FormDescriptor;
import com.quemb.qmbform.descriptor.FormItemDescriptor;
Expand All @@ -10,13 +17,6 @@
import com.quemb.qmbform.descriptor.Value;
import com.quemb.qmbform.view.Cell;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ListView;

/**
* Created by tonimoeckel on 15.07.14.
*/
Expand Down Expand Up @@ -53,7 +53,7 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)

Cell cell = itemDescriptor.getCell();
if (cell != null && itemDescriptor instanceof RowDescriptor) {
RowDescriptor rowDescriptor = (RowDescriptor) itemDescriptor;
RowDescriptor<?> rowDescriptor = (RowDescriptor<?>) itemDescriptor;
if (!rowDescriptor.getDisabled()) {
cell.onCellSelected();
}
Expand Down Expand Up @@ -98,31 +98,31 @@ public void setOnFormRowChangeListener(OnFormRowChangeListener onFormRowChangeLi
}

@Override
public void onRowAdded(RowDescriptor rowDescriptor, SectionDescriptor sectionDescriptor) {
public void onRowAdded(RowDescriptor<?> rowDescriptor, SectionDescriptor sectionDescriptor) {
updateRows();
if (mOnFormRowChangeListener != null) {
mOnFormRowChangeListener.onRowAdded(rowDescriptor, sectionDescriptor);
}
}

@Override
public void onRowRemoved(RowDescriptor rowDescriptor, SectionDescriptor sectionDescriptor) {
public void onRowRemoved(RowDescriptor<?> rowDescriptor, SectionDescriptor sectionDescriptor) {
updateRows();
if (mOnFormRowChangeListener != null) {
mOnFormRowChangeListener.onRowRemoved(rowDescriptor, sectionDescriptor);
}
}

@Override
public void onRowChanged(RowDescriptor rowDescriptor, SectionDescriptor sectionDescriptor) {
public void onRowChanged(RowDescriptor<?> rowDescriptor, SectionDescriptor sectionDescriptor) {
updateRows();
if (mOnFormRowChangeListener != null) {
mOnFormRowChangeListener.onRowChanged(rowDescriptor, sectionDescriptor);
}
}

@Override
public void onValueChanged(RowDescriptor rowDescriptor, Value<?> oldValue, Value<?> newValue) {
public void onValueChanged(RowDescriptor<?> rowDescriptor, Value<?> oldValue, Value<?> newValue) {
if (mOnFormRowValueChangedListener != null) {
mOnFormRowValueChangedListener.onValueChanged(rowDescriptor, oldValue, newValue);
}
Expand Down
Loading