Bug 1064263 - Part 0: cleanup. r=me

This commit is contained in:
Richard Newman 2014-10-15 16:26:44 -07:00
Родитель 32c4b4c2ae
Коммит f9a11fd932
3 изменённых файлов: 33 добавлений и 32 удалений

Просмотреть файл

@ -58,7 +58,7 @@ public class SendTab extends ShareMethod {
public static final String EXTRA_CLIENT_RECORDS = "RECORDS";
// The intent we should dispatch when the button for this ShareMethod is tapped, instead of
// taking the normal action (eg. "Set up sync!")
// taking the normal action (e.g., "Set up Sync!")
public static final String OVERRIDE_INTENT = "OVERRIDE_INTENT";
private Set<String> validGUIDs;

Просмотреть файл

@ -4,22 +4,24 @@
package org.mozilla.gecko.overlays.ui;
import android.app.AlertDialog;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.Collection;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.Assert;
import org.mozilla.gecko.R;
import org.mozilla.gecko.overlays.service.sharemethods.ParcelableClientRecord;
import org.mozilla.gecko.overlays.ui.SendTabList.State;
import java.util.Collection;
import static org.mozilla.gecko.overlays.ui.SendTabList.*;
import android.app.AlertDialog;
import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
public class SendTabDeviceListArrayAdapter extends ArrayAdapter<ParcelableClientRecord> {
@SuppressWarnings("unused")
private static final String LOGTAG = "GeckoSendTabAdapter";
private State currentState;

Просмотреть файл

@ -4,25 +4,25 @@
package org.mozilla.gecko.overlays.ui;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.ListAdapter;
import android.widget.ListView;
import org.mozilla.gecko.Assert;
import org.mozilla.gecko.R;
import org.mozilla.gecko.overlays.service.sharemethods.ParcelableClientRecord;
import java.util.Arrays;
import static org.mozilla.gecko.overlays.ui.SendTabList.State.LIST;
import static org.mozilla.gecko.overlays.ui.SendTabList.State.LOADING;
import static org.mozilla.gecko.overlays.ui.SendTabList.State.NONE;
import static org.mozilla.gecko.overlays.ui.SendTabList.State.SHOW_DEVICES;
import java.util.Arrays;
import org.mozilla.gecko.Assert;
import org.mozilla.gecko.R;
import org.mozilla.gecko.overlays.service.sharemethods.ParcelableClientRecord;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ListAdapter;
import android.widget.ListView;
/**
* The SendTab button has a few different states depending on the available devices (and whether
* we've loaded them yet...)
@ -44,7 +44,8 @@ import static org.mozilla.gecko.overlays.ui.SendTabList.State.SHOW_DEVICES;
* devices.
*/
public class SendTabList extends ListView {
private static final String LOGTAG = "SendTabList";
@SuppressWarnings("unused")
private static final String LOGTAG = "GeckoSendTabList";
// The maximum number of target devices to show in the main list. Further devices are available
// from a secondary menu.
@ -107,14 +108,12 @@ public class SendTabList extends ListView {
}
}
public void setSyncClients(ParcelableClientRecord[] clients) {
if (clients == null) {
clients = new ParcelableClientRecord[0];
}
public void setSyncClients(final ParcelableClientRecord[] c) {
final ParcelableClientRecord[] clients = c == null ? new ParcelableClientRecord[0] : c;
int size = clients.length;
if (size == 0) {
// Just show a button to set up sync (or whatever).
// Just show a button to set up Sync (or whatever).
switchState(NONE);
return;
}
@ -122,12 +121,12 @@ public class SendTabList extends ListView {
clientListAdapter.setClientRecordList(Arrays.asList(clients));
if (size <= MAXIMUM_INLINE_ELEMENTS) {
// Show the list of devices inline.
// Show the list of devices in-line.
switchState(LIST);
return;
}
// Just show a button to launch the list of devices to choose one from.
// Just show a button to launch the list of devices to choose from.
switchState(SHOW_DEVICES);
}