mirror of
https://github.com/badaix/snapcast.git
synced 2025-08-04 00:59:32 +02:00
fix some Linter warnings
This commit is contained in:
parent
998f6b3f47
commit
5c78d2380b
13 changed files with 45 additions and 98 deletions
2
android/.idea/misc.xml
generated
2
android/.idea/misc.xml
generated
|
@ -37,7 +37,7 @@
|
|||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -30,8 +30,11 @@ public class AboutActivity extends AppCompatActivity {
|
|||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_about);
|
||||
getSupportActionBar().setTitle(getString(R.string.about) + " Snapcast");
|
||||
PackageInfo pInfo = null;
|
||||
try {
|
||||
getSupportActionBar().setTitle(getString(R.string.about) + " Snapcast");
|
||||
} catch (Exception e) {
|
||||
}
|
||||
PackageInfo pInfo;
|
||||
try {
|
||||
pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||
getSupportActionBar().setSubtitle("v" + pInfo.versionName);
|
||||
|
|
|
@ -30,7 +30,6 @@ import android.widget.SeekBar;
|
|||
import android.widget.TextView;
|
||||
|
||||
import de.badaix.snapcast.control.json.Client;
|
||||
import de.badaix.snapcast.control.json.ServerStatus;
|
||||
import de.badaix.snapcast.control.json.Volume;
|
||||
|
||||
public class ClientItem extends LinearLayout implements SeekBar.OnSeekBarChangeListener, View.OnClickListener, PopupMenu.OnMenuItemClickListener {
|
||||
|
@ -42,10 +41,13 @@ public class ClientItem extends LinearLayout implements SeekBar.OnSeekBarChangeL
|
|||
private ImageButton ibMute;
|
||||
private ImageButton ibOverflow;
|
||||
private Client client;
|
||||
private ServerStatus server;
|
||||
private ClientItemListener listener = null;
|
||||
|
||||
public ClientItem(Context context, ServerStatus server, Client client) {
|
||||
public ClientItem(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public ClientItem(Context context, Client client) {
|
||||
super(context);
|
||||
LayoutInflater vi = (LayoutInflater) context
|
||||
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
|
@ -58,7 +60,6 @@ public class ClientItem extends LinearLayout implements SeekBar.OnSeekBarChangeL
|
|||
ibOverflow = (ImageButton) findViewById(R.id.ibOverflow);
|
||||
ibOverflow.setOnClickListener(this);
|
||||
volumeSeekBar.setOnSeekBarChangeListener(this);
|
||||
this.server = server;
|
||||
setClient(client);
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ public class GroupItem extends LinearLayout implements SeekBar.OnSeekBarChangeLi
|
|||
if ((client == null) || client.isDeleted() || (hideOffline && !client.isConnected()))
|
||||
continue;
|
||||
|
||||
ClientItem clientItem = new ClientItem(this.getContext(), server, client);
|
||||
ClientItem clientItem = new ClientItem(this.getContext(), client);
|
||||
clientItem.setListener(this);
|
||||
clientItems.add(clientItem);
|
||||
llClient.addView(clientItem);
|
||||
|
|
|
@ -20,6 +20,8 @@ package de.badaix.snapcast;
|
|||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -43,11 +45,6 @@ public class GroupListFragment extends Fragment {
|
|||
|
||||
private static final String TAG = "GroupList";
|
||||
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
private static final String ARG_PARAM2 = "param2";
|
||||
|
||||
private GroupItem.GroupItemListener groupItemListener;
|
||||
private GroupAdapter groupAdapter;
|
||||
private ServerStatus serverStatus = null;
|
||||
|
@ -57,29 +54,13 @@ public class GroupListFragment extends Fragment {
|
|||
// Required empty public constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this factory method to create a new instance of
|
||||
* this fragment using the provided parameters.
|
||||
* <p/>
|
||||
* //@param param1 Parameter 1.
|
||||
*
|
||||
* @return A new instance of fragment GroupListFragment.
|
||||
* // TODO: Rename and change types and number of parameters
|
||||
* public static GroupListFragment newInstance(String param1) {
|
||||
* GroupListFragment fragment = new GroupListFragment();
|
||||
* Bundle args = new Bundle();
|
||||
* args.putString(ARG_PARAM1, param1);
|
||||
* fragment.setArguments(args);
|
||||
* return fragment;
|
||||
* }
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
// if (getArguments() != null) {
|
||||
// mParam1 = getArguments().getString(ARG_PARAM1);
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -137,14 +118,17 @@ public class GroupListFragment extends Fragment {
|
|||
private boolean hideOffline = false;
|
||||
private ServerStatus serverStatus = new ServerStatus();
|
||||
|
||||
public GroupAdapter(Context context, GroupItem.GroupItemListener listener) {
|
||||
GroupAdapter(Context context, GroupItem.GroupItemListener listener) {
|
||||
super(context, 0);
|
||||
this.context = context;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
public
|
||||
@NonNull
|
||||
View getView(int position, @Nullable View convertView,
|
||||
@NonNull ViewGroup parent) {
|
||||
Group group = getItem(position);
|
||||
final GroupItem groupItem;
|
||||
|
||||
|
@ -159,7 +143,7 @@ public class GroupListFragment extends Fragment {
|
|||
return groupItem;
|
||||
}
|
||||
|
||||
public void updateServer(final ServerStatus serverStatus) {
|
||||
void updateServer(final ServerStatus serverStatus) {
|
||||
if (serverStatus != null) {
|
||||
GroupAdapter.this.serverStatus = serverStatus;
|
||||
update();
|
||||
|
@ -167,14 +151,12 @@ public class GroupListFragment extends Fragment {
|
|||
}
|
||||
|
||||
|
||||
public void update() {
|
||||
void update() {
|
||||
getActivity().runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
clear();
|
||||
// TODO: group
|
||||
for (Group group : GroupAdapter.this.serverStatus.getGroups()) {
|
||||
// add(group);
|
||||
if (group.getClients().isEmpty())
|
||||
continue;
|
||||
|
||||
|
@ -198,7 +180,7 @@ public class GroupListFragment extends Fragment {
|
|||
});
|
||||
}
|
||||
|
||||
public void setHideOffline(boolean hideOffline) {
|
||||
void setHideOffline(boolean hideOffline) {
|
||||
if (this.hideOffline == hideOffline)
|
||||
return;
|
||||
this.hideOffline = hideOffline;
|
||||
|
|
|
@ -44,7 +44,7 @@ import de.badaix.snapcast.control.json.Stream;
|
|||
|
||||
public class GroupSettingsFragment extends PreferenceFragment {
|
||||
|
||||
private static final String TAG = "GroupSettingsFragment";
|
||||
//private static final String TAG = "GroupSettingsFragment";
|
||||
|
||||
private ListPreference prefStreams;
|
||||
private Group group = null;
|
||||
|
|
|
@ -34,7 +34,6 @@ import android.os.Bundle;
|
|||
import android.os.IBinder;
|
||||
import android.support.design.widget.CoordinatorLayout;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
@ -79,7 +78,6 @@ public class MainActivity extends AppCompatActivity implements GroupItem.GroupIt
|
|||
private ServerStatus serverStatus = null;
|
||||
private SnapclientService snapclientService;
|
||||
private GroupListFragment groupListFragment;
|
||||
private TabLayout tabLayout;
|
||||
private Snackbar warningSamplerateSnackbar = null;
|
||||
private int nativeSampleRate = 0;
|
||||
private CoordinatorLayout coordinatorLayout;
|
||||
|
@ -154,7 +152,7 @@ public class MainActivity extends AppCompatActivity implements GroupItem.GroupIt
|
|||
}
|
||||
|
||||
public void checkFirstRun() {
|
||||
PackageInfo pInfo = null;
|
||||
PackageInfo pInfo;
|
||||
try {
|
||||
pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||
final int verCode = pInfo.versionCode;
|
||||
|
@ -396,7 +394,7 @@ public class MainActivity extends AppCompatActivity implements GroupItem.GroupIt
|
|||
return;
|
||||
}
|
||||
if (requestCode == CLIENT_PROPERTIES_REQUEST) {
|
||||
Client client = null;
|
||||
Client client;
|
||||
try {
|
||||
client = new Client(new JSONObject(data.getStringExtra("client")));
|
||||
} catch (JSONException e) {
|
||||
|
@ -404,7 +402,7 @@ public class MainActivity extends AppCompatActivity implements GroupItem.GroupIt
|
|||
return;
|
||||
}
|
||||
|
||||
Client clientOriginal = null;
|
||||
Client clientOriginal;
|
||||
try {
|
||||
clientOriginal = new Client(new JSONObject(data.getStringExtra("clientOriginal")));
|
||||
} catch (JSONException e) {
|
||||
|
@ -597,7 +595,7 @@ public class MainActivity extends AppCompatActivity implements GroupItem.GroupIt
|
|||
groupListFragment.updateServer(serverStatus);
|
||||
}
|
||||
});
|
||||
mySnackbar.setCallback(new Snackbar.Callback() {
|
||||
mySnackbar.addCallback(new Snackbar.Callback() {
|
||||
@Override
|
||||
public void onDismissed(Snackbar snackbar, int event) {
|
||||
super.onDismissed(snackbar, event);
|
||||
|
|
|
@ -122,7 +122,6 @@ public class ServerDialogFragment extends DialogFragment implements View.OnClick
|
|||
if (context instanceof Activity) {
|
||||
update();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void update() {
|
||||
|
|
|
@ -26,10 +26,7 @@ import android.content.Context;
|
|||
import android.content.Intent;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.Binder;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.PowerManager;
|
||||
import android.support.v4.app.NotificationCompat;
|
||||
import android.support.v4.app.TaskStackBuilder;
|
||||
|
@ -73,10 +70,10 @@ public class SnapclientService extends Service {
|
|||
if (intent == null)
|
||||
return START_NOT_STICKY;
|
||||
|
||||
if (intent.getAction() == ACTION_STOP) {
|
||||
if (intent.getAction().equals(ACTION_STOP)) {
|
||||
stopService();
|
||||
return START_NOT_STICKY;
|
||||
} else if (intent.getAction() == ACTION_START) {
|
||||
} else if (intent.getAction().equals(ACTION_START)) {
|
||||
String host = intent.getStringExtra(EXTRA_HOST);
|
||||
int port = intent.getIntExtra(EXTRA_PORT, 1704);
|
||||
|
||||
|
@ -111,11 +108,8 @@ public class SnapclientService extends Service {
|
|||
PendingIntent.FLAG_UPDATE_CURRENT
|
||||
);
|
||||
builder.setContentIntent(resultPendingIntent);
|
||||
NotificationManager mNotificationManager =
|
||||
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
// mId allows you to update the notification later on.
|
||||
final Notification notification = builder.build();
|
||||
// mNotificationManager.notify(123, notification);
|
||||
startForeground(123, notification);
|
||||
|
||||
start(host, port);
|
||||
|
@ -257,31 +251,6 @@ public class SnapclientService extends Service {
|
|||
}
|
||||
}
|
||||
|
||||
// Handler that receives messages from the thread
|
||||
private final class ServiceHandler extends Handler {
|
||||
public ServiceHandler(Looper looper) {
|
||||
super(looper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
// Normally we would do some work here, like download a file.
|
||||
// For our sample, we just sleep for 5 seconds.
|
||||
long endTime = System.currentTimeMillis() + 5 * 1000;
|
||||
while (System.currentTimeMillis() < endTime) {
|
||||
synchronized (this) {
|
||||
try {
|
||||
wait(endTime - System.currentTimeMillis());
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
// Stop the service using the startId, so that we don't stop
|
||||
// the service in the middle of handling another job
|
||||
stopSelf(msg.arg1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
package de.badaix.snapcast.control.json;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import org.json.JSONArray;
|
||||
|
@ -203,7 +204,7 @@ public class Group implements JsonSerialisable, Comparable<Group> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Group another) {
|
||||
public int compareTo(@NonNull Group another) {
|
||||
if (getClients().isEmpty())
|
||||
return -1;
|
||||
if (another.getClients().isEmpty())
|
||||
|
|
|
@ -2,17 +2,16 @@
|
|||
<string name="app_name">Snapcast</string>
|
||||
<string name="ticker_text">Snapclient gestartet</string>
|
||||
<string name="notification_title">Snapclient</string>
|
||||
<string name="notification_text">Snapclient läuft...</string>
|
||||
<string name="notification_info">Info...</string>
|
||||
<string name="notification_text">Snapclient läuft…</string>
|
||||
<string name="notification_info">Info…</string>
|
||||
<string name="stop">Stop</string>
|
||||
<string name="menu_details">Details</string>
|
||||
<string name="menu_delete">Löschen</string>
|
||||
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="title_activity_snapcast">Snapcast</string>
|
||||
|
||||
<string name="action_about">Über...</string>
|
||||
<string name="action_settings">Einstellungen...</string>
|
||||
<string name="action_about">Über…</string>
|
||||
<string name="action_settings">Einstellungen…</string>
|
||||
<string name="action_scan">Suche nach Server</string>
|
||||
<string name="action_refresh">Aktualisiere Client-Liste</string>
|
||||
<string name="action_hide_offline">Verstecke offline Clients</string>
|
||||
|
@ -36,7 +35,6 @@
|
|||
<string name="about_file">files/about.html</string>
|
||||
<string name="about">Über</string>
|
||||
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="client_stream">Stream</string>
|
||||
<string name="first_run_title">Warnung</string>
|
||||
<string name="first_run_text">Dies ist ein Test-Client.\nNicht für den Produktiv-Einsatz vorgesehen.</string>
|
||||
|
|
|
@ -2,17 +2,16 @@
|
|||
<string name="app_name">Snapcast</string>
|
||||
<string name="ticker_text">Snapclient 開始しました</string>
|
||||
<string name="notification_title">Snapclient</string>
|
||||
<string name="notification_text">Snapclient は実行中です...</string>
|
||||
<string name="notification_info">情報...</string>
|
||||
<string name="notification_text">Snapclient は実行中です…</string>
|
||||
<string name="notification_info">情報…</string>
|
||||
<string name="stop">停止</string>
|
||||
<string name="menu_details">詳細</string>
|
||||
<string name="menu_delete">削除</string>
|
||||
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="title_activity_snapcast">Snapcast</string>
|
||||
|
||||
<string name="action_about">アプリについて...</string>
|
||||
<string name="action_settings">設定...</string>
|
||||
<string name="action_about">アプリについて…</string>
|
||||
<string name="action_settings">設定…</string>
|
||||
<string name="action_scan">サーバーのスキャン</string>
|
||||
<string name="action_refresh">クライアント一覧の更新</string>
|
||||
<string name="action_hide_offline">オフラインのクライアントを非表示</string>
|
||||
|
@ -36,7 +35,6 @@
|
|||
<string name="about_file">files/about.html</string>
|
||||
<string name="about">アプリについて</string>
|
||||
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="client_stream">ストリーム</string>
|
||||
<string name="first_run_title">警告</string>
|
||||
<string name="first_run_text">これはテストクライアントです。\n正式利用用途ではありません。</string>
|
||||
|
|
|
@ -2,18 +2,17 @@
|
|||
<string name="app_name">Snapcast</string>
|
||||
<string name="ticker_text">Snapclient started</string>
|
||||
<string name="notification_title">Snapclient</string>
|
||||
<string name="notification_text">Snapclient is running...</string>
|
||||
<string name="notification_info">info...</string>
|
||||
<string name="notification_text">Snapclient is running…</string>
|
||||
<string name="notification_info">info…</string>
|
||||
<string name="stop">stop</string>
|
||||
<string name="menu_details">Details</string>
|
||||
<string name="menu_delete">Delete</string>
|
||||
<string name="menu_group">Group</string>
|
||||
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="title_activity_snapcast">Snapcast</string>
|
||||
|
||||
<string name="action_about">About...</string>
|
||||
<string name="action_settings">Settings...</string>
|
||||
<string name="action_about">About…</string>
|
||||
<string name="action_settings">Settings…</string>
|
||||
<string name="action_scan">Scan for server</string>
|
||||
<string name="action_refresh">Refresh client list</string>
|
||||
<string name="action_hide_offline">Hide offline clients</string>
|
||||
|
@ -41,7 +40,6 @@
|
|||
<string name="about_file">files/about.html</string>
|
||||
<string name="about">About</string>
|
||||
|
||||
<!-- TODO: Remove or change this placeholder text -->
|
||||
<string name="client_stream">Stream</string>
|
||||
<string name="first_run_title">Warning</string>
|
||||
<string name="first_run_text">This is just a test client.\nNot meant for production use.</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue