mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-30 03:19:11 +08:00
android: Minor refactor
Reduces the level of indentation, and makes the code easier to read.
This commit is contained in:
@ -18,22 +18,19 @@ import io.flutter.plugin.common.MethodChannel;
|
||||
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
|
||||
import io.flutter.plugin.common.MethodChannel.Result;
|
||||
|
||||
// For EventChannel
|
||||
import io.flutter.plugin.common.EventChannel;
|
||||
|
||||
import io.flutter.util.PathUtils;
|
||||
|
||||
public class MainActivity extends FlutterActivity {
|
||||
private static final String CHANNEL = "gitjournal.io/git";
|
||||
private static final String STREAM_CLONE_CHANNEL = "gitjournal.io/gitClone";
|
||||
public class MainActivity extends FlutterActivity implements MethodCallHandler {
|
||||
private static final String CHANNEL_NAME = "gitjournal.io/git";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
GeneratedPluginRegistrant.registerWith(this);
|
||||
|
||||
new MethodChannel(getFlutterView(), CHANNEL).setMethodCallHandler(
|
||||
new MethodCallHandler() {
|
||||
new MethodChannel(getFlutterView(), CHANNEL_NAME).setMethodCallHandler(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMethodCall(MethodCall call, Result result) {
|
||||
final String filesDir = PathUtils.getFilesDir(getApplicationContext());
|
||||
@ -114,7 +111,6 @@ public class MainActivity extends FlutterActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
String cloneLocation = filesDir + "/" + folderName;
|
||||
|
||||
new GitRmTask(result).execute(cloneLocation, filePattern);
|
||||
@ -185,21 +181,4 @@ public class MainActivity extends FlutterActivity {
|
||||
|
||||
result.notImplemented();
|
||||
}
|
||||
});
|
||||
|
||||
new EventChannel(getFlutterView(), STREAM_CLONE_CHANNEL).setStreamHandler(
|
||||
new EventChannel.StreamHandler() {
|
||||
@Override
|
||||
public void onListen(Object args, final EventChannel.EventSink events) {
|
||||
Log.w("CloneStream", "adding listener");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(Object args) {
|
||||
Log.w("CloneStream", "cancelling listener");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user