diff --git a/.gitignore b/.gitignore
index afbdab3..4b2a92f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,13 @@
/.idea/libraries
.DS_Store
/build
+
+
+# Android Studio
+*.iml
+.idea
+
+# generated files
+bin/
+gen/
+
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..ab246e6
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+TourGuide
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..217af47
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..e206d70
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
new file mode 100644
index 0000000..99b502c
--- /dev/null
+++ b/.idea/gradle.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..59436c9
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..c18248d
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml
new file mode 100644
index 0000000..922003b
--- /dev/null
+++ b/.idea/scopes/scope_settings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..def6a6a
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/TourGuide.iml b/TourGuide.iml
new file mode 100644
index 0000000..0bb6048
--- /dev/null
+++ b/TourGuide.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/.idea/.name b/app/.idea/.name
new file mode 100644
index 0000000..7a0b7f0
--- /dev/null
+++ b/app/.idea/.name
@@ -0,0 +1 @@
+app
\ No newline at end of file
diff --git a/app/.idea/app.iml b/app/.idea/app.iml
new file mode 100644
index 0000000..ef582b1
--- /dev/null
+++ b/app/.idea/app.iml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/.idea/compiler.xml b/app/.idea/compiler.xml
new file mode 100644
index 0000000..217af47
--- /dev/null
+++ b/app/.idea/compiler.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/.idea/copyright/profiles_settings.xml b/app/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/app/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/app/.idea/encodings.xml b/app/.idea/encodings.xml
new file mode 100644
index 0000000..e206d70
--- /dev/null
+++ b/app/.idea/encodings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/.idea/misc.xml b/app/.idea/misc.xml
new file mode 100644
index 0000000..28b71f5
--- /dev/null
+++ b/app/.idea/misc.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/app/.idea/modules.xml b/app/.idea/modules.xml
new file mode 100644
index 0000000..d1d947c
--- /dev/null
+++ b/app/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/.idea/scopes/scope_settings.xml b/app/.idea/scopes/scope_settings.xml
new file mode 100644
index 0000000..922003b
--- /dev/null
+++ b/app/.idea/scopes/scope_settings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/.idea/vcs.xml b/app/.idea/vcs.xml
new file mode 100644
index 0000000..def6a6a
--- /dev/null
+++ b/app/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/app/.idea/workspace.xml b/app/.idea/workspace.xml
new file mode 100644
index 0000000..23e455f
--- /dev/null
+++ b/app/.idea/workspace.xml
@@ -0,0 +1,218 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+ 5050
+
+
+
+
+
+
+ 1438237027057
+ 1438237027057
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/app.iml b/app/app.iml
new file mode 100644
index 0000000..a4b7ee6
--- /dev/null
+++ b/app/app.iml
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f9e280b..81c7729 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -42,10 +42,15 @@
+
+
+
diff --git a/app/src/main/java/tourguide/tourguidedemo/DialogFragmentActivity.java b/app/src/main/java/tourguide/tourguidedemo/DialogFragmentActivity.java
new file mode 100644
index 0000000..6a3f545
--- /dev/null
+++ b/app/src/main/java/tourguide/tourguidedemo/DialogFragmentActivity.java
@@ -0,0 +1,58 @@
+package tourguide.tourguidedemo;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.graphics.Color;
+import android.os.Bundle;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentTransaction;
+import android.support.v7.app.ActionBarActivity;
+import android.view.Gravity;
+import android.view.View;
+import android.widget.Button;
+
+import tourguide.tourguide.Overlay;
+import tourguide.tourguide.Pointer;
+import tourguide.tourguide.ToolTip;
+import tourguide.tourguide.TourGuide;
+
+
+public class DialogFragmentActivity extends ActionBarActivity {
+ public TourGuide mTutorialHandler;
+ public Activity mActivity;
+ public static final String COLOR_DEMO = "color_demo";
+ public static final String GRAVITY_DEMO = "gravity_demo";
+
+ @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_dialog);
+
+ Button button = (Button)findViewById(R.id.button);
+
+
+ button.setOnClickListener(new View.OnClickListener(){
+ @Override
+ public void onClick(View view) {
+ showEditDialog();
+ }
+ });
+
+
+
+
+ }
+
+ private void showEditDialog() {
+ FragmentManager fm = getSupportFragmentManager();
+ DialogFragmentSample editNameDialog = new DialogFragmentSample();
+ editNameDialog.show(fm, "fragment_edit_name");
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/tourguide/tourguidedemo/DialogFragmentSample.java b/app/src/main/java/tourguide/tourguidedemo/DialogFragmentSample.java
new file mode 100644
index 0000000..0c3a96f
--- /dev/null
+++ b/app/src/main/java/tourguide/tourguidedemo/DialogFragmentSample.java
@@ -0,0 +1,134 @@
+package tourguide.tourguidedemo;
+
+import android.app.Dialog;
+import android.graphics.Color;
+import android.graphics.drawable.ColorDrawable;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.v4.app.DialogFragment;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.Window;
+import android.view.WindowManager;
+import android.widget.Button;
+import android.widget.FrameLayout;
+import android.widget.ImageButton;
+
+import tourguide.tourguide.Overlay;
+import tourguide.tourguide.Pointer;
+import tourguide.tourguide.ToolTip;
+import tourguide.tourguide.TourGuide;
+
+/**
+ * Created by aaronliew on 8/27/15.
+ */
+public class DialogFragmentSample extends DialogFragment {
+ public TourGuide mTutorialHandler,mTutorialHandler1,mTutorialHandler2;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ View view = inflater.inflate(R.layout.fragment_dialog_basic, container);
+ getDialog().setTitle("Bello!");
+
+ Button button = (Button) view.findViewById(R.id.button);
+ final ImageButton closebutton = (ImageButton) view.findViewById(R.id.cross);
+ final ImageButton gmailbutton = (ImageButton) view.findViewById(R.id.gmail);
+ FrameLayout frameLayout = (FrameLayout) view.findViewById(R.id.tourguide);
+//
+ final ToolTip toolTip = new ToolTip().
+ setTitle("Welcome!").
+ setDescription("Click on Get Started to begin...");
+
+ // Setup pointer for demo
+ final Pointer pointer = new Pointer();
+
+
+ // the return handler is used to manipulate the cleanup of all the tutorial elements
+ mTutorialHandler = TourGuide.init(getActivity()).with(TourGuide.Technique.Click)
+ .setPointer(pointer)
+ .setToolTip(toolTip)
+ .setOverlay(new Overlay().setBackgroundColor(Color.parseColor("#66FF0000")))
+ .playOnDialog(button, frameLayout);
+
+
+// mTutorialHandler1 = TourGuide.init(getActivity()).with(TourGuide.Technique.Click)
+// .setPointer(pointer)
+// .setToolTip(toolTip)
+// .setOverlay(new Overlay().setBackgroundColor(Color.parseColor("#66FF0000")))
+// .playOn(closebutton);
+//
+// mTutorialHandler2 = TourGuide.init(getActivity()).with(TourGuide.Technique.Click)
+// .setPointer(pointer)
+// .setToolTip(toolTip)
+// .setOverlay(new Overlay().setBackgroundColor(Color.parseColor("#66FF0000")))
+// .playOn(gmailbutton);
+//
+// getDialog().setTitle("hihi Sir!");
+//
+//
+//
+//// mTutorialHandler.contentArea = frameLayout;
+//// mTutorialHandler.mContainer = frameLayout;
+//
+//
+// closebutton.setOnClickListener(new View.OnClickListener() {
+// @Override
+// public void onClick(View v) {
+// mTutorialHandler1.cleanUp();
+// }
+// });
+//
+// gmailbutton.setOnClickListener(new View.OnClickListener() {
+// @Override
+// public void onClick(View v) {
+// mTutorialHandler2.cleanUp();
+// }
+// });
+
+ button.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ mTutorialHandler.cleanUp();
+ dismissAllowingStateLoss();
+ }
+ });
+ return view;
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ Window window = getDialog().getWindow();
+ window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
+// window.setLayout(1000, 1000);
+ window.setGravity(Gravity.BOTTOM);
+ }
+
+ @NonNull
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ Dialog dialog = super.onCreateDialog(savedInstanceState);
+
+ // request a window without the title
+ dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
+ dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
+
+ return dialog;
+ }
+
+ @Override
+ public void onStart()
+ {
+ super.onStart();
+ Dialog dialog = getDialog();
+ if (dialog != null)
+ {
+ int width = ViewGroup.LayoutParams.MATCH_PARENT;
+ int height = ViewGroup.LayoutParams.MATCH_PARENT;
+ dialog.getWindow().setLayout(width, height);
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/tourguide/tourguidedemo/NavDrawerActivity.java b/app/src/main/java/tourguide/tourguidedemo/NavDrawerActivity.java
index cb36c0a..2a57276 100644
--- a/app/src/main/java/tourguide/tourguidedemo/NavDrawerActivity.java
+++ b/app/src/main/java/tourguide/tourguidedemo/NavDrawerActivity.java
@@ -40,6 +40,10 @@ protected void onCreate(Bundle savedInstanceState) {
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){
@@ -47,11 +51,8 @@ protected void onCreate(Bundle savedInstanceState) {
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
// Note that playNow() is used instead of playOn(), because NavigationDrawer is initially hidden.
- 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")))
- .playNow(mTextView1);
+
+ mTutorialHandler.playOn(mTextView1);
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
diff --git a/app/src/main/java/tourguide/tourguidedemo/TourGuideDemoMain.java b/app/src/main/java/tourguide/tourguidedemo/TourGuideDemoMain.java
index 5c00d47..fc5a97c 100644
--- a/app/src/main/java/tourguide/tourguidedemo/TourGuideDemoMain.java
+++ b/app/src/main/java/tourguide/tourguidedemo/TourGuideDemoMain.java
@@ -34,7 +34,7 @@ class CustomAdapter extends BaseAdapter {
public Object getItem(int arg0) { return null;}
public long getItemId(int position) { return position; }
public int getCount() {
- return 18;
+ return 19;
// return 19;
}
@@ -259,6 +259,15 @@ public void onClick(View view) {
startActivity(mIntent);
}
});
+ } else if (position == 18) {
+ text.setText("Dialog Fragment");
+ row.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ mIntent = new Intent(mActivity, DialogFragmentActivity.class);
+ startActivity(mIntent);
+ }
+ });
}
// else if (position == 17){
// mIntent = new Intent(mActivity, MemoryLeakTestActivity.class);
diff --git a/app/src/main/res/drawable-hdpi/ic_action_alarm.png b/app/src/main/res/drawable-hdpi/ic_action_alarm.png
new file mode 100755
index 0000000..92c107c
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_action_alarm.png differ
diff --git a/app/src/main/res/drawable-hdpi/ic_action_cancel.png b/app/src/main/res/drawable-hdpi/ic_action_cancel.png
new file mode 100755
index 0000000..a85355e
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_action_cancel.png differ
diff --git a/app/src/main/res/layout/activity_basic.xml b/app/src/main/res/layout/activity_basic.xml
index 55619a8..75c8ee7 100644
--- a/app/src/main/res/layout/activity_basic.xml
+++ b/app/src/main/res/layout/activity_basic.xml
@@ -25,6 +25,20 @@
android:text="Get Started"
android:textColor="#fbfcfc" />
+
diff --git a/app/src/main/res/layout/activity_dialog.xml b/app/src/main/res/layout/activity_dialog.xml
new file mode 100644
index 0000000..fe0b1e8
--- /dev/null
+++ b/app/src/main/res/layout/activity_dialog.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_dialog_basic.xml b/app/src/main/res/layout/fragment_dialog_basic.xml
new file mode 100644
index 0000000..da60fa1
--- /dev/null
+++ b/app/src/main/res/layout/fragment_dialog_basic.xml
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tourguide/.idea/.name b/tourguide/.idea/.name
new file mode 100644
index 0000000..c804bef
--- /dev/null
+++ b/tourguide/.idea/.name
@@ -0,0 +1 @@
+tourguide
\ No newline at end of file
diff --git a/tourguide/.idea/compiler.xml b/tourguide/.idea/compiler.xml
new file mode 100644
index 0000000..217af47
--- /dev/null
+++ b/tourguide/.idea/compiler.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tourguide/.idea/copyright/profiles_settings.xml b/tourguide/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/tourguide/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/tourguide/.idea/encodings.xml b/tourguide/.idea/encodings.xml
new file mode 100644
index 0000000..e206d70
--- /dev/null
+++ b/tourguide/.idea/encodings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/tourguide/.idea/misc.xml b/tourguide/.idea/misc.xml
new file mode 100644
index 0000000..28b71f5
--- /dev/null
+++ b/tourguide/.idea/misc.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/tourguide/.idea/modules.xml b/tourguide/.idea/modules.xml
new file mode 100644
index 0000000..f8dbbab
--- /dev/null
+++ b/tourguide/.idea/modules.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/tourguide/.idea/scopes/scope_settings.xml b/tourguide/.idea/scopes/scope_settings.xml
new file mode 100644
index 0000000..922003b
--- /dev/null
+++ b/tourguide/.idea/scopes/scope_settings.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/tourguide/.idea/tourguide.iml b/tourguide/.idea/tourguide.iml
new file mode 100644
index 0000000..ef582b1
--- /dev/null
+++ b/tourguide/.idea/tourguide.iml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/tourguide/.idea/vcs.xml b/tourguide/.idea/vcs.xml
new file mode 100644
index 0000000..def6a6a
--- /dev/null
+++ b/tourguide/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/tourguide/.idea/workspace.xml b/tourguide/.idea/workspace.xml
new file mode 100644
index 0000000..5199520
--- /dev/null
+++ b/tourguide/.idea/workspace.xml
@@ -0,0 +1,218 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+ 5050
+
+
+
+
+
+
+ 1438237307100
+ 1438237307100
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tourguide/src/main/java/tourguide/tourguide/Overlay.java b/tourguide/src/main/java/tourguide/tourguide/Overlay.java
index e53ebde..bb645b9 100644
--- a/tourguide/src/main/java/tourguide/tourguide/Overlay.java
+++ b/tourguide/src/main/java/tourguide/tourguide/Overlay.java
@@ -80,4 +80,4 @@ public Overlay setOnClickListener(View.OnClickListener onClickListener){
mOnClickListener=onClickListener;
return this;
}
-}
+}
\ No newline at end of file
diff --git a/tourguide/src/main/java/tourguide/tourguide/TourGuide.java b/tourguide/src/main/java/tourguide/tourguide/TourGuide.java
index 71e025c..7c1d6bd 100644
--- a/tourguide/src/main/java/tourguide/tourguide/TourGuide.java
+++ b/tourguide/src/main/java/tourguide/tourguide/TourGuide.java
@@ -45,6 +45,7 @@ public enum MotionType {
public ToolTip mToolTip;
public Pointer mPointer;
public Overlay mOverlay;
+ private ViewGroup mContainer;
private Sequence mSequence;
@@ -101,6 +102,13 @@ public TourGuide playOn(View targetView){
return this;
}
+ public TourGuide playOnDialog(View targetView, ViewGroup container){
+ mHighlightedView = targetView;
+ mContainer = container;
+ setupView();
+ return this;
+ }
+
/**
* Sets the targeted view for TourGuide to play on, this should be called after Views are shown (not in onCreate())
* Details: read description for playOn()
@@ -144,11 +152,11 @@ public TourGuide setPointer(Pointer pointer){
/**
* Clean up the tutorial that is added to the activity
*/
- public void cleanUp(){
- mFrameLayout.cleanUp();
- if (mToolTipViewGroup!=null) {
- ((ViewGroup) mActivity.getWindow().getDecorView()).removeView(mToolTipViewGroup);
- }
+ public void cleanUp(){
+ mFrameLayout.cleanUp();
+ if (mToolTipViewGroup!=null) {
+ ((ViewGroup) mActivity.getWindow().getDecorView()).removeView(mToolTipViewGroup);
+ }
}
public TourGuide playLater(View view){
@@ -241,14 +249,36 @@ private int getYBasedOnGravity(int height){
}
}
+ private void setupDialogView(){
+ if (mHighlightedView.isAttachedToWindow()){
+ startView();
+ }
+ else {
+ final ViewTreeObserver viewTreeObserver = mHighlightedView.getViewTreeObserver();
+ viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+ @Override
+ public void onGlobalLayout() {
+ mHighlightedView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
+ startView();
+ }
+ });
+ }
+ }
+
private void setupView(){
- final ViewTreeObserver viewTreeObserver = mHighlightedView.getViewTreeObserver();
- viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
- @Override
- public void onGlobalLayout() {
- startView();
- }
- });
+ if (mHighlightedView.isAttachedToWindow()){
+ startView();
+ }
+ else {
+ final ViewTreeObserver viewTreeObserver = mHighlightedView.getViewTreeObserver();
+ viewTreeObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+ @Override
+ public void onGlobalLayout() {
+ mHighlightedView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
+ startView();
+ }
+ });
+ }
}
private void startView(){
@@ -343,7 +373,7 @@ private void setupToolTip(){
// add view to parent
// ((ViewGroup) mActivity.getWindow().getDecorView().findViewById(android.R.id.content)).addView(mToolTipViewGroup, layoutParams);
- parent.addView(mToolTipViewGroup, layoutParams);
+ mContainer.addView(mToolTipViewGroup, layoutParams);
// 1. width < screen check
if (toolTipMeasuredWidth > parent.getWidth()){
@@ -425,7 +455,7 @@ private FloatingActionButton setupAndAddFABToFrameLayout(final FrameLayoutWithHo
final FloatingActionButton invisFab = new FloatingActionButton(mActivity);
invisFab.setSize(FloatingActionButton.SIZE_MINI);
invisFab.setVisibility(View.INVISIBLE);
- ((ViewGroup)mActivity.getWindow().getDecorView()).addView(invisFab);
+ mContainer.addView(invisFab);
// fab is the real fab that is going to be added
final FloatingActionButton fab = new FloatingActionButton(mActivity);
@@ -463,7 +493,7 @@ private void setupFrameLayout(){
// but we're adding it to the content area only, so we need to offset it to the same Y value of contentArea
layoutParams.setMargins(0,-pos[1],0,0);
- contentArea.addView(mFrameLayout, layoutParams);
+ mContainer.addView(mFrameLayout, layoutParams);
}
private void performAnimationOn(final View view){
diff --git a/tourguide/tourguide.iml b/tourguide/tourguide.iml
new file mode 100644
index 0000000..a281d11
--- /dev/null
+++ b/tourguide/tourguide.iml
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+