Search in sources :

Example 6 with OpenHABSitemap

use of org.openhab.habdroid.model.OpenHABSitemap in project openhab-android by openhab.

the class Util method parseSitemapList.

public static List<OpenHABSitemap> parseSitemapList(JSONArray jsonArray) {
    List<OpenHABSitemap> sitemapList = new ArrayList<OpenHABSitemap>();
    for (int i = 0; i < jsonArray.length(); i++) {
        try {
            JSONObject sitemapJson = jsonArray.getJSONObject(i);
            OpenHABSitemap openHABSitemap = OpenHABSitemap.fromJson(sitemapJson);
            if (!(openHABSitemap.name().equals("_default") && jsonArray.length() != 1)) {
                sitemapList.add(openHABSitemap);
            }
        } catch (JSONException e) {
            Log.d(TAG, "Error while parsing sitemap", e);
        }
    }
    return sitemapList;
}
Also used : JSONObject(org.json.JSONObject) ArrayList(java.util.ArrayList) JSONException(org.json.JSONException) OpenHABSitemap(org.openhab.habdroid.model.OpenHABSitemap)

Aggregations

OpenHABSitemap (org.openhab.habdroid.model.OpenHABSitemap)6 MenuItem (android.view.MenuItem)2 ArrayList (java.util.ArrayList)2 PendingIntent (android.app.PendingIntent)1 Intent (android.content.Intent)1 SharedPreferences (android.content.SharedPreferences)1 RecognizerIntent (android.speech.RecognizerIntent)1 NavigationView (android.support.design.widget.NavigationView)1 DrawerLayout (android.support.v4.widget.DrawerLayout)1 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)1 RecyclerView (android.support.v7.widget.RecyclerView)1 SubMenu (android.view.SubMenu)1 View (android.view.View)1 Call (okhttp3.Call)1 Headers (okhttp3.Headers)1 JSONException (org.json.JSONException)1 JSONObject (org.json.JSONObject)1 NodeList (org.w3c.dom.NodeList)1