Skip to content

Commit d6458d8

Browse files
author
zhouxingrong
committed
fix
1 parent cbcaee7 commit d6458d8

File tree

11 files changed

+246
-26
lines changed

11 files changed

+246
-26
lines changed

.idea/misc.xml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ dependencies {
126126
compile('com.mikepenz:materialdrawer:5.3.6@aar') {
127127
transitive = true
128128
}
129+
129130
compile 'com.android.support:appcompat-v7:26.+'
130131
compile 'com.android.support:design:26.+'
131132
compile 'com.android.support.constraint:constraint-layout:1.0.2'
@@ -137,6 +138,8 @@ dependencies {
137138
compile 'com.github.rey5137:material:1.2.4'
138139
compile 'com.github.clans:fab:1.6.4'
139140
compile 'com.pddstudio:highlightjs-android:1.2.0'
141+
compile 'com.youth.banner:banner:1.4.9'
142+
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
140143
compile 'com.mikepenz:devicon-typeface:2.0.0.2@aar'
141144
compile 'com.mikepenz:fontawesome-typeface:4.6.0.3@aar'
142145
compile 'com.mikepenz:octicons-typeface:3.2.0.2@aar'

app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060
android:scheme="githubapp"/>
6161
</intent-filter>
6262
</activity>
63+
<activity
64+
android:name=".guidance.GuidanceActivity"
65+
android:screenOrientation="portrait"
66+
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
6367
<activity
6468
android:name=".user.ui.activity.LoginActivity"
6569
android:screenOrientation="portrait"/>
@@ -105,6 +109,7 @@
105109
<activity
106110
android:name=".home.ui.activity.IssuesListActivity"
107111
android:screenOrientation="portrait"/>
112+
108113
</application>
109114

110115
</manifest>

app/src/main/java/com/jusenr/androidgithub/base/InitializeIntentService.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ public InitializeIntentService() {
2424

2525
@Override
2626
protected void onHandleIntent(@Nullable Intent intent) {
27-
28-
setupUmeng();
27+
//UMeng初始化
28+
MobclickAgent.setDebugMode(BuildConfig.IS_TEST);
29+
MobclickAgent.setCatchUncaughtExceptions(true);
30+
MobclickAgent.openActivityDurationTrack(false);
2931

3032
//Logcat异常捕捉
3133
// CrashHandler.getInstance().initCrashHandler(getApplication());
@@ -36,10 +38,4 @@ protected void onHandleIntent(@Nullable Intent intent) {
3638
// init Share
3739
SharePlatform.init(this.getApplicationContext());
3840
}
39-
40-
private void setupUmeng() {
41-
MobclickAgent.setDebugMode(BuildConfig.IS_TEST);
42-
MobclickAgent.setCatchUncaughtExceptions(true);
43-
MobclickAgent.openActivityDurationTrack(false);
44-
}
4541
}

app/src/main/java/com/jusenr/androidgithub/base/PTApplication.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import com.jusenr.androidlibrary.BaseApplication;
1313
import com.jusenr.androidlibrary.commn.database.DBManager;
1414
import com.jusenr.androidlibrary.widgets.fresco.ImagePipelineFactory;
15+
import com.nostra13.universalimageloader.core.ImageLoader;
16+
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
1517

1618

1719
/**
@@ -34,6 +36,11 @@ public void onCreate() {
3436
ImagePipelineFactory.imagePipelineConfig(getApplicationContext()
3537
, getAppComponent().okHttpClient()
3638
, getCacheDir().getAbsolutePath()));
39+
40+
//ImageLoader初始化
41+
ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(this).build();
42+
ImageLoader.getInstance().init(configuration);
43+
3744
DBManager.init(this);
3845
if (AccountHelper.isLogin())
3946
DBManager.initDefaultRealm(AccountHelper.getCurrentUid(), APPRealmMigration.VERSION, new APPRealmMigration());
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.jusenr.androidgithub.guidance;
2+
3+
import android.content.Context;
4+
import android.widget.ImageView;
5+
6+
import com.youth.banner.loader.ImageLoader;
7+
8+
/**
9+
* Description:
10+
* Copyright : Copyright (c) 2017
11+
* Email : jusenr@163.com
12+
* Author : Jusenr
13+
* Date : 2017/10/19
14+
* Time : 10:45
15+
* Project :androidgithub.
16+
*/
17+
public class BannerImageLoader extends ImageLoader {
18+
19+
@Override
20+
public void displayImage(Context context, Object path, ImageView imageView) {
21+
com.nostra13.universalimageloader.core.ImageLoader instance = com.nostra13.universalimageloader.core.ImageLoader.getInstance();
22+
instance.displayImage((String) path, imageView);
23+
}
24+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
package com.jusenr.androidgithub.guidance;
2+
3+
import android.content.Intent;
4+
import android.os.Bundle;
5+
import android.support.annotation.Nullable;
6+
import android.support.v4.view.ViewPager;
7+
import android.widget.Button;
8+
import android.widget.TextView;
9+
10+
import com.jusenr.androidgithub.R;
11+
import com.jusenr.androidgithub.base.PTActivity;
12+
import com.jusenr.androidgithub.home.ui.activity.MainActivity;
13+
import com.jusenr.androidgithub.user.ui.activity.LoginActivity;
14+
import com.jusenr.androidgithub.utils.AccountHelper;
15+
import com.youth.banner.Banner;
16+
17+
import java.util.Arrays;
18+
19+
import butterknife.BindView;
20+
import butterknife.OnClick;
21+
22+
public class GuidanceActivity extends PTActivity {
23+
24+
@BindView(R.id.banner)
25+
Banner mBanner;
26+
@BindView(R.id.tv_text)
27+
TextView mTvText;
28+
@BindView(R.id.btn_start)
29+
Button mBtnStart;
30+
31+
32+
@Override
33+
protected int getLayoutId() {
34+
return R.layout.activity_guidance;
35+
}
36+
37+
@Override
38+
protected void onViewCreated(@Nullable Bundle savedInstanceState) {
39+
final String[] urls = {
40+
getString(R.string.guidance_image_1),
41+
getString(R.string.guidance_image_2),
42+
getString(R.string.guidance_image_3),
43+
getString(R.string.guidance_image_4),
44+
getString(R.string.guidance_image_5),
45+
getString(R.string.guidance_image_6)
46+
};
47+
final String[] texts = {
48+
getString(R.string.guidance_text_1),
49+
getString(R.string.guidance_text_2),
50+
getString(R.string.guidance_text_3),
51+
getString(R.string.guidance_text_4),
52+
getString(R.string.guidance_text_5),
53+
getString(R.string.guidance_text_6)
54+
};
55+
mBanner.setImageLoader(new BannerImageLoader());
56+
//设置图片集合
57+
mBanner.setImages(Arrays.asList(urls));
58+
//设置标题
59+
mBanner.setBannerTitles(Arrays.asList(texts));
60+
61+
mBanner.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
62+
@Override
63+
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
64+
65+
}
66+
67+
@Override
68+
public void onPageSelected(int position) {
69+
// int i = (position - 1) % urls.length;
70+
// mTvText.setText(texts[i]);
71+
}
72+
73+
@Override
74+
public void onPageScrollStateChanged(int state) {
75+
76+
}
77+
});
78+
//启动轮播
79+
mBanner.start();
80+
}
81+
82+
@OnClick(R.id.btn_start)
83+
public void onViewClicked() {
84+
if (AccountHelper.isLogin()) {
85+
startActivity(new Intent(getApplicationContext(), MainActivity.class));
86+
} else {
87+
startActivity(new Intent(getApplicationContext(), LoginActivity.class));
88+
}
89+
finish();
90+
}
91+
}

app/src/main/java/com/jusenr/androidgithub/guidance/LogoSplashActivity.java

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@
66

77
import com.jusenr.androidgithub.R;
88
import com.jusenr.androidgithub.base.PTActivity;
9-
import com.jusenr.androidgithub.home.ui.activity.MainActivity;
10-
import com.jusenr.androidgithub.user.ui.activity.LoginActivity;
11-
import com.jusenr.androidgithub.utils.AccountHelper;
129
import com.trello.rxlifecycle.android.ActivityEvent;
1310

1411
import java.util.concurrent.TimeUnit;
1512

1613
import rx.Observable;
1714
import rx.android.schedulers.AndroidSchedulers;
18-
import rx.functions.Action0;
1915
import rx.functions.Action1;
2016
import rx.schedulers.Schedulers;
2117

@@ -41,23 +37,10 @@ protected void onViewCreated(@Nullable Bundle savedInstanceState) {
4137
.compose(this.<Long>bindUntilEvent(ActivityEvent.DESTROY))
4238
.subscribeOn(Schedulers.computation())
4339
.observeOn(AndroidSchedulers.mainThread())
44-
.doOnSubscribe(new Action0() {
45-
@Override
46-
public void call() {
47-
//提前登录
48-
if (AccountHelper.isLogin()) {
49-
50-
}
51-
}
52-
})
5340
.subscribe(new Action1<Long>() {
5441
@Override
5542
public void call(Long time) {
56-
if (AccountHelper.isLogin()) {
57-
startActivity(new Intent(getApplicationContext(), MainActivity.class));
58-
} else {
59-
startActivity(new Intent(getApplicationContext(), LoginActivity.class));
60-
}
43+
startActivity(new Intent(getApplicationContext(), GuidanceActivity.class));
6144
finish();
6245
}
6346
});
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:app="http://schemas.android.com/apk/res-auto"
5+
xmlns:tools="http://schemas.android.com/tools"
6+
android:layout_width="match_parent"
7+
android:layout_height="match_parent"
8+
tools:context="com.jusenr.androidgithub.guidance.GuidanceActivity">
9+
10+
<com.youth.banner.Banner
11+
android:id="@+id/banner"
12+
android:layout_width="match_parent"
13+
android:layout_height="200dp"
14+
tools:layout_editor_absoluteX="8dp"
15+
tools:layout_editor_absoluteY="16dp"/>
16+
17+
<TextView
18+
android:id="@+id/tv_text"
19+
android:layout_width="match_parent"
20+
android:layout_height="wrap_content"
21+
android:layout_above="@+id/btn_start"
22+
android:layout_margin="8dp"
23+
android:gravity="center"
24+
android:text="@string/current_app_name"
25+
android:textSize="16sp"/>
26+
27+
<Button
28+
android:id="@+id/btn_start"
29+
android:layout_width="wrap_content"
30+
android:layout_height="wrap_content"
31+
android:layout_alignParentBottom="true"
32+
android:layout_centerHorizontal="true"
33+
android:layout_marginBottom="20dp"
34+
android:layout_marginTop="50dp"
35+
android:text="@string/begun_to_taste"
36+
android:textAllCaps="false"
37+
android:textColor="@color/grey"/>
38+
39+
</RelativeLayout>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<resources>
2+
<string name="current_app_name">GitHubApp</string>
3+
4+
<string name="exit_again">Press Back again to exit application.</string>
5+
<string name="begun_to_taste">Begin to experience</string>
6+
7+
<!-- guidance -->
8+
<string name="guidance_text_1">我喜欢这样的时刻:我抓到你正在看我,你笑了,然后害羞地别过脸去。</string>
9+
<string name="guidance_text_2">其实爱对了人,每天都是情人节。</string>
10+
<string name="guidance_text_3">人生就像愤怒的小鸟,当你失败时,总有几头猪在笑!</string>
11+
<string name="guidance_text_4">生活是世上最罕见的事情,大多数人只是存在,仅此而已。</string>
12+
<string name="guidance_text_5">做你自己,这世界崇拜原创性。</string>
13+
<string name="guidance_text_6">只有一种成功,那就是能够用自己的方式度过自己的一生。</string>
14+
15+
16+
<!-- main menu labels -->
17+
<string name="menu_trending">Trending</string>
18+
<string name="menu_most_star">Most Stars</string>
19+
<string name="menu_account">Profile</string>
20+
<string name="menu_search">Search</string>
21+
22+
<string name="settings">Settings</string>
23+
<string name="profile">Profile</string>
24+
<string name="search">Search</string>
25+
<string name="load_searching">Searching</string>
26+
<string name="loading">Loading</string>
27+
<string name="sign_in">Sign In</string>
28+
<string name="please_login">Please Login</string>
29+
<string name="count">( %1$d )</string>
30+
31+
<string name="upgrade">Check the Newest Version</string>
32+
<string name="about">About This App</string>
33+
<string name="about_author">About Author</string>
34+
35+
<string name="repositories">%1$s \'s repositories</string>
36+
<string name="your_stars">%1$s \'s stars</string>
37+
<string name="following">%1$s \'s following</string>
38+
<string name="followers">%1$s \'s followers</string>
39+
40+
<string name="my_repositories">My Repositories</string>
41+
<string name="my_stars">My Stars</string>
42+
<string name="my_following">My Following</string>
43+
<string name="my_followers">My Followers</string>
44+
45+
<string name="about_us">About Us</string>
46+
<string name="about_us_github_com_v3">Api from Github Document \nhttps://developer.github.com/v3</string>
47+
<string name="about_us_no_copyright">Copyright © 2017 Jusenr</string>
48+
<string name="about_us_make_it_better">Welcome to fork/star/pull request to make it better</string>
49+
<string name="about_us_source_link">Source Link \n https://github.com/Jusenr/androidgithub</string>
50+
<string name="about_us_qrcode_create_failed">QRCode creation failed</string>
51+
52+
</resources>

0 commit comments

Comments
 (0)