Convert Java tabs to spaces.

This commit is contained in:
Ryan Heise 2020-10-16 00:13:35 +11:00
parent 1ac687cedc
commit cc2b10834b
3 changed files with 677 additions and 677 deletions

View File

@ -12,46 +12,46 @@ import io.flutter.plugin.common.PluginRegistry.Registrar;
*/
public class JustAudioPlugin implements FlutterPlugin {
private MethodChannel channel;
private MainMethodCallHandler methodCallHandler;
private MethodChannel channel;
private MainMethodCallHandler methodCallHandler;
public JustAudioPlugin() {
}
public JustAudioPlugin() {
}
/**
* v1 plugin registration.
*/
public static void registerWith(Registrar registrar) {
final JustAudioPlugin plugin = new JustAudioPlugin();
plugin.startListening(registrar.context(), registrar.messenger());
registrar.addViewDestroyListener(
view -> {
plugin.stopListening();
return false;
});
}
/**
* v1 plugin registration.
*/
public static void registerWith(Registrar registrar) {
final JustAudioPlugin plugin = new JustAudioPlugin();
plugin.startListening(registrar.context(), registrar.messenger());
registrar.addViewDestroyListener(
view -> {
plugin.stopListening();
return false;
});
}
@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
startListening(binding.getApplicationContext(), binding.getBinaryMessenger());
}
@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
startListening(binding.getApplicationContext(), binding.getBinaryMessenger());
}
@Override
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
stopListening();
}
@Override
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
stopListening();
}
private void startListening(Context applicationContext, BinaryMessenger messenger) {
methodCallHandler = new MainMethodCallHandler(applicationContext, messenger);
private void startListening(Context applicationContext, BinaryMessenger messenger) {
methodCallHandler = new MainMethodCallHandler(applicationContext, messenger);
channel = new MethodChannel(messenger, "com.ryanheise.just_audio.methods");
channel.setMethodCallHandler(methodCallHandler);
}
channel = new MethodChannel(messenger, "com.ryanheise.just_audio.methods");
channel.setMethodCallHandler(methodCallHandler);
}
private void stopListening() {
methodCallHandler.dispose();
methodCallHandler = null;
private void stopListening() {
methodCallHandler.dispose();
methodCallHandler = null;
channel.setMethodCallHandler(null);
}
channel.setMethodCallHandler(null);
}
}

View File

@ -13,46 +13,46 @@ import java.util.Map;
public class MainMethodCallHandler implements MethodCallHandler {
private final Context applicationContext;
private final BinaryMessenger messenger;
private final Context applicationContext;
private final BinaryMessenger messenger;
private final Map<String, AudioPlayer> players = new HashMap<>();
private final Map<String, AudioPlayer> players = new HashMap<>();
public MainMethodCallHandler(Context applicationContext,
BinaryMessenger messenger) {
this.applicationContext = applicationContext;
this.messenger = messenger;
}
public MainMethodCallHandler(Context applicationContext,
BinaryMessenger messenger) {
this.applicationContext = applicationContext;
this.messenger = messenger;
}
@Override
public void onMethodCall(MethodCall call, @NonNull Result result) {
final Map<?, ?> request = call.arguments();
switch (call.method) {
case "init": {
String id = (String)request.get("id");
players.put(id, new AudioPlayer(applicationContext, messenger, id));
result.success(null);
break;
}
case "disposePlayer": {
String id = (String)request.get("id");
AudioPlayer player = players.get(id);
if (player != null) {
player.dispose();
players.remove(id);
}
result.success(new HashMap<String, Object>());
break;
}
default:
result.notImplemented();
break;
}
}
@Override
public void onMethodCall(MethodCall call, @NonNull Result result) {
final Map<?, ?> request = call.arguments();
switch (call.method) {
case "init": {
String id = (String)request.get("id");
players.put(id, new AudioPlayer(applicationContext, messenger, id));
result.success(null);
break;
}
case "disposePlayer": {
String id = (String)request.get("id");
AudioPlayer player = players.get(id);
if (player != null) {
player.dispose();
players.remove(id);
}
result.success(new HashMap<String, Object>());
break;
}
default:
result.notImplemented();
break;
}
}
void dispose() {
for (AudioPlayer player : new ArrayList<AudioPlayer>(players.values())) {
player.dispose();
}
}
void dispose() {
for (AudioPlayer player : new ArrayList<AudioPlayer>(players.values())) {
player.dispose();
}
}
}