Languages

Menu
Sites
Language
Force landscape mode for Gear Fit 2.

Is it possible to run Native app for Gear Fit 2 in landscape mode? It means widht: 432 and height: 208.

I set elm_win_rotation_set(ad->win, 270);

But it doesn't work though.

 

Responses

3 Replies
Armaan-Ul- Islam

Would you try 90 instead of 270?

elm_win_rotation_set(ad->win, 90);

 

If you still can' t launch application on landscape mode, You may need to check is landscape mode supported or not for developers in Gear fit2. May use elm_win_wm_rotation_available_rotations_get() function to know how may angles are supported and what the angles are.

Referenes: https://developer.tizen.org/development/api-references/native-application?redirect=/dev-guide/2.4/org.tizen.native.mobile.apireference/group__Win.html

Slawek Kowalski

Is it possible to set landscape mode in tizne-manifes.xml file? What property should I insert to the file?

 

Armaan-Ul- Islam

For a web application UI, you can change the rotation in 'config.xml'. That would rotate the HTML div, span elements residing in UI. 

 

But when It comes to Native UI formed with Objects/Evas Objects you can't just change rotation that simply. Developer has to design his 'native C code for UI' according to the view he/she is expecting. You would get some Idea how Native developers do that from this document:

Responsive UI in Tizen Native

Code:

evas_object_smart_callback_add(ad->win, "wm,rotation,changed", rotation_cb, ad);

static void
rotation_cb(void *data, Evas_Object *obj, void *event_info)
{
      appdata_s *ad = data;
      int current_degree = elm_win_rotation_get(obj);

    /* Code to load Landscape View */

      if (current_degree != 0 && current_degree != 180) {
            elm_grid_pack_set(ad->labelTitle, 15, 10, 30, 20);
            elm_grid_pack_set(ad->image, 50, 10, 35, 55);
            elm_grid_pack_set(ad->buttonOk, 50, 70, 35, 20);
            elm_grid_pack_set(ad->buttonPrev, 5, 30, 5, 40);
            elm_grid_pack_set(ad->buttonNext, 90, 30, 5, 40);

            evas_object_show(ad->text);

      }

    /* Code to load Portrait View */
        else {
            elm_grid_pack_set(ad->labelTitle, 20, 10, 60, 30);
            elm_grid_pack_set(ad->image, 20, 25, 60, 50);
            elm_grid_pack_set(ad->buttonOk, 20, 80, 60, 10);
            elm_grid_pack_set(ad->buttonPrev, 5, 35, 10, 30);
            elm_grid_pack_set(ad->buttonNext, 85, 35, 10, 30);

            evas_object_hide(ad->text);
      }
}

 

Or even you check how the 'Native Sample apps' handle landscape UI code and portrait UI code. For example, the 'Settings UI' Sample from Sample>Mobile>UI>Settings UI.

 

    elm_win_screen_size_get(parent, NULL, NULL, &w, &h);
    pos = elm_win_rotation_get(parent);

	switch (pos) {
	case 0:
	case 180:
		evas_object_move(obj, 0, h);
		break;
	case 90:
		evas_object_move(obj, 0, w);
		break;
	case 270:
		evas_object_move(obj, h, w);
		break;
	}

 

Similarly, you have to code for Tizen Wearable- 'Landscape UI'       

/*  Skip the Portrait UI, Only Landscape for your Case */