1
0
mirror of https://github.com/etesync/android synced 2025-01-11 00:01:12 +00:00

Various bug fixes

* don't set left/right padding in list items (fixes #240)
* don't allow list headers to be selected (part of issue #355)
* version bump to 0.6.8
This commit is contained in:
rfc2822 2014-11-30 21:04:59 +01:00
parent bc8d63f233
commit 51ac34790c
8 changed files with 26 additions and 18 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="at.bitfire.davdroid" package="at.bitfire.davdroid"
android:versionCode="46" android:versionCode="47"
android:versionName="0.6.7.1" android:installLocation="internalOnly"> android:versionName="0.6.8" android:installLocation="internalOnly">
<uses-sdk <uses-sdk
android:minSdkVersion="14" android:minSdkVersion="14"

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="fill_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" > android:orientation="vertical" >

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="fill_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" > android:orientation="vertical" >

View File

@ -9,7 +9,7 @@ package at.bitfire.davdroid;
public class Constants { public class Constants {
public static final String public static final String
APP_VERSION = "0.6.7.1", APP_VERSION = "0.6.8",
ACCOUNT_TYPE = "bitfire.at.davdroid", ACCOUNT_TYPE = "bitfire.at.davdroid",
WEB_URL_HELP = "http://davdroid.bitfire.at/configuration?pk_campaign=davdroid-app", WEB_URL_HELP = "http://davdroid.bitfire.at/configuration?pk_campaign=davdroid-app",

View File

@ -361,7 +361,7 @@ public class Event extends Resource {
return timezone.getTimeZoneId().getValue(); return timezone.getTimeZoneId().getValue();
} }
} catch (Exception ex) { } catch (Exception ex) {
Log.w(TAG, "Can't understand time zone definition", ex); Log.w(TAG, "Can't understand time zone definition, ignoring", ex);
} }
throw new IllegalArgumentException(); throw new IllegalArgumentException();
} }

View File

@ -8,6 +8,7 @@
package at.bitfire.davdroid.syncadapter; package at.bitfire.davdroid.syncadapter;
import lombok.Getter; import lombok.Getter;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.text.Html; import android.text.Html;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -89,40 +90,43 @@ public class SelectCollectionsAdapter extends BaseAdapter implements ListAdapter
} }
@Override @Override
@SuppressLint("InflateParams")
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
// step 1: get view (either by creating or recycling) // step 1: get view (either by creating or recycling)
if (convertView == null) { if (v == null) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext()); LayoutInflater inflater = LayoutInflater.from(parent.getContext());
switch (getItemViewType(position)) { switch (getItemViewType(position)) {
case TYPE_ADDRESS_BOOKS_HEADING: case TYPE_ADDRESS_BOOKS_HEADING:
convertView = inflater.inflate(R.layout.address_books_heading, parent, false); v = inflater.inflate(R.layout.address_books_heading, parent, false);
break; break;
case TYPE_ADDRESS_BOOKS_ROW: case TYPE_ADDRESS_BOOKS_ROW:
convertView = inflater.inflate(android.R.layout.simple_list_item_single_choice, null); v = inflater.inflate(android.R.layout.simple_list_item_single_choice, null);
break; break;
case TYPE_CALENDARS_HEADING: case TYPE_CALENDARS_HEADING:
convertView = inflater.inflate(R.layout.calendars_heading, parent, false); v = inflater.inflate(R.layout.calendars_heading, parent, false);
break; break;
case TYPE_CALENDARS_ROW: case TYPE_CALENDARS_ROW:
convertView = inflater.inflate(android.R.layout.simple_list_item_multiple_choice, null); v = inflater.inflate(android.R.layout.simple_list_item_multiple_choice, null);
} }
} }
// step 2: fill view with content // step 2: fill view with content
switch (getItemViewType(position)) { switch (getItemViewType(position)) {
case TYPE_ADDRESS_BOOKS_ROW: case TYPE_ADDRESS_BOOKS_ROW:
setContent((CheckedTextView)convertView, R.drawable.addressbook, (ServerInfo.ResourceInfo)getItem(position)); setContent((CheckedTextView)v, R.drawable.addressbook, (ServerInfo.ResourceInfo)getItem(position));
break; break;
case TYPE_CALENDARS_ROW: case TYPE_CALENDARS_ROW:
setContent((CheckedTextView)convertView, R.drawable.calendar, (ServerInfo.ResourceInfo)getItem(position)); setContent((CheckedTextView)v, R.drawable.calendar, (ServerInfo.ResourceInfo)getItem(position));
} }
return convertView; return v;
} }
protected void setContent(CheckedTextView view, int collectionIcon, ServerInfo.ResourceInfo info) { protected void setContent(CheckedTextView view, int collectionIcon, ServerInfo.ResourceInfo info) {
// set layout and icons // set layout and icons
view.setPadding(10, 10, 10, 10); view.setPadding(view.getPaddingLeft(), 8, view.getPaddingRight(), 8);
view.setCompoundDrawablesWithIntrinsicBounds(collectionIcon, 0, info.isReadOnly() ? R.drawable.ic_read_only : 0, 0); view.setCompoundDrawablesWithIntrinsicBounds(collectionIcon, 0, info.isReadOnly() ? R.drawable.ic_read_only : 0, 0);
view.setCompoundDrawablePadding(10); view.setCompoundDrawablePadding(10);

View File

@ -25,6 +25,7 @@ import at.bitfire.davdroid.resource.ServerInfo;
public class SelectCollectionsFragment extends ListFragment { public class SelectCollectionsFragment extends ListFragment {
public static final String KEY_SERVER_INFO = "server_info"; public static final String KEY_SERVER_INFO = "server_info";
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = super.onCreateView(inflater, container, savedInstanceState); View v = super.onCreateView(inflater, container, savedInstanceState);
@ -45,8 +46,8 @@ public class SelectCollectionsFragment extends ListFragment {
final ListView listView = getListView(); final ListView listView = getListView();
listView.setPadding(20, 30, 20, 30); listView.setPadding(20, 30, 20, 30);
View header = getActivity().getLayoutInflater().inflate(R.layout.select_collections_header, null); View header = getActivity().getLayoutInflater().inflate(R.layout.select_collections_header, getListView(), false);
listView.addHeaderView(header); listView.addHeaderView(header, getListView(), false);
final ServerInfo serverInfo = (ServerInfo)getArguments().getSerializable(KEY_SERVER_INFO); final ServerInfo serverInfo = (ServerInfo)getArguments().getSerializable(KEY_SERVER_INFO);
final SelectCollectionsAdapter adapter = new SelectCollectionsAdapter(view.getContext(), serverInfo); final SelectCollectionsAdapter adapter = new SelectCollectionsAdapter(view.getContext(), serverInfo);

View File

@ -74,6 +74,7 @@ public class EventTest extends InstrumentationTestCase {
} }
public void testTimezoneDefToTzId() { public void testTimezoneDefToTzId() {
// test valid definition
final String VTIMEZONE_SAMPLE = // taken from RFC 4791, 5.2.2. CALDAV:calendar-timezone Property final String VTIMEZONE_SAMPLE = // taken from RFC 4791, 5.2.2. CALDAV:calendar-timezone Property
"BEGIN:VCALENDAR\n" + "BEGIN:VCALENDAR\n" +
"PRODID:-//Example Corp.//CalDAV Client//EN\n" + "PRODID:-//Example Corp.//CalDAV Client//EN\n" +
@ -98,7 +99,8 @@ public class EventTest extends InstrumentationTestCase {
"END:VTIMEZONE\n" + "END:VTIMEZONE\n" +
"END:VCALENDAR"; "END:VCALENDAR";
assertEquals("US-Eastern", Event.TimezoneDefToTzId(VTIMEZONE_SAMPLE)); assertEquals("US-Eastern", Event.TimezoneDefToTzId(VTIMEZONE_SAMPLE));
// test null value
try { try {
Event.TimezoneDefToTzId(null); Event.TimezoneDefToTzId(null);
fail(); fail();
@ -106,6 +108,7 @@ public class EventTest extends InstrumentationTestCase {
assert(true); assert(true);
} }
// test invalid time zone
try { try {
Event.TimezoneDefToTzId("/* invalid content */"); Event.TimezoneDefToTzId("/* invalid content */");
fail(); fail();