Search in sources :

Example 1 with Pointer

use of tourguide.tourguide.Pointer in project TourGuide by worker8.

the class SequenceTestActivity method runOverlayContinueMethod.

private void runOverlayContinueMethod() {
    // the return handler is used to manipulate the cleanup of all the tutorial elements
    ChainTourGuide mTG1 = ChainTourGuide.init(this).setToolTip(new ToolTip().setTitle("Hey!").setDescription("I'm the top fellow").setGravity(Gravity.RIGHT)).playLater(button);
    ChainTourGuide mTG2 = ChainTourGuide.init(this).setToolTip(new ToolTip().setTitle("Hey!").setDescription("Just the middle man").setGravity(Gravity.BOTTOM | Gravity.LEFT)).setOverlay(new Overlay().setEnterAnimation(enterAnimation).setExitAnimation(exitAnimation).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Toast.makeText(SequenceTestActivity.this, "Bello! This is the default Overlay", Toast.LENGTH_SHORT).show();
            mTutorialHandler.next();
        }
    })).playLater(button2);
    ChainTourGuide mTG3 = ChainTourGuide.init(this).setToolTip(new ToolTip().setTitle("Hey!").setDescription("It's time to say goodbye").setGravity(Gravity.TOP | Gravity.RIGHT)).playLater(button3);
    mSequence = new Sequence.SequenceBuilder().add(mTG1, mTG2, mTG3).setDefaultOverlay(new Overlay().setEnterAnimation(enterAnimation).setExitAnimation(exitAnimation).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Toast.makeText(SequenceTestActivity.this, "Bello! This is the default Overlay", Toast.LENGTH_SHORT).show();
            mTutorialHandler.next();
        }
    })).setDefaultPointer(new Pointer()).setContinueMethod(Sequence.ContinueMethod.OVERLAY).build();
    mTutorialHandler = ChainTourGuide.init(this).playInSequence(mSequence);
}
Also used : ToolTip(tourguide.tourguide.ToolTip) ChainTourGuide(tourguide.tourguide.ChainTourGuide) Pointer(tourguide.tourguide.Pointer) Overlay(tourguide.tourguide.Overlay) View(android.view.View)

Example 2 with Pointer

use of tourguide.tourguide.Pointer in project TourGuide by worker8.

the class SequenceTestActivity method runOverlayListenerContinueMethod.

private void runOverlayListenerContinueMethod() {
    // the return handler is used to manipulate the cleanup of all the tutorial elements
    ChainTourGuide mTG1 = ChainTourGuide.init(this).setToolTip(new ToolTip().setTitle("Hey!").setDescription("I'm the top fellow").setGravity(Gravity.RIGHT)).playLater(button);
    ChainTourGuide mTG2 = ChainTourGuide.init(this).setToolTip(new ToolTip().setTitle("Hey!").setDescription("Just the middle man").setGravity(Gravity.BOTTOM | Gravity.LEFT)).setOverlay(new Overlay().setEnterAnimation(enterAnimation).setExitAnimation(exitAnimation)).playLater(button2);
    ChainTourGuide mTG3 = ChainTourGuide.init(this).setToolTip(new ToolTip().setTitle("Hey!").setDescription("It's time to say goodbye").setGravity(Gravity.TOP | Gravity.RIGHT)).playLater(button3);
    mSequence = new Sequence.SequenceBuilder().add(mTG1, mTG2, mTG3).setDefaultOverlay(new Overlay().setEnterAnimation(enterAnimation).setExitAnimation(exitAnimation).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Toast.makeText(SequenceTestActivity.this, "Bello! This is the default Overlay", Toast.LENGTH_SHORT).show();
            mTutorialHandler.next();
        }
    })).setDefaultPointer(new Pointer()).setContinueMethod(Sequence.ContinueMethod.OVERLAY_LISTENER).build();
    mTutorialHandler = ChainTourGuide.init(this).playInSequence(mSequence);
}
Also used : ToolTip(tourguide.tourguide.ToolTip) ChainTourGuide(tourguide.tourguide.ChainTourGuide) Pointer(tourguide.tourguide.Pointer) Overlay(tourguide.tourguide.Overlay) View(android.view.View)

Example 3 with Pointer

use of tourguide.tourguide.Pointer in project TourGuide by worker8.

the class ToolTipMeasureTestActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    /* Get parameters from main activity */
    Intent intent = getIntent();
    int tooltip_num = intent.getIntExtra(TOOLTIP_NUM, 1);
    super.onCreate(savedInstanceState);
    mActivity = this;
    int gravity;
    if (tooltip_num == 1) {
        setContentView(R.layout.activity_tooltip_gravity_i);
        gravity = Gravity.RIGHT | Gravity.BOTTOM;
    } else if (tooltip_num == 2) {
        setContentView(R.layout.activity_tooltip_gravity_ii);
        gravity = Gravity.LEFT | Gravity.BOTTOM;
    } else if (tooltip_num == 3) {
        setContentView(R.layout.activity_tooltip_gravity_iii);
        gravity = Gravity.LEFT | Gravity.TOP;
    } else {
        setContentView(R.layout.activity_tooltip_gravity_iv);
        gravity = Gravity.RIGHT | Gravity.TOP;
    }
    Button button = (Button) findViewById(R.id.button);
    ToolTip toolTip = new ToolTip().setTitle("Welcome!").setDescription("This is a really really long title....This is a really really long title....This is a really really long title....This is a really really long title....This is a really really long title....This is a really really long title....This is a really really long title....").setBackgroundColor(Color.parseColor("#2980b9")).setTextColor(Color.parseColor("#FFFFFF")).setGravity(gravity).setShadow(true);
    mTutorialHandler = TourGuide.init(this).with(TourGuide.Technique.CLICK).setPointer(new Pointer()).setToolTip(toolTip).setOverlay(new Overlay()).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) Intent(android.content.Intent) Pointer(tourguide.tourguide.Pointer) Overlay(tourguide.tourguide.Overlay) View(android.view.View)

Example 4 with Pointer

use of tourguide.tourguide.Pointer in project TourGuide by worker8.

the class BasicActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    /* Get parameters from main activity */
    Intent intent = getIntent();
    boolean color_demo = intent.getBooleanExtra(COLOR_DEMO, false);
    boolean gravity_demo = intent.getBooleanExtra(GRAVITY_DEMO, false);
    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);
    ToolTip toolTip = new ToolTip().setTitle("Welcome!").setDescription("Click on Get Started to begin...");
    // Setup pointer for demo
    Pointer pointer = new Pointer();
    if (color_demo) {
        pointer.setColor(Color.RED);
    }
    if (gravity_demo) {
        pointer.setGravity(Gravity.BOTTOM | Gravity.RIGHT);
        button1.setText("BUTTON\n THAT IS\n PRETTY BIG");
    }
    // the return handler is used to manipulate the cleanup of all the tutorial elements
    mTourGuideHandler = TourGuide.init(this).with(TourGuide.Technique.CLICK).setPointer(pointer).setToolTip(toolTip).setOverlay(new Overlay().setBackgroundColor(Color.parseColor("#66FF0000"))).playOn(button1);
    button1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            if (mTourGuideHandler != null) {
                mTourGuideHandler.cleanUp();
            }
        }
    });
    button2.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mTourGuideHandler.playOn(button1);
        }
    });
}
Also used : ToolTip(tourguide.tourguide.ToolTip) Button(android.widget.Button) Intent(android.content.Intent) Pointer(tourguide.tourguide.Pointer) Overlay(tourguide.tourguide.Overlay) View(android.view.View)

Example 5 with Pointer

use of tourguide.tourguide.Pointer 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)

Aggregations

View (android.view.View)14 Pointer (tourguide.tourguide.Pointer)14 ToolTip (tourguide.tourguide.ToolTip)14 Overlay (tourguide.tourguide.Overlay)12 Button (android.widget.Button)10 Intent (android.content.Intent)3 Animation (android.view.animation.Animation)2 ChainTourGuide (tourguide.tourguide.ChainTourGuide)2 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)1 Toolbar (android.support.v7.widget.Toolbar)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 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1