Skip to content

Commit

Permalink
添加网易云音乐UI模仿
Browse files Browse the repository at this point in the history
  • Loading branch information
D-clock committed Feb 27, 2016
1 parent 529a606 commit 215e806
Show file tree
Hide file tree
Showing 13 changed files with 176 additions and 8 deletions.
2 changes: 1 addition & 1 deletion note/02_AndroidSystemUI:开始使用NavigationDrawer.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 谈谈我眼中的 NavigationDrawer
# 最详细的 NavigationDrawer 开发实践总结



Expand Down
3 changes: 3 additions & 0 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
android:name=".ui.activity.navigation.SimpleNavigationDrawerActivity"
android:label="@string/simple_navigation_drawer"
android:theme="@style/Theme.Translucent.Navigation" />
<activity
android:name=".ui.activity.navigation.CloudMusicActivity"
android:theme="@style/Theme.Translucent.Navigation" />
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.view.View;

import com.clock.systemui.R;
import com.clock.systemui.ui.activity.navigation.CloudMusicActivity;
import com.clock.systemui.ui.activity.navigation.SimpleDrawerActivity;
import com.clock.systemui.ui.activity.navigation.SimpleNavigationDrawerActivity;
import com.clock.systemui.ui.activity.toolbar.ToolBarActivity;
Expand All @@ -28,6 +29,7 @@ protected void onCreate(Bundle savedInstanceState) {
findViewById(R.id.btn_toolbar_zhihu).setOnClickListener(this);
findViewById(R.id.btn_simple_drawer).setOnClickListener(this);
findViewById(R.id.btn_simple_navigation_drawer).setOnClickListener(this);
findViewById(R.id.btn_cloud_music).setOnClickListener(this);

}

Expand Down Expand Up @@ -58,10 +60,14 @@ public void onClick(View v) {
Intent simpleDrawerIntent = new Intent(this, SimpleDrawerActivity.class);
startActivity(simpleDrawerIntent);

} else if (viewId == R.id.btn_simple_navigation_drawer){
} else if (viewId == R.id.btn_simple_navigation_drawer) {
Intent simpleNavigationDrawerIntent = new Intent(this, SimpleNavigationDrawerActivity.class);
startActivity(simpleNavigationDrawerIntent);

} else if (viewId == R.id.btn_cloud_music) {
Intent cloudmusicIntent = new Intent(this, CloudMusicActivity.class);
startActivity(cloudmusicIntent);

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.clock.systemui.ui.activity.navigation;

import android.os.Bundle;

import com.clock.systemui.R;
import com.clock.systemui.ui.activity.base.BaseActivity;

/**
* 仿网易云音乐
*
* @author Clock
* @since 2016-02-27
*/
public class CloudMusicActivity extends BaseActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cloud_music);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ protected void onCreate(Bundle savedInstanceState) {

mDrawer = (DrawerLayout) findViewById(R.id.drawer);

mNavigationView = (NavigationView) findViewById(R.id.navigation_view);//ScrimInsetsFrameLayout
mNavigationView.setItemIconTintList(null);//设置菜单图标的颜色
mNavigationView = (NavigationView) findViewById(R.id.navigation_view);
mNavigationView.setItemIconTintList(null);//设置菜单图标恢复本来的颜色
mNavigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem item) {
Expand Down
133 changes: 133 additions & 0 deletions src/main/res/layout/activity_cloud_music.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_cd3e3a">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="65dp"
android:background="@color/color_cd3e3a"
android:gravity="center"
android:text="网易云音乐"
android:textColor="@android:color/white"
android:textSize="18sp" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical">

</LinearLayout>
</LinearLayout>

<LinearLayout
android:id="@+id/navigation_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white"
android:fitsSystemWindows="true"
android:orientation="vertical"
app:insetForeground="@android:color/transparent">

<ImageView
android:layout_width="match_parent"
android:layout_height="180dp"
android:scaleType="centerCrop"
android:src="@mipmap/topinfo_ban_bg" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_vertical"
android:orientation="horizontal">

<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="@mipmap/topmenu_icn_msg" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我的消息"
android:textColor="@android:color/black"
android:textSize="15sp" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_vertical"
android:orientation="horizontal">

<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="@mipmap/topmenu_icn_store" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="积分商城"
android:textColor="@android:color/black"
android:textSize="15sp" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_vertical"
android:orientation="horizontal">

<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="@mipmap/topmenu_icn_member" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="付费音乐包"
android:textColor="@android:color/black"
android:textSize="15sp" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center_vertical"
android:orientation="horizontal">

<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="@mipmap/topmenu_icn_free" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="在线听歌免流量"
android:textColor="@android:color/black"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
6 changes: 6 additions & 0 deletions src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Simple Navigation Drawer" />

<Button
android:id="@+id/btn_cloud_music"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="NavigationDrawer(网易云音乐)" />
</LinearLayout>
7 changes: 3 additions & 4 deletions src/main/res/layout/activity_simple_navigation_drawer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_cd3e3a">
android:fitsSystemWindows="true">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_cd3e3a"
android:orientation="vertical">

<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="NavigationDrawerContent"
android:textColor="@android:color/white" />
android:text="NavigationDrawerContent" />
</LinearLayout>

<android.support.design.widget.NavigationView
Expand All @@ -27,6 +25,7 @@
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/navigation_drawer_header"
app:insetForeground="@android:color/transparent"
app:menu="@menu/navigation_drawer_menu" />

</android.support.v4.widget.DrawerLayout>
Binary file added src/main/res/mipmap-xhdpi/topinfo_ban_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/res/mipmap-xhdpi/topmenu_icn_free.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/res/mipmap-xhdpi/topmenu_icn_member.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/res/mipmap-xhdpi/topmenu_icn_msg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/res/mipmap-xhdpi/topmenu_icn_store.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 215e806

Please sign in to comment.