зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1064263 - Part 0: cleanup. r=me
This commit is contained in:
Родитель
32c4b4c2ae
Коммит
f9a11fd932
|
@ -58,7 +58,7 @@ public class SendTab extends ShareMethod {
|
||||||
public static final String EXTRA_CLIENT_RECORDS = "RECORDS";
|
public static final String EXTRA_CLIENT_RECORDS = "RECORDS";
|
||||||
|
|
||||||
// The intent we should dispatch when the button for this ShareMethod is tapped, instead of
|
// 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";
|
public static final String OVERRIDE_INTENT = "OVERRIDE_INTENT";
|
||||||
|
|
||||||
private Set<String> validGUIDs;
|
private Set<String> validGUIDs;
|
||||||
|
|
|
@ -4,22 +4,24 @@
|
||||||
|
|
||||||
package org.mozilla.gecko.overlays.ui;
|
package org.mozilla.gecko.overlays.ui;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import java.util.Collection;
|
||||||
import android.content.Context;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import org.mozilla.gecko.AppConstants;
|
import org.mozilla.gecko.AppConstants;
|
||||||
import org.mozilla.gecko.Assert;
|
import org.mozilla.gecko.Assert;
|
||||||
import org.mozilla.gecko.R;
|
import org.mozilla.gecko.R;
|
||||||
import org.mozilla.gecko.overlays.service.sharemethods.ParcelableClientRecord;
|
import org.mozilla.gecko.overlays.service.sharemethods.ParcelableClientRecord;
|
||||||
|
import org.mozilla.gecko.overlays.ui.SendTabList.State;
|
||||||
|
|
||||||
import java.util.Collection;
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Context;
|
||||||
import static org.mozilla.gecko.overlays.ui.SendTabList.*;
|
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> {
|
public class SendTabDeviceListArrayAdapter extends ArrayAdapter<ParcelableClientRecord> {
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private static final String LOGTAG = "GeckoSendTabAdapter";
|
private static final String LOGTAG = "GeckoSendTabAdapter";
|
||||||
|
|
||||||
private State currentState;
|
private State currentState;
|
||||||
|
|
|
@ -4,25 +4,25 @@
|
||||||
|
|
||||||
package org.mozilla.gecko.overlays.ui;
|
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.LIST;
|
||||||
import static org.mozilla.gecko.overlays.ui.SendTabList.State.LOADING;
|
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.NONE;
|
||||||
import static org.mozilla.gecko.overlays.ui.SendTabList.State.SHOW_DEVICES;
|
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
|
* The SendTab button has a few different states depending on the available devices (and whether
|
||||||
* we've loaded them yet...)
|
* we've loaded them yet...)
|
||||||
|
@ -44,7 +44,8 @@ import static org.mozilla.gecko.overlays.ui.SendTabList.State.SHOW_DEVICES;
|
||||||
* devices.
|
* devices.
|
||||||
*/
|
*/
|
||||||
public class SendTabList extends ListView {
|
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
|
// The maximum number of target devices to show in the main list. Further devices are available
|
||||||
// from a secondary menu.
|
// from a secondary menu.
|
||||||
|
@ -107,14 +108,12 @@ public class SendTabList extends ListView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSyncClients(ParcelableClientRecord[] clients) {
|
public void setSyncClients(final ParcelableClientRecord[] c) {
|
||||||
if (clients == null) {
|
final ParcelableClientRecord[] clients = c == null ? new ParcelableClientRecord[0] : c;
|
||||||
clients = new ParcelableClientRecord[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
int size = clients.length;
|
int size = clients.length;
|
||||||
if (size == 0) {
|
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);
|
switchState(NONE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -122,12 +121,12 @@ public class SendTabList extends ListView {
|
||||||
clientListAdapter.setClientRecordList(Arrays.asList(clients));
|
clientListAdapter.setClientRecordList(Arrays.asList(clients));
|
||||||
|
|
||||||
if (size <= MAXIMUM_INLINE_ELEMENTS) {
|
if (size <= MAXIMUM_INLINE_ELEMENTS) {
|
||||||
// Show the list of devices inline.
|
// Show the list of devices in-line.
|
||||||
switchState(LIST);
|
switchState(LIST);
|
||||||
return;
|
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);
|
switchState(SHOW_DEVICES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче