Skip to content

Commit

Permalink
Cleanup code
Browse files Browse the repository at this point in the history
  • Loading branch information
badaix committed Apr 22, 2024
1 parent 21c7389 commit 7dc66b8
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 32 deletions.
8 changes: 4 additions & 4 deletions Snapcast/src/main/java/de/badaix/snapcast/ClientItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ public ClientItem(Context context, Client client) {
LayoutInflater vi = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
vi.inflate(R.layout.client_item, this);
title = (TextView) findViewById(R.id.title);
volumeSeekBar = (SeekBar) findViewById(R.id.volumeSeekBar);
ibMute = (ImageButton) findViewById(R.id.ibMute);
title = findViewById(R.id.title);
volumeSeekBar = findViewById(R.id.volumeSeekBar);
ibMute = findViewById(R.id.ibMute);
ibMute.setImageResource(R.drawable.ic_speaker_icon);
ibMute.setOnClickListener(this);
ibOverflow = (ImageButton) findViewById(R.id.ibOverflow);
ibOverflow = findViewById(R.id.ibOverflow);
ibOverflow.setOnClickListener(this);
volumeSeekBar.setOnSeekBarChangeListener(this);
setClient(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
}
});

prefMac = (Preference) findPreference("pref_client_mac");
prefId = (Preference) findPreference("pref_client_id");
prefIp = (Preference) findPreference("pref_client_ip");
prefHost = (Preference) findPreference("pref_client_host");
prefOS = (Preference) findPreference("pref_client_os");
prefVersion = (Preference) findPreference("pref_client_version");
prefLastSeen = (Preference) findPreference("pref_client_last_seen");
prefMac = findPreference("pref_client_mac");
prefId = findPreference("pref_client_id");
prefIp = findPreference("pref_client_ip");
prefHost = findPreference("pref_client_host");
prefOS = findPreference("pref_client_os");
prefVersion = findPreference("pref_client_version");
prefLastSeen = findPreference("pref_client_last_seen");
prefLatency = (EditTextPreference) findPreference("pref_client_latency");
prefLatency.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
Expand Down
12 changes: 6 additions & 6 deletions Snapcast/src/main/java/de/badaix/snapcast/GroupItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ public GroupItem(Context context, ServerStatus server, Group group) {
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
vi.inflate(R.layout.group_item, this);
// title = (TextView) findViewById(R.id.title);
volumeSeekBar = (SeekBar) findViewById(R.id.volumeSeekBar);
ibMute = (ImageButton) findViewById(R.id.ibMute);
volumeSeekBar = findViewById(R.id.volumeSeekBar);
ibMute = findViewById(R.id.ibMute);
ibMute.setImageResource(R.drawable.ic_speaker_icon);
ibMute.setOnClickListener(this);
ibSettings = (ImageButton) findViewById(R.id.ibSettings);
ibSettings = findViewById(R.id.ibSettings);
ibSettings.setOnClickListener(this);
llVolume = (LinearLayout) findViewById(R.id.llVolume);
llVolume = findViewById(R.id.llVolume);
llVolume.setVisibility(GONE);
llClient = (LinearLayout) findViewById(R.id.llClient);
llClient = findViewById(R.id.llClient);
llClient.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
tvStreamName = (TextView) findViewById(R.id.tvStreamName);
tvStreamName = findViewById(R.id.tvStreamName);
tvStreamName.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Inflate the layout for this fragment
Log.d(TAG, "onCreateView: " + this);
View view = inflater.inflate(R.layout.fragment_group_list, container, false);
ListView lvGroup = (ListView) view.findViewById(R.id.lvGroup);
ListView lvGroup = view.findViewById(R.id.lvGroup);
groupAdapter = new GroupAdapter(getContext(), groupItemListener);
groupAdapter.setHideOffline(hideOffline);
groupAdapter.updateServer(serverStatus);
Expand Down
6 changes: 3 additions & 3 deletions Snapcast/src/main/java/de/badaix/snapcast/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ protected void onCreate(Bundle savedInstanceState) {
// tvInfo.setText("Sample rate: " + rate + ", buffer size: " + size);
}

coordinatorLayout = (CoordinatorLayout) findViewById(R.id.myCoordinatorLayout);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
coordinatorLayout = findViewById(R.id.myCoordinatorLayout);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

btnConnect = (Button) findViewById(R.id.btnConnect);
btnConnect = findViewById(R.id.btnConnect);
btnConnect.setVisibility(View.GONE);
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,20 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
View view = inflater.inflate(R.layout.dialog_server, null);
btnScan = (Button) view.findViewById(R.id.btn_scan);
btnScan = view.findViewById(R.id.btn_scan);
btnScan.setOnClickListener(this);

editHost = (EditText) view.findViewById(R.id.host);
editStreamPort = (EditText) view.findViewById(R.id.stream_port);
editControlPort = (EditText) view.findViewById(R.id.control_port);
checkBoxAutoStart = (CheckBox) view.findViewById(R.id.checkBoxAutoStart);
editHost = view.findViewById(R.id.host);
editStreamPort = view.findViewById(R.id.stream_port);
editControlPort = view.findViewById(R.id.control_port);
checkBoxAutoStart = view.findViewById(R.id.checkBoxAutoStart);

spinnerAudioEngine = (Spinner) view.findViewById(R.id.audio_engine);
spinnerAudioEngine = view.findViewById(R.id.audio_engine);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getContext(),
R.array.audio_engine_array, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerAudioEngine.setAdapter(adapter);
checkBoxResample = (CheckBox) view.findViewById(R.id.checkBoxResample);
checkBoxResample = view.findViewById(R.id.checkBoxResample);

update();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public boolean equals(Object o) {
if (latency != that.latency) return false;
if (!Objects.equals(name, that.name)) return false;
if (instance != that.instance) return false;
return !(!Objects.equals(volume, that.volume));
return Objects.equals(volume, that.volume);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public boolean equals(Object o) {
if (!Objects.equals(mac, that.mac)) return false;
if (!Objects.equals(os, that.os)) return false;
if (!Objects.equals(arch, that.arch)) return false;
return !(!Objects.equals(ip, that.ip));
return Objects.equals(ip, that.ip);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public boolean equals(Object o) {

if (!Objects.equals(uri, stream.uri)) return false;
if (!Objects.equals(id, stream.id)) return false;
return !(!Objects.equals(status, stream.status));
return Objects.equals(status, stream.status);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public boolean equals(Object o) {
if (!Objects.equals(path, stream.path)) return false;
if (!Objects.equals(fragment, stream.fragment))
return false;
return !(!Objects.equals(query, stream.query));
return Objects.equals(query, stream.query);
}

@Override
Expand Down

0 comments on commit 7dc66b8

Please sign in to comment.