Skip to content

Commit 397fa00

Browse files
committed
see 06/23 log
1 parent 05bdb00 commit 397fa00

File tree

21 files changed

+425
-226
lines changed

21 files changed

+425
-226
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
android:theme="@style/AppTheme">
5252
<activity android:name=".activity.ActivityActivity"/>
5353
<activity android:name=".activity.AppActivity"/>
54+
<activity android:name=".activity.BarActivity"/>
5455
<activity android:name=".activity.CleanActivity"/>
5556
<activity android:name=".activity.DeviceActivity"/>
5657
<activity android:name=".activity.FragmentActivity"/>

app/src/main/java/com/blankj/androidutilcode/activity/MainActivity.java

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
import android.content.Context;
44
import android.content.Intent;
5-
import android.graphics.Color;
65
import android.net.Uri;
76
import android.os.Bundle;
7+
import android.support.annotation.NonNull;
8+
import android.support.design.widget.NavigationView;
9+
import android.support.v4.widget.DrawerLayout;
10+
import android.support.v7.app.ActionBarDrawerToggle;
811
import android.support.v7.widget.Toolbar;
9-
import android.view.Menu;
1012
import android.view.MenuItem;
1113
import android.view.View;
1214

@@ -21,7 +23,8 @@
2123
* desc : MainActivity
2224
* </pre>
2325
*/
24-
public class MainActivity extends BaseActivity {
26+
public class MainActivity extends BaseActivity
27+
implements NavigationView.OnNavigationItemSelectedListener {
2528

2629
@Override
2730
public void initData(Bundle bundle) {
@@ -35,11 +38,14 @@ public int bindLayout() {
3538

3639
@Override
3740
public void initView(Bundle savedInstanceState, View view) {
41+
DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
3842
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
39-
if (toolbar != null) {
40-
toolbar.setTitleTextColor(Color.WHITE);
41-
setSupportActionBar(toolbar);
42-
}
43+
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
44+
setSupportActionBar(toolbar);
45+
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
46+
mDrawerLayout.addDrawerListener(toggle);
47+
toggle.syncState();
48+
navigationView.setNavigationItemSelectedListener(this);
4349
}
4450

4551
@Override
@@ -136,30 +142,16 @@ public void toastClick(View view) {
136142
startActivity(new Intent(this, ToastActivity.class));
137143
}
138144

139-
140-
@Override
141-
public boolean onCreateOptionsMenu(Menu menu) {
142-
getMenuInflater().inflate(R.menu.about, menu);
143-
return true;
144-
}
145-
146145
@Override
147-
public boolean onOptionsItemSelected(MenuItem item) {
148-
try {
149-
switch (item.getItemId()) {
150-
151-
case R.id.action_git_hub:
152-
153-
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/Blankj/AndroidUtilCode")));
154-
break;
155-
case R.id.action_blog:
156-
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.jianshu.com/u/46702d5c6978")));
157-
break;
158-
}
159-
} catch (Exception e) {
160-
e.printStackTrace();
146+
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
147+
switch (item.getItemId()) {
148+
case R.id.action_git_hub:
149+
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/Blankj/AndroidUtilCode")));
150+
break;
151+
case R.id.action_blog:
152+
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.jianshu.com/u/46702d5c6978")));
153+
break;
161154
}
162-
163-
return super.onOptionsItemSelected(item);
155+
return false;
164156
}
165157
}

app/src/main/java/com/blankj/androidutilcode/base/BaseActivity.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public abstract class BaseActivity extends AppCompatActivity
2323
/**
2424
* 是否全屏
2525
*/
26-
private boolean isFullScreen = false;
26+
private boolean isFullScreen = false;
2727
/**
2828
* 是否沉浸状态栏
2929
*/
@@ -73,7 +73,7 @@ protected void onCreate(Bundle savedInstanceState) {
7373
*
7474
* @param bundle 从上个Activity传递过来的bundle
7575
*/
76-
public abstract void initData(Bundle bundle);
76+
public abstract void initData(final Bundle bundle);
7777

7878
/**
7979
* 绑定布局
@@ -85,21 +85,21 @@ protected void onCreate(Bundle savedInstanceState) {
8585
/**
8686
* 初始化view
8787
*/
88-
public abstract void initView(Bundle savedInstanceState, final View view);
88+
public abstract void initView(final Bundle savedInstanceState, final View view);
8989

9090
/**
9191
* 业务操作
9292
*
9393
* @param context 上下文
9494
*/
95-
public abstract void doBusiness(Context context);
95+
public abstract void doBusiness(final Context context);
9696

9797
/**
9898
* 视图点击事件
9999
*
100100
* @param view 视图
101101
*/
102-
public abstract void onWidgetClick(View view);
102+
public abstract void onWidgetClick(final View view);
103103

104104
/**
105105
* 判断是否快速点击
@@ -116,7 +116,7 @@ private boolean isFastClick() {
116116
}
117117

118118
@Override
119-
public void onClick(View view) {
119+
public void onClick(final View view) {
120120
if (!isFastClick()) onWidgetClick(view);
121121
}
122122

@@ -125,7 +125,7 @@ public void onClick(View view) {
125125
*
126126
* @param isFullScreen 是否全屏
127127
*/
128-
public void setFullScreen(boolean isFullScreen) {
128+
public void setFullScreen(final boolean isFullScreen) {
129129
this.isFullScreen = isFullScreen;
130130
}
131131

@@ -134,7 +134,7 @@ public void setFullScreen(boolean isFullScreen) {
134134
*
135135
* @param isSteepStatusBar 是否沉浸状态栏
136136
*/
137-
public void setSteepStatusBar(boolean isSteepStatusBar) {
137+
public void setSteepStatusBar(final boolean isSteepStatusBar) {
138138
this.isSteepStatusBar = isSteepStatusBar;
139139
}
140140
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<set xmlns:android="http://schemas.android.com/apk/res/android">
3+
<translate
4+
android:duration="300"
5+
android:fromXDelta="100%"
6+
android:toXDelta="0"/>
7+
</set>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<set xmlns:android="http://schemas.android.com/apk/res/android">
3+
<translate
4+
android:duration="300"
5+
android:fromXDelta="-100%"
6+
android:toXDelta="0"/>
7+
</set>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<set xmlns:android="http://schemas.android.com/apk/res/android">
3+
<translate
4+
android:duration="300"
5+
android:fromXDelta="0"
6+
android:toXDelta="-100%"/>
7+
</set>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<set xmlns:android="http://schemas.android.com/apk/res/android">
3+
<translate
4+
android:duration="300"
5+
android:fromXDelta="0"
6+
android:toXDelta="100%"/>
7+
</set>
291 KB
Loading
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:width="24dp"
4+
android:height="24dp"
5+
android:viewportHeight="508.52"
6+
android:viewportWidth="508.52">
7+
8+
<path
9+
android:fillColor="#000000"
10+
android:pathData="M254.26,0C113.845,0,0,113.845,0,254.26s113.845,254.26,254.26,254.26
11+
s254.26-113.845,254.26-254.26C508.52,113.813,394.675,0,254.26,0z
12+
M412.727,310.451c0,56.509-45.989,102.308-102.943,102.308
13+
H198.831c-56.891,0-103.102-45.735-103.102-102.308V198.132c0.032-56.541,46.18-102.371,103.102-102.371h51.964
14+
c56.954,0,102.53,42.525,102.53,99.066c0.731,10.584,10.298,19.8,21.167,19.8h17.766c11.378,0,20.5,11.95,20.5,23.233
15+
L412.727,310.451L412.727,310.451z"/>
16+
<path
17+
android:fillColor="#010002"
18+
android:pathData="M313.693,293.893H194.827c-10.901,0-19.8,8.899-19.8,19.801c0,10.87,8.931,19.8,19.8,19.8
19+
h118.866c10.901,0,19.8-8.931,19.8-19.8C333.494,302.792,324.594,293.893,313.693,293.893z"/>
20+
<path
21+
android:fillColor="#010002"
22+
android:pathData="M194.827,214.627h59.433c10.901,0,19.8-8.931,19.8-19.8c0-10.901-8.931-19.8-19.8-19.8h-59.433
23+
c-10.901,0-19.8,8.931-19.8,19.8C174.994,205.728,183.925,214.627,194.827,214.627z"/>
24+
</vector>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:width="24dp"
4+
android:height="24dp"
5+
android:viewportHeight="16"
6+
android:viewportWidth="16">
7+
8+
<path
9+
android:fillColor="#000000"
10+
android:pathData="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59 .4 .07 .55 -.17 .55 -.38
11+
0-.19-.01-.82-.01-1.49-2.01 .37
12+
-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53 .63 -.01
13+
1.08 .58 1.23 .82 .72 1.21 1.87 .87 2.33 .66 .07-.52 .28 -.87 .51
14+
-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87 .31 -1.59 .82 -2.15-.08-.2-.36-1.02 .08
15+
-2.12 0 0 .67-.21 2.2 .82 .64-.18 1.32-.27 2-.27 .68 0 1.36 .09 2 .27 1.53-1.04
16+
2.2-.82 2.2-.82 .44 1.1 .16 1.92 .08 2.12 .51 .56 .82 1.27 .82 2.15 0 3.07-1.87
17+
3.75-3.65 3.95 .29 .25 .54 .73 .54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21 .15 .46
18+
.55 .38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"/>
19+
</vector>

0 commit comments

Comments
 (0)