Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
a07aef06
Commit
a07aef06
authored
Nov 11, 2019
by
徐健
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改fm引用media方式,删除platform中重复的baseflutter代码
parent
0e3e5822
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
19 additions
and
399 deletions
+19
-399
config.gradle
config.gradle
+2
-2
build.gradle
m-fm/build.gradle
+1
-1
modular.gradle
m-fm/modular.gradle
+1
-1
FMDetailActivity.java
m-fm/src/main/java/com/yidianling/fm/FMDetailActivity.java
+14
-15
build.gradle
m-muse/build.gradle
+1
-4
BaseFlutterChannelPlugin.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/base/flutter/base/BaseFlutterChannelPlugin.kt
+0
-49
BaseFlutterActivity.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/flutter/base/BaseFlutterActivity.kt
+0
-73
BaseFlutterChannelPlugin.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/flutter/base/BaseFlutterChannelPlugin.kt
+0
-49
BaseFlutterFragment.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/flutter/base/BaseFlutterFragment.kt
+0
-36
Flutter.java
ydl-platform/src/main/java/com/ydl/ydlcommon/flutter/io/flutter/facade/Flutter.java
+0
-129
FlutterFragment.java
ydl-platform/src/main/java/com/ydl/ydlcommon/flutter/io/flutter/facade/FlutterFragment.java
+0
-40
No files found.
config.gradle
View file @
a07aef06
ext
{
kotlin_version
=
'1.3.21'
dev_mode
=
tru
e
dev_mode
=
fals
e
ydl_app
=
[
appName
:
"心理咨询壹点灵"
,
...
...
@@ -179,6 +179,6 @@ ext {
"ydl-m-user-api"
:
'com.ydl:m-user-api:0.0.5'
,
"ydl-m-muse-api"
:
'com.ydl:m-muse-api:0.0.1'
,
"ydl-m-fm-api"
:
'com.ydl:m-fm-api:0.0.2'
,
"ydl-m-fm-module-ydl"
:
'com.ydl:m-fm-module-ydl:0.0.
1
@aar'
"ydl-m-fm-module-ydl"
:
'com.ydl:m-fm-module-ydl:0.0.
6
@aar'
]
}
m-fm/build.gradle
View file @
a07aef06
...
...
@@ -78,7 +78,7 @@ dependencies {
implementation
project
(
':ydl-media'
)
}
else
{
//发布时使用
implementation
project
(
':ydl-media'
)
implementation
"com.ydl:ydl-media:0.0.4@aar"
implementation
rootProject
.
ext
.
dependencies
[
"ydl-m-user-api"
]
implementation
rootProject
.
ext
.
dependencies
[
"ydl-platform"
]
}
...
...
m-fm/modular.gradle
View file @
a07aef06
...
...
@@ -15,7 +15,7 @@ modular {
groupId
=
"com.ydl"
artifactId
=
"m-fm-module-ydl"
// 上报的 壹点灵 业务模块 aar 包的版本号
version
=
"0.0.
6
"
version
=
"0.0.
7
"
}
}
...
...
m-fm/src/main/java/com/yidianling/fm/FMDetailActivity.java
View file @
a07aef06
...
...
@@ -42,6 +42,7 @@ import com.yidianling.fm.param.FavParam;
import
com.yidianling.fm.response.FMDetail
;
import
com.yidianling.fm.router.FMIn
;
import
com.yidianling.fm.widget.FMSurfaceView
;
import
com.yidianling.user.api.event.UserLoginEvent
;
import
org.jetbrains.annotations.NotNull
;
import
org.json.JSONException
;
...
...
@@ -52,6 +53,7 @@ import java.util.ArrayList;
import
java.util.Date
;
import
java.util.HashMap
;
import
de.greenrobot.event.EventBus
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
/**
...
...
@@ -180,8 +182,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
fmIdList
.
clear
();
// todo 打开
// EventBus.getDefault().register(this);
EventBus
.
getDefault
().
register
(
this
);
if
(
null
==
getIntent
())
{
finish
();
...
...
@@ -406,10 +407,10 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
if
(!
TextUtils
.
isEmpty
(
fmDetail
.
getFm_url
()))
{
Music
music
=
new
Music
();
music
.
setPath
(
fmDetail
.
getFm_url
());
music
.
setAlbum
(
""
);
music
.
setArtist
(
""
);
music
.
setCoverPath
(
""
);
music
.
setTitle
(
""
);
music
.
setAlbum
(
fmDetail
.
getImage_url
()
);
music
.
setArtist
(
fmDetail
.
getAuthor
()
);
music
.
setCoverPath
(
fmDetail
.
getImage_url
()
);
music
.
setTitle
(
fmDetail
.
getTitle
()
);
AudioPlayer
.
Companion
.
get
().
prev
();
AudioPlayer
.
Companion
.
get
().
singlePlay
(
music
,
false
);
}
...
...
@@ -439,13 +440,12 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
// }
// }
//todo xujian
// public void onEvent(UserLoginEvent event) {
// if (isToTrend) {
// isToTrend = false;
// toTrend();
// }
// }
public
void
onEvent
(
UserLoginEvent
event
)
{
if
(
isToTrend
)
{
isToTrend
=
false
;
toTrend
();
}
}
@Override
public
void
onClick
(
View
v
)
{
...
...
@@ -588,8 +588,7 @@ public class FMDetailActivity extends BaseActivity implements View.OnClickListen
super
.
onDestroy
();
anim
.
cancel
();
// todo 打开
// EventBus.getDefault().unregister(this);
EventBus
.
getDefault
().
unregister
(
this
);
AudioPlayer
.
Companion
.
get
().
removeOnPlayEventListener
(
this
);
}
...
...
m-muse/build.gradle
View file @
a07aef06
...
...
@@ -69,9 +69,6 @@ dependencies {
}
else
{
//发布时使用
implementation
project
(
':ydl-media'
)
api
(
rootProject
.
ext
.
dependencies
[
"ydl-platform"
])
{
transitive
=
true
}
implementation
rootProject
.
ext
.
dependencies
[
"ydl-platform"
]
}
}
ydl-platform/src/main/java/com/ydl/ydlcommon/base/flutter/base/BaseFlutterChannelPlugin.kt
deleted
100644 → 0
View file @
0e3e5822
package
com.ydl.ydlcommon.base.flutter.base
import
io.flutter.app.FlutterActivity
import
io.flutter.plugin.common.MethodCall
import
io.flutter.plugin.common.MethodChannel
/**
* 公共通道插件类
* Created by xj on 2019/9/30.
*/
class
BaseFlutterChannelPlugin
:
MethodChannel
.
MethodCallHandler
{
companion
object
{
const
val
CHANNEL
:
String
=
"lib/common/channel"
const
val
ACTION_GET_APPINFO_INITIAL_DATA
=
"action_get_initial_app_info_data"
//获取主包信息的数据
fun
rigister
(
activity
:
FlutterActivity
)
{
MethodChannel
(
activity
.
flutterView
,
CHANNEL
).
setMethodCallHandler
(
BaseFlutterChannelPlugin
(
activity
))
}
}
private
var
mActivity
:
FlutterActivity
?
=
null
private
constructor
(
activity
:
FlutterActivity
)
{
mActivity
=
activity
}
override
fun
onMethodCall
(
methodCall
:
MethodCall
,
result
:
MethodChannel
.
Result
)
{
methodCall
?.
let
{
when
(
methodCall
.
method
)
{
// 获取主包信息的数据
//todo xujian
// ACTION_GET_APPINFO_INITIAL_DATA -> {
// val mRequestMap = mutableMapOf(
// "isDevelopment" to (BuildConfig.FLUTTER_API != "prod"),
// "uid" to ,
// "accessToken" to LoginHelper.getInstance().user.accessToken,
// "version" to RxAppTool.getAppVersionName(mActivity?.applicationContext),
// "isFromApp" to "1",
// "osBuild" to RxDeviceTool.getBuildBrandModel() + "," + RxDeviceTool.getSDKVersionName() + "," + RxAppTool.getAppVersionName(mActivity?.applicationContext)
// )
// }
}
}
}
}
\ No newline at end of file
ydl-platform/src/main/java/com/ydl/ydlcommon/flutter/base/BaseFlutterActivity.kt
deleted
100644 → 0
View file @
0e3e5822
package
com.yidianling.ydlcommon.flutter.base
import
android.content.Context
import
android.content.Intent
import
android.graphics.PixelFormat
import
android.os.Bundle
import
android.util.AttributeSet
import
android.view.WindowManager
import
io.flutter.app.FlutterActivity
import
io.flutter.plugins.GeneratedPluginRegistrant
import
io.flutter.view.FlutterView
import
org.json.JSONObject
/**
* flutter 页面基类
* Created by xj on 2019/9/30.
*/
abstract
class
BaseFlutterActivity
:
FlutterActivity
()
{
companion
object
{
const
val
ROUTE_PAGE
=
"route"
//路由
/**
* 路由传递过来的参数
*/
const
val
ROUTER_PARAMS
=
"routerParam"
}
override
fun
createFlutterView
(
context
:
Context
?):
FlutterView
{
val
matchParent
=
WindowManager
.
LayoutParams
(-
1
,
-
1
)
val
nativeView
=
this
.
createFlutterNativeView
()
val
flutterView
=
FlutterView
(
this
,
null
as
AttributeSet
?,
nativeView
)
flutterView
.
layoutParams
=
matchParent
this
.
setContentView
(
flutterView
)
//这个action必加,不然无法在flutter端获取route参数值
intent
.
action
=
Intent
.
ACTION_RUN
/**
* 在这边初始化route
*/
intent
.
putExtra
(
ROUTE_PAGE
,
initialRoute
())
//渲染优化(优化一丢丢几乎看不出来)
flutterView
.
setZOrderOnTop
(
true
)
flutterView
.
holder
.
setFormat
(
PixelFormat
.
TRANSLUCENT
)
return
flutterView
}
public
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
GeneratedPluginRegistrant
.
registerWith
(
this
)
/**
* 获取统一路由传递过来的参数并初始化交互通道
*/
val
json
=
intent
.
getStringExtra
(
ROUTER_PARAMS
)
initChannelPlugin
(
JSONObject
(
json
))
}
/**
* 路由,例 "/native/muse/home"
*/
abstract
fun
initialRoute
():
String
/**
* 初始化flutter channel插件
*/
abstract
fun
initChannelPlugin
(
jsonObject
:
JSONObject
)
}
\ No newline at end of file
ydl-platform/src/main/java/com/ydl/ydlcommon/flutter/base/BaseFlutterChannelPlugin.kt
deleted
100644 → 0
View file @
0e3e5822
package
com.yidianling.ydlcommon.flutter.base
import
io.flutter.app.FlutterActivity
import
io.flutter.plugin.common.MethodCall
import
io.flutter.plugin.common.MethodChannel
/**
* 公共通道插件类
* Created by xj on 2019/9/30.
*/
class
BaseFlutterChannelPlugin
:
MethodChannel
.
MethodCallHandler
{
companion
object
{
const
val
CHANNEL
:
String
=
"lib/common/channel"
const
val
ACTION_GET_APPINFO_INITIAL_DATA
=
"action_get_initial_app_info_data"
//获取主包信息的数据
fun
rigister
(
activity
:
FlutterActivity
)
{
MethodChannel
(
activity
.
flutterView
,
CHANNEL
).
setMethodCallHandler
(
BaseFlutterChannelPlugin
(
activity
))
}
}
private
var
mActivity
:
FlutterActivity
?
=
null
private
constructor
(
activity
:
FlutterActivity
)
{
mActivity
=
activity
}
override
fun
onMethodCall
(
methodCall
:
MethodCall
,
result
:
MethodChannel
.
Result
)
{
methodCall
?.
let
{
when
(
methodCall
.
method
)
{
// 获取主包信息的数据
//todo xujian 组件化之后完善
// ACTION_GET_APPINFO_INITIAL_DATA -> {
// val mRequestMap = mutableMapOf(
// "isDevelopment" to (BuildConfig.FLUTTER_API != "prod"),
// "uid" to ,
// "accessToken" to LoginHelper.getInstance().user.accessToken,
// "version" to RxAppTool.getAppVersionName(mActivity?.applicationContext),
// "isFromApp" to "1",
// "osBuild" to RxDeviceTool.getBuildBrandModel() + "," + RxDeviceTool.getSDKVersionName() + "," + RxAppTool.getAppVersionName(mActivity?.applicationContext)
// )
// }
}
}
}
}
\ No newline at end of file
ydl-platform/src/main/java/com/ydl/ydlcommon/flutter/base/BaseFlutterFragment.kt
deleted
100644 → 0
View file @
0e3e5822
package
com.yidianling.ydlcommon.flutter.base
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.ViewGroup
import
com.ydl.ydlcommon.flutter.io.flutter.facade.Flutter
import
com.ydl.ydlcommon.flutter.io.flutter.facade.FlutterFragment
import
io.flutter.view.FlutterView
/**
* flutter fragment 基类
* Created by xj on 2019/9/30.
*/
abstract
class
BaseFlutterFragment
:
FlutterFragment
()
{
private
var
mFlutterView
:
FlutterView
?
=
null
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
FlutterView
{
mFlutterView
=
Flutter
.
createView
(
activity
!!
,
lifecycle
,
initialRoute
())
initChannelPlugin
(
mFlutterView
!!
)
return
mFlutterView
!!
}
/**
* 路由,例 "quick_reply"
*/
abstract
fun
initialRoute
():
String
/**
* 初始化flutter channel插件
*/
abstract
fun
initChannelPlugin
(
flutterView
:
FlutterView
)
}
ydl-platform/src/main/java/com/ydl/ydlcommon/flutter/io/flutter/facade/Flutter.java
deleted
100644 → 0
View file @
0e3e5822
package
com
.
ydl
.
ydlcommon
.
flutter
.
io
.
flutter
.
facade
;
import
android.app.Activity
;
import
android.arch.lifecycle.Lifecycle
;
import
android.arch.lifecycle.LifecycleObserver
;
import
android.arch.lifecycle.OnLifecycleEvent
;
import
android.content.Context
;
import
android.os.Bundle
;
import
android.support.annotation.NonNull
;
import
io.flutter.plugin.common.BasicMessageChannel
;
import
io.flutter.plugin.common.StringCodec
;
import
io.flutter.plugins.GeneratedPluginRegistrant
;
import
io.flutter.view.FlutterMain
;
import
io.flutter.view.FlutterNativeView
;
import
io.flutter.view.FlutterRunArguments
;
import
io.flutter.view.FlutterView
;
/**
* Main entry point for using Flutter in Android applications.
*
* <p><strong>Warning:</strong> This file is auto-generated by Flutter tooling.
* DO NOT EDIT.</p>
*/
public
final
class
Flutter
{
private
Flutter
()
{
// to prevent instantiation
}
/**
* Initiates the Dart VM. Calling this method at an early point may help decreasing time to first
* frame for a subsequently created {@link FlutterView}.
*
* @param applicationContext the application's {@link Context}
*/
public
static
void
startInitialization
(
@NonNull
Context
applicationContext
)
{
FlutterMain
.
startInitialization
(
applicationContext
);
}
/**
* Creates a {@link FlutterFragment} managing a {@link FlutterView}. The optional
* initial route string will be made available to the Dart code
* (via {@code window.defaultRouteName}) and may be used to determine which widget
* should be displayed in the view. The default initialRoute is "/".
*
* @param initialRoute an initial route {@link String}, or null
* @return a {@link FlutterFragment}
*/
@NonNull
public
static
FlutterFragment
createFragment
(
String
initialRoute
)
{
final
FlutterFragment
fragment
=
new
FlutterFragment
();
final
Bundle
args
=
new
Bundle
();
args
.
putString
(
FlutterFragment
.
ARG_ROUTE
,
initialRoute
);
fragment
.
setArguments
(
args
);
return
fragment
;
}
/**
* Creates a {@link FlutterView} linked to the specified {@link Activity} and {@link Lifecycle}.
* The optional initial route string will be made available to the Dart code (via
* {@code window.defaultRouteName}) and may be used to determine which widget should be displayed
* in the view. The default initialRoute is "/".
*
* @param activity an {@link Activity}
* @param lifecycle a {@link Lifecycle}
* @param initialRoute an initial route {@link String}, or null
* @return a {@link FlutterView}
*/
@NonNull
public
static
FlutterView
createView
(
@NonNull
final
Activity
activity
,
@NonNull
final
Lifecycle
lifecycle
,
final
String
initialRoute
)
{
FlutterMain
.
startInitialization
(
activity
.
getApplicationContext
());
FlutterMain
.
ensureInitializationComplete
(
activity
.
getApplicationContext
(),
null
);
final
FlutterNativeView
nativeView
=
new
FlutterNativeView
(
activity
);
final
FlutterView
flutterView
=
new
FlutterView
(
activity
,
null
,
nativeView
)
{
private
final
BasicMessageChannel
<
String
>
lifecycleMessages
=
new
BasicMessageChannel
<>(
this
,
"flutter/lifecycle"
,
StringCodec
.
INSTANCE
);
@Override
public
void
onFirstFrame
()
{
super
.
onFirstFrame
();
setAlpha
(
1.0f
);
}
@Override
public
void
onPostResume
()
{
// Overriding default behavior to avoid dictating system UI via PlatformPlugin.
lifecycleMessages
.
send
(
"AppLifecycleState.resumed"
);
}
};
if
(
initialRoute
!=
null
)
{
flutterView
.
setInitialRoute
(
initialRoute
);
}
lifecycle
.
addObserver
(
new
LifecycleObserver
()
{
@OnLifecycleEvent
(
Lifecycle
.
Event
.
ON_CREATE
)
public
void
onCreate
()
{
final
FlutterRunArguments
arguments
=
new
FlutterRunArguments
();
arguments
.
bundlePath
=
FlutterMain
.
findAppBundlePath
(
activity
.
getApplicationContext
());
arguments
.
entrypoint
=
"main"
;
flutterView
.
runFromBundle
(
arguments
);
GeneratedPluginRegistrant
.
registerWith
(
flutterView
.
getPluginRegistry
());
}
@OnLifecycleEvent
(
Lifecycle
.
Event
.
ON_START
)
public
void
onStart
()
{
flutterView
.
onStart
();
}
@OnLifecycleEvent
(
Lifecycle
.
Event
.
ON_RESUME
)
public
void
onResume
()
{
flutterView
.
onPostResume
();
}
@OnLifecycleEvent
(
Lifecycle
.
Event
.
ON_PAUSE
)
public
void
onPause
()
{
flutterView
.
onPause
();
}
@OnLifecycleEvent
(
Lifecycle
.
Event
.
ON_STOP
)
public
void
onStop
()
{
flutterView
.
onStop
();
}
@OnLifecycleEvent
(
Lifecycle
.
Event
.
ON_DESTROY
)
public
void
onDestroy
()
{
flutterView
.
destroy
();
}
});
flutterView
.
setAlpha
(
0.0f
);
return
flutterView
;
}
}
ydl-platform/src/main/java/com/ydl/ydlcommon/flutter/io/flutter/facade/FlutterFragment.java
deleted
100644 → 0
View file @
0e3e5822
package
com
.
ydl
.
ydlcommon
.
flutter
.
io
.
flutter
.
facade
;
import
android.content.Context
;
import
android.os.Bundle
;
import
android.support.annotation.NonNull
;
import
android.support.v4.app.Fragment
;
import
android.util.AttributeSet
;
import
android.view.LayoutInflater
;
import
android.view.ViewGroup
;
import
io.flutter.view.FlutterView
;
/**
* A {@link Fragment} managing a {@link FlutterView}.
*
* <p><strong>Warning:</strong> This file is auto-generated by Flutter tooling.
* DO NOT EDIT.</p>
*/
public
class
FlutterFragment
extends
Fragment
{
public
static
final
String
ARG_ROUTE
=
"route"
;
private
String
mRoute
=
"/"
;
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
if
(
getArguments
()
!=
null
)
{
mRoute
=
getArguments
().
getString
(
ARG_ROUTE
);
}
}
@Override
public
void
onInflate
(
Context
context
,
AttributeSet
attrs
,
Bundle
savedInstanceState
)
{
super
.
onInflate
(
context
,
attrs
,
savedInstanceState
);
}
@Override
public
FlutterView
onCreateView
(
@NonNull
LayoutInflater
inflater
,
ViewGroup
container
,
Bundle
savedInstanceState
)
{
return
Flutter
.
createView
(
getActivity
(),
getLifecycle
(),
mRoute
);
}
}
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