@@ -31,7 +31,7 @@ const val TAG = "AndroidTracker"
3131internal fun Activity.getTrackName (): String {
3232 var name: String? = null
3333 if (this is ITrackerHelper ) {
34- name = this .getTrackName()
34+ name = this .getTrackName(Tracker .trackContext.getApplicationContext() )
3535 }
3636 if (name.isNullOrEmpty()) {
3737 name = this .javaClass.canonicalName
@@ -48,7 +48,7 @@ internal fun Activity.getTrackName(): String {
4848internal fun Fragment.getTrackName (): String {
4949 var name: String? = null
5050 if (this is ITrackerHelper ) {
51- name = this .getTrackName()
51+ name = this .getTrackName(Tracker .trackContext.getApplicationContext() )
5252 }
5353 if (name.isNullOrEmpty()) {
5454 name = this .javaClass.canonicalName
@@ -69,9 +69,9 @@ internal fun Fragment.getTrackTitle(): String = activity?.getTrackTitle() ?: ""
6969internal fun Activity.getTrackProperties (): Map <String , Any > {
7070 val properties = HashMap <String , Any >()
7171 if (this is ITrackerHelper ) {
72- this .getTrackProperties()?.let {
72+ this .getTrackProperties(Tracker .trackContext.getApplicationContext() )?.let {
7373 it.filter { it.value != null }.forEach {
74- properties.put( it.key, it.value!! )
74+ properties[ it.key] = it.value!!
7575 }
7676 }
7777 }
@@ -84,9 +84,9 @@ internal fun Activity.getTrackProperties(): Map<String, Any> {
8484internal fun Fragment.getTrackProperties (): Map <String , Any > {
8585 val properties = HashMap <String , Any >()
8686 if (this is ITrackerHelper ) {
87- this .getTrackProperties()?.let {
87+ this .getTrackProperties(Tracker .trackContext.getApplicationContext() )?.let {
8888 it.filter { it.value != null }.forEach {
89- properties.put( it.key, it.value!! )
89+ properties[ it.key] = it.value!!
9090 }
9191 }
9292 }
@@ -96,9 +96,9 @@ internal fun Fragment.getTrackProperties(): Map<String, Any> {
9696internal fun View.getTrackProperties (ev : MotionEvent ? ): Map <String , Any > {
9797 // 首先获取元素本身的属性
9898 val properties = HashMap <String , Any >()
99- properties.put( ELEMENT_TYPE , this .javaClass.name)
99+ properties[ ELEMENT_TYPE ] = this .javaClass.name
100100 if (this is TextView ) {
101- properties.put( ELEMENT_CONTENT , this .text?.toString() ? : " " )
101+ properties[ ELEMENT_CONTENT ] = this .text?.toString() ? : " "
102102 }
103103 /* ev?.let {
104104 properties.put(ELEMENT_X, ev.x)
@@ -108,7 +108,7 @@ internal fun View.getTrackProperties(ev: MotionEvent?): Map<String, Any> {
108108 // 然后获取开发者附加的属性
109109 val additionalProperties = Tracker .elementsProperties[this ]
110110 additionalProperties?.filter { it.value != null }?.forEach {
111- properties.put( it.key, it.value!! )
111+ properties[ it.key] = it.value!!
112112 }
113113 Tracker .elementsProperties.remove(this )
114114 return properties
0 commit comments