use of com.github.amlcurran.showcaseview.targets.ViewTarget in project ShowcaseView by amlcurran.
the class CustomShowcaseActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_custom_showcase);
new ShowcaseView.Builder(this).setTarget(new ViewTarget(R.id.imageView, this)).setContentTitle(R.string.custom_text_painting_title).setContentText(R.string.custom_text_painting_text).setShowcaseDrawer(new CustomShowcaseView(getResources())).build();
}
use of com.github.amlcurran.showcaseview.targets.ViewTarget in project ShowcaseView by amlcurran.
the class EventsActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_events);
TextView eventLog = (TextView) findViewById(R.id.events_log);
Button customButton = (Button) getLayoutInflater().inflate(R.layout.view_custom_button, null);
MultiEventListener multiEventListener = new MultiEventListener(new LogToTextListener(eventLog), new ShakeButtonListener(customButton));
new ShowcaseView.Builder(this).withMaterialShowcase().setStyle(R.style.CustomShowcaseTheme3).setTarget(new ViewTarget(R.id.imageView, this)).setContentTitle("Events").setContentText("Listening to ShowcaseView events is easy!").setShowcaseEventListener(multiEventListener).replaceEndButton(customButton).build();
}
use of com.github.amlcurran.showcaseview.targets.ViewTarget in project ShowcaseView by amlcurran.
the class MainActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
HardcodedListAdapter adapter = new HardcodedListAdapter(this);
listView = (ListView) findViewById(R.id.listView);
listView.setAdapter(adapter);
listView.setOnItemClickListener(this);
buttonBlocked = (Button) findViewById(R.id.buttonBlocked);
buttonBlocked.setOnClickListener(this);
RelativeLayout.LayoutParams lps = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
lps.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
lps.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
int margin = ((Number) (getResources().getDisplayMetrics().density * 12)).intValue();
lps.setMargins(margin, margin, margin, margin);
ViewTarget target = new ViewTarget(R.id.buttonBlocked, this);
sv = new ShowcaseView.Builder(this).withMaterialShowcase().setTarget(target).setContentTitle(R.string.showcase_main_title).setContentText(R.string.showcase_main_message).setStyle(R.style.CustomShowcaseTheme2).setShowcaseEventListener(this).replaceEndButton(R.layout.view_custom_button).build();
sv.setButtonPosition(lps);
}
use of com.github.amlcurran.showcaseview.targets.ViewTarget in project ShowcaseView by amlcurran.
the class SingleShotActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_single_shot);
Target viewTarget = new ViewTarget(R.id.button, this);
new ShowcaseView.Builder(this).setTarget(viewTarget).setContentTitle(R.string.title_single_shot).setContentText(R.string.R_string_desc_single_shot).singleShot(42).build();
}
use of com.github.amlcurran.showcaseview.targets.ViewTarget in project ShowcaseView by amlcurran.
the class ViewTargets method navigationButtonViewTarget.
/**
* Highlight the navigation button (the Up or Navigation drawer button) in a Toolbar
* @param toolbar The toolbar to search for the view in
* @return the {@link ViewTarget} to supply to a {@link com.github.amlcurran.showcaseview.ShowcaseView}
* @throws MissingViewException when the view couldn't be found. Raise an issue on Github if you get this!
*/
public static ViewTarget navigationButtonViewTarget(Toolbar toolbar) throws MissingViewException {
try {
Field field = Toolbar.class.getDeclaredField("mNavButtonView");
field.setAccessible(true);
View navigationView = (View) field.get(toolbar);
return new ViewTarget(navigationView);
} catch (NoSuchFieldException e) {
throw new MissingViewException(e);
} catch (IllegalAccessException e) {
throw new MissingViewException(e);
}
}
Aggregations