use of tourguide.tourguide.Overlay in project TourGuide by worker8.
the class NavDrawerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mActivity = this;
setContentView(R.layout.activity_nav_drawer);
/* get views from xml */
mTextView1 = (TextView) findViewById(R.id.item1);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
/* setup toolbar */
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
toolbar.setTitle("Nav Drawer Example");
mTutorialHandler = TourGuide.init(mActivity).with(TourGuide.Technique.CLICK).setPointer(new Pointer()).setToolTip(new ToolTip().setTitle(null).setDescription("hello world")).setOverlay(new Overlay().setBackgroundColor(Color.parseColor("#66FF0000")));
final ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.drawer_open_string, R.string.drawer_close_string) {
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
/* We need call playOn only after the drawer is opened,
so that TourGuide knows the updated location of the targetted view */
mTutorialHandler.playOn(mTextView1);
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
mDrawerToggle.syncState();
/* setup clean up code */
mTextView1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mTutorialHandler.cleanUp();
mDrawerLayout.closeDrawers();
}
});
final ViewTreeObserver viewTreeObserver = mTextView1.getViewTreeObserver();
viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// make sure this only run once
mTextView1.getViewTreeObserver().removeGlobalOnLayoutListener(this);
mDrawerLayout.openDrawer(Gravity.LEFT);
}
});
}
use of tourguide.tourguide.Overlay in project TourGuide by worker8.
the class RoundedRectangleOverlayActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mActivity = this;
setContentView(R.layout.activity_overlay_customization);
final Button button = (Button) findViewById(R.id.button);
Button next_button = (Button) findViewById(R.id.next_button);
ToolTip toolTip = new ToolTip().setTitle("Hello!").setDescription("Click to view tutorial. Next button is disabled until tutorial is viewed");
Overlay overlay = new Overlay().setBackgroundColor(Color.parseColor("#AAFF0000")).disableClick(false).disableClickThroughHole(false).setStyle(Overlay.Style.ROUNDED_RECTANGLE).setRoundedCornerRadius(8).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mTutorialHandler.cleanUp();
}
});
// the return handler is used to manipulate the cleanup of all the tutorial elements
mTutorialHandler = TourGuide.init(this).with(TourGuide.Technique.CLICK).setPointer(new Pointer()).setToolTip(toolTip).setOverlay(overlay).playOn(button);
next_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(mActivity, "BOOM!", Toast.LENGTH_LONG).show();
}
});
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mTutorialHandler.cleanUp();
}
});
}
use of tourguide.tourguide.Overlay in project TourGuide by worker8.
the class ToolTipCustomizationActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mActivity = this;
setContentView(R.layout.activity_customization);
Button button = (Button) findViewById(R.id.button);
Animation animation = new TranslateAnimation(0f, 0f, 200f, 0f);
animation.setDuration(1000);
animation.setFillAfter(true);
animation.setInterpolator(new BounceInterpolator());
ToolTip toolTip = new ToolTip().setTitle("Next Button").setDescription("Click on Next button to proceed...").setTextColor(Color.parseColor("#bdc3c7")).setBackgroundColor(Color.parseColor("#e74c3c")).setShadow(true).setGravity(Gravity.TOP | Gravity.LEFT).setEnterAnimation(animation);
mTutorialHandler = TourGuide.init(this).with(TourGuide.Technique.CLICK).setToolTip(toolTip).setOverlay(new Overlay()).setPointer(new Pointer()).playOn(button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mTutorialHandler.cleanUp();
}
});
}
use of tourguide.tourguide.Overlay in project TourGuide by worker8.
the class ToolbarActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu;
getMenuInflater().inflate(R.menu.menu_demo_main, menu);
// We need to get the menu item as a View in order to work with TourGuide
MenuItem menuItem = menu.getItem(0);
ImageView button = (ImageView) menuItem.getActionView();
// just adding some padding to look better
float density = mActivity.getResources().getDisplayMetrics().density;
int padding = (int) (5 * density);
button.setPadding(padding, padding, padding, padding);
// set an image
button.setImageDrawable(mActivity.getResources().getDrawable(android.R.drawable.ic_dialog_email));
ToolTip toolTip = new ToolTip().setTitle("Welcome!").setDescription("Click on Get Started to begin...").setGravity(Gravity.LEFT | Gravity.BOTTOM);
mTutorialHandler = TourGuide.init(this).with(TourGuide.Technique.CLICK).motionType(TourGuide.MotionType.CLICK_ONLY).setPointer(new Pointer()).setToolTip(toolTip).setOverlay(new Overlay()).playOn(button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mTutorialHandler.cleanUp();
}
});
return true;
}
use of tourguide.tourguide.Overlay in project TourGuide by worker8.
the class NoPointerActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
/* Get parameters from main activity */
super.onCreate(savedInstanceState);
mActivity = this;
setContentView(R.layout.activity_basic);
final Button button1 = (Button) findViewById(R.id.button1);
final Button button2 = (Button) findViewById(R.id.button2);
button1.setText("Purchase");
ToolTip toolTip = new ToolTip().setTitle("Expensive Item").setDescription("Click 'purchase' only when you are ready\nClick on the OVERLAY to dismiss");
Overlay overlay = new Overlay().disableClickThroughHole(true).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mTourGuideHandler.cleanUp();
}
});
// the return handler is used to manipulate the cleanup of all the tutorial elements
mTourGuideHandler = TourGuide.init(this).with(TourGuide.Technique.CLICK).setPointer(// set pointer to null
null).setToolTip(toolTip).setOverlay(overlay).playOn(button1);
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mTourGuideHandler.playOn(button1);
}
});
}
Aggregations