Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public final class PackageUtilities
*/
private static Set<String> constructPackageSet()
{
final HashSet<String> packages = new HashSet<String>();
final HashSet<String> packages = new HashSet<>();

packages.add(Constants.LOCALE_PACKAGE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ public void run() {
private boolean isInACallback;

public ArduinoFirmata(Context context) {
uartBuffer = new LinkedBlockingQueue<Byte>();
bluetoothBuffer = new LinkedBlockingQueue<Byte>();
uartBuffer = new LinkedBlockingQueue<>();
bluetoothBuffer = new LinkedBlockingQueue<>();
bluetoothService = new BluetoothService(context);
eventHandlers = new CopyOnWriteArrayList<ArduinoFirmataEventHandler>();
dataHandlers = new CopyOnWriteArrayList<ArduinoFirmataDataHandler>();
frameHandlers = new CopyOnWriteArrayList<ArduinoFirmataShieldFrameHandler>();
firmwareVersionQueryHandlers = new CopyOnWriteArrayList<FirmwareVersionQueryHandler>();
arduinoLibraryVersionChangeHandlers = new CopyOnWriteArrayList<ArduinoLibraryVersionChangeHandler>();
eventHandlers = new CopyOnWriteArrayList<>();
dataHandlers = new CopyOnWriteArrayList<>();
frameHandlers = new CopyOnWriteArrayList<>();
firmwareVersionQueryHandlers = new CopyOnWriteArrayList<>();
arduinoLibraryVersionChangeHandlers = new CopyOnWriteArrayList<>();
queuedFrames = new ConcurrentLinkedQueue<>();
this.context = context;
bluetoothService.addBluetoothServiceHandler(handler);
Expand Down Expand Up @@ -620,7 +620,7 @@ private void sendFrame(ShieldFrame frame) {
// StartSysex,
// EndSysex and
// Uart_data
ArrayList<byte[]> subArrays = new ArrayList<byte[]>();
ArrayList<byte[]> subArrays = new ArrayList<>();
for (int i = 0; i < frameBytes.length; i += maxShieldFrameBytes) {
byte[] subArray = (i + maxShieldFrameBytes > frameBytes.length) ? ArrayUtils
.copyOfRange(frameBytes, i, frameBytes.length) : ArrayUtils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static interface BluetoothServiceHandler {
public BluetoothService(Context context) {
mAdapter = BluetoothAdapter.getDefaultAdapter();
mState = STATE_NONE;
this.handlers = new CopyOnWriteArrayList<BluetoothServiceHandler>();
this.handlers = new CopyOnWriteArrayList<>();

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class Jodem {

Thread fileSendingThread;

LinkedBlockingQueue<Byte> buffer = new LinkedBlockingQueue<Byte>();
LinkedBlockingQueue<Byte> buffer = new LinkedBlockingQueue<>();

public interface JodemEventHandler {
public void onError(String error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ public ShieldFrame(byte shieldId, byte functionId) {
this.shieldId = shieldId;
this.functionId = functionId;
this.verificationByte = getNewVerificationByte();
arguments = new ArrayList<byte[]>();
arguments = new ArrayList<>();
}

public ShieldFrame(byte shieldId) {
// TODO Auto-generated constructor stub
this.shieldId = shieldId;
this.functionId = 0;
this.verificationByte = getNewVerificationByte();
arguments = new ArrayList<byte[]>();
arguments = new ArrayList<>();
}

private byte getNewVerificationByte(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public class OneSheeldApplication extends Application {
private final String TASKER_CONDITION_STATUS = "taskerConditionStatus";
private final String CAMERA_CAPTURING = "cameraCapturing";
private final String REMEMBER_SHIELDS = "rememberedShields";
private Hashtable<String, ControllerParent<?>> runningSheelds = new Hashtable<String, ControllerParent<?>>();
private final List<OneSheeldServiceHandler> serviceEventHandlers = new ArrayList<OneSheeldServiceHandler>();
private Hashtable<String, ControllerParent<?>> runningSheelds = new Hashtable<>();
private final List<OneSheeldServiceHandler> serviceEventHandlers = new ArrayList<>();
private ArduinoFirmata appFirmata;
private ConnectionDetector connectionHandler;
private ArduinoFirmataEventHandler arduinoFirmataEventHandler;
Expand Down Expand Up @@ -193,7 +193,7 @@ public void uncaughtException(Thread arg0, final Throwable arg1) {
@SuppressLint("UseSparseArrays")
public void initTaskerPins() {
ArduinoPin[] pins = ArduinoPin.values();
taskerPinsStatus = new SparseArray<Boolean>(pins.length);
taskerPinsStatus = new SparseArray<>(pins.length);
for (ArduinoPin pin : pins) {
taskerPinsStatus.put(pin.microHardwarePin, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class MediaAudioFilesListAdapter extends BaseAdapter {

public MediaAudioFilesListAdapter(Activity a, ArrayList<PlaylistItem> items) {
this.activity = (MainActivity) a;
this.items = new CopyOnWriteArrayList<PlaylistItem>();
this.items = new CopyOnWriteArrayList<>();
for (PlaylistItem playlistItem : items) {
this.items.add(playlistItem);
}
Expand Down Expand Up @@ -101,7 +101,7 @@ public void addToPlayList() {

public void updateList(ArrayList<PlaylistItem> items) {
if (items != null) {
this.items = new CopyOnWriteArrayList<PlaylistItem>();
this.items = new CopyOnWriteArrayList<>();
for (PlaylistItem playlistItem : items) {
this.items.add(playlistItem);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class MusicPlayListAdapter extends BaseAdapter {

public MusicPlayListAdapter(Activity a, ArrayList<PlaylistItem> items) {
this.activity = (MainActivity) a;
this.items = new CopyOnWriteArrayList<PlaylistItem>();
this.items = new CopyOnWriteArrayList<>();
for (PlaylistItem playlistItem : items) {
this.items.add(playlistItem);
}
Expand Down Expand Up @@ -102,7 +102,7 @@ public void removeFromPlaylist() {

public void updateList(ArrayList<PlaylistItem> items) {
if (items != null) {
this.items = new CopyOnWriteArrayList<PlaylistItem>();
this.items = new CopyOnWriteArrayList<>();
for (PlaylistItem playlistItem : items) {
this.items.add(playlistItem);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class SelectedShieldsListAdapter extends BaseAdapter {

public SelectedShieldsListAdapter(Activity a) {
this.activity = a;
this.shieldList = new ArrayList<Shield>();
this.shieldList = new ArrayList<>();
for (int i = 0; i < AppShields.getInstance().getShieldsArray().size(); i++) {
Shield shield = AppShields.getInstance().getShield(i);
if (shield.mainActivitySelection)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ protected void publishResults(CharSequence arg0, FilterResults arg1) {
@Override
protected FilterResults performFiltering(CharSequence arg0) {
FilterResults results = new FilterResults();
SparseArray<Shield> filteredShields = new SparseArray<Shield>();
SparseArray<Shield> filteredShields = new SparseArray<>();
if (arg0 != null) {
for (int i = 0; i < AppShields.getInstance()
.getShieldsArray().size(); i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public EnumSet<ArduinoPinCapability> getCapabilitySet() {
}

public static List<ArduinoPin> getDigitalPins() {
List<ArduinoPin> arduinoPins = new ArrayList<ArduinoPin>();
List<ArduinoPin> arduinoPins = new ArrayList<>();
for (ArduinoPin pin : ArduinoPin.values()) {
if (pin.getCapabilitySet().contains(ArduinoPinCapability.INPUT)
&& pin.getCapabilitySet().contains(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public static void setConnected(boolean isConnected) {

public static synchronized List<UIShield> valuesFiltered() {
UIShield[] vals = values();
List<UIShield> valsFiltered = new ArrayList<UIShield>();
List<UIShield> valsFiltered = new ArrayList<>();
for (int i = 0; i < vals.length; i++) {
UIShield cur = vals[i];
if (cur.isReleasable) {
Expand All @@ -227,7 +227,7 @@ public int compare(UIShield lhs, UIShield rhs) {
}
});
vals = null;
final ArrayList<UIShield> ret = new ArrayList<UIShield>();
final ArrayList<UIShield> ret = new ArrayList<>();
for (UIShield uiShield : valsFiltered) {
uiShield.itemBackgroundColor = colors[ret.size()];
ret.add(uiShield);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static class ApiObject {
private HashMap<String, String> apiObjects;

public ApiObject() {
apiObjects = new HashMap<String, String>();
apiObjects = new HashMap<>();
}

public void add(String key, String value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public ArduinoConnectivityPopup(Activity context) {
super(context, android.R.style.Theme_Translucent_NoTitleBar);
this.activity = context;
scale = activity.getResources().getDisplayMetrics().density;
foundDevicesTable = new Hashtable<String, BluetoothDevice>();
foundDevicesTable = new Hashtable<>();
thisInstance = this;
}

Expand Down Expand Up @@ -535,7 +535,7 @@ public void onTick(int secondsLeft) {
private void scanDevices() {
devicesList.removeAllViews();
backPressed = false;
foundDevicesTable = new Hashtable<String, BluetoothDevice>();
foundDevicesTable = new Hashtable<>();
// Register for broadcasts when a device is discovered
initTimeOut();
IntentFilter filter = new IntentFilter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ public ValidationPopup(MainActivity activity, String title, String msg,
ValidationAction... actions) {
super(activity, android.R.style.Theme_Translucent_NoTitleBar);
this.msg = msg;
this.actions = new ArrayList<ValidationAction>(Arrays.asList(actions));
this.actions = new ArrayList<>(Arrays.asList(actions));
this.title = title;
this.activity = activity;
}

public void addValidationAction(ValidationAction action) {
if (this.actions == null) actions = new ArrayList<ValidationPopup.ValidationAction>();
if (this.actions == null) actions = new ArrayList<>();
if (!actions.contains(action)) actions.add(action);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ public abstract class ControllerParent<T extends ControllerParent<?>> {
private static final byte SELECT_SHIELD = (byte) 0xFE;
private static final byte DESELECT_SHIELD = (byte) 0xFD;
public MainActivity activity;
protected List<String> requiredPermissions = new ArrayList<String>();
protected List<String> requiredPermissions = new ArrayList<>();
// case of FALSE
public String[][] requiredPinsNames = new String[][]{
{"2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13",
"A0", "A1", "A2", "A3", "A4", "A5"},
{"3", "5", "6", "9", "10", "11"}}; // 2D array for pins types
// (Digital and PWM)
public Hashtable<String, ArduinoPin> matchedShieldPins = new Hashtable<String, ArduinoPin>(); // saving
public Hashtable<String, ArduinoPin> matchedShieldPins = new Hashtable<>(); // saving
// connected
// pins
public int requiredPinsIndex = -1;// related to the pins type (index of the
Expand All @@ -60,7 +60,7 @@ public abstract class ControllerParent<T extends ControllerParent<?>> {
// like not
// found sensors
public boolean isInteractive = true;// flag used for the interaction
public List<String> permissions = new ArrayList<String>();
public List<String> permissions = new ArrayList<>();
// top-right toggle button
public boolean cachedArduinoCallbackStatus = false;
public Handler actionHandler = new Handler(); // queuing sysex UI calls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class MusicShield extends ControllerParent<MusicShield> {
public MediaPlayer mediaPlayer;
public String musicFileName = "";
private ArrayList<PlaylistItem> mediaFiles = new ArrayList<PlaylistItem>();
private ArrayList<PlaylistItem> mediaFiles = new ArrayList<>();
private int currentIndex = 0;
private MusicEventHandler eventHandler;
public int mediaDuration = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -922,8 +922,8 @@ private void sendError(byte errorCode) {
sendError(errorCode,false);
}
private ArrayList<ArrayList<String>> generateArrayListForDisplay() {
ArrayList<ArrayList<String>> parentArrayList = new ArrayList<ArrayList<String>>();
ArrayList<String> childArrayList = new ArrayList<String>();
ArrayList<ArrayList<String>> parentArrayList = new ArrayList<>();
ArrayList<String> childArrayList = new ArrayList<>();
DataReply recordCount = getNdefRecordCount();
if (recordCount.getIntegerData() > 0 && (!recordCount.hasError() || recordCount.getError() == INDEX_OUT_OF_BOUNDS) ) {
for (int childCount = 0; childCount < recordCount.getIntegerData(); childCount++) {
Expand Down Expand Up @@ -957,7 +957,7 @@ private ArrayList<ArrayList<String>> generateArrayListForDisplay() {
childArrayList.add("Is Data Parsable: " + "false");

parentArrayList.add(childArrayList);
childArrayList = new ArrayList<String>();
childArrayList = new ArrayList<>();
}
return parentArrayList;
}else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

public class SevenSegmentShield extends ControllerParent<SevenSegmentShield> {
private SevenSegmentsEventHandler eventHandler;
public Hashtable<String, Boolean> pinsStatus = new Hashtable<String, Boolean>();
public Hashtable<String, Boolean> pinsStatus = new Hashtable<>();

public SevenSegmentShield() {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class TerminalShield extends ControllerParent<TerminalShield> {
public int selectedEnMth = 0;
public CopyOnWriteArrayList<TerminalPrintedLine> terminalPrintedLines;
public boolean lastItemEndedWithNewLine = true;
public CopyOnWriteArrayList<TerminalPrintedLine> tempLines = new CopyOnWriteArrayList<TerminalPrintedLine>();
public CopyOnWriteArrayList<TerminalPrintedLine> tempLines = new CopyOnWriteArrayList<>();
public boolean isTimeOn = true, isAutoScrolling = true;

public TerminalShield() {
Expand All @@ -37,7 +37,7 @@ public TerminalShield(Activity activity, String tag) {

@Override
public ControllerParent<TerminalShield> init(String tag) {
terminalPrintedLines = new CopyOnWriteArrayList<TerminalPrintedLine>();
terminalPrintedLines = new CopyOnWriteArrayList<>();
lastItemEndedWithNewLine = true;
return super.init(tag);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private void talkToText() {

public void speech(String speechText) {
if (myTTS != null) {
HashMap<String, String> map = new HashMap<String, String>();
HashMap<String, String> map = new HashMap<>();
map.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID,
activity.getPackageName());
myTTS.speak(speechText, TextToSpeech.QUEUE_FLUSH, //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public ControllerParent<TwitterShield> init(String tag) {
mSharedPreferences = activity.getApplicationContext()
.getSharedPreferences("com.integreight.onesheeld",
Context.MODE_PRIVATE);
trackedKeywords = new ArrayList<String>();
trackedKeywords = new ArrayList<>();
thereIsAConnectionRequest = false;
isTwitterStreamConnecting = false;
// if(isTwitterLoggedInAlready())initTwitterListening();
Expand All @@ -114,7 +114,7 @@ public TwitterShield(Activity activity, String tag) {
mSharedPreferences = activity.getApplicationContext()
.getSharedPreferences("com.integreight.onesheeld",
Context.MODE_PRIVATE);
trackedKeywords = new ArrayList<String>();
trackedKeywords = new ArrayList<>();
thereIsAConnectionRequest = false;
isTwitterStreamConnecting = false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ private int drawChar(char c, float x, float y, int textSize, int textFont, int c
for (int widhtAdderCount = 0; widhtAdderCount < c; widhtAdderCount++) {
charInit += mfont.chars_width[widhtAdderCount] * 2;
}
ArrayList<Integer> charBytes = new ArrayList<Integer>();
ArrayList<Integer> charBytes = new ArrayList<>();
for (int charBytesCount = 0; charBytesCount < mfont.chars_width[c]; charBytesCount++) {
charBytes.add(data[charInit + charBytesCount]);
int ha = data[charInit + charBytesCount];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class RadioGroup {
int keyCounter = 0;

public RadioGroup() {
radios = new SparseArray<RadioButton>();
radios = new SparseArray<>();
}

public void add(RadioButton radioButton) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ public void onClick(View arg0) {
((TerminalShield) getApplication().getRunningShields()
.get(getControllerTag())).lastItemEndedWithNewLine = true;
((TerminalShield) getApplication().getRunningShields()
.get(getControllerTag())).tempLines = new CopyOnWriteArrayList<TerminalPrintedLine>();
.get(getControllerTag())).tempLines = new CopyOnWriteArrayList<>();
((TerminalShield) getApplication().getRunningShields()
.get(getControllerTag())).terminalPrintedLines = new CopyOnWriteArrayList<TerminalPrintedLine>();
.get(getControllerTag())).terminalPrintedLines = new CopyOnWriteArrayList<>();
}
});
send.setOnClickListener(new View.OnClickListener() {
Expand Down Expand Up @@ -180,7 +180,7 @@ public void onClick(View vi) {
((TerminalShield) getApplication().getRunningShields()
.get(getControllerTag())).selectedEnMth = x;
((TerminalShield) getApplication().getRunningShields()
.get(getControllerTag())).tempLines = new CopyOnWriteArrayList<TerminalPrintedLine>();
.get(getControllerTag())).tempLines = new CopyOnWriteArrayList<>();
for (TerminalPrintedLine line : ((TerminalShield) getApplication()
.getRunningShields().get(getControllerTag())).terminalPrintedLines) {
((TerminalShield) getApplication()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private void initView() {
Cursor imagecursor = getActivity().getContentResolver().query(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, columns, null,
null, orderBy);
ArrayList<PlaylistItem> items = new ArrayList<PlaylistItem>();
ArrayList<PlaylistItem> items = new ArrayList<>();
for (int i = 0; i < imagecursor.getCount(); i++) {
imagecursor.moveToPosition(i);
int dataColumnIndex = imagecursor
Expand Down
Loading