Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issues #155 Support to Android X #158

Open
wants to merge 15 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .idea/compiler.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/copyright/profiles_settings.xml

This file was deleted.

60 changes: 0 additions & 60 deletions .idea/misc.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,6 @@ CSDN:http://blog.csdn.net/Hubert_bing
掘金:https://juejin.im/user/57bb1fdcc4c971006152d7b0/posts


**本人正在考虑新的工作机会,如果有上海的公司,欢迎内推我,联系邮箱[email protected]或者微信h139x726845**


## License

Expand Down
30 changes: 15 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
applicationId "com.app.hubert.newbieguide"
minSdkVersion 14
targetSdkVersion 26
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -23,28 +23,28 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation project(':guide')
// implementation ('com.github.huburt-Hu:NewbieGuide:v2.3.0')
implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "com.android.support:recyclerview-v7:$rootProject.ext.supportLibraryVersion"
// implementation ('com.github.huburt-Hu:NewbieGuide:v2.4.4')
implementation "androidx.appcompat:appcompat:$rootProject.ext.supportLibraryVersion"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation "androidx.recyclerview:recyclerview:$rootProject.ext.supportLibraryVersion"
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.28'
implementation("com.jaeger.statusbarutil:library:1.4.0") {
exclude group: 'com.android.support'
}
testImplementation 'junit:junit:4.12'

// Lifecycles, LiveData 和 ViewModel
implementation 'android.arch.lifecycle:runtime:1.0.3'
implementation 'android.arch.lifecycle:extensions:1.0.0'
annotationProcessor "android.arch.lifecycle:compiler:1.0.0"
implementation 'androidx.lifecycle:lifecycle-runtime:2.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.1.0'
// Room
implementation 'android.arch.persistence.room:runtime:1.0.0'
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
implementation 'androidx.room:room-runtime:2.2.3'
annotationProcessor 'androidx.room:room-compiler:2.2.3'

debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4'
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.1'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'
}
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
</intent-filter>
</activity>
<activity android:name=".RecyclerViewActivity" />

<activity android:name=".ScrollViewActivity" />
</application>

</manifest>
18 changes: 16 additions & 2 deletions app/src/main/java/com/app/hubert/newbieguide/AbcFragment.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package com.app.hubert.newbieguide;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.app.hubert.guide.core.Controller;
import com.app.hubert.guide.listener.OnGuideChangedListener;
import com.app.hubert.guide.model.GuidePage;
import com.app.hubert.guide.model.HighLight;
import com.app.hubert.guide.NewbieGuide;
Expand Down Expand Up @@ -53,6 +56,17 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
NewbieGuide.with(this)//传入fragment
.setLabel("guide2")//设置引导层标示,必传!否则报错
.alwaysShow(true)
.setOnGuideChangedListener(new OnGuideChangedListener() {
@Override
public void onShowed(Controller controller) {

}

@Override
public void onRemoved(Controller controller) {
Log.e("tag", "onRemoved");
}
})
.addGuidePage(GuidePage.newInstance()
.addHighLight(textView, HighLight.Shape.CIRCLE)//添加需要高亮的view
.setLayoutRes(R.layout.view_guide)//自定义的提示layout,不要添加背景色,引导层背景色通过setBackgroundColor()设置
Expand Down
15 changes: 0 additions & 15 deletions app/src/main/java/com/app/hubert/newbieguide/App.java
Original file line number Diff line number Diff line change
@@ -1,37 +1,22 @@
package com.app.hubert.newbieguide;

import android.app.Application;
import android.content.Context;

import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;

/**
* Created by hubert on 2018/5/2.
*/
public class App extends Application {

private RefWatcher refWatcher;
private static App instance;

@Override
public void onCreate() {
super.onCreate();
instance = this;
if (LeakCanary.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
return;
}
refWatcher = LeakCanary.install(this);
// Normal app init code...
}

public static App getInstance() {
return instance;
}

public RefWatcher getRefWatcher() {
return refWatcher;
}
}
22 changes: 13 additions & 9 deletions app/src/main/java/com/app/hubert/newbieguide/FirstActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import android.graphics.RectF;
import android.support.annotation.IntDef;
import android.support.v7.app.AppCompatActivity;
import androidx.annotation.IntDef;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
Expand All @@ -23,17 +23,14 @@
import com.app.hubert.guide.model.HighLight;
import com.app.hubert.guide.model.HighlightOptions;
import com.app.hubert.guide.model.RelativeGuide;
import com.app.hubert.guide.util.ViewUtils;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

public class FirstActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first);
//简单使用
final Button btnSimple = (Button) findViewById(R.id.btn_simple);
btnSimple.setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -49,6 +46,7 @@ public void onClick(View v) {
.show();
}
});
//对话框形式
final Button btnDialog = (Button) findViewById(R.id.btn_dialog);
btnDialog.setOnClickListener(new View.OnClickListener() {
@Override
Expand All @@ -71,7 +69,7 @@ public void onLayoutInflated(View view, Controller controller) {
.show();
}
});

//设置anchor 及 自定义绘制图形
final View anchorView = findViewById(R.id.ll_anchor);
final Button btnAnchor = (Button) findViewById(R.id.btn_anchor);
btnAnchor.setOnClickListener(new View.OnClickListener() {
Expand Down Expand Up @@ -100,7 +98,7 @@ public void onHighlightDrew(Canvas canvas, RectF rectF) {
.show();
}
});

//监听
final Button btnListener = findViewById(R.id.btn_listener);
btnListener.setOnClickListener(new View.OnClickListener() {
@Override
Expand Down Expand Up @@ -138,6 +136,12 @@ public void onClick(View v) {
RecyclerViewActivity.start(FirstActivity.this);
}
});
findViewById(R.id.btn_scroll).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ScrollViewActivity.start(FirstActivity.this);
}
});

final View btnRelative = findViewById(R.id.btn_relative);
btnRelative.setOnClickListener(new View.OnClickListener() {
Expand All @@ -146,7 +150,7 @@ public void onClick(View v) {
HighlightOptions options = new HighlightOptions.Builder()
.setRelativeGuide(new RelativeGuide(R.layout.view_relative_guide, Gravity.LEFT, 100) {
@Override
protected void onLayoutInflated(View view) {
protected void onLayoutInflated(View view, Controller controller) {
TextView textView = view.findViewById(R.id.tv);
textView.setText("inflated");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.GridView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatActivity;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
Expand Down
Loading