-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from MSzalek-Mobile/voice_search
Voice search
- Loading branch information
Showing
11 changed files
with
245 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 35 additions & 1 deletion
36
android/app/src/main/java/com/mszalek/weight_tracker/MainActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,47 @@ | ||
package com.mszalek.weight_tracker; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import com.google.android.gms.actions.NoteIntents; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
import io.flutter.app.FlutterActivity; | ||
import io.flutter.plugin.common.ActivityLifecycleListener; | ||
import io.flutter.plugin.common.MethodCall; | ||
import io.flutter.plugin.common.MethodChannel; | ||
import io.flutter.plugins.GeneratedPluginRegistrant; | ||
|
||
public class MainActivity extends FlutterActivity { | ||
String savedNote; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
GeneratedPluginRegistrant.registerWith(this); | ||
Intent intent = getIntent(); | ||
String action = intent.getAction(); | ||
String type = intent.getType(); | ||
|
||
if (NoteIntents.ACTION_CREATE_NOTE.equals(action) && type != null) { | ||
if ("text/plain".equals(type)) { | ||
handleSendText(intent); | ||
} | ||
} | ||
|
||
new MethodChannel(getFlutterView(), "app.channel.shared.data").setMethodCallHandler(new MethodChannel.MethodCallHandler() { | ||
@Override | ||
public void onMethodCall(MethodCall methodCall, MethodChannel.Result result) { | ||
if (methodCall.method.contentEquals("getSavedNote")) { | ||
result.success(savedNote); | ||
savedNote = null; | ||
} | ||
} | ||
}); | ||
} | ||
|
||
|
||
void handleSendText(Intent intent) { | ||
savedNote = intent.getStringExtra(Intent.EXTRA_TEXT); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
const double KG_LBS_RATIO = 2.2; | ||
const int MAX_KG_VALUE = 200; | ||
const int MIN_KG_VALUE = 5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.