From b3a95d55b1cf58fdc699fb5e51b1479bffe1f362 Mon Sep 17 00:00:00 2001 From: Javier Gamarra Date: Thu, 16 Jun 2016 15:19:08 +0200 Subject: [PATCH 01/34] use the value directly instead of an indirection that causes a bug in some phones/apps --- .../main/res/layout/ddlfield_document_chose_option_default.xml | 2 +- .../src/main/res/layout/user_portrait_chose_origin_default.xml | 2 +- android/library/src/main/res/values/styles.xml | 2 +- .../src/main/res/drawable-v21/westeros_dark_button_ripple.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/android/library/src/main/res/layout/ddlfield_document_chose_option_default.xml b/android/library/src/main/res/layout/ddlfield_document_chose_option_default.xml index 823f2ce612..383ed83545 100644 --- a/android/library/src/main/res/layout/ddlfield_document_chose_option_default.xml +++ b/android/library/src/main/res/layout/ddlfield_document_chose_option_default.xml @@ -17,7 +17,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/liferay_dialog_title" - android:divider="?android:attr/textColorSecondary" + android:divider="@color/textColorSecondary" android:orientation="vertical" android:showDividers="middle"> diff --git a/android/library/src/main/res/layout/user_portrait_chose_origin_default.xml b/android/library/src/main/res/layout/user_portrait_chose_origin_default.xml index a38e53548b..9303a0eb3d 100644 --- a/android/library/src/main/res/layout/user_portrait_chose_origin_default.xml +++ b/android/library/src/main/res/layout/user_portrait_chose_origin_default.xml @@ -17,7 +17,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/liferay_dialog_title" - android:divider="?android:attr/textColorSecondary" + android:divider="@color/textColorSecondary" android:orientation="vertical" android:showDividers="middle"> diff --git a/android/library/src/main/res/values/styles.xml b/android/library/src/main/res/values/styles.xml index 7f7a862633..a84f48c389 100644 --- a/android/library/src/main/res/values/styles.xml +++ b/android/library/src/main/res/values/styles.xml @@ -75,7 +75,7 @@ diff --git a/android/viewsets/westeros/src/main/res/drawable-v21/westeros_dark_button_ripple.xml b/android/viewsets/westeros/src/main/res/drawable-v21/westeros_dark_button_ripple.xml index 9155d91680..b935d8eacd 100644 --- a/android/viewsets/westeros/src/main/res/drawable-v21/westeros_dark_button_ripple.xml +++ b/android/viewsets/westeros/src/main/res/drawable-v21/westeros_dark_button_ripple.xml @@ -1,6 +1,6 @@ + android:color="@color/textColorPrimary"> From add298742e5c88b1570a2fd481c7e04d140a94ea Mon Sep 17 00:00:00 2001 From: Javier Gamarra Date: Wed, 6 Jul 2016 13:11:50 +0200 Subject: [PATCH 02/34] fix form adapter --- .../ddl/pager/DDLFormPagerViewAdapter.java | 39 ++++++++----------- .../src/main/res/layout/ddl_form_pager.xml | 35 ++++++++++++++--- 2 files changed, 46 insertions(+), 28 deletions(-) diff --git a/android/library/src/main/java/com/liferay/mobile/screens/viewsets/defaultviews/ddl/pager/DDLFormPagerViewAdapter.java b/android/library/src/main/java/com/liferay/mobile/screens/viewsets/defaultviews/ddl/pager/DDLFormPagerViewAdapter.java index dd9c9caf02..8177a184ea 100644 --- a/android/library/src/main/java/com/liferay/mobile/screens/viewsets/defaultviews/ddl/pager/DDLFormPagerViewAdapter.java +++ b/android/library/src/main/java/com/liferay/mobile/screens/viewsets/defaultviews/ddl/pager/DDLFormPagerViewAdapter.java @@ -1,11 +1,11 @@ /** * Copyright (c) 2000-present Liferay, Inc. All rights reserved. - * + *

* This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. - * + *

* This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more @@ -19,7 +19,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.LinearLayout; import com.liferay.mobile.screens.ddl.form.view.DDLFieldViewModel; import com.liferay.mobile.screens.ddl.model.Field; @@ -32,8 +31,7 @@ */ public class DDLFormPagerViewAdapter extends PagerAdapter { - public DDLFormPagerViewAdapter( - List fields, Map layoutIds) { + public DDLFormPagerViewAdapter(List fields, Map layoutIds) { _fields = fields; _layoutIds = layoutIds; @@ -41,34 +39,31 @@ public DDLFormPagerViewAdapter( @Override public int getCount() { - return 2; + return _fields.size(); } @Override public Object instantiateItem(ViewGroup container, int position) { Context context = container.getContext(); - LinearLayout layout = new LinearLayout(context); - layout.setOrientation(LinearLayout.VERTICAL); - int nFields = 2; + Field field = _fields.get(position); + Field.EditorType type = field.getEditorType(); + int layoutId = _layoutIds.get(type); - for (int i = 0; i < nFields; i++) { - Field field = _fields.get(i); - Field.EditorType type = field.getEditorType(); - int layoutId = _layoutIds.get(type); + LayoutInflater inflater = LayoutInflater.from(context); + View view = inflater.inflate(layoutId, container, false); - LayoutInflater inflater = LayoutInflater.from(context); - View view = inflater.inflate(layoutId, layout, false); + DDLFieldViewModel viewModel = (DDLFieldViewModel) view; + viewModel.setField(field); - DDLFieldViewModel viewModel = (DDLFieldViewModel) view; - viewModel.setField(field); + container.addView(view); - layout.addView(view); - } - - container.addView(layout); + return view; + } - return layout; + @Override + public void destroyItem(ViewGroup container, int position, Object object) { + container.removeView((View) object); } @Override diff --git a/android/library/src/main/res/layout/ddl_form_pager.xml b/android/library/src/main/res/layout/ddl_form_pager.xml index 6c6ed2b29c..d52d2dc0db 100644 --- a/android/library/src/main/res/layout/ddl_form_pager.xml +++ b/android/library/src/main/res/layout/ddl_form_pager.xml @@ -1,10 +1,33 @@ + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fillViewport="true"> - + + + + + + +