Fix a bunch of Lint errors

This commit is contained in:
Cameron Gutman
2014-11-13 21:37:11 -08:00
parent 6604675bf9
commit a37fff6eb5
9 changed files with 62 additions and 73 deletions

View File

@@ -33,8 +33,7 @@ import android.widget.Toast;
import android.widget.AdapterView.AdapterContextMenuInfo;
public class AppView extends Activity {
private GridView appGrid;
private AppGridAdapter appGridAdapter;
private AppGridAdapter appGridAdapter;
private InetAddress ipAddress;
private String uniqueId;
private boolean remote;
@@ -77,7 +76,7 @@ public class AppView extends Activity {
}
// Setup the list view
appGrid = (GridView)findViewById(R.id.appGridView);
GridView appGrid = (GridView) findViewById(R.id.appGridView);
try {
appGridAdapter = new AppGridAdapter(this, ipAddress, uniqueId);
} catch (Exception e) {
@@ -87,23 +86,22 @@ public class AppView extends Activity {
}
appGrid.setAdapter(appGridAdapter);
appGrid.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
long id) {
AppObject app = (AppObject) appGridAdapter.getItem(pos);
if (app == null || app.app == null) {
return;
}
// Only open the context menu if something is running, otherwise start it
if (getRunningAppId() != -1) {
openContextMenu(arg1);
}
else {
doStart(app.app);
}
}
});
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
long id) {
AppObject app = (AppObject) appGridAdapter.getItem(pos);
if (app == null || app.app == null) {
return;
}
// Only open the context menu if something is running, otherwise start it
if (getRunningAppId() != -1) {
openContextMenu(arg1);
} else {
doStart(app.app);
}
}
});
registerForContextMenu(appGrid);
}

View File

@@ -395,7 +395,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
}
// Try the controller handler first
boolean handled = controllerHandler.handleButtonDown(keyCode, event);
boolean handled = controllerHandler.handleButtonDown(event);
if (!handled) {
// Try the keyboard handler
short translated = keybTranslator.translate(event.getKeyCode());
@@ -438,7 +438,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
}
// Try the controller handler first
boolean handled = controllerHandler.handleButtonUp(keyCode, event);
boolean handled = controllerHandler.handleButtonUp(event);
if (!handled) {
// Try the keyboard handler
short translated = keybTranslator.translate(event.getKeyCode());

View File

@@ -44,10 +44,8 @@ import android.widget.Toast;
import android.widget.AdapterView.AdapterContextMenuInfo;
public class PcView extends Activity {
private ImageButton settingsButton, addComputerButton;
private RelativeLayout noPcFoundLayout;
private GridView pcGrid;
private PcGridAdapter pcGridAdapter;
private PcGridAdapter pcGridAdapter;
private ComputerManagerService.ComputerManagerBinder managerBinder;
private boolean freezeUpdates, runningPolling;
private ServiceConnection serviceConnection = new ServiceConnection() {
@@ -101,47 +99,43 @@ public class PcView extends Activity {
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
// Setup the list view
settingsButton = (ImageButton)findViewById(R.id.settingsButton);
addComputerButton = (ImageButton)findViewById(R.id.manuallyAddPc);
ImageButton settingsButton = (ImageButton) findViewById(R.id.settingsButton);
ImageButton addComputerButton = (ImageButton) findViewById(R.id.manuallyAddPc);
pcGrid = (GridView)findViewById(R.id.pcGridView);
GridView pcGrid = (GridView) findViewById(R.id.pcGridView);
pcGrid.setAdapter(pcGridAdapter);
pcGrid.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
long id) {
ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(pos);
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
long id) {
ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(pos);
if (computer.details.reachability == ComputerDetails.Reachability.UNKNOWN) {
// Do nothing
return;
} else if (computer.details.reachability == ComputerDetails.Reachability.OFFLINE) {
// Open the context menu if a PC is offline
openContextMenu(arg1);
} else if (computer.details.pairState != PairState.PAIRED) {
// Pair an unpaired machine by default
doPair(computer.details);
} else {
doAppList(computer.details);
}
else if (computer.details.reachability == ComputerDetails.Reachability.OFFLINE) {
// Open the context menu if a PC is offline
openContextMenu(arg1);
}
else if (computer.details.pairState != PairState.PAIRED) {
// Pair an unpaired machine by default
doPair(computer.details);
}
else {
doAppList(computer.details);
}
}
});
}
});
registerForContextMenu(pcGrid);
settingsButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(PcView.this, StreamSettings.class));
}
});
@Override
public void onClick(View v) {
startActivity(new Intent(PcView.this, StreamSettings.class));
}
});
addComputerButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(PcView.this, AddComputerManually.class);
startActivity(i);
}
});
@Override
public void onClick(View v) {
Intent i = new Intent(PcView.this, AddComputerManually.class);
startActivity(i);
}
});
noPcFoundLayout = (RelativeLayout) findViewById(R.id.no_pc_found_layout);
if (pcGridAdapter.getCount() == 0) {

View File

@@ -398,13 +398,13 @@ public class ControllerHandler {
return true;
}
public boolean handleButtonUp(int keyCode, KeyEvent event) {
public boolean handleButtonUp(KeyEvent event) {
ControllerMapping mapping = getMappingForDevice(event.getDevice());
if (mapping == null) {
return false;
}
keyCode = handleRemapping(mapping, event);
int keyCode = handleRemapping(mapping, event);
if (keyCode == 0) {
return true;
}
@@ -521,13 +521,13 @@ public class ControllerHandler {
return true;
}
public boolean handleButtonDown(int keyCode, KeyEvent event) {
public boolean handleButtonDown(KeyEvent event) {
ControllerMapping mapping = getMappingForDevice(event.getDevice());
if (mapping == null) {
return false;
}
keyCode = handleRemapping(mapping, event);
int keyCode = handleRemapping(mapping, event);
if (keyCode == 0) {
return true;
}

View File

@@ -30,7 +30,7 @@ public class ComputerManagerService extends Service {
private AtomicInteger dbRefCount = new AtomicInteger(0);
private IdentityManager idManager;
private HashMap<ComputerDetails, Thread> pollingThreads;
private final HashMap<ComputerDetails, Thread> pollingThreads = new HashMap<ComputerDetails, Thread>();
private ComputerManagerListener listener = null;
private AtomicInteger activePolls = new AtomicInteger(0);
@@ -355,8 +355,6 @@ public class ComputerManagerService extends Service {
// Bind to the discovery service
bindService(new Intent(this, DiscoveryService.class),
discoveryServiceConnection, Service.BIND_AUTO_CREATE);
pollingThreads = new HashMap<ComputerDetails, Thread>();
// Lookup or generate this device's UID
idManager = new IdentityManager(this);

View File

@@ -36,7 +36,7 @@ public class AppGridAdapter extends GenericGridAdapter<AppView.AppObject> {
private String uniqueId;
private LimelightCryptoProvider cryptoProvider;
private SSLContext sslContext;
private HashMap<ImageView, Future> pendingRequests = new HashMap<ImageView, Future>();
private final HashMap<ImageView, Future> pendingRequests = new HashMap<ImageView, Future>();
public AppGridAdapter(Context context, InetAddress address, String uniqueId) throws NoSuchAlgorithmException, KeyManagementException {
super(context, R.layout.app_grid_item, R.drawable.image_loading);

View File

@@ -19,7 +19,7 @@ public class SeekBarPreference extends DialogPreference
private static final String SCHEMA_URL = "http://schemas.android.com/apk/res/android";
private SeekBar seekBar;
private TextView splashText, valueText;
private TextView valueText;
private Context context;
private String dialogMessage, suffix;
@@ -60,7 +60,7 @@ public class SeekBarPreference extends DialogPreference
layout.setOrientation(LinearLayout.VERTICAL);
layout.setPadding(6, 6, 6, 6);
splashText = new TextView(context);
TextView splashText = new TextView(context);
splashText.setPadding(30, 10, 30, 10);
if (dialogMessage != null) {
splashText.setText(dialogMessage);
@@ -149,10 +149,10 @@ public class SeekBarPreference extends DialogPreference
if (shouldPersist()) {
currentValue = seekBar.getProgress();
persistInt(seekBar.getProgress());
callChangeListener(Integer.valueOf(seekBar.getProgress()));
callChangeListener(seekBar.getProgress());
}
((AlertDialog) getDialog()).dismiss();
getDialog().dismiss();
}
});
}

View File

@@ -14,7 +14,7 @@ public class UiHelper {
public static void notifyNewRootView(Activity activity)
{
View rootView = (View) activity.findViewById(android.R.id.content);
View rootView = activity.findViewById(android.R.id.content);
UiModeManager modeMgr = (UiModeManager) activity.getSystemService(Context.UI_MODE_SERVICE);
if (modeMgr.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION)

View File

@@ -2,7 +2,6 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000"
tools:context=".Game" >
<SurfaceView