Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
flutter_boost_1.22.4
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢冠章
flutter_boost_1.22.4
Commits
80bbf5c0
Commit
80bbf5c0
authored
Jun 04, 2019
by
Jidong Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Android params problem.
parent
f6567808
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
11 deletions
+20
-11
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/MainActivity.java
...com/taobao/idlefish/flutterboostexample/MainActivity.java
+6
-3
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/MyApplication.java
...om/taobao/idlefish/flutterboostexample/MyApplication.java
+2
-2
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/NativePageActivity.java
...obao/idlefish/flutterboostexample/NativePageActivity.java
+7
-3
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/PageRouter.java
...a/com/taobao/idlefish/flutterboostexample/PageRouter.java
+5
-3
No files found.
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/MainActivity.java
View file @
80bbf5c0
...
...
@@ -10,6 +10,7 @@ import com.taobao.idlefish.flutterboost.FlutterBoostPlugin;
import
java.lang.ref.WeakReference
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
MainActivity
extends
AppCompatActivity
implements
View
.
OnClickListener
{
...
...
@@ -45,13 +46,15 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
@Override
public
void
onClick
(
View
v
)
{
Map
params
=
new
HashMap
();
//Add some params if needed.
if
(
v
==
mOpenNative
)
{
PageRouter
.
openPageByUrl
(
this
,
PageRouter
.
NATIVE_PAGE_URL
);
PageRouter
.
openPageByUrl
(
this
,
PageRouter
.
NATIVE_PAGE_URL
,
params
);
}
else
if
(
v
==
mOpenFlutter
)
{
PageRouter
.
openPageByUrl
(
this
,
PageRouter
.
FLUTTER_PAGE_URL
);
PageRouter
.
openPageByUrl
(
this
,
PageRouter
.
FLUTTER_PAGE_URL
,
params
);
FlutterBoostPlugin
.
onPageResult
(
"result_id_100"
,
new
HashMap
(),
new
HashMap
());
}
else
if
(
v
==
mOpenFlutterFragment
)
{
PageRouter
.
openPageByUrl
(
this
,
PageRouter
.
FLUTTER_FRAGMENT_PAGE_URL
);
PageRouter
.
openPageByUrl
(
this
,
PageRouter
.
FLUTTER_FRAGMENT_PAGE_URL
,
params
);
}
}
}
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/MyApplication.java
View file @
80bbf5c0
...
...
@@ -56,10 +56,10 @@ public class MyApplication extends FlutterApplication {
* @return
*/
@Override
public
boolean
startActivity
(
Context
context
,
String
url
,
int
requestCode
)
{
public
boolean
startActivity
(
Context
context
,
String
url
,
Map
params
,
int
requestCode
)
{
Debuger
.
log
(
"startActivity url="
+
url
);
return
PageRouter
.
openPageByUrl
(
context
,
url
,
requestCode
);
return
PageRouter
.
openPageByUrl
(
context
,
url
,
params
,
requestCode
);
}
@Override
...
...
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/NativePageActivity.java
View file @
80bbf5c0
...
...
@@ -6,6 +6,9 @@ import android.support.v7.app.AppCompatActivity;
import
android.view.View
;
import
android.widget.TextView
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
NativePageActivity
extends
AppCompatActivity
implements
View
.
OnClickListener
{
private
TextView
mOpenNative
;
...
...
@@ -29,12 +32,13 @@ public class NativePageActivity extends AppCompatActivity implements View.OnClic
@Override
public
void
onClick
(
View
v
)
{
Map
params
=
new
HashMap
();
if
(
v
==
mOpenNative
)
{
PageRouter
.
openPageByUrl
(
this
,
PageRouter
.
NATIVE_PAGE_URL
);
PageRouter
.
openPageByUrl
(
this
,
PageRouter
.
NATIVE_PAGE_URL
,
params
);
}
else
if
(
v
==
mOpenFlutter
)
{
PageRouter
.
openPageByUrl
(
this
,
PageRouter
.
FLUTTER_PAGE_URL
);
PageRouter
.
openPageByUrl
(
this
,
PageRouter
.
FLUTTER_PAGE_URL
,
params
);
}
else
if
(
v
==
mOpenFlutterFragment
)
{
PageRouter
.
openPageByUrl
(
this
,
PageRouter
.
FLUTTER_FRAGMENT_PAGE_URL
);
PageRouter
.
openPageByUrl
(
this
,
PageRouter
.
FLUTTER_FRAGMENT_PAGE_URL
,
params
);
}
}
}
\ No newline at end of file
example/android/app/src/main/java/com/taobao/idlefish/flutterboostexample/PageRouter.java
View file @
80bbf5c0
...
...
@@ -4,17 +4,19 @@ import android.content.Context;
import
android.content.Intent
;
import
android.text.TextUtils
;
import
java.util.Map
;
public
class
PageRouter
{
public
static
final
String
NATIVE_PAGE_URL
=
"sample://nativePage"
;
public
static
final
String
FLUTTER_PAGE_URL
=
"sample://flutterPage"
;
public
static
final
String
FLUTTER_FRAGMENT_PAGE_URL
=
"sample://flutterFragmentPage"
;
public
static
boolean
openPageByUrl
(
Context
context
,
String
url
)
{
return
openPageByUrl
(
context
,
url
,
0
);
public
static
boolean
openPageByUrl
(
Context
context
,
String
url
,
Map
params
)
{
return
openPageByUrl
(
context
,
url
,
params
,
0
);
}
public
static
boolean
openPageByUrl
(
Context
context
,
String
url
,
int
requestCode
)
{
public
static
boolean
openPageByUrl
(
Context
context
,
String
url
,
Map
params
,
int
requestCode
)
{
try
{
if
(
url
.
startsWith
(
FLUTTER_PAGE_URL
))
{
context
.
startActivity
(
new
Intent
(
context
,
FlutterPageActivity
.
class
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment