File tree Expand file tree Collapse file tree
activitytaskview/src/main/java/cc/rome753/activitytask Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,12 +111,14 @@ public void handleMessage(Message msg) {
111111 }
112112 }
113113 } else {
114- if (info .lifecycle .contains ("Create" )) {
115- activityTaskView .add (info );
116- } else if (info .lifecycle .contains ("Destroy" )) {
117- activityTaskView .remove (info );
118- } else {
119- activityTaskView .update (info );
114+ if (activityTaskView != null ) {
115+ if (info .lifecycle .contains ("Create" )) {
116+ activityTaskView .add (info );
117+ } else if (info .lifecycle .contains ("Destroy" )) {
118+ activityTaskView .remove (info );
119+ } else {
120+ activityTaskView .update (info );
121+ }
120122 }
121123 }
122124 }
Original file line number Diff line number Diff line change @@ -35,8 +35,15 @@ public ObserverTextView getOne(Context context) {
3535 view = new ObserverTextView (context );
3636 } else {
3737 view = pool .remove ();
38+ removeParent (view );
3839 }
3940 return view ;
4041 }
4142
43+ private void removeParent (View view ) {
44+ if (view != null && view .getParent () instanceof ViewGroup ) {
45+ ((ViewGroup ) view .getParent ()).removeView (view );
46+ }
47+ }
48+
4249}
Original file line number Diff line number Diff line change @@ -111,13 +111,8 @@ private void moveToBorder() {
111111
112112 if (p .x <= (mScreenWidth - getWidth ()) / 2 ) { // move left
113113 p .x = 0 ;
114- removeView (mTinyView );
115- addView (mTinyView , 0 );
116-
117114 } else { // move right
118115 p .x = mScreenWidth ;
119- removeView (mTinyView );
120- addView (mTinyView );
121116 }
122117 updateLayout (p );
123118 }
You can’t perform that action at this time.
0 commit comments