Commit 970c6223bb831230bd34de74d2da0a0a6206fffa
代码整理
Showing
9 changed files
with
375 additions
and
127 deletions
app/src/main/java/com/cnlive/gundam/main/ui/fragment/ConfigFragment.java
| @@ -9,12 +9,14 @@ import android.view.LayoutInflater; | @@ -9,12 +9,14 @@ import android.view.LayoutInflater; | ||
| 9 | import android.view.View; | 9 | import android.view.View; |
| 10 | import android.view.ViewGroup; | 10 | import android.view.ViewGroup; |
| 11 | 11 | ||
| 12 | +import com.bumptech.glide.Glide; | ||
| 12 | import com.cnlive.gundam.R; | 13 | import com.cnlive.gundam.R; |
| 13 | import com.cnlive.gundam.databinding.UserFragmentBinding; | 14 | import com.cnlive.gundam.databinding.UserFragmentBinding; |
| 14 | import com.cnlive.gundam.user.activity.CommentActivity; | 15 | import com.cnlive.gundam.user.activity.CommentActivity; |
| 15 | import com.cnlive.gundam.user.activity.LoginActivity; | 16 | import com.cnlive.gundam.user.activity.LoginActivity; |
| 17 | +import com.cnlive.gundam.user.activity.UserPersonalActivity; | ||
| 16 | import com.cnlive.gundam.user.auth.UserService; | 18 | import com.cnlive.gundam.user.auth.UserService; |
| 17 | - | 19 | +import com.cnlive.gundam.user.model.User; |
| 18 | 20 | ||
| 19 | 21 | ||
| 20 | /** | 22 | /** |
| @@ -28,7 +30,6 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { | @@ -28,7 +30,6 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { | ||
| 28 | @Override | 30 | @Override |
| 29 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | 31 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { |
| 30 | binding = DataBindingUtil.inflate(inflater, R.layout.user_fragment, container, false); | 32 | binding = DataBindingUtil.inflate(inflater, R.layout.user_fragment, container, false); |
| 31 | - | ||
| 32 | return binding.getRoot(); | 33 | return binding.getRoot(); |
| 33 | } | 34 | } |
| 34 | 35 | ||
| @@ -39,24 +40,14 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { | @@ -39,24 +40,14 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { | ||
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | 42 | ||
| 42 | - /* public static Fragment newInstance() { | ||
| 43 | - UserFragment fragment = new UserFragment(); | ||
| 44 | - return fragment; | ||
| 45 | - }*/ | ||
| 46 | - | ||
| 47 | @Override | 43 | @Override |
| 48 | public void onActivityCreated(Bundle savedInstanceState) { | 44 | public void onActivityCreated(Bundle savedInstanceState) { |
| 49 | super.onActivityCreated(savedInstanceState); | 45 | super.onActivityCreated(savedInstanceState); |
| 50 | 46 | ||
| 51 | - | ||
| 52 | - /*initToolBar(); | ||
| 53 | - init(); | ||
| 54 | - MyHeadItem.getContent(getActivity());*/ | ||
| 55 | } | 47 | } |
| 56 | 48 | ||
| 57 | private void initUI() { | 49 | private void initUI() { |
| 58 | binding.configHeader.setOnClickListener(this); | 50 | binding.configHeader.setOnClickListener(this); |
| 59 | - binding.live.setOnClickListener(this); | ||
| 60 | binding.message.setOnClickListener(this); | 51 | binding.message.setOnClickListener(this); |
| 61 | } | 52 | } |
| 62 | 53 | ||
| @@ -64,28 +55,32 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { | @@ -64,28 +55,32 @@ public class ConfigFragment extends Fragment implements View.OnClickListener { | ||
| 64 | @Override | 55 | @Override |
| 65 | public void onClick(View view) { | 56 | public void onClick(View view) { |
| 66 | switch (view.getId()) { | 57 | switch (view.getId()) { |
| 67 | - | ||
| 68 | - | ||
| 69 | case R.id.config_header: | 58 | case R.id.config_header: |
| 70 | int uid = UserService.getInstance(getActivity()).getActiveAccountInfo().getUid(); | 59 | int uid = UserService.getInstance(getActivity()).getActiveAccountInfo().getUid(); |
| 71 | - if (uid != 0) { | ||
| 72 | - //进入个人中心页面 | ||
| 73 | - //startActivity(new Intent(getActivity(), UserPersonalActivity.class)); | ||
| 74 | - } else { | ||
| 75 | - //进入登录页面 | 60 | + if (uid != 0) |
| 61 | + startActivity(new Intent(getActivity(), UserPersonalActivity.class)); | ||
| 62 | + else | ||
| 76 | startActivity(new Intent(getActivity(), LoginActivity.class)); | 63 | startActivity(new Intent(getActivity(), LoginActivity.class)); |
| 77 | - } | ||
| 78 | - | ||
| 79 | break; | 64 | break; |
| 80 | - case R.id.live: | ||
| 81 | 65 | ||
| 82 | - break; | ||
| 83 | case R.id.message: | 66 | case R.id.message: |
| 84 | startActivity(new Intent(getActivity(), CommentActivity.class)); | 67 | startActivity(new Intent(getActivity(), CommentActivity.class)); |
| 85 | - | ||
| 86 | break; | 68 | break; |
| 87 | 69 | ||
| 88 | } | 70 | } |
| 89 | 71 | ||
| 90 | } | 72 | } |
| 73 | + | ||
| 74 | + @Override | ||
| 75 | + public void onResume() { | ||
| 76 | + super.onResume(); | ||
| 77 | + notifyUI(); | ||
| 78 | + | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + private void notifyUI() { | ||
| 82 | + User activeAccountInfo = UserService.getInstance(getActivity()).getActiveAccountInfo(); | ||
| 83 | + Glide.with(getActivity()).load(activeAccountInfo.getFaceurl()).into(binding.headImg); | ||
| 84 | + binding.tvNickname.setText(activeAccountInfo.getNickname()); | ||
| 85 | + } | ||
| 91 | } | 86 | } |
app/src/main/java/com/cnlive/gundam/user/fragment/FeedbackFragment.java
| @@ -67,7 +67,7 @@ public class FeedbackFragment extends Fragment implements View.OnClickListener { | @@ -67,7 +67,7 @@ public class FeedbackFragment extends Fragment implements View.OnClickListener { | ||
| 67 | public void onClick(View v) { | 67 | public void onClick(View v) { |
| 68 | int i = v.getId(); | 68 | int i = v.getId(); |
| 69 | if (i == R.id.back_selector) {//返回上一页面 | 69 | if (i == R.id.back_selector) {//返回上一页面 |
| 70 | - getFragmentManager().popBackStack(); | 70 | + getActivity().finish(); |
| 71 | 71 | ||
| 72 | } else if (i == R.id.feedback) { | 72 | } else if (i == R.id.feedback) { |
| 73 | /** | 73 | /** |
| @@ -94,7 +94,7 @@ public class FeedbackFragment extends Fragment implements View.OnClickListener { | @@ -94,7 +94,7 @@ public class FeedbackFragment extends Fragment implements View.OnClickListener { | ||
| 94 | switch (what) { | 94 | switch (what) { |
| 95 | case IUserService.SUCCESS: | 95 | case IUserService.SUCCESS: |
| 96 | ToastUtil.show(getActivity(), "反馈成功"); | 96 | ToastUtil.show(getActivity(), "反馈成功"); |
| 97 | - getFragmentManager().popBackStack(); | 97 | + getActivity().finish(); |
| 98 | break; | 98 | break; |
| 99 | case IUserService.ERROR_PARAM: | 99 | case IUserService.ERROR_PARAM: |
| 100 | ToastUtil.show(getActivity(), IUserService.message_error_param); | 100 | ToastUtil.show(getActivity(), IUserService.message_error_param); |
app/src/main/java/com/cnlive/gundam/user/fragment/LoginFragment.java
| @@ -155,6 +155,7 @@ public class LoginFragment extends Fragment implements View.OnClickListener { | @@ -155,6 +155,7 @@ public class LoginFragment extends Fragment implements View.OnClickListener { | ||
| 155 | closeDialog(); | 155 | closeDialog(); |
| 156 | UserData userData = (UserData) obj; | 156 | UserData userData = (UserData) obj; |
| 157 | data = userData.getData(); | 157 | data = userData.getData(); |
| 158 | + | ||
| 158 | UserService userService = UserService.getInstance(getActivity()); | 159 | UserService userService = UserService.getInstance(getActivity()); |
| 159 | userService.setUserInfo(account, data); | 160 | userService.setUserInfo(account, data); |
| 160 | //userService.isAutoLogin(); | 161 | //userService.isAutoLogin(); |
app/src/main/java/com/cnlive/gundam/user/fragment/UserPersonalFragment.java
app/src/main/java/com/cnlive/gundam/user/view/CircleImageView.java
0 → 100644
| 1 | +package com.cnlive.gundam.user.view; | ||
| 2 | + | ||
| 3 | +import android.annotation.SuppressLint; | ||
| 4 | +import android.content.Context; | ||
| 5 | +import android.content.res.TypedArray; | ||
| 6 | +import android.graphics.Bitmap; | ||
| 7 | +import android.graphics.BitmapShader; | ||
| 8 | +import android.graphics.Canvas; | ||
| 9 | +import android.graphics.Color; | ||
| 10 | +import android.graphics.Matrix; | ||
| 11 | +import android.graphics.Paint; | ||
| 12 | +import android.graphics.RectF; | ||
| 13 | +import android.graphics.Shader; | ||
| 14 | +import android.graphics.drawable.BitmapDrawable; | ||
| 15 | +import android.graphics.drawable.ColorDrawable; | ||
| 16 | +import android.graphics.drawable.Drawable; | ||
| 17 | +import android.util.AttributeSet; | ||
| 18 | +import android.widget.ImageView; | ||
| 19 | + | ||
| 20 | +import com.cnlive.gundam.R; | ||
| 21 | + | ||
| 22 | + | ||
| 23 | +/** | ||
| 24 | + * @author 陈硕 | ||
| 25 | + * @time 2016/11/7 10:27 | ||
| 26 | + * @desc ${TODD} | ||
| 27 | + */ | ||
| 28 | +@SuppressLint("AppCompatCustomView") | ||
| 29 | +public class CircleImageView extends ImageView { | ||
| 30 | + | ||
| 31 | + | ||
| 32 | + private static final ImageView.ScaleType SCALE_TYPE = ImageView.ScaleType.CENTER_CROP; | ||
| 33 | + | ||
| 34 | + private static final Bitmap.Config BITMAP_CONFIG = Bitmap.Config.ARGB_8888; | ||
| 35 | + private static final int COLORDRAWABLE_DIMENSION = 1; | ||
| 36 | + | ||
| 37 | + private static final int DEFAULT_BORDER_WIDTH = 0; | ||
| 38 | + private static final int DEFAULT_BORDER_COLOR = Color.BLACK; | ||
| 39 | + | ||
| 40 | + private final RectF mDrawableRect = new RectF(); | ||
| 41 | + private final RectF mBorderRect = new RectF(); | ||
| 42 | + | ||
| 43 | + private final Matrix mShaderMatrix = new Matrix(); | ||
| 44 | + private final Paint mBitmapPaint = new Paint(); | ||
| 45 | + private final Paint mBorderPaint = new Paint(); | ||
| 46 | + | ||
| 47 | + private int mBorderColor = DEFAULT_BORDER_COLOR; | ||
| 48 | + private int mBorderWidth = DEFAULT_BORDER_WIDTH; | ||
| 49 | + | ||
| 50 | + private Bitmap mBitmap; | ||
| 51 | + private BitmapShader mBitmapShader; | ||
| 52 | + private int mBitmapWidth; | ||
| 53 | + private int mBitmapHeight; | ||
| 54 | + | ||
| 55 | + private float mDrawableRadius; | ||
| 56 | + private float mBorderRadius; | ||
| 57 | + | ||
| 58 | + private boolean mReady; | ||
| 59 | + private boolean mSetupPending; | ||
| 60 | + | ||
| 61 | + public CircleImageView(Context context) { | ||
| 62 | + super(context); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public CircleImageView(Context context, AttributeSet attrs) { | ||
| 66 | + this(context, attrs, 0); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public CircleImageView(Context context, AttributeSet attrs, int defStyle) { | ||
| 70 | + super(context, attrs, defStyle); | ||
| 71 | + super.setScaleType(SCALE_TYPE); | ||
| 72 | + | ||
| 73 | + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleImageView, defStyle, 0); | ||
| 74 | + | ||
| 75 | + mBorderWidth = a.getDimensionPixelSize(R.styleable.CircleImageView_border_width, DEFAULT_BORDER_WIDTH); | ||
| 76 | + mBorderColor = a.getColor(R.styleable.CircleImageView_border_color, DEFAULT_BORDER_COLOR); | ||
| 77 | + | ||
| 78 | + a.recycle(); | ||
| 79 | + | ||
| 80 | + mReady = true; | ||
| 81 | + | ||
| 82 | + if (mSetupPending) { | ||
| 83 | + setup(); | ||
| 84 | + mSetupPending = false; | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + @Override | ||
| 89 | + public ScaleType getScaleType() { | ||
| 90 | + return SCALE_TYPE; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + @Override | ||
| 94 | + public void setScaleType(ScaleType scaleType) { | ||
| 95 | + if (scaleType != SCALE_TYPE) { | ||
| 96 | + throw new IllegalArgumentException(String.format("ScaleType %s not supported.", scaleType)); | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @Override | ||
| 101 | + protected void onDraw(Canvas canvas) { | ||
| 102 | + if (getDrawable() == null) { | ||
| 103 | + return; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + canvas.drawCircle(getWidth() / 2, getHeight() / 2, mDrawableRadius, mBitmapPaint); | ||
| 107 | + canvas.drawCircle(getWidth() / 2, getHeight() / 2, mBorderRadius, mBorderPaint); | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + @Override | ||
| 111 | + protected void onSizeChanged(int w, int h, int oldw, int oldh) { | ||
| 112 | + super.onSizeChanged(w, h, oldw, oldh); | ||
| 113 | + setup(); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + public int getBorderColor() { | ||
| 117 | + return mBorderColor; | ||
| 118 | + } | ||
| 119 | + | ||
| 120 | + public void setBorderColor(int borderColor) { | ||
| 121 | + if (borderColor == mBorderColor) { | ||
| 122 | + return; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + mBorderColor = borderColor; | ||
| 126 | + mBorderPaint.setColor(mBorderColor); | ||
| 127 | + invalidate(); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + public int getBorderWidth() { | ||
| 131 | + return mBorderWidth; | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + public void setBorderWidth(int borderWidth) { | ||
| 135 | + if (borderWidth == mBorderWidth) { | ||
| 136 | + return; | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + mBorderWidth = borderWidth; | ||
| 140 | + setup(); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + @Override | ||
| 144 | + public void setImageBitmap(Bitmap bm) { | ||
| 145 | + super.setImageBitmap(bm); | ||
| 146 | + mBitmap = bm; | ||
| 147 | + setup(); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + @Override | ||
| 151 | + public void setImageDrawable(Drawable drawable) { | ||
| 152 | + super.setImageDrawable(drawable); | ||
| 153 | + mBitmap = getBitmapFromDrawable(drawable); | ||
| 154 | + setup(); | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + @Override | ||
| 158 | + public void setImageResource(int resId) { | ||
| 159 | + super.setImageResource(resId); | ||
| 160 | + mBitmap = getBitmapFromDrawable(getDrawable()); | ||
| 161 | + setup(); | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + private Bitmap getBitmapFromDrawable(Drawable drawable) { | ||
| 165 | + if (drawable == null) { | ||
| 166 | + return null; | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + if (drawable instanceof BitmapDrawable) { | ||
| 170 | + return ((BitmapDrawable) drawable).getBitmap(); | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + try { | ||
| 174 | + Bitmap bitmap; | ||
| 175 | + | ||
| 176 | + if (drawable instanceof ColorDrawable) { | ||
| 177 | + bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG); | ||
| 178 | + } else { | ||
| 179 | + bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), BITMAP_CONFIG); | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + Canvas canvas = new Canvas(bitmap); | ||
| 183 | + drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); | ||
| 184 | + drawable.draw(canvas); | ||
| 185 | + return bitmap; | ||
| 186 | + } catch (OutOfMemoryError e) { | ||
| 187 | + return null; | ||
| 188 | + } | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + private void setup() { | ||
| 192 | + if (!mReady) { | ||
| 193 | + mSetupPending = true; | ||
| 194 | + return; | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + if (mBitmap == null) { | ||
| 198 | + return; | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); | ||
| 202 | + | ||
| 203 | + mBitmapPaint.setAntiAlias(true); | ||
| 204 | + mBitmapPaint.setShader(mBitmapShader); | ||
| 205 | + | ||
| 206 | + mBorderPaint.setStyle(Paint.Style.STROKE); | ||
| 207 | + mBorderPaint.setAntiAlias(true); | ||
| 208 | + mBorderPaint.setColor(mBorderColor); | ||
| 209 | + mBorderPaint.setStrokeWidth(mBorderWidth); | ||
| 210 | + | ||
| 211 | + mBitmapHeight = mBitmap.getHeight(); | ||
| 212 | + mBitmapWidth = mBitmap.getWidth(); | ||
| 213 | + | ||
| 214 | + mBorderRect.set(0, 0, getWidth(), getHeight()); | ||
| 215 | + mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2); | ||
| 216 | + | ||
| 217 | + mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth); | ||
| 218 | + mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2); | ||
| 219 | + | ||
| 220 | + updateShaderMatrix(); | ||
| 221 | + invalidate(); | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + private void updateShaderMatrix() { | ||
| 225 | + float scale; | ||
| 226 | + float dx = 0; | ||
| 227 | + float dy = 0; | ||
| 228 | + | ||
| 229 | + mShaderMatrix.set(null); | ||
| 230 | + | ||
| 231 | + if (mBitmapWidth * mDrawableRect.height() > mDrawableRect.width() * mBitmapHeight) { | ||
| 232 | + scale = mDrawableRect.height() / (float) mBitmapHeight; | ||
| 233 | + dx = (mDrawableRect.width() - mBitmapWidth * scale) * 0.5f; | ||
| 234 | + } else { | ||
| 235 | + scale = mDrawableRect.width() / (float) mBitmapWidth; | ||
| 236 | + dy = (mDrawableRect.height() - mBitmapHeight * scale) * 0.5f; | ||
| 237 | + } | ||
| 238 | + | ||
| 239 | + mShaderMatrix.setScale(scale, scale); | ||
| 240 | + mShaderMatrix.postTranslate((int) (dx + 0.5f) + mBorderWidth, (int) (dy + 0.5f) + mBorderWidth); | ||
| 241 | + | ||
| 242 | + mBitmapShader.setLocalMatrix(mShaderMatrix); | ||
| 243 | + } | ||
| 244 | + | ||
| 245 | +} | ||
| 246 | + | ||
| 247 | + |
app/src/main/res/layout/user_feedback.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | -<layout xmlns:android="http://schemas.android.com/apk/res/android"> | 2 | +<layout xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | + > | ||
| 3 | 4 | ||
| 4 | 5 | ||
| 5 | - <RelativeLayout | ||
| 6 | - android:layout_width="match_parent" | ||
| 7 | - android:layout_height="match_parent"> | ||
| 8 | 6 | ||
| 9 | - <LinearLayout | ||
| 10 | - android:layout_width="match_parent" | ||
| 11 | - android:layout_height="wrap_content" | ||
| 12 | - android:orientation="vertical"> | 7 | +<RelativeLayout |
| 8 | + android:layout_width="match_parent" | ||
| 9 | + android:layout_height="match_parent"> | ||
| 10 | + | ||
| 11 | +<LinearLayout | ||
| 12 | + android:orientation="vertical" android:layout_width="match_parent" | ||
| 13 | + android:layout_height="wrap_content"> | ||
| 13 | 14 | ||
| 14 | - <include | ||
| 15 | - android:id="@+id/feedbackIncludeLayout" | ||
| 16 | - layout="@layout/user_toolbar_title" /> | 15 | + <include layout="@layout/user_toolbar_title" |
| 16 | + android:id="@+id/feedbackIncludeLayout"/> | ||
| 17 | 17 | ||
| 18 | - <include layout="@layout/user_divider_head_line" /> | 18 | + <include layout="@layout/user_divider_head_line" /> |
| 19 | 19 | ||
| 20 | - <View | ||
| 21 | - android:layout_width="match_parent" | ||
| 22 | - android:layout_height="@dimen/_20px" /> | 20 | + <View |
| 21 | + android:layout_width="match_parent" | ||
| 22 | + android:layout_height="@dimen/_20px" /> | ||
| 23 | 23 | ||
| 24 | - <EditText | ||
| 25 | - android:id="@+id/feedback_textView" | ||
| 26 | - android:layout_width="match_parent" | ||
| 27 | - android:layout_height="wrap_content" | ||
| 28 | - android:layout_centerVertical="true" | ||
| 29 | - android:layout_marginLeft="@dimen/_30px" | ||
| 30 | - android:background="@null" | ||
| 31 | - android:hint="有什么好的建议嘛" | ||
| 32 | - android:imeOptions="flagNoExtractUi" | ||
| 33 | - android:textColor="#000000" | ||
| 34 | - android:textColorHint="@color/color_list_bg" | ||
| 35 | - android:textSize="@dimen/text_size_15" /> | 24 | + <EditText |
| 25 | + android:id="@+id/feedback_textView" | ||
| 26 | + android:layout_width="match_parent" | ||
| 27 | + android:layout_height="wrap_content" | ||
| 28 | + android:paddingTop="@dimen/_20px" | ||
| 29 | + android:paddingBottom="@dimen/_20px" | ||
| 30 | + android:layout_centerVertical="true" | ||
| 31 | + android:layout_marginLeft="@dimen/_30px" | ||
| 32 | + android:background="@null" | ||
| 33 | + android:hint="有什么好的建议嘛" | ||
| 34 | + android:textColor="#000000" | ||
| 35 | + android:textColorHint="@color/color_list_bg" | ||
| 36 | + android:textSize="@dimen/text_size_15" | ||
| 37 | + android:imeOptions="flagNoExtractUi" /> | ||
| 36 | 38 | ||
| 37 | - <View | ||
| 38 | - android:layout_width="match_parent" | ||
| 39 | - android:layout_height="@dimen/_100px" /> | 39 | + <View |
| 40 | + android:layout_width="match_parent" | ||
| 41 | + android:layout_height="@dimen/_100px" /> | ||
| 40 | 42 | ||
| 41 | - <Button | ||
| 42 | - android:id="@+id/feedback" | ||
| 43 | - style="@style/LoginButtonStyle" | ||
| 44 | - android:layout_width="match_parent" | ||
| 45 | - android:layout_height="35dp" | ||
| 46 | - android:layout_alignParentBottom="true" | ||
| 47 | - android:layout_centerHorizontal="true" | ||
| 48 | - android:layout_gravity="center" | ||
| 49 | - android:layout_marginBottom="15dp" | ||
| 50 | - android:background="@drawable/user_btn_login" | ||
| 51 | - android:gravity="center" | ||
| 52 | - android:onClick="onClick" | ||
| 53 | - android:text="提交" /> | 43 | + <Button |
| 44 | + android:id="@+id/feedback" | ||
| 45 | + style="@style/LoginButtonStyle" | ||
| 46 | + android:layout_width="match_parent" | ||
| 47 | + android:layout_height="35dp" | ||
| 48 | + android:layout_gravity="center" | ||
| 49 | + android:layout_centerHorizontal="true" | ||
| 50 | + android:layout_marginBottom="15dp" | ||
| 51 | + android:layout_alignParentBottom="true" | ||
| 52 | + android:background="@drawable/user_btn_login" | ||
| 53 | + android:gravity="center" | ||
| 54 | + android:onClick="onClick" | ||
| 55 | + android:text="提交" /> | ||
| 54 | 56 | ||
| 55 | - </LinearLayout> | 57 | +</LinearLayout> |
| 56 | 58 | ||
| 57 | - <ImageView | ||
| 58 | - android:id="@+id/back_selector" | ||
| 59 | - android:layout_width="30dp" | ||
| 60 | - android:layout_height="30dp" | ||
| 61 | - android:layout_marginLeft="@dimen/_10px" | ||
| 62 | - android:layout_marginTop="@dimen/_20px" | ||
| 63 | - android:onClick="onClick" | ||
| 64 | - android:src="@drawable/btn_return" /> | 59 | + <ImageView |
| 60 | + android:id="@+id/back_selector" | ||
| 61 | + android:layout_width="30dp" | ||
| 62 | + android:layout_height="30dp" | ||
| 63 | + android:layout_marginLeft="@dimen/_10px" | ||
| 64 | + android:layout_marginTop="@dimen/_20px" | ||
| 65 | + android:onClick="onClick" | ||
| 66 | + android:src="@drawable/btn_return" /> | ||
| 65 | 67 | ||
| 66 | </RelativeLayout> | 68 | </RelativeLayout> |
| 67 | 69 | ||
| 68 | -</layout> | ||
| 69 | \ No newline at end of file | 70 | \ No newline at end of file |
| 71 | + </layout> | ||
| 70 | \ No newline at end of file | 72 | \ No newline at end of file |
app/src/main/res/layout/user_fragment.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | 2 | ||
| 3 | -<layout xmlns:android="http://schemas.android.com/apk/res/android"> | 3 | +<layout xmlns:android="http://schemas.android.com/apk/res/android" |
| 4 | + > | ||
| 4 | 5 | ||
| 5 | <LinearLayout | 6 | <LinearLayout |
| 6 | android:layout_width="match_parent" | 7 | android:layout_width="match_parent" |
| @@ -9,36 +10,40 @@ | @@ -9,36 +10,40 @@ | ||
| 9 | 10 | ||
| 10 | <RelativeLayout | 11 | <RelativeLayout |
| 11 | android:layout_width="match_parent" | 12 | android:layout_width="match_parent" |
| 12 | - android:layout_height="100dp"> | ||
| 13 | - | 13 | + android:layout_height="150dp" |
| 14 | + > | ||
| 14 | <TextView | 15 | <TextView |
| 15 | android:layout_width="wrap_content" | 16 | android:layout_width="wrap_content" |
| 16 | android:layout_height="wrap_content" | 17 | android:layout_height="wrap_content" |
| 17 | android:layout_centerInParent="true" | 18 | android:layout_centerInParent="true" |
| 19 | + android:singleLine="true" | ||
| 18 | android:text="我的" | 20 | android:text="我的" |
| 19 | - android:textSize="@dimen/_30px" /> | 21 | + android:textColor="@color/config_black_color" |
| 22 | + android:textSize="22sp" | ||
| 23 | + /> | ||
| 20 | 24 | ||
| 21 | 25 | ||
| 22 | </RelativeLayout> | 26 | </RelativeLayout> |
| 23 | - | ||
| 24 | <View | 27 | <View |
| 25 | android:layout_width="match_parent" | 28 | android:layout_width="match_parent" |
| 29 | + android:layout_marginBottom="@dimen/_20px" | ||
| 26 | android:layout_height="1px" | 30 | android:layout_height="1px" |
| 27 | android:background="@color/gray_line_color" /> | 31 | android:background="@color/gray_line_color" /> |
| 28 | 32 | ||
| 29 | 33 | ||
| 30 | <RelativeLayout | 34 | <RelativeLayout |
| 31 | android:id="@+id/config_header" | 35 | android:id="@+id/config_header" |
| 32 | - style="@style/list_item_style" | ||
| 33 | android:layout_width="fill_parent" | 36 | android:layout_width="fill_parent" |
| 34 | android:layout_height="85dp" | 37 | android:layout_height="85dp" |
| 35 | - android:gravity="center_vertical"> | 38 | + android:gravity="center_vertical" |
| 39 | + style="@style/list_item_style"> | ||
| 36 | 40 | ||
| 37 | - <ImageView | 41 | + <com.cnlive.gundam.user.view.CircleImageView |
| 38 | android:id="@+id/head_img" | 42 | android:id="@+id/head_img" |
| 39 | android:layout_width="55dip" | 43 | android:layout_width="55dip" |
| 40 | android:layout_height="55dip" | 44 | android:layout_height="55dip" |
| 41 | android:layout_centerVertical="true" | 45 | android:layout_centerVertical="true" |
| 46 | + android:src="@drawable/cnlive_user_header" | ||
| 42 | android:layout_marginLeft="11dp" | 47 | android:layout_marginLeft="11dp" |
| 43 | android:layout_marginRight="16dp" /> | 48 | android:layout_marginRight="16dp" /> |
| 44 | 49 | ||
| @@ -46,9 +51,9 @@ | @@ -46,9 +51,9 @@ | ||
| 46 | android:layout_width="wrap_content" | 51 | android:layout_width="wrap_content" |
| 47 | android:layout_height="wrap_content" | 52 | android:layout_height="wrap_content" |
| 48 | android:layout_centerVertical="true" | 53 | android:layout_centerVertical="true" |
| 49 | - android:layout_toLeftOf="@+id/next" | ||
| 50 | android:layout_toRightOf="@+id/head_img" | 54 | android:layout_toRightOf="@+id/head_img" |
| 51 | - android:orientation="vertical"> | 55 | + android:orientation="vertical" |
| 56 | + android:layout_toLeftOf="@+id/next"> | ||
| 52 | 57 | ||
| 53 | <TextView | 58 | <TextView |
| 54 | android:id="@+id/tv_nickname" | 59 | android:id="@+id/tv_nickname" |
| @@ -61,14 +66,6 @@ | @@ -61,14 +66,6 @@ | ||
| 61 | android:textColor="@color/config_black_color" | 66 | android:textColor="@color/config_black_color" |
| 62 | android:textSize="17sp" /> | 67 | android:textSize="17sp" /> |
| 63 | 68 | ||
| 64 | - <TextView | ||
| 65 | - android:id="@+id/point" | ||
| 66 | - android:layout_width="wrap_content" | ||
| 67 | - android:layout_height="wrap_content" | ||
| 68 | - android:layout_margin="3dp" | ||
| 69 | - android:text="@string/login_china_coin" | ||
| 70 | - android:textColor="@color/config_gray_color" | ||
| 71 | - android:textSize="12sp" /> | ||
| 72 | </LinearLayout> | 69 | </LinearLayout> |
| 73 | 70 | ||
| 74 | <ImageView | 71 | <ImageView |
| @@ -83,53 +80,49 @@ | @@ -83,53 +80,49 @@ | ||
| 83 | </RelativeLayout> | 80 | </RelativeLayout> |
| 84 | 81 | ||
| 85 | 82 | ||
| 86 | - <RelativeLayout | ||
| 87 | - android:id="@+id/live" | ||
| 88 | - style="@style/list_item_style" | ||
| 89 | - android:layout_width="match_parent" | ||
| 90 | - android:layout_height="30dp"> | ||
| 91 | 83 | ||
| 92 | - <ImageView | ||
| 93 | - android:id="@+id/ic_config_history" | ||
| 94 | - android:layout_width="20dp" | ||
| 95 | - android:layout_height="20dp" | ||
| 96 | - android:layout_centerVertical="true" | ||
| 97 | - android:src="@drawable/ic_config_history" /> | ||
| 98 | 84 | ||
| 99 | - <TextView | ||
| 100 | - android:layout_width="wrap_content" | ||
| 101 | - android:layout_height="wrap_content" | ||
| 102 | - android:layout_centerVertical="true" | ||
| 103 | - android:layout_marginLeft="20dp" | ||
| 104 | - android:layout_toRightOf="@+id/ic_config_history" | ||
| 105 | - android:text="我要直播" /> | ||
| 106 | - </RelativeLayout> | ||
| 107 | 85 | ||
| 108 | <View | 86 | <View |
| 109 | android:layout_width="match_parent" | 87 | android:layout_width="match_parent" |
| 110 | android:layout_height="1px" | 88 | android:layout_height="1px" |
| 111 | android:background="@color/gray_line_color" /> | 89 | android:background="@color/gray_line_color" /> |
| 112 | - | ||
| 113 | <RelativeLayout | 90 | <RelativeLayout |
| 114 | - android:id="@+id/message" | ||
| 115 | - style="@style/list_item_style" | ||
| 116 | android:layout_width="match_parent" | 91 | android:layout_width="match_parent" |
| 117 | - android:layout_height="30dp"> | 92 | + android:layout_height="50dp" |
| 93 | + android:layout_marginTop="@dimen/_20px" | ||
| 94 | + android:id="@+id/message" | ||
| 95 | + style="@style/list_item_style"> | ||
| 118 | 96 | ||
| 119 | <ImageView | 97 | <ImageView |
| 120 | - android:id="@+id/ic_setting_opinion" | ||
| 121 | - android:layout_width="20dp" | ||
| 122 | - android:layout_height="20dp" | 98 | + android:layout_width="30dp" |
| 99 | + android:layout_height="30dp" | ||
| 100 | + android:layout_marginLeft="@dimen/_20px" | ||
| 123 | android:layout_centerVertical="true" | 101 | android:layout_centerVertical="true" |
| 124 | - android:src="@drawable/ic_setting_opinion" /> | ||
| 125 | - | 102 | + android:id="@+id/ic_setting_opinion" |
| 103 | + android:src="@drawable/ic_setting_opinion"/> | ||
| 126 | <TextView | 104 | <TextView |
| 127 | android:layout_width="wrap_content" | 105 | android:layout_width="wrap_content" |
| 128 | android:layout_height="wrap_content" | 106 | android:layout_height="wrap_content" |
| 129 | android:layout_centerVertical="true" | 107 | android:layout_centerVertical="true" |
| 130 | - android:layout_marginLeft="20dp" | ||
| 131 | android:layout_toRightOf="@+id/ic_setting_opinion" | 108 | android:layout_toRightOf="@+id/ic_setting_opinion" |
| 132 | - android:text="意见反馈" /> | 109 | + android:gravity="center_vertical" |
| 110 | + android:singleLine="true" | ||
| 111 | + android:text="意见反馈" | ||
| 112 | + android:textColor="@color/config_black_color" | ||
| 113 | + android:layout_marginLeft="30dp" | ||
| 114 | + android:textSize="17sp"/> | ||
| 115 | + | ||
| 116 | + | ||
| 117 | + <ImageView | ||
| 118 | + android:id="@+id/imv_message" | ||
| 119 | + android:layout_width="@dimen/next_image_width" | ||
| 120 | + android:layout_height="@dimen/next_image_height" | ||
| 121 | + android:layout_alignParentRight="true" | ||
| 122 | + android:layout_centerVertical="true" | ||
| 123 | + android:layout_marginRight="@dimen/next_image_margin_right" | ||
| 124 | + android:contentDescription="@null" | ||
| 125 | + android:src="@drawable/btn_channel_more" /> | ||
| 133 | 126 | ||
| 134 | </RelativeLayout> | 127 | </RelativeLayout> |
| 135 | 128 |
user/src/main/res/drawable-hdpi/cnlive_user_header.png
0 → 100644
6.29 KB
user/src/main/res/values/attrs.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | +<resources> | ||
| 3 | + <declare-styleable name="CircleImageView"> | ||
| 4 | + <attr name="border_width" format="dimension" /> | ||
| 5 | + <attr name="border_color" format="color" /> | ||
| 6 | + </declare-styleable> | ||
| 7 | +</resources> | ||
| 0 | \ No newline at end of file | 8 | \ No newline at end of file |