diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index f2be736fb..36bb0f952 100755 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -16,7 +16,7 @@ --> diff --git a/android/res/xml/preferences.xml b/android/res/xml/preferences.xml index bbefde697..e7481aac0 100755 --- a/android/res/xml/preferences.xml +++ b/android/res/xml/preferences.xml @@ -102,8 +102,8 @@ --> - + + + diff --git a/android/src/com/google/zxing/client/android/pref/BSPlusPreference.java b/android/src/com/google/zxing/client/android/pref/BSPlusPreference.java deleted file mode 100644 index c3703df63..000000000 --- a/android/src/com/google/zxing/client/android/pref/BSPlusPreference.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2012 ZXing authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.zxing.client.android.pref; - -import android.content.Context; -import android.content.Intent; -import android.net.Uri; -import android.preference.Preference; -import android.util.AttributeSet; - -/** - * A dummy pref that launches Play to the BS+ page. - * - * @author Sean Owen - */ -public final class BSPlusPreference extends Preference { - - private static final String MARKET_URL = "market://details?id=com.srowen.bs.android"; - - public BSPlusPreference(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - configureClickListener(); - } - - public BSPlusPreference(Context context, AttributeSet attrs) { - super(context, attrs); - configureClickListener(); - } - - public BSPlusPreference(Context context) { - super(context); - configureClickListener(); - } - - private void configureClickListener() { - setOnPreferenceClickListener(new OnPreferenceClickListener() { - @Override - public boolean onPreferenceClick(Preference preference) { - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(MARKET_URL)); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); - getContext().startActivity(intent); - return true; - } - }); - } - -} diff --git a/android/src/com/google/zxing/client/android/share/BookmarkPickerActivity.java b/android/src/com/google/zxing/client/android/share/BookmarkPickerActivity.java index 068054606..792b22372 100644 --- a/android/src/com/google/zxing/client/android/share/BookmarkPickerActivity.java +++ b/android/src/com/google/zxing/client/android/share/BookmarkPickerActivity.java @@ -46,21 +46,27 @@ public final class BookmarkPickerActivity extends ListActivity { private static final String BOOKMARK_SELECTION = Browser.BookmarkColumns.BOOKMARK + " = 1 AND " + Browser.BookmarkColumns.URL + " IS NOT NULL"; - private Cursor cursor = null; + private Cursor cursor; @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); - cursor = getContentResolver().query(Browser.BOOKMARKS_URI, BOOKMARK_PROJECTION, BOOKMARK_SELECTION, null, null); if (cursor == null) { Log.w(TAG, "No cursor returned for bookmark query"); finish(); - } else { - startManagingCursor(cursor); - setListAdapter(new BookmarkAdapter(this, cursor)); + return; } + setListAdapter(new BookmarkAdapter(this, cursor)); + } + + @Override + protected void onDestroy() { + if (cursor != null) { + cursor.close(); + } + super.onDestroy(); } @Override