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
pull/2/head
rfc2822 10 years ago
parent bc8d63f233
commit 51ac34790c

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

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<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:orientation="vertical" >

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<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:orientation="vertical" >

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

@ -361,7 +361,7 @@ public class Event extends Resource {
return timezone.getTimeZoneId().getValue();
}
} 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();
}

@ -8,6 +8,7 @@
package at.bitfire.davdroid.syncadapter;
import lombok.Getter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.text.Html;
import android.view.LayoutInflater;
@ -89,40 +90,43 @@ public class SelectCollectionsAdapter extends BaseAdapter implements ListAdapter
}
@Override
@SuppressLint("InflateParams")
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
// step 1: get view (either by creating or recycling)
if (convertView == null) {
if (v == null) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
switch (getItemViewType(position)) {
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;
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;
case TYPE_CALENDARS_HEADING:
convertView = inflater.inflate(R.layout.calendars_heading, parent, false);
v = inflater.inflate(R.layout.calendars_heading, parent, false);
break;
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
switch (getItemViewType(position)) {
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;
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) {
// 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.setCompoundDrawablePadding(10);

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

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

Loading…
Cancel
Save