@Override
  protected void onCreate(Bundle savedInstanceState) {
    opzioni = SoulissApp.getOpzioni();

    db = new SoulissDBTagHelper(this);
    if (opzioni.isLightThemeSelected()) setTheme(R.style.LightThemeSelector);
    else setTheme(R.style.DarkThemeSelector);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_tag_detail);

    Bundle extras = getIntent().getExtras();
    if (extras != null && extras.get("TAG") != null) tagId = (long) extras.get("TAG");

    try {
      collected = db.getTag((int) tagId);
    } catch (SQLDataException sql) {
      Log.i(Constants.TAG, "TAGID NOT FOUND: " + tagId);
    }

    if (savedInstanceState == null) {
      FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
      fragment = new TagDetailFragment();
      transaction.replace(R.id.detailPane, fragment);
      transaction.commit();
    }
    /* try {
        setEnterSharedElementCallback(new SharedElementCallback() {
            @Override
            public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) {
                Log.i(Constants.TAG, "EnterSharedElement.onMapSharedElements:" + sharedElements.size());
                //manual override perche il fragment ancora non c'e
                //sharedElements.put("photo_hero", fragment.getView().findViewById(R.id.photo));
                //  sharedElements.put("shadow_hero", fragment.getView().findViewById(R.id.infoAlpha));
                // sharedElements.put("tag_icon", fragment.getView().findViewById(R.id.imageTagIcon));
                super.onMapSharedElements(names, sharedElements);
            }

            @Override
            public void onRejectSharedElements(List<View> rejectedSharedElements) {
                Log.i(Constants.TAG, "EnterSharedElement.onMapSharedElements:" + rejectedSharedElements.size());
                super.onRejectSharedElements(rejectedSharedElements);
            }

        });
    } catch (Exception uie) {
        Log.e(Constants.TAG, "UIE:" + uie.getMessage());
    }*/
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    opzioni = SoulissApp.getOpzioni();
    getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
    if (opzioni.isLightThemeSelected()) setTheme(R.style.LightThemeSelector);
    else setTheme(R.style.DarkThemeSelector);
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main_programs);
    setTitle(getString(R.string.app_name) + " - " + getString(R.string.programs_title));
    tt = (TextView) findViewById(R.id.TextViewTypicals);

    listaProgrammiView = (ListView) findViewById(R.id.ListViewListaProgs);
    SoulissApp.setBackground(findViewById(R.id.containerlistaProgrammi), getWindowManager());

    // check se IP non settato
    if (!opzioni.isSoulissIpConfigured() && !opzioni.isSoulissReachable()) {
      AlertDialog.Builder alert = AlertDialogHelper.sysNotInitedDialog(this);
      alert.show();
    }
    datasource = new SoulissDBHelper(this);

    super.initDrawer(this, DrawerMenuHelper.PROGRAMS);

    listaProgrammiView.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            Log.w(TAG, "Activating SCENE " + arg2);
            Intent nodeDatail = new Intent(ProgramListActivity.this, AddProgramActivity.class);
            nodeDatail.putExtra("PROG", programsArray[arg2]);
            ProgramListActivity.this.startActivity(nodeDatail);
            if (opzioni.isAnimationsEnabled())
              overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
          }
        });

    registerForContextMenu(listaProgrammiView);

    SoulissApp.setBackground(findViewById(R.id.containerlistaScenes), getWindowManager());
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    opzioni = SoulissClient.getOpzioni();
    // Remove title bar
    // this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    if (opzioni.isLightThemeSelected()) setTheme(R.style.LightThemeSelector);
    else setTheme(R.style.DarkThemeSelector);
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main_scenes);
    // final Button buttAddProgram = (Button)
    // findViewById(R.id.buttonAddScene);
    // tt = (TextView) findViewById(R.id.TextViewScenes);
    /*
     * if ("def".compareToIgnoreCase(opzioni.getPrefFont()) != 0) { Typeface
     * font = Typeface.createFromAsset(getAssets(), opzioni.getPrefFont());
     * tt.setTypeface(font, Typeface.NORMAL); }
     */
    // ParallaxListView listView2 = (ParallaxListView) findViewById(R.id.paraList);

    listaScenesView = (ListView) findViewById(R.id.ListViewListaScenes);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.attachToListView(listaScenesView);
    SoulissClient.setBackground(findViewById(R.id.containerlistaScenes), getWindowManager());

    // ADD NEW SCENE
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            int rest = datasource.createOrUpdateScene(null);
            // prendo comandi dal DB, setto adapter
            LinkedList<SoulissScene> goer = datasource.getScenes(SoulissClient.getAppContext());
            // scenesArray = new SoulissScene[goer.size()];
            scenesArray = goer.toArray(scenesArray);
            progsAdapter = new SceneListAdapter(SceneListActivity.this, scenesArray, opzioni);
            // Adapter della lista
            // SceneListAdapter t = listaScenesView.getAdapter();
            progsAdapter.setScenes(scenesArray);
            progsAdapter.notifyDataSetChanged();
            listaScenesView.setAdapter(progsAdapter);
            listaScenesView.invalidateViews();
            Toast.makeText(
                    SceneListActivity.this,
                    "Scene " + rest + " inserted, long-press to rename it and choose icon",
                    Toast.LENGTH_LONG)
                .show();
          }
        });
    // check se IP non settato
    if (!opzioni.isSoulissIpConfigured() && !opzioni.isSoulissReachable()) {
      AlertDialog.Builder alert = AlertDialogHelper.sysNotInitedDialog(this);
      alert.show();
    }

    // TODO error management
    datasource = new SoulissDBHelper(this);
    // datasource.open();

    // DRAWER
    super.initDrawer(this, DrawerMenuHelper.SCENES);

    listaScenesView.setOnItemClickListener(
        new OnItemClickListener() {
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            Log.w(TAG, "Activating SCENE " + arg2);
            Intent nodeDatail = new Intent(SceneListActivity.this, SceneDetailActivity.class);
            SceneViewHolder holder = (SceneViewHolder) arg1.getTag();
            nodeDatail.putExtra("SCENA", holder.data);
            SceneListActivity.this.startActivity(nodeDatail);
            if (opzioni.isAnimationsEnabled())
              overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
          }
        });

    registerForContextMenu(listaScenesView);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    opzioni = SoulissApp.getOpzioni();
    // Remove title bar
    // this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    if (opzioni.isLightThemeSelected()) setTheme(R.style.LightThemeSelector);
    else setTheme(R.style.DarkThemeSelector);
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main_tags_grid);
    // final Button buttAddProgram = (Button)
    // findViewById(R.id.buttonAddScene);
    // tt = (TextView) findViewById(R.id.TextViewScenes);
    /*
     * if ("def".compareToIgnoreCase(opzioni.getPrefFont()) != 0) { Typeface
     * font = Typeface.createFromAsset(getAssets(), opzioni.getPrefFont());
     * tt.setTypeface(font, Typeface.NORMAL); }
     */

    mRecyclerView = (ContextMenuRecyclerView) findViewById(R.id.recyclerViewTags);

    // 3 colonne in horiz
    gridManager =
        new GridLayoutManager(
            this,
            getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
                ? 3
                : 2);
    mRecyclerView.setLayoutManager(gridManager);
    mRecyclerView.setItemAnimator(new DefaultItemAnimator()); // FIXME
    // Floatin Button
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.attachToRecyclerView(mRecyclerView);

    // ADD NEW SCENE
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            // LinkedList perche asList torna array non ridimensionabile
            List<SoulissTag> goerBck = new LinkedList<>(Arrays.asList(tagAdapter.getTagArray()));

            long rest = datasource.createOrUpdateTag(null);
            // prendo comandi dal DB, setto adapter
            List<SoulissTag> goer = datasource.getTags(SoulissApp.getAppContext());
            goer.removeAll(goerBck);
            Assert.assertTrue(goer.size() == 1);
            SoulissTag newTag = goer.get(0); // quello nuovo
            goerBck.add(Constants.TAG_INSERT_POINT, newTag);

            // goer.removeAll(goerBck);
            tags = new SoulissTag[goerBck.size()];
            tags = goerBck.toArray(tags);
            // tagAdapter = new TagListAdapter(TagGridActivity.this, tags, opzioni);
            // Adapter della lista
            // SceneListAdapter t = listaTagsView.getAdapter();
            tagAdapter.setTagArray(tags);

            tagAdapter.notifyItemInserted(Constants.TAG_INSERT_POINT);
            Handler handler = new Handler();
            handler.postDelayed(
                new Runnable() {
                  // fai finire l'animazione
                  public void run() {
                    // force rebind of click listeners
                    tagAdapter.notifyDataSetChanged();
                  }
                },
                500); // msec

            // listaTagsView.invalidateViews();
            Toast.makeText(
                    TagGridActivity.this,
                    getString(R.string.tag)
                        + rest
                        + " inserted, long-press to rename it and choose icon",
                    Toast.LENGTH_LONG)
                .show();
          }
        });
    // check se IP non settato
    if (!opzioni.isSoulissIpConfigured() && !opzioni.isSoulissReachable()) {
      AlertDialog.Builder alert = AlertDialogHelper.sysNotInitedDialog(this);
      alert.show();
    }

    datasource = new SoulissDBTagHelper(this);
    SoulissDBHelper.open();
    // prendo comandi dal DB, setto adapter
    List<SoulissTag> goer = datasource.getTags(SoulissApp.getAppContext());
    tags = new SoulissTag[goer.size()];
    tags = goer.toArray(tags);
    tagAdapter = new TagRecyclerAdapter(this, tags, opzioni);
    // Adapter della lista
    mRecyclerView.setAdapter(tagAdapter);

    // DRAWER
    super.initDrawer(this, DrawerMenuHelper.TAGS);

    registerForContextMenu(mRecyclerView);

    // TODEBUG TRANSACTIONS
    setExitSharedElementCallback(
        new SharedElementCallback() {
          @Override
          public void onSharedElementStart(
              List<String> sharedElementNames,
              List<View> sharedElements,
              List<View> sharedElementSnapshots) {
            Log.d(
                Constants.TAG,
                "ExitSharedElementCallback.onSharedElementStart:" + sharedElementNames.size());
            super.onSharedElementStart(sharedElementNames, sharedElements, sharedElementSnapshots);
          }

          @Override
          public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) {
            Log.d(Constants.TAG, "ExitSharedElementCallback.onMapSharedElements:" + names.get(0));
            super.onMapSharedElements(names, sharedElements);
          }

          @TargetApi(Build.VERSION_CODES.LOLLIPOP)
          @Override
          public void onRejectSharedElements(List<View> rejectedSharedElements) {
            Log.d(
                Constants.TAG,
                "ExitSharedElementCallback.onRejectSharedElements:"
                    + rejectedSharedElements.size());

            super.onRejectSharedElements(rejectedSharedElements);
          }

          @Override
          public void onSharedElementEnd(
              List<String> sharedElementNames,
              List<View> sharedElements,
              List<View> sharedElementSnapshots) {
            Log.i(Constants.TAG, "ExitSharedElementCallback.onSharedElementEnd");
            super.onSharedElementEnd(sharedElementNames, sharedElements, sharedElementSnapshots);
          }
        });
  }