@Override protected void onStart() { super.onStart(); setActionBarInfo(getString(R.string.scenes_title)); this.getSupportActionBar().setDisplayHomeAsUpEnabled(true); opzioni.initializePrefs(); if (!opzioni.isDbConfigured()) { AlertDialogHelper.dbNotInitedDialog(this); } SoulissDBHelper.open(); // 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(this, scenesArray, opzioni); // Adapter della lista listaScenesView.setAdapter(progsAdapter); listaScenesView.invalidateViews(); // ImageView nodeic = (ImageView) findViewById(R.id.scene_icon); // nodeic.setAlpha(150); mAdapter = new NavDrawerAdapter( SceneListActivity.this, R.layout.drawer_list_item, dmh.getStuff(), DrawerMenuHelper.SCENES); mDrawerList.setAdapter(mAdapter); }
@Override protected void onStart() { super.onStart(); setActionBarInfo(getString(R.string.tag)); opzioni.initializePrefs(); if (!opzioni.isDbConfigured()) { AlertDialogHelper.dbNotInitedDialog(this); } SoulissDBHelper.open(); this.getSupportActionBar().setDisplayHomeAsUpEnabled(true); navAdapter = new NavDrawerAdapter( TagGridActivity.this, R.layout.drawer_list_item, dmh.getStuff(), DrawerMenuHelper.TAGS); mDrawerList.setAdapter(navAdapter); }
@Override protected void onStart() { super.onStart(); setActionBarInfo(getString(R.string.programs_title)); this.getSupportActionBar().setDisplayHomeAsUpEnabled(true); SoulissDBHelper.open(); opzioni.initializePrefs(); if (!opzioni.isDbConfigured()) { AlertDialogHelper.dbNotInitedDialog(this); } if (!opzioni.isDataServiceEnabled()) { AlertDialogHelper.serviceNotActiveDialog(this); } // prendo comandi dal DB, setto adapter LinkedList<SoulissCommand> goer = datasource.getUnexecutedCommands(this); if (goer.size() == 0) tt.setText(getString(R.string.programs_no)); programsArray = new SoulissCommand[goer.size()]; programsArray = goer.toArray(programsArray); progsAdapter = new ProgramListAdapter( this.getApplicationContext(), programsArray, datasource.getTriggerMap(this), opzioni); // Adapter della lista listaProgrammiView.setAdapter(progsAdapter); listaProgrammiView.invalidateViews(); // forza refresh drawer mDrawermAdapter = new NavDrawerAdapter( ProgramListActivity.this, R.layout.drawer_list_item, dmh.getStuff(), DrawerMenuHelper.PROGRAMS); mDrawerList.setAdapter(mDrawermAdapter); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.attachToListView(listaProgrammiView); // ADD NEW PROGRAM Listener fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent myIntentt = new Intent(ProgramListActivity.this, AddProgramActivity.class); ProgramListActivity.this.startActivityForResult(myIntentt, 12); } }); }
@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); } }); }