Small cleanup of deprecated API, simpler way to make a pref intent

git-svn-id: https://zxing.googlecode.com/svn/trunk@2818 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen@gmail.com 2013-06-16 22:11:58 +00:00
parent d539107e47
commit 03354c4757
4 changed files with 15 additions and 70 deletions

View file

@ -16,7 +16,7 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.zxing.client.android"
android:versionName="4.4 beta 1"
android:versionName="4.4 beta 3"
android:versionCode="89"
android:installLocation="auto">

View file

@ -102,8 +102,8 @@
-->
</PreferenceCategory>
<PreferenceCategory android:title="@string/preferences_try_bsplus">
<com.google.zxing.client.android.pref.BSPlusPreference
android:title="@string/preferences_try_bsplus"
android:summary="@string/preferences_try_bsplus_summary"/>
<Preference android:title="@string/preferences_try_bsplus" >
<intent android:action="android.intent.action.VIEW" android:data="market://details?id=com.srowen.bs.android" />
</Preference>
</PreferenceCategory>
</PreferenceScreen>

View file

@ -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;
}
});
}
}

View file

@ -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