mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
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:
parent
d539107e47
commit
03354c4757
|
@ -16,7 +16,7 @@
|
||||||
-->
|
-->
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.google.zxing.client.android"
|
package="com.google.zxing.client.android"
|
||||||
android:versionName="4.4 beta 1"
|
android:versionName="4.4 beta 3"
|
||||||
android:versionCode="89"
|
android:versionCode="89"
|
||||||
android:installLocation="auto">
|
android:installLocation="auto">
|
||||||
|
|
||||||
|
|
|
@ -102,8 +102,8 @@
|
||||||
-->
|
-->
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/preferences_try_bsplus">
|
<PreferenceCategory android:title="@string/preferences_try_bsplus">
|
||||||
<com.google.zxing.client.android.pref.BSPlusPreference
|
<Preference android:title="@string/preferences_try_bsplus" >
|
||||||
android:title="@string/preferences_try_bsplus"
|
<intent android:action="android.intent.action.VIEW" android:data="market://details?id=com.srowen.bs.android" />
|
||||||
android:summary="@string/preferences_try_bsplus_summary"/>
|
</Preference>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -46,21 +46,27 @@ public final class BookmarkPickerActivity extends ListActivity {
|
||||||
private static final String BOOKMARK_SELECTION =
|
private static final String BOOKMARK_SELECTION =
|
||||||
Browser.BookmarkColumns.BOOKMARK + " = 1 AND " + Browser.BookmarkColumns.URL + " IS NOT NULL";
|
Browser.BookmarkColumns.BOOKMARK + " = 1 AND " + Browser.BookmarkColumns.URL + " IS NOT NULL";
|
||||||
|
|
||||||
private Cursor cursor = null;
|
private Cursor cursor;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle icicle) {
|
protected void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
|
|
||||||
cursor = getContentResolver().query(Browser.BOOKMARKS_URI, BOOKMARK_PROJECTION,
|
cursor = getContentResolver().query(Browser.BOOKMARKS_URI, BOOKMARK_PROJECTION,
|
||||||
BOOKMARK_SELECTION, null, null);
|
BOOKMARK_SELECTION, null, null);
|
||||||
if (cursor == null) {
|
if (cursor == null) {
|
||||||
Log.w(TAG, "No cursor returned for bookmark query");
|
Log.w(TAG, "No cursor returned for bookmark query");
|
||||||
finish();
|
finish();
|
||||||
} else {
|
return;
|
||||||
startManagingCursor(cursor);
|
}
|
||||||
setListAdapter(new BookmarkAdapter(this, cursor));
|
setListAdapter(new BookmarkAdapter(this, cursor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
if (cursor != null) {
|
||||||
|
cursor.close();
|
||||||
|
}
|
||||||
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue