try {
decodeThread.join();
} catch (InterruptedException e) {
+ // continue
}
// Be absolutely sure we don't send any queued up messages
* @author dswitkin@google.com (Daniel Switkin)
*/
public final class HelpActivity extends Activity {
+
private static final String TAG = HelpActivity.class.getSimpleName();
// Actually guessing at the Desire's MODEL for now:
webView.loadUrl(BASE_URL + DEFAULT_PAGE);
}
- backButton = (Button)findViewById(R.id.back_button);
+ backButton = (Button) findViewById(R.id.back_button);
backButton.setOnClickListener(backListener);
- Button doneButton = (Button)findViewById(R.id.done_button);
+ View doneButton = findViewById(R.id.done_button);
doneButton.setOnClickListener(doneListener);
if (!initialized) {
* @author dswitkin@google.com (Daniel Switkin)
*/
final class SearchBookContentsAdapter extends ArrayAdapter<SearchBookContentsResult> {
- public SearchBookContentsAdapter(Context context, List<SearchBookContentsResult> items) {
+
+ SearchBookContentsAdapter(Context context, List<SearchBookContentsResult> items) {
super(context, R.layout.search_book_contents_list_item, 0, items);
}
return cameraResolution;
}
- private static Point findBestPreviewSizeValue(String previewSizeValueString,
- Point screenResolution) {
+ private static Point findBestPreviewSizeValue(CharSequence previewSizeValueString, Point screenResolution) {
int bestX = 0;
int bestY = 0;
int diff = Integer.MAX_VALUE;
private static final String TAG = FlashlightManager.class.getSimpleName();
- private static Object iHardwareService;
- private static Method setFlashEnabledMethod;
+ private static final Object iHardwareService;
+ private static final Method setFlashEnabledMethod;
static {
iHardwareService = getHardwareService();
setFlashEnabledMethod = getSetFlashEnabledMethod(iHardwareService);
} else if (type.equals(Contents.Type.CONTACT)) {
Bundle bundle = intent.getBundleExtra(Intents.Encode.DATA);
if (bundle != null) {
- StringBuilder newContents = new StringBuilder();
- StringBuilder newDisplayContents = new StringBuilder();
+ StringBuilder newContents = new StringBuilder(100);
+ StringBuilder newDisplayContents = new StringBuilder(100);
newContents.append("MECARD:");
String name = trim(bundle.getString(Contacts.Intents.Insert.NAME));
if (name != null) {
}
private boolean encodeQRCodeContents(AddressBookParsedResult contact) {
- StringBuilder newContents = new StringBuilder();
- StringBuilder newDisplayContents = new StringBuilder();
+ StringBuilder newContents = new StringBuilder(100);
+ StringBuilder newDisplayContents = new StringBuilder(100);
newContents.append("MECARD:");
String[] names = contact.getNames();
if (names != null && names.length > 0) {
BarcodeFormat format,
int desiredWidth,
int desiredHeight) throws WriterException {
- Hashtable hints = null;
+ Hashtable<EncodeHintType,Object> hints = null;
String encoding = guessAppropriateEncoding(contents);
if (encoding != null) {
- hints = new Hashtable(2);
+ hints = new Hashtable<EncodeHintType,Object>(2);
hints.put(EncodeHintType.CHARACTER_SET, encoding);
}
MultiFormatWriter writer = new MultiFormatWriter();
@Override
public CharSequence getDisplayContents() {
AddressBookParsedResult result = (AddressBookParsedResult) getResult();
- StringBuffer contents = new StringBuffer();
+ StringBuffer contents = new StringBuffer(100);
ParsedResult.maybeAppend(result.getNames(), contents);
int namesLength = contents.length();
@Override
public CharSequence getDisplayContents() {
CalendarParsedResult calResult = (CalendarParsedResult) getResult();
- StringBuffer result = new StringBuffer();
+ StringBuffer result = new StringBuffer(100);
ParsedResult.maybeAppend(calResult.getSummary(), result);
appendTime(calResult.getStart(), result);
import android.preference.PreferenceManager;
import android.provider.Contacts;
import android.view.View;
-import android.widget.Button;
import java.text.DateFormat;
import java.text.ParsePosition;
// Make sure the Shopper button is hidden by default. Without this, scanning a product followed
// by a QR Code would leave the button on screen among the QR Code actions.
- Button shopperButton = (Button) activity.findViewById(R.id.shopper_button);
+ View shopperButton = activity.findViewById(R.id.shopper_button);
shopperButton.setVisibility(View.GONE);
}
* @param listener The on click listener to install for this button.
*/
protected void showGoogleShopperButton(View.OnClickListener listener) {
- Button shopperButton = (Button) activity.findViewById(R.id.shopper_button);
+ View shopperButton = activity.findViewById(R.id.shopper_button);
shopperButton.setVisibility(View.VISIBLE);
shopperButton.setOnClickListener(listener);
}
@Override
public CharSequence getDisplayContents() {
SMSParsedResult smsResult = (SMSParsedResult) getResult();
- StringBuffer contents = new StringBuffer();
+ StringBuffer contents = new StringBuffer(50);
String[] rawNumbers = smsResult.getNumbers();
String[] formattedNumbers = new String[rawNumbers.length];
for (int i = 0; i < rawNumbers.length; i++) {
@Override
public CharSequence getDisplayContents() {
WifiParsedResult wifiResult = (WifiParsedResult) getResult();
- StringBuffer contents = new StringBuffer();
+ StringBuffer contents = new StringBuffer(50);
String wifiLabel = parent.getString(R.string.wifi_ssid_label);
ParsedResult.maybeAppend(wifiLabel + '\n' + wifiResult.getSsid(), contents);
String typeLabel = parent.getString(R.string.wifi_type_label);
import android.app.ListActivity;
import android.app.ProgressDialog;
+import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Browser;
public final class AppPickerActivity extends ListActivity {
private final List<String[]> labelsPackages = new ArrayList<String[]>();
- private ProgressDialog dialog;
+ private DialogInterface dialog;
@Override
protected void onCreate(Bundle icicle) {
finish();
}
- ProgressDialog getProgressDialog() {
+ DialogInterface getProgressDialog() {
return dialog;
}
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
}
}
}
- Collections.sort(labelsPackages, new Comparator<String[]>() {
- public int compare(String[] o1, String[] o2) {
- return o1[0].compareTo(o2[0]);
- }
- });
+ Collections.sort(labelsPackages, new ByFirstStringComparator());
return labelsPackages;
}
appPickerActivity.getProgressDialog().dismiss();
}
+ private static class ByFirstStringComparator implements Comparator<String[]>, Serializable {
+ public int compare(String[] o1, String[] o2) {
+ return o1[0].compareTo(o2[0]);
+ }
+ }
+
}
}
if (state == NetworkInfo.State.DISCONNECTED){
Log.d(TAG, "Got state: " + state + " for ssid: " + ssid);
- ((WifiActivity)parent).gotError();
+ parent.gotError();
}
}
}