The patch resolves jira TIZENIOT-1949 music closes on swiping minicontroller 74/245074/1
authorJagrat Patidar <j1.patidar@samsung.com>
Wed, 30 Sep 2020 13:04:14 +0000 (18:34 +0530)
committerJagrat Patidar <j1.patidar@samsung.com>
Wed, 30 Sep 2020 13:04:49 +0000 (18:34 +0530)
Change-Id: I6ff8af0df4eaacc8c14497f3622c1f04570d7d00

src/widget/mp-minicontroller.c

index a1a73a25f0d5ab2f9a929bc01e8f7e9d012a88fc..93a48bc0c222a9f18974bee2357a8e2ddd1f1e4e 100755 (executable)
@@ -391,6 +391,33 @@ static Evas_Object *_load_edj(Evas_Object * parent, const char *file,
        return eo;
 }
 
+static void
+_minicontroller_close_music()
+{
+       struct appdata *ad = mp_util_get_appdata();
+       MP_CHECK(ad);
+       MP_TIMER_FREEZE(ad->timer);
+       DEBUG_TRACE("CLOSE");
+       if (!mp_util_is_other_player_playing()) {
+               int ret_set = 0;
+               ret_set = preference_set_int(PREF_MUSIC_STATE, PREF_MUSIC_OFF);
+               if (ret_set) {
+                       ERROR_TRACE("set preference failed");
+               }
+       }
+       mp_play_control_reset_ff_rew();
+       xD = 0;
+       yD = 0;
+       xDMove = 0;
+       yDMove = 0;
+       xU = 0;
+       yU = 0;
+       ad->is_sdcard_removed = false;
+       if (!hide_from_mp) {
+               elm_exit();
+       }
+}
+
 static void _quick_panel_cb(minicontrol_viewer_event_e event_type,
                                                        bundle * event_arg)
 {
@@ -398,32 +425,13 @@ static void _quick_panel_cb(minicontrol_viewer_event_e event_type,
        struct appdata *ad = mp_util_get_appdata();
        MP_CHECK(ad);
        _mp_minicontroller_update_btn(ad);
+
        minicontrol_viewer_event_e event_hide =
                (minicontrol_viewer_event_e) MINICONTROL_EVENT_REQUEST_HIDE;
        if (event_type == event_hide) {
-               MP_TIMER_FREEZE(ad->timer);
-               DEBUG_TRACE("CLOSE");
-               if (!mp_util_is_other_player_playing()) {
-                       int ret_set = 0;
-                       ret_set = preference_set_int(PREF_MUSIC_STATE, PREF_MUSIC_OFF);
-                       if (ret_set) {
-                               ERROR_TRACE("set preference failed");
-                       }
-               }
-               mp_play_control_reset_ff_rew();
-               xD = 0;
-               yD = 0;
-               xDMove = 0;
-               yDMove = 0;
-               xU = 0;
-               yU = 0;
-               ad->is_sdcard_removed = false;
-               if (!hide_from_mp) {
-                       elm_exit();
-               }
+               _minicontroller_close_music();
        }
-       if (event_type ==
-               (minicontrol_viewer_event_e) MINICONTROL_VIEWER_EVENT_REPORT_ANGLE) {
+       if (event_type == (minicontrol_viewer_event_e) MINICONTROL_VIEWER_EVENT_REPORT_ANGLE) {
                char *value = NULL;
                int angle = 0;
                bundle_get_str(event_arg, "angle", &value);
@@ -431,6 +439,10 @@ static void _quick_panel_cb(minicontrol_viewer_event_e event_type,
                        angle = atoi(value);
                        DEBUG_TRACE("Angle is : %d", angle);
                }
+               if (!event_arg) {
+                       /* Closing music-player when minicontroller is swiped in quickpanel */
+                       _minicontroller_close_music();
+               }
                mp_minicontroller_rotate(ad, angle);
        }
        hide_from_mp = false;