Search in sources :

Example 6 with ToolTip

use of tourguide.tourguide.ToolTip 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);
        }
    });
}
Also used : ToolTip(tourguide.tourguide.ToolTip) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) Pointer(tourguide.tourguide.Pointer) Overlay(tourguide.tourguide.Overlay) TextView(android.widget.TextView) View(android.view.View) ViewTreeObserver(android.view.ViewTreeObserver) Toolbar(android.support.v7.widget.Toolbar)

Example 7 with ToolTip

use of tourguide.tourguide.ToolTip 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();
        }
    });
}
Also used : ToolTip(tourguide.tourguide.ToolTip) Button(android.widget.Button) Pointer(tourguide.tourguide.Pointer) Overlay(tourguide.tourguide.Overlay) View(android.view.View)

Example 8 with ToolTip

use of tourguide.tourguide.ToolTip 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();
        }
    });
}
Also used : ToolTip(tourguide.tourguide.ToolTip) Button(android.widget.Button) BounceInterpolator(android.view.animation.BounceInterpolator) TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) TranslateAnimation(android.view.animation.TranslateAnimation) Pointer(tourguide.tourguide.Pointer) Overlay(tourguide.tourguide.Overlay) View(android.view.View)

Example 9 with ToolTip

use of tourguide.tourguide.ToolTip 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;
}
Also used : ToolTip(tourguide.tourguide.ToolTip) MenuItem(android.view.MenuItem) Pointer(tourguide.tourguide.Pointer) ImageView(android.widget.ImageView) Overlay(tourguide.tourguide.Overlay) ImageView(android.widget.ImageView) View(android.view.View)

Example 10 with ToolTip

use of tourguide.tourguide.ToolTip 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);
        }
    });
}
Also used : ToolTip(tourguide.tourguide.ToolTip) Button(android.widget.Button) Overlay(tourguide.tourguide.Overlay) View(android.view.View)

Aggregations

ToolTip (tourguide.tourguide.ToolTip)19 View (android.view.View)18 Overlay (tourguide.tourguide.Overlay)17 Pointer (tourguide.tourguide.Pointer)14 Button (android.widget.Button)12 ChainTourGuide (tourguide.tourguide.ChainTourGuide)4 Intent (android.content.Intent)3 Sequence (tourguide.tourguide.Sequence)3 Animation (android.view.animation.Animation)2 TextInputLayout (android.support.design.widget.TextInputLayout)1 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)1 Toolbar (android.support.v7.widget.Toolbar)1 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1 MenuItem (android.view.MenuItem)1 ViewTreeObserver (android.view.ViewTreeObserver)1 AlphaAnimation (android.view.animation.AlphaAnimation)1 BounceInterpolator (android.view.animation.BounceInterpolator)1 TranslateAnimation (android.view.animation.TranslateAnimation)1 EditText (android.widget.EditText)1