forked from binIoter/GuideView
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9acf0d9
Showing
43 changed files
with
1,620 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 22 | ||
buildToolsVersion "22.0.1" | ||
|
||
defaultConfig { | ||
applicationId "com.daojia.guide" | ||
minSdkVersion 8 | ||
targetSdkVersion 17 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
compile 'com.android.support:appcompat-v7:22.2.0' | ||
compile project(':guideview') | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/androidTest/java/com/demo/guide/ApplicationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.demo.guide; | ||
|
||
import android.app.Application; | ||
import android.test.ApplicationTestCase; | ||
|
||
/** | ||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> | ||
*/ | ||
public class ApplicationTest extends ApplicationTestCase<Application> { | ||
public ApplicationTest() { | ||
super(Application.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.demo.guide" > | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme" > | ||
<activity | ||
android:name="com.demo.aty.MainActivity" | ||
android:label="@string/app_name" > | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name="com.demo.aty.SimpleGuideViewActivity" | ||
android:label="@string/title_activity_simple_guide_view" > | ||
</activity> | ||
<activity | ||
android:name="com.demo.aty.MutiGuideViewActivity" | ||
android:label="@string/title_activity_muti_guide_view" > | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.demo.aty; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.BaseAdapter; | ||
import android.widget.Button; | ||
import android.widget.ListView; | ||
import com.demo.guide.R; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class MainActivity extends AppCompatActivity { | ||
|
||
private ListView listView; | ||
private List<String> mList; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
listView = (ListView) findViewById(R.id.lv); | ||
initListData(); | ||
listView.setAdapter(new MyAdapter(this, mList)); | ||
} | ||
|
||
private void initListData() { | ||
mList = new ArrayList<String>(); | ||
mList.add("SimpleGuideViewActivity"); | ||
mList.add("MutiGuideViewActivity"); | ||
} | ||
|
||
private void gotoOthersActivity(int i) { | ||
switch (i) { | ||
case 0: | ||
startActivity(new Intent(MainActivity.this, SimpleGuideViewActivity.class)); | ||
break; | ||
case 1: | ||
startActivity(new Intent(MainActivity.this, MutiGuideViewActivity.class)); | ||
break; | ||
} | ||
} | ||
|
||
class MyAdapter extends BaseAdapter { | ||
|
||
List<String> mList; | ||
Context context; | ||
|
||
public MyAdapter() { | ||
} | ||
|
||
public MyAdapter(Context context, List<String> list) { | ||
this.context = context; | ||
this.mList = list; | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
return mList.size(); | ||
} | ||
|
||
@Override | ||
public Object getItem(int i) { | ||
return i; | ||
} | ||
|
||
@Override | ||
public long getItemId(int i) { | ||
return i; | ||
} | ||
|
||
@Override | ||
public View getView(final int i, View view, ViewGroup viewGroup) { | ||
viewGroup = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.item, null); | ||
Button btn = (Button) viewGroup.findViewById(R.id.btn); | ||
btn.setText(mList.get(i)); | ||
btn.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
gotoOthersActivity(i); | ||
} | ||
}); | ||
return viewGroup; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package com.demo.aty; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.widget.Button; | ||
import com.blog.www.guideview.Guide; | ||
import com.blog.www.guideview.GuideBuilder; | ||
import com.demo.component.MutiComponent; | ||
import com.demo.component.SimpleComponent; | ||
import com.demo.guide.R; | ||
|
||
public class MutiGuideViewActivity extends AppCompatActivity { | ||
|
||
private Button button1, button2; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_muti_guide_view); | ||
button1 = (Button) findViewById(R.id.btn1); | ||
button2 = (Button) findViewById(R.id.btn2); | ||
button1.post(new Runnable() { | ||
@Override | ||
public void run() { | ||
showGuideView(); | ||
} | ||
}); | ||
} | ||
|
||
public void showGuideView() { | ||
final GuideBuilder builder1 = new GuideBuilder(); | ||
builder1.setTargetView(button1) | ||
.setAlpha(150) | ||
.setOverlayTarget(true) | ||
.setOutsideTouchable(false); | ||
builder1.setOnVisibilityChangedListener(new GuideBuilder.OnVisibilityChangedListener() { | ||
@Override | ||
public void onShown() { | ||
// Toast.makeText(MutiGuideViewActivity.this, "show", Toast.LENGTH_SHORT).show(); | ||
|
||
} | ||
|
||
@Override | ||
public void onDismiss() { | ||
button2.post(new Runnable() { | ||
@Override | ||
public void run() { | ||
showGuideView2(); | ||
} | ||
}); | ||
// Toast.makeText(MutiGuideViewActivity.this, "dismiss", Toast.LENGTH_SHORT).show(); | ||
} | ||
}); | ||
|
||
builder1.addComponent(new SimpleComponent()); | ||
Guide guide = builder1.createGuide(); | ||
guide.setShouldCheckLocInWindow(false); | ||
guide.show(MutiGuideViewActivity.this); | ||
} | ||
|
||
public void showGuideView2() { | ||
final GuideBuilder builder1 = new GuideBuilder(); | ||
builder1.setTargetView(button2) | ||
.setAlpha(150) | ||
.setOverlayTarget(false) | ||
.setOutsideTouchable(false); | ||
builder1.setOnVisibilityChangedListener(new GuideBuilder.OnVisibilityChangedListener() { | ||
@Override | ||
public void onShown() { | ||
// Toast.makeText(MutiGuideViewActivity.this, "show", Toast.LENGTH_SHORT).show(); | ||
|
||
} | ||
|
||
@Override | ||
public void onDismiss() { | ||
// Toast.makeText(MutiGuideViewActivity.this, "dismiss", Toast.LENGTH_SHORT).show(); | ||
} | ||
}); | ||
|
||
builder1.addComponent(new MutiComponent()); | ||
Guide guide = builder1.createGuide(); | ||
guide.setShouldCheckLocInWindow(false); | ||
guide.show(MutiGuideViewActivity.this); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
app/src/main/java/com/demo/aty/SimpleGuideViewActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.demo.aty; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.widget.Button; | ||
import com.blog.www.guideview.Guide; | ||
import com.blog.www.guideview.GuideBuilder; | ||
import com.demo.component.SimpleComponent; | ||
import com.demo.guide.R; | ||
|
||
public class SimpleGuideViewActivity extends AppCompatActivity { | ||
|
||
private Button button; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_simple_guide_view); | ||
button = (Button) findViewById(R.id.btn); | ||
button.post(new Runnable() { | ||
@Override | ||
public void run() { | ||
showGuideView(); | ||
} | ||
}); | ||
} | ||
|
||
public void showGuideView() { | ||
GuideBuilder builder = new GuideBuilder(); | ||
builder.setTargetView(button) | ||
.setAlpha(150) | ||
.setOverlayTarget(true) | ||
.setOutsideTouchable(false); | ||
builder.setOnVisibilityChangedListener(new GuideBuilder.OnVisibilityChangedListener() { | ||
@Override | ||
public void onShown() { | ||
// Toast.makeText(SimpleGuideViewActivity.this, "show", Toast.LENGTH_SHORT).show(); | ||
|
||
} | ||
|
||
@Override | ||
public void onDismiss() { | ||
// Toast.makeText(SimpleGuideViewActivity.this, "dismiss", Toast.LENGTH_SHORT) | ||
// .show(); | ||
} | ||
}); | ||
|
||
builder.addComponent(new SimpleComponent()); | ||
Guide guide = builder.createGuide(); | ||
guide.setShouldCheckLocInWindow(false); | ||
guide.show(SimpleGuideViewActivity.this); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.demo.component; | ||
|
||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import com.blog.www.guideview.Component; | ||
|
||
/** | ||
* Created by binIoter on 16/6/17. | ||
*/ | ||
public class MutiComponent extends SimpleComponent { | ||
|
||
@Override | ||
public View getView(LayoutInflater inflater) { | ||
return super.getView(inflater); | ||
} | ||
|
||
@Override | ||
public int getAnchor() { | ||
return Component.ANCHOR_TOP; | ||
} | ||
|
||
@Override | ||
public int getFitPosition() { | ||
return Component.FIT_START; | ||
} | ||
|
||
@Override | ||
public int getXOffset() { | ||
return -60; | ||
} | ||
|
||
@Override | ||
public int getYOffset() { | ||
return 0; | ||
} | ||
} |
Oops, something went wrong.