@@ -292,7 +292,7 @@ public static class BatteryInfo extends InfoBarItem {
292
292
/**
293
293
* This popup is used to show additional signal info.
294
294
*/
295
- private PopupWindow mPopup ;
295
+ protected PopupWindow mPopup ;
296
296
297
297
298
298
private TextView currentView ;
@@ -594,7 +594,7 @@ protected void initItemView(Context context, View parentView, Drone drone) {
594
594
595
595
mExtraInfoBarItems = new InfoBarItem [] { new HomeInfo (context , popupView , drone ),
596
596
new GpsInfo (context , popupView , drone ),
597
- new BatteryInfo (context , popupView , drone ),
597
+ new ExtraBatteryInfo (context , popupView , drone , mItemView ),
598
598
new ExtraFlightTimeInfo (context , popupView , drone , mItemView ),
599
599
new ExtraSignalInfo (context , popupView , drone , mItemView ) };
600
600
@@ -622,6 +622,34 @@ public void updateItemView(final Context context, final Drone drone) {
622
622
}
623
623
}
624
624
625
+ private static class ExtraBatteryInfo extends BatteryInfo {
626
+
627
+ private final View mWindowView ;
628
+
629
+ public ExtraBatteryInfo (Context context , View parentView , Drone drone , View windowView ) {
630
+ super (context , parentView , drone );
631
+ mWindowView = windowView ;
632
+ }
633
+
634
+ @ Override
635
+ protected void initItemView (Context context , final View parentView , Drone drone ){
636
+ super .initItemView (context , parentView , drone );
637
+ if (mItemView == null )
638
+ return ;
639
+
640
+ mItemView .setOnClickListener (new View .OnClickListener () {
641
+ @ Override
642
+ public void onClick (View v ) {
643
+ if (mPopup == null )
644
+ return ;
645
+
646
+ int yLoc = mWindowView .getBottom () + mItemView .getBottom ();
647
+ mPopup .showAtLocation (mWindowView , Gravity .RIGHT | Gravity .TOP , 0 , yLoc );
648
+ }
649
+ });
650
+ }
651
+ }
652
+
625
653
private static class ExtraFlightTimeInfo extends FlightTimeInfo {
626
654
627
655
/**
0 commit comments