@Override public void onClick(View view) { switch (counter) { case 0: showcaseView.setShowcase(new ViewTarget(findViewById(R.id.bNewSession)), false); showcaseView.setContentTitle("Create Sessions"); showcaseView.setContentText("Click here to Create new Session."); showcaseView.setButtonText("GOT IT"); break; case 1: showcaseView.hide(); break; } counter++; }
/** Set the descriptive text shown on the ShowcaseView. */ public Builder setContentText(CharSequence text) { showcaseView.setContentText(text); return this; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sessions_activity); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); try { final ActionBar ab = getSupportActionBar(); getSupportActionBar().setDisplayHomeAsUpEnabled(true); ab.setTitle("Sessions"); } catch (Exception ex) { } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(getResources().getColor(R.color.colorPrimaryDark)); } RecyclerView recyclerView = (RecyclerView) findViewById(R.id.lvSessions); recyclerView.setLayoutManager(new LinearLayoutManager(this)); ArrayList<Session> sessionsList = SessionsUtil.getSessionList(); if (sessionsList.size() != 0) { Session session = new Session(); session.setSessionName("---sep---"); session.setLastUsed(0); sessionsList.add(session); findViewById(R.id.tvNoSessions).setVisibility(View.GONE); findViewById(R.id.lvSessions).setVisibility(View.VISIBLE); } else { findViewById(R.id.tvNoSessions).setVisibility(View.VISIBLE); findViewById(R.id.lvSessions).setVisibility(View.GONE); } sessionListAdapter = new RecyclerViewAdapter(getBaseContext(), sessionsList, SessionsListActivity.this); recyclerView.setAdapter(sessionListAdapter); findViewById(R.id.bNewSession) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(SessionsListActivity.this, CreateSessionActivity.class)); finish(); overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right); } }); showcaseView = new ShowcaseView.Builder(this) .withMaterialShowcase() .setTarget(Target.NONE) .singleShot(10921) .setOnClickListener(this) .setStyle(R.style.CustomShowcaseTheme) .build(); showcaseView.setContentTitle("Sessions"); showcaseView.setContentText( "Click on a session to see\n" + "TODO and mastered words.\n\n" + "Click on the start button to Start Session\n\n" + "Swipe left to see more options."); showcaseView.setButtonText("Next"); // AttributeSet attr = apiUtils. RelativeLayout.LayoutParams mLayoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); mLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); mLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT); // mLayoutParams.setMargins(50, 0, 0, 200); int margin = ((Number) (getResources().getDisplayMetrics().density * 12)).intValue(); mLayoutParams.setMargins(margin, margin, margin, margin); showcaseView.setButtonPosition(mLayoutParams); }