Skip to content
This repository was archived by the owner on Nov 5, 2020. It is now read-only.

Commit 786b0d0

Browse files
committed
添加关于
1 parent 64b9a9f commit 786b0d0

File tree

7 files changed

+43
-6
lines changed

7 files changed

+43
-6
lines changed

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ dependencies {
3030
implementation 'com.stephentuso:welcome:1.4.1'
3131
implementation 'com.android.support:design:26.1.0'
3232
implementation 'com.chanven.lib:cptr:1.1.0'
33+
implementation 'com.github.medyo:android-about-page:1.2.4'
3334
}

app/src/main/java/io/github/zhaoqi99/snnu_android/AboutFragment.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@
33

44
import android.os.Bundle;
55
import android.support.v4.app.Fragment;
6+
import android.view.Gravity;
67
import android.view.LayoutInflater;
78
import android.view.View;
89
import android.view.ViewGroup;
10+
import android.widget.Toast;
11+
12+
import java.util.Calendar;
13+
14+
import mehdi.sakout.aboutpage.AboutPage;
15+
import mehdi.sakout.aboutpage.Element;
916

1017

1118
/**
@@ -23,7 +30,35 @@ public AboutFragment() {
2330
public View onCreateView(LayoutInflater inflater, ViewGroup container,
2431
Bundle savedInstanceState) {
2532
// Inflate the layout for this fragment
26-
return inflater.inflate(R.layout.fragment_about, container, false);
33+
View aboutPage = new AboutPage(getContext())
34+
.isRTL(false)
35+
.setImage(R.drawable.logo)//图片
36+
.setDescription("道理我都懂,可我就是不听啊")//介绍
37+
.addItem(new Element().setTitle("Version 1.0"))
38+
.addGroup("与我联系")
39+
.addEmail("[email protected]")//邮箱
40+
.addWebsite("https://zhaoqi.vip")//网站
41+
.addGitHub("zhaoqi99")//github
42+
.addItem(getCopyRightsElement())
43+
.create();
44+
return aboutPage;
45+
}
46+
Element getCopyRightsElement() {
47+
Element copyRightsElement = new Element();
48+
String copyrights = getString(R.string.copy_right)+ Calendar.getInstance().get(Calendar.YEAR);
49+
copyRightsElement.setTitle(copyrights);
50+
//copyRightsElement.setIconDrawable(R.drawable.about_icon_copy_right);
51+
copyRightsElement.setIconDrawable(R.drawable.logo);
52+
copyRightsElement.setIconTint(mehdi.sakout.aboutpage.R.color.about_item_icon_color);
53+
copyRightsElement.setIconNightTint(android.R.color.white);
54+
copyRightsElement.setGravity(Gravity.CENTER);
55+
copyRightsElement.setOnClickListener(new View.OnClickListener() {
56+
@Override
57+
public void onClick(View v) {
58+
// Toast.makeText(AboutFragment.this, copyrights, Toast.LENGTH_SHORT).show();
59+
}
60+
});
61+
return copyRightsElement;
2762
}
2863

2964
}

app/src/main/java/io/github/zhaoqi99/snnu_android/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
5757
}
5858
});
5959
setSupportActionBar(mToolBar);
60-
switchToAbout();
60+
switchToNews();
6161
}
6262

6363

app/src/main/java/io/github/zhaoqi99/snnu_android/NewsFragment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ private void InitTab(){
5151
mTabTitleList.add("新闻");
5252
mTabTitleList.add("通知");
5353

54-
mAdapter = new mViewPagerFragmentAdapter(getActivity().getSupportFragmentManager(), mFragmentList,mTabTitleList);
54+
mAdapter = new mViewPagerFragmentAdapter(getChildFragmentManager(), mFragmentList,mTabTitleList);
5555
mViewPager.setAdapter(mAdapter);
5656
tablayout.setupWithViewPager(mViewPager);
5757
}

app/src/main/res/layout/fragment_news.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
33
xmlns:tools="http://schemas.android.com/tools"
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
6+
android:orientation="vertical"
67
tools:context=".NewsFragment">
78

89
<android.support.design.widget.TabLayout
@@ -19,4 +20,4 @@
1920

2021
</android.support.v4.view.ViewPager>
2122

22-
</FrameLayout>
23+
</LinearLayout>

app/src/main/res/layout/fragment_tab.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
android:layout_height="match_parent"
66
tools:context=".Tab">
77

8-
<!-- TODO: Update blank fragment layout -->
98
<LinearLayout
109
android:layout_width="match_parent"
1110
android:layout_height="match_parent"

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33

44
<!-- TODO: Remove or change this placeholder text -->
55
<string name="hello_blank_fragment">Hello blank fragment</string>
6+
<string name="copy_right">CopyRight</string>
67
</resources>

0 commit comments

Comments
 (0)