frame update 3

ongbodev
ongbo 6 years ago
parent d51caed138
commit 3c6844b51f

@ -25,6 +25,7 @@ android {
repositories {
maven { url 'https://jitpack.io' }
jcenter()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
@ -57,5 +58,8 @@ dependencies {
implementation 'com.github.yalantis:jellytoolbar:v1.0'
//
implementation 'com.github.yalantis:Side-Menu.Android:1.0.1'
implementation 'com.mxn.soul:flowingdrawer-core:2.1.0'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.squareup.picasso:picasso:2.5.0'
}

@ -0,0 +1,90 @@
//package com.example.HomeContent;
//
//import android.content.Context;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.ViewGroup;
//import android.widget.FrameLayout;
//import android.widget.ImageButton;
//import android.widget.ImageView;
//import android.widget.TextSwitcher;
//
//import androidx.annotation.NonNull;
//import androidx.recyclerview.widget.RecyclerView;
//
//import com.example.PersonalCenter.FeedAdapter;
//import com.example.cmknowledgegraph.R;
//
//public class HomeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
// private Context context;
// private int itemsCount = 0;
//
// public HomeAdapter(Context context){this.context = context;}
//
//
// @NonNull
// @Override
// public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
// final View view = LayoutInflater.from(context).inflate(R.layout.item_feed, parent, false);
//
// return new HomeAdapter.CellFeedViewHolder(view);
// }
//
// @Override
// public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
// final FeedAdapter.CellFeedViewHolder holder = (FeedAdapter.CellFeedViewHolder) viewHolder;
// bindDefaultFeedItem(position, holder);
// }
// private void bindDefaultFeedItem(int position, FeedAdapter.CellFeedViewHolder holder) {
// if (position % 2 == 0) {
// holder.ivFeedCenter.setImageResource(R.drawable.img_feed_center_1);
// holder.ivFeedBottom.setImageResource(R.drawable.img_feed_bottom_1);
// } else {
// holder.ivFeedCenter.setImageResource(R.drawable.img_feed_center_2);
// holder.ivFeedBottom.setImageResource(R.drawable.img_feed_bottom_2);
// }
//
// holder.btnComments.setTag(position);
// holder.btnMore.setTag(position);
// holder.ivFeedCenter.setTag(holder);
// holder.btnLike.setTag(holder);
//
// }
// public void updateItems() {
// itemsCount = 10;
// notifyDataSetChanged();
// }
// @Override
// public int getItemCount() {
// return itemsCount;
// }
//
// @Override
// public int getItemViewType(int position) {
// return 1;
// }
//// 在这里构建一个cell的内容
// private static class CellFeedViewHolder extends RecyclerView.ViewHolder {
// ImageView ivFeedCenter;
// ImageView ivFeedBottom;
// ImageButton btnComments;
// ImageButton btnLike;
// ImageButton btnMore;
// TextSwitcher tsLikesCounter;
// ImageView ivUserProfile;
// FrameLayout vImageRoot;
//
// CellFeedViewHolder(View view) {
// super(view);
//
// ivFeedCenter = (ImageView) view.findViewById(R.id.ivFeedCenter);
// ivFeedBottom = (ImageView) view.findViewById(R.id.ivFeedBottom);
// btnComments = (ImageButton) view.findViewById(R.id.btnComments);
// btnLike = (ImageButton) view.findViewById(R.id.btnLike);
// btnMore = (ImageButton) view.findViewById(R.id.btnMore);
// tsLikesCounter = (TextSwitcher) view.findViewById(R.id.tsLikesCounter);
// ivUserProfile = (ImageView) view.findViewById(R.id.ivUserProfile);
// vImageRoot = (FrameLayout) view.findViewById(R.id.vImageRoot);
// }
// }
//}

@ -0,0 +1,56 @@
package com.example.PersonalCenter;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import com.squareup.picasso.Transformation;
class CircleTransformation implements Transformation {
private static final int STROKE_WIDTH = 6;
@Override
public Bitmap transform(Bitmap source) {
int size = Math.min(source.getWidth(), source.getHeight());
int x = (source.getWidth() - size) / 2;
int y = (source.getHeight() - size) / 2;
Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size);
if (squaredBitmap != source) {
source.recycle();
}
Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig());
Canvas canvas = new Canvas(bitmap);
Paint avatarPaint = new Paint();
BitmapShader shader = new BitmapShader(squaredBitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP);
avatarPaint.setShader(shader);
Paint outlinePaint = new Paint();
outlinePaint.setColor(Color.WHITE);
outlinePaint.setStyle(Paint.Style.STROKE);
outlinePaint.setStrokeWidth(STROKE_WIDTH);
outlinePaint.setAntiAlias(true);
float r = size / 2f;
canvas.drawCircle(r, r, r, avatarPaint);
canvas.drawCircle(r, r, r - STROKE_WIDTH / 2, outlinePaint);
squaredBitmap.recycle();
return bitmap;
}
@Override
public String key() {
return "circleTransformation()";
}
}

@ -0,0 +1,97 @@
package com.example.PersonalCenter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextSwitcher;
import androidx.recyclerview.widget.RecyclerView;
import com.example.cmknowledgegraph.R;
public class FeedAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private Context context;
private int itemsCount = 0;
public FeedAdapter(Context context) {
this.context = context;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
final View view = LayoutInflater.from(context).inflate(R.layout.item_feed, parent, false);
return new CellFeedViewHolder(view);
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
final CellFeedViewHolder holder = (CellFeedViewHolder) viewHolder;
bindDefaultFeedItem(position, holder);
}
private void bindDefaultFeedItem(int position, CellFeedViewHolder holder) {
if (position % 2 == 0) {
holder.ivFeedCenter.setImageResource(R.drawable.img_feed_center_1);
holder.ivFeedBottom.setImageResource(R.drawable.img_feed_bottom_1);
} else {
holder.ivFeedCenter.setImageResource(R.drawable.img_feed_center_2);
holder.ivFeedBottom.setImageResource(R.drawable.img_feed_bottom_2);
}
holder.btnComments.setTag(position);
holder.btnMore.setTag(position);
holder.ivFeedCenter.setTag(holder);
holder.btnLike.setTag(holder);
}
public void updateItems() {
itemsCount = 10;
notifyDataSetChanged();
}
@Override
public int getItemViewType(int position) {
return 1;
}
@Override
public int getItemCount() {
return itemsCount;
}
private static class CellFeedViewHolder extends RecyclerView.ViewHolder {
ImageView ivFeedCenter;
ImageView ivFeedBottom;
ImageButton btnComments;
ImageButton btnLike;
ImageButton btnMore;
TextSwitcher tsLikesCounter;
ImageView ivUserProfile;
FrameLayout vImageRoot;
CellFeedViewHolder(View view) {
super(view);
ivFeedCenter = (ImageView) view.findViewById(R.id.ivFeedCenter);
ivFeedBottom = (ImageView) view.findViewById(R.id.ivFeedBottom);
btnComments = (ImageButton) view.findViewById(R.id.btnComments);
btnLike = (ImageButton) view.findViewById(R.id.btnLike);
btnMore = (ImageButton) view.findViewById(R.id.btnMore);
tsLikesCounter = (TextSwitcher) view.findViewById(R.id.tsLikesCounter);
ivUserProfile = (ImageView) view.findViewById(R.id.ivUserProfile);
vImageRoot = (FrameLayout) view.findViewById(R.id.vImageRoot);
}
}
}

@ -0,0 +1,76 @@
package com.example.PersonalCenter;
import com.example.cmknowledgegraph.R;
import com.google.android.material.navigation.NavigationView;
import com.squareup.picasso.Picasso;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
/**
* Created by mxn on 2016/12/13.
* MenuListFragment
*/
public class MenuListFragment extends Fragment {
private ImageView ivMenuUserProfilePhoto;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_menu, container,
false);
Log.i("view==","=="+view.toString()+"==");
NavigationView linearLayout = view.findViewById(R.id.vNavigation);
View frameLayout = linearLayout.inflateHeaderView(R.layout.view_global_menu_header);
ivMenuUserProfilePhoto = (ImageView) frameLayout.findViewById(R.id.ivMenuUserProfilePhoto);
Log.i("ismenu---===","====)"+ivMenuUserProfilePhoto.toString());
NavigationView vNavigation = (NavigationView) view.findViewById(R.id.vNavigation);
vNavigation.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
Toast.makeText(getActivity(),menuItem.getTitle(),Toast.LENGTH_SHORT).show();
return false;
}
}) ;
setupHeader();
return view ;
}
private void setupHeader() {
int avatarSize = getResources().getDimensionPixelSize(R.dimen.global_menu_avatar_size);
String profilePhoto = getResources().getString(R.string.user_profile_photo);
//在这里加载对应的图片信息
// Picasso.with(getActivity())
// .load(R.drawable.draw1)
// .placeholder(R.drawable.img_circle_placeholder)
// .resize(avatarSize, avatarSize)
// .centerCrop()
// .transform(new CircleTransformation())
// .into(ivMenuUserProfilePhoto);
Picasso.with(getActivity())
.load(R.drawable.draw1)
.placeholder(R.drawable.img_circle_placeholder)
.into(ivMenuUserProfilePhoto);
}
}

@ -0,0 +1,32 @@
package com.example.PersonalCenter;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.FrameLayout;
public class SquaredFrameLayout extends FrameLayout {
public SquaredFrameLayout(Context context) {
super(context);
}
public SquaredFrameLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SquaredFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public SquaredFrameLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, widthMeasureSpec);
}
}

@ -5,10 +5,25 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
public class MainContent extends Fragment {
protected int res;
private RecyclerView rvFeed;
AppCompatActivity appCompatActivity;
public AppCompatActivity getAppCompatActivity() {
return appCompatActivity;
}
public void setAppCompatActivity(AppCompatActivity appCompatActivity) {
this.appCompatActivity = appCompatActivity;
}
//创建视图
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -16,4 +31,9 @@ public class MainContent extends Fragment {
// Inflate the layout for this fragment
return inflater.inflate( R.layout.activity_home, container, false ); //要加载的layout文件
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
}

@ -1,6 +1,7 @@
package com.example.cmknowledgegraph;
import android.app.Person;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@ -12,9 +13,19 @@ import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.PersonalCenter.FeedAdapter;
import com.example.PersonalCenter.MenuListFragment;
import com.mxn.soul.flowingdrawer_core.ElasticDrawer;
import com.mxn.soul.flowingdrawer_core.FlowingDrawer;
import yalantis.com.sidemenu.interfaces.Resourceble;
import yalantis.com.sidemenu.interfaces.ScreenShotable;
@ -25,8 +36,13 @@ public class PersonContent extends Fragment {
protected int res;
private RecyclerView rvFeed;
private FlowingDrawer mDrawer;
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
MainActivity mainActivity = (MainActivity) context;
}
AppCompatActivity appCompatActivity;
@ -40,26 +56,92 @@ public class PersonContent extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate( R.layout.activity_personality_center, container, false ); //要加载的layout文件
}
public void onActivityCreated(Bundle savedInstanceState) {
// TODO Auto-generated method stub
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Button login_pc_btn = (Button) getActivity().findViewById(R.id.login_pc_button);
login_pc_btn.setOnClickListener(new View.OnClickListener() {
rvFeed = (RecyclerView) appCompatActivity.findViewById(R.id.rvFeed);
mDrawer = (FlowingDrawer) appCompatActivity.findViewById(R.id.drawerlayout);
mDrawer.setTouchMode(ElasticDrawer.TOUCH_MODE_BEZEL);
//设置工具栏
setupToolbar();
//设置直接页面
setupFeed();
//设置侧滑菜单
setupMenu();
}
protected void setupToolbar() {
Toolbar toolbar = (Toolbar) appCompatActivity.findViewById(R.id.toolbar);
appCompatActivity.setSupportActionBar(toolbar);
//这里是图片,可以将其动态加载用户图片,如果没有登录就改成别的。
toolbar.setNavigationIcon(R.drawable.ic_menu_white);
//点击了就开始侧滑
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent();
intent.setClass(getActivity(),LoginActivity.class);
startActivity(intent);
mDrawer.toggleMenu();
}
});
}
//设置没有侧滑之前的状态页面
//在这里将东西其改成几个按钮
private void setupFeed() {
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(appCompatActivity) {
@Override
protected int getExtraLayoutSpace(RecyclerView.State state) {
return 300;
}
};
rvFeed.setLayoutManager(linearLayoutManager);
FeedAdapter feedAdapter = new FeedAdapter(appCompatActivity);
rvFeed.setAdapter(feedAdapter);
feedAdapter.updateItems();
}
//设置菜单
private void setupMenu() {
FragmentManager fm = appCompatActivity.getSupportFragmentManager();//获取Fragment管理器
MenuListFragment mMenuFragment = (MenuListFragment) fm.findFragmentById(R.id.id_container_menu);
if (mMenuFragment == null) {
mMenuFragment = new MenuListFragment();
fm.beginTransaction().add(R.id.id_container_menu, mMenuFragment).commit();
//向activity添加一个布局
}
// mDrawer.setOnDrawerStateChangeListener(new ElasticDrawer.OnDrawerStateChangeListener() {
// @Override
// public void onDrawerStateChange(int oldState, int newState) {
// if (newState == ElasticDrawer.STATE_CLOSED) {
// Log.i("MainActivity", "Drawer STATE_CLOSED");
// }
// }
//
// @Override
// public void onDrawerSlide(float openRatio, int offsetPixels) {
// Log.i("MainActivity", "openRatio=" + openRatio + " ,offsetPixels=" + offsetPixels);
// }
// });
}
//
// public void onActivityCreated(Bundle savedInstanceState) {
// // TODO Auto-generated method stub
// super.onActivityCreated(savedInstanceState);
//
// Button login_pc_btn = (Button) getActivity().findViewById(R.id.login_pc_button);
// login_pc_btn.setOnClickListener(new View.OnClickListener() {
// public void onClick(View v) {
//
// Intent intent=new Intent();
// intent.setClass(getActivity(),LoginActivity.class);
// startActivity(intent);
// }
// });
// }
// @Override
// public void onResume() {

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="150"
android:interpolator="@android:anim/linear_interpolator">
<translate
android:fromYDelta="80%p"
android:toYDelta="0" />
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0" />
</set>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="150"
android:interpolator="@android:anim/linear_interpolator">
<translate
android:fromYDelta="0"
android:toYDelta="-80%p" />
<alpha
android:fromAlpha="1.0"
android:toAlpha="0.0" />
</set>

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!--drawable/btn_feed_action.xml-->
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:enterFadeDuration="200" android:exitFadeDuration="200">
<item android:state_pressed="false">
<shape android:shape="oval">
<solid android:color="@android:color/transparent" />
</shape>
</item>
<item android:state_pressed="true">
<shape android:shape="oval">
<solid android:color="#6621425d" />
</shape>
</item>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 654 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 851 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 881 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#ffffff" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 KiB

@ -1,213 +1,270 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
<com.mxn.soul.flowingdrawer_core.FlowingDrawer
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawerlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".PersonalityCenterActivity">
<ImageView
android:id="@+id/head_picture"
android:layout_width="110dp"
android:layout_height="110dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="150dp"
android:layout_centerInParent="true"
android:src="@mipmap/picture"/>
<Button
android:id="@+id/login_pc_button"
android:layout_width="100dp"
android:layout_height="50dp"
android:text="登录"
android:textSize="20sp"
android:background="#FFDAB9"
android:layout_marginLeft="157dp"
android:visibility="visible"/>
<Button
android:id="@+id/welcom_btn"
android:layout_width="100dp"
android:layout_height="50dp"
android:text="欢迎"
android:textSize="20sp"
android:background="#FFDAB9"
android:layout_marginLeft="157dp"
android:visibility="gone"/>
<View
android:layout_marginTop="20dp"
android:layout_height="1px"
android:background="#000000"
android:layout_width="fill_parent"/>
<LinearLayout
android:clipChildren="false"
android:clipToPadding="false"
app:edPosition="1"
app:edMenuSize="260dp"
app:edMenuBackground="#dddddd">
<!--content-->
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:layout_height="match_parent"
android:orientation="vertical">
>
<!-- 主要页面的内容也就是在person直接能看到的-->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvFeed"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
//最上面的菜单栏
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/yellow_star1"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="2dp"
android:src="@mipmap/star"/>
<include
android:id="@+id/toolbar"
layout="@layout/view_feed_toolbar"/>
</com.google.android.material.appbar.AppBarLayout>
<TextView
android:id="@+id/personal"
android:layout_width="100dp"
android:layout_height="40dp"
android:text="个性推荐"
android:textSize="18sp"
android:layout_marginTop="12dp"
android:layout_marginLeft="16dp"/>
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<View
android:layout_height="1px"
android:background="#000000"
android:layout_width="fill_parent"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/yellow_star2"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="2dp"
android:src="@mipmap/star"/>
<TextView
android:id="@+id/diet_hobby"
android:layout_width="100dp"
android:layout_height="40dp"
android:text="饮食爱好"
android:textSize="18sp"
android:layout_marginTop="12dp"
android:layout_marginLeft="16dp"/>
</LinearLayout>
<View
android:layout_height="1px"
android:background="#000000"
android:layout_width="fill_parent"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/yellow_star3"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="2dp"
android:src="@mipmap/star"/>
<TextView
android:id="@+id/regimen"
android:layout_width="100dp"
android:layout_height="40dp"
android:text="养生方案"
android:textSize="18sp"
android:layout_marginTop="12dp"
android:layout_marginLeft="16dp"/>
</LinearLayout>
<View
android:layout_height="1px"
android:background="#000000"
android:layout_width="fill_parent"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/yellow_star4"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="2dp"
android:src="@mipmap/star"/>
<TextView
android:id="@+id/history"
android:layout_width="100dp"
android:layout_height="40dp"
android:text="浏览记录"
android:textSize="18sp"
android:layout_marginTop="12dp"
android:layout_marginLeft="16dp"/>
</LinearLayout>
<View
android:layout_height="1px"
android:background="#000000"
android:layout_width="fill_parent"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/yellow_star5"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="2dp"
android:src="@mipmap/star"/>
<TextView
android:id="@+id/message"
android:layout_width="100dp"
android:layout_height="40dp"
android:text="消息通知"
android:textSize="18sp"
android:layout_marginTop="12dp"
android:layout_marginLeft="16dp"/>
</LinearLayout>
<View
android:layout_height="1px"
android:background="#000000"
android:layout_width="fill_parent"/>
<LinearLayout
<!--menu在这里设置的是左侧的菜单内容-->
<com.mxn.soul.flowingdrawer_core.FlowingMenuLayout
android:id="@+id/menulayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/yellow_star6"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginLeft="2dp"
android:src="@mipmap/star"/>
<TextView
android:id="@+id/setting"
android:layout_width="100dp"
android:layout_height="40dp"
android:text="设置"
android:textSize="18sp"
android:layout_marginTop="12dp"
android:layout_marginLeft="16dp"/>
</LinearLayout>
<View
android:layout_height="1px"
android:background="#000000"
android:layout_width="fill_parent"/>
</LinearLayout>
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/id_container_menu"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</com.mxn.soul.flowingdrawer_core.FlowingMenuLayout>
</com.mxn.soul.flowingdrawer_core.FlowingDrawer>
<!--<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"-->
<!-- xmlns:tools="http://schemas.android.com/tools"-->
<!-- android:orientation="vertical"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- tools:context=".PersonalityCenterActivity">-->
<!-- <ImageView-->
<!-- android:id="@+id/head_picture"-->
<!-- android:layout_width="110dp"-->
<!-- android:layout_height="110dp"-->
<!-- android:layout_marginTop="20dp"-->
<!-- android:layout_marginLeft="150dp"-->
<!-- android:layout_centerInParent="true"-->
<!-- android:src="@mipmap/picture"/>-->
<!-- <Button-->
<!-- android:id="@+id/login_pc_button"-->
<!-- android:layout_width="100dp"-->
<!-- android:layout_height="50dp"-->
<!-- android:text="登录"-->
<!-- android:textSize="20sp"-->
<!-- android:background="#FFDAB9"-->
<!-- android:layout_marginLeft="157dp"-->
<!-- android:visibility="visible"/>-->
<!-- <Button-->
<!-- android:id="@+id/welcom_btn"-->
<!-- android:layout_width="100dp"-->
<!-- android:layout_height="50dp"-->
<!-- android:text="欢迎"-->
<!-- android:textSize="20sp"-->
<!-- android:background="#FFDAB9"-->
<!-- android:layout_marginLeft="157dp"-->
<!-- android:visibility="gone"/>-->
<!-- <View-->
<!-- android:layout_marginTop="20dp"-->
<!-- android:layout_height="1px"-->
<!-- android:background="#000000"-->
<!-- android:layout_width="fill_parent"/>-->
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal">-->
<!-- <ImageView-->
<!-- android:id="@+id/yellow_star1"-->
<!-- android:layout_width="50dp"-->
<!-- android:layout_height="50dp"-->
<!-- android:layout_marginLeft="2dp"-->
<!-- android:src="@mipmap/star"/>-->
<!-- <TextView-->
<!-- android:id="@+id/personal"-->
<!-- android:layout_width="100dp"-->
<!-- android:layout_height="40dp"-->
<!-- android:text="个性推荐"-->
<!-- android:textSize="18sp"-->
<!-- android:layout_marginTop="12dp"-->
<!-- android:layout_marginLeft="16dp"/>-->
<!-- </LinearLayout>-->
<!-- <View-->
<!-- android:layout_height="1px"-->
<!-- android:background="#000000"-->
<!-- android:layout_width="fill_parent"/>-->
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal">-->
<!-- <ImageView-->
<!-- android:id="@+id/yellow_star2"-->
<!-- android:layout_width="50dp"-->
<!-- android:layout_height="50dp"-->
<!-- android:layout_marginLeft="2dp"-->
<!-- android:src="@mipmap/star"/>-->
<!-- <TextView-->
<!-- android:id="@+id/diet_hobby"-->
<!-- android:layout_width="100dp"-->
<!-- android:layout_height="40dp"-->
<!-- android:text="饮食爱好"-->
<!-- android:textSize="18sp"-->
<!-- android:layout_marginTop="12dp"-->
<!-- android:layout_marginLeft="16dp"/>-->
<!-- </LinearLayout>-->
<!-- <View-->
<!-- android:layout_height="1px"-->
<!-- android:background="#000000"-->
<!-- android:layout_width="fill_parent"/>-->
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal">-->
<!-- <ImageView-->
<!-- android:id="@+id/yellow_star3"-->
<!-- android:layout_width="50dp"-->
<!-- android:layout_height="50dp"-->
<!-- android:layout_marginLeft="2dp"-->
<!-- android:src="@mipmap/star"/>-->
<!-- <TextView-->
<!-- android:id="@+id/regimen"-->
<!-- android:layout_width="100dp"-->
<!-- android:layout_height="40dp"-->
<!-- android:text="养生方案"-->
<!-- android:textSize="18sp"-->
<!-- android:layout_marginTop="12dp"-->
<!-- android:layout_marginLeft="16dp"/>-->
<!-- </LinearLayout>-->
<!-- <View-->
<!-- android:layout_height="1px"-->
<!-- android:background="#000000"-->
<!-- android:layout_width="fill_parent"/>-->
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal">-->
<!-- <ImageView-->
<!-- android:id="@+id/yellow_star4"-->
<!-- android:layout_width="50dp"-->
<!-- android:layout_height="50dp"-->
<!-- android:layout_marginLeft="2dp"-->
<!-- android:src="@mipmap/star"/>-->
<!-- <TextView-->
<!-- android:id="@+id/history"-->
<!-- android:layout_width="100dp"-->
<!-- android:layout_height="40dp"-->
<!-- android:text="浏览记录"-->
<!-- android:textSize="18sp"-->
<!-- android:layout_marginTop="12dp"-->
<!-- android:layout_marginLeft="16dp"/>-->
<!-- </LinearLayout>-->
<!-- <View-->
<!-- android:layout_height="1px"-->
<!-- android:background="#000000"-->
<!-- android:layout_width="fill_parent"/>-->
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal">-->
<!-- <ImageView-->
<!-- android:id="@+id/yellow_star5"-->
<!-- android:layout_width="50dp"-->
<!-- android:layout_height="50dp"-->
<!-- android:layout_marginLeft="2dp"-->
<!-- android:src="@mipmap/star"/>-->
<!-- <TextView-->
<!-- android:id="@+id/message"-->
<!-- android:layout_width="100dp"-->
<!-- android:layout_height="40dp"-->
<!-- android:text="消息通知"-->
<!-- android:textSize="18sp"-->
<!-- android:layout_marginTop="12dp"-->
<!-- android:layout_marginLeft="16dp"/>-->
<!-- </LinearLayout>-->
<!-- <View-->
<!-- android:layout_height="1px"-->
<!-- android:background="#000000"-->
<!-- android:layout_width="fill_parent"/>-->
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="horizontal">-->
<!-- <ImageView-->
<!-- android:id="@+id/yellow_star6"-->
<!-- android:layout_width="50dp"-->
<!-- android:layout_height="50dp"-->
<!-- android:layout_marginLeft="2dp"-->
<!-- android:src="@mipmap/star"/>-->
<!-- <TextView-->
<!-- android:id="@+id/setting"-->
<!-- android:layout_width="100dp"-->
<!-- android:layout_height="40dp"-->
<!-- android:text="设置"-->
<!-- android:textSize="18sp"-->
<!-- android:layout_marginTop="12dp"-->
<!-- android:layout_marginLeft="16dp"/>-->
<!-- </LinearLayout>-->
<!-- <View-->
<!-- android:layout_height="1px"-->
<!-- android:background="#000000"-->
<!-- android:layout_width="fill_parent"/>-->
<!--</LinearLayout>-->

@ -0,0 +1,19 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<com.google.android.material.navigation.NavigationView
android:id="@+id/vNavigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/transparent"
app:headerLayout="@layout/view_global_menu_header"
app:itemIconTint="#8b8b8b"
app:itemTextColor="#666666"
app:menu="@menu/drawer_menu"/>
</RelativeLayout>

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?><!-- item_feed.xml -->
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="8dp"
card_view:cardCornerRadius="4dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/ivUserProfile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_feed_top" />
<com.example.PersonalCenter.SquaredFrameLayout
android:id="@+id/vImageRoot"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/ivFeedCenter"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
</com.example.PersonalCenter.SquaredFrameLayout>
<ImageView
android:id="@+id/ivFeedBottom"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp">
<ImageButton
android:id="@+id/btnLike"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/btn_feed_action"
android:src="@drawable/ic_heart_outline_grey" />
<ImageButton
android:id="@+id/btnComments"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/btn_feed_action"
android:src="@drawable/ic_comment_outline_grey" />
<ImageButton
android:id="@+id/btnMore"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@drawable/btn_feed_action"
android:src="@drawable/ic_more_grey" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical|right">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_heart_small_blue" />
<TextSwitcher
android:id="@+id/tsLikesCounter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:inAnimation="@anim/slide_in_likes_counter"
android:outAnimation="@anim/slide_out_likes_counter">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123 likes"
android:textColor="@color/text_like_counter" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/text_like_counter" />
</TextSwitcher>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:elevation="@dimen/default_elevation"
app:layout_scrollFlags="scroll|enterAlways"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
</androidx.appcompat.widget.Toolbar>

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:clickable="true">
<LinearLayout
android:id="@+id/vGlobalMenuHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/ivMenuUserProfilePhoto"
android:layout_width="@dimen/global_menu_avatar_size"
android:layout_height="@dimen/global_menu_avatar_size"
android:layout_margin="12dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="mxn"
android:textColor="#2d5d82"
android:textSize="16sp"
android:textStyle="bold" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="16dp"
android:background="@android:color/transparent"
android:src="@drawable/ic_global_menu_search" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="bottom"
android:background="#dddddd" />
</FrameLayout>

@ -0,0 +1,36 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:id="@+id/menu_group_1">
<item
android:id="@+id/menu_feed"
android:icon="@drawable/ic_global_menu_feed"
android:title="My Feed" />
<item
android:id="@+id/menu_direct"
android:icon="@drawable/ic_global_menu_direct"
android:title="Instagram Direct" />
<item
android:id="@+id/menu_news"
android:icon="@drawable/ic_global_menu_news"
android:title="News" />
<item
android:id="@+id/menu_popular"
android:icon="@drawable/ic_global_menu_popular"
android:title="Popular" />
<item
android:id="@+id/menu_photos_nearby"
android:icon="@drawable/ic_global_menu_nearby"
android:title="Photos Nearby" />
<item
android:id="@+id/menu_photo_you_liked"
android:icon="@drawable/ic_global_menu_likes"
android:title="Photos You've Liked" />
</group>
<group android:id="@+id/menu_group_2">
<item
android:id="@+id/menu_settings"
android:title="Settings" />
<item
android:id="@+id/menu_about"
android:title="About" />
</group>
</menu>

@ -6,4 +6,12 @@
<color name="colorTransparent">#00ffffff</color>
<color name="colorStart">#cb5ed9</color>
<color name="colorEnd">#8463d4</color>
<color name="style_color_primary">#2d5d82</color>
<color name="style_color_primary_dark">#21425d</color>
<color name="style_color_accent">#01bcd5</color>
<color name="fab_color_pressed">#007787</color>
<color name="fab_color_shadow">#44000000</color>
<color name="text_like_counter">#2b5a83</color>
<color name="paint_color">#dddddd</color>
</resources>

@ -2,4 +2,7 @@
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
<dimen name="user_profile_avatar_size">88dp</dimen>
<dimen name="global_menu_avatar_size">64dp</dimen>
<dimen name="default_elevation">8dp</dimen>
</resources>

@ -4,4 +4,8 @@
<string name="action_settings">Settings</string>
<string name="drawer_open">Open</string>
<string name="drawer_close">Close</string>
<string name="hello_world">Hello world!</string>
<string name="user_profile_photo">http://baobaoloveyou.com/flowingdrawer_icon.png</string>
</resources>

Loading…
Cancel
Save