mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-06-17 14:21:08 +00:00
Fix a bunch of Lint errors
This commit is contained in:
@@ -33,8 +33,7 @@ import android.widget.Toast;
|
|||||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||||
|
|
||||||
public class AppView extends Activity {
|
public class AppView extends Activity {
|
||||||
private GridView appGrid;
|
private AppGridAdapter appGridAdapter;
|
||||||
private AppGridAdapter appGridAdapter;
|
|
||||||
private InetAddress ipAddress;
|
private InetAddress ipAddress;
|
||||||
private String uniqueId;
|
private String uniqueId;
|
||||||
private boolean remote;
|
private boolean remote;
|
||||||
@@ -77,7 +76,7 @@ public class AppView extends Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup the list view
|
// Setup the list view
|
||||||
appGrid = (GridView)findViewById(R.id.appGridView);
|
GridView appGrid = (GridView) findViewById(R.id.appGridView);
|
||||||
try {
|
try {
|
||||||
appGridAdapter = new AppGridAdapter(this, ipAddress, uniqueId);
|
appGridAdapter = new AppGridAdapter(this, ipAddress, uniqueId);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -87,23 +86,22 @@ public class AppView extends Activity {
|
|||||||
}
|
}
|
||||||
appGrid.setAdapter(appGridAdapter);
|
appGrid.setAdapter(appGridAdapter);
|
||||||
appGrid.setOnItemClickListener(new OnItemClickListener() {
|
appGrid.setOnItemClickListener(new OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
|
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
|
||||||
long id) {
|
long id) {
|
||||||
AppObject app = (AppObject) appGridAdapter.getItem(pos);
|
AppObject app = (AppObject) appGridAdapter.getItem(pos);
|
||||||
if (app == null || app.app == null) {
|
if (app == null || app.app == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only open the context menu if something is running, otherwise start it
|
// Only open the context menu if something is running, otherwise start it
|
||||||
if (getRunningAppId() != -1) {
|
if (getRunningAppId() != -1) {
|
||||||
openContextMenu(arg1);
|
openContextMenu(arg1);
|
||||||
}
|
} else {
|
||||||
else {
|
doStart(app.app);
|
||||||
doStart(app.app);
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
registerForContextMenu(appGrid);
|
registerForContextMenu(appGrid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try the controller handler first
|
// Try the controller handler first
|
||||||
boolean handled = controllerHandler.handleButtonDown(keyCode, event);
|
boolean handled = controllerHandler.handleButtonDown(event);
|
||||||
if (!handled) {
|
if (!handled) {
|
||||||
// Try the keyboard handler
|
// Try the keyboard handler
|
||||||
short translated = keybTranslator.translate(event.getKeyCode());
|
short translated = keybTranslator.translate(event.getKeyCode());
|
||||||
@@ -438,7 +438,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try the controller handler first
|
// Try the controller handler first
|
||||||
boolean handled = controllerHandler.handleButtonUp(keyCode, event);
|
boolean handled = controllerHandler.handleButtonUp(event);
|
||||||
if (!handled) {
|
if (!handled) {
|
||||||
// Try the keyboard handler
|
// Try the keyboard handler
|
||||||
short translated = keybTranslator.translate(event.getKeyCode());
|
short translated = keybTranslator.translate(event.getKeyCode());
|
||||||
|
|||||||
@@ -44,10 +44,8 @@ import android.widget.Toast;
|
|||||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||||
|
|
||||||
public class PcView extends Activity {
|
public class PcView extends Activity {
|
||||||
private ImageButton settingsButton, addComputerButton;
|
|
||||||
private RelativeLayout noPcFoundLayout;
|
private RelativeLayout noPcFoundLayout;
|
||||||
private GridView pcGrid;
|
private PcGridAdapter pcGridAdapter;
|
||||||
private PcGridAdapter pcGridAdapter;
|
|
||||||
private ComputerManagerService.ComputerManagerBinder managerBinder;
|
private ComputerManagerService.ComputerManagerBinder managerBinder;
|
||||||
private boolean freezeUpdates, runningPolling;
|
private boolean freezeUpdates, runningPolling;
|
||||||
private ServiceConnection serviceConnection = new ServiceConnection() {
|
private ServiceConnection serviceConnection = new ServiceConnection() {
|
||||||
@@ -101,47 +99,43 @@ public class PcView extends Activity {
|
|||||||
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
|
||||||
|
|
||||||
// Setup the list view
|
// Setup the list view
|
||||||
settingsButton = (ImageButton)findViewById(R.id.settingsButton);
|
ImageButton settingsButton = (ImageButton) findViewById(R.id.settingsButton);
|
||||||
addComputerButton = (ImageButton)findViewById(R.id.manuallyAddPc);
|
ImageButton addComputerButton = (ImageButton) findViewById(R.id.manuallyAddPc);
|
||||||
|
|
||||||
pcGrid = (GridView)findViewById(R.id.pcGridView);
|
GridView pcGrid = (GridView) findViewById(R.id.pcGridView);
|
||||||
pcGrid.setAdapter(pcGridAdapter);
|
pcGrid.setAdapter(pcGridAdapter);
|
||||||
pcGrid.setOnItemClickListener(new OnItemClickListener() {
|
pcGrid.setOnItemClickListener(new OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
|
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
|
||||||
long id) {
|
long id) {
|
||||||
ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(pos);
|
ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(pos);
|
||||||
if (computer.details.reachability == ComputerDetails.Reachability.UNKNOWN) {
|
if (computer.details.reachability == ComputerDetails.Reachability.UNKNOWN) {
|
||||||
// Do nothing
|
// 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);
|
registerForContextMenu(pcGrid);
|
||||||
settingsButton.setOnClickListener(new OnClickListener() {
|
settingsButton.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
startActivity(new Intent(PcView.this, StreamSettings.class));
|
startActivity(new Intent(PcView.this, StreamSettings.class));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addComputerButton.setOnClickListener(new OnClickListener() {
|
addComputerButton.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent i = new Intent(PcView.this, AddComputerManually.class);
|
Intent i = new Intent(PcView.this, AddComputerManually.class);
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
noPcFoundLayout = (RelativeLayout) findViewById(R.id.no_pc_found_layout);
|
noPcFoundLayout = (RelativeLayout) findViewById(R.id.no_pc_found_layout);
|
||||||
if (pcGridAdapter.getCount() == 0) {
|
if (pcGridAdapter.getCount() == 0) {
|
||||||
|
|||||||
@@ -398,13 +398,13 @@ public class ControllerHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean handleButtonUp(int keyCode, KeyEvent event) {
|
public boolean handleButtonUp(KeyEvent event) {
|
||||||
ControllerMapping mapping = getMappingForDevice(event.getDevice());
|
ControllerMapping mapping = getMappingForDevice(event.getDevice());
|
||||||
if (mapping == null) {
|
if (mapping == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyCode = handleRemapping(mapping, event);
|
int keyCode = handleRemapping(mapping, event);
|
||||||
if (keyCode == 0) {
|
if (keyCode == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -521,13 +521,13 @@ public class ControllerHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean handleButtonDown(int keyCode, KeyEvent event) {
|
public boolean handleButtonDown(KeyEvent event) {
|
||||||
ControllerMapping mapping = getMappingForDevice(event.getDevice());
|
ControllerMapping mapping = getMappingForDevice(event.getDevice());
|
||||||
if (mapping == null) {
|
if (mapping == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
keyCode = handleRemapping(mapping, event);
|
int keyCode = handleRemapping(mapping, event);
|
||||||
if (keyCode == 0) {
|
if (keyCode == 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class ComputerManagerService extends Service {
|
|||||||
private AtomicInteger dbRefCount = new AtomicInteger(0);
|
private AtomicInteger dbRefCount = new AtomicInteger(0);
|
||||||
|
|
||||||
private IdentityManager idManager;
|
private IdentityManager idManager;
|
||||||
private HashMap<ComputerDetails, Thread> pollingThreads;
|
private final HashMap<ComputerDetails, Thread> pollingThreads = new HashMap<ComputerDetails, Thread>();
|
||||||
private ComputerManagerListener listener = null;
|
private ComputerManagerListener listener = null;
|
||||||
private AtomicInteger activePolls = new AtomicInteger(0);
|
private AtomicInteger activePolls = new AtomicInteger(0);
|
||||||
|
|
||||||
@@ -356,8 +356,6 @@ public class ComputerManagerService extends Service {
|
|||||||
bindService(new Intent(this, DiscoveryService.class),
|
bindService(new Intent(this, DiscoveryService.class),
|
||||||
discoveryServiceConnection, Service.BIND_AUTO_CREATE);
|
discoveryServiceConnection, Service.BIND_AUTO_CREATE);
|
||||||
|
|
||||||
pollingThreads = new HashMap<ComputerDetails, Thread>();
|
|
||||||
|
|
||||||
// Lookup or generate this device's UID
|
// Lookup or generate this device's UID
|
||||||
idManager = new IdentityManager(this);
|
idManager = new IdentityManager(this);
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class AppGridAdapter extends GenericGridAdapter<AppView.AppObject> {
|
|||||||
private String uniqueId;
|
private String uniqueId;
|
||||||
private LimelightCryptoProvider cryptoProvider;
|
private LimelightCryptoProvider cryptoProvider;
|
||||||
private SSLContext sslContext;
|
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 {
|
public AppGridAdapter(Context context, InetAddress address, String uniqueId) throws NoSuchAlgorithmException, KeyManagementException {
|
||||||
super(context, R.layout.app_grid_item, R.drawable.image_loading);
|
super(context, R.layout.app_grid_item, R.drawable.image_loading);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class SeekBarPreference extends DialogPreference
|
|||||||
private static final String SCHEMA_URL = "http://schemas.android.com/apk/res/android";
|
private static final String SCHEMA_URL = "http://schemas.android.com/apk/res/android";
|
||||||
|
|
||||||
private SeekBar seekBar;
|
private SeekBar seekBar;
|
||||||
private TextView splashText, valueText;
|
private TextView valueText;
|
||||||
private Context context;
|
private Context context;
|
||||||
|
|
||||||
private String dialogMessage, suffix;
|
private String dialogMessage, suffix;
|
||||||
@@ -60,7 +60,7 @@ public class SeekBarPreference extends DialogPreference
|
|||||||
layout.setOrientation(LinearLayout.VERTICAL);
|
layout.setOrientation(LinearLayout.VERTICAL);
|
||||||
layout.setPadding(6, 6, 6, 6);
|
layout.setPadding(6, 6, 6, 6);
|
||||||
|
|
||||||
splashText = new TextView(context);
|
TextView splashText = new TextView(context);
|
||||||
splashText.setPadding(30, 10, 30, 10);
|
splashText.setPadding(30, 10, 30, 10);
|
||||||
if (dialogMessage != null) {
|
if (dialogMessage != null) {
|
||||||
splashText.setText(dialogMessage);
|
splashText.setText(dialogMessage);
|
||||||
@@ -149,10 +149,10 @@ public class SeekBarPreference extends DialogPreference
|
|||||||
if (shouldPersist()) {
|
if (shouldPersist()) {
|
||||||
currentValue = seekBar.getProgress();
|
currentValue = seekBar.getProgress();
|
||||||
persistInt(seekBar.getProgress());
|
persistInt(seekBar.getProgress());
|
||||||
callChangeListener(Integer.valueOf(seekBar.getProgress()));
|
callChangeListener(seekBar.getProgress());
|
||||||
}
|
}
|
||||||
|
|
||||||
((AlertDialog) getDialog()).dismiss();
|
getDialog().dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class UiHelper {
|
|||||||
|
|
||||||
public static void notifyNewRootView(Activity activity)
|
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);
|
UiModeManager modeMgr = (UiModeManager) activity.getSystemService(Context.UI_MODE_SERVICE);
|
||||||
|
|
||||||
if (modeMgr.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION)
|
if (modeMgr.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="#000"
|
|
||||||
tools:context=".Game" >
|
tools:context=".Game" >
|
||||||
|
|
||||||
<SurfaceView
|
<SurfaceView
|
||||||
|
|||||||
Reference in New Issue
Block a user