Commit cf00f22ab4c560127640c633b03fc97024731e16
1 parent
ba7d7409b2
Exists in
master
update resource application ( icon + map + ..)
Showing 60 changed files with 355 additions and 129 deletions Side-by-side Diff
- app/build.gradle
- app/src/main/java/com/dinhcv/lifelogpedometer/activity/HistoryContentFragment.java
- app/src/main/java/com/dinhcv/lifelogpedometer/activity/PedometerActivity.java
- app/src/main/java/com/dinhcv/lifelogpedometer/activity/RankFragment.java
- app/src/main/java/com/dinhcv/lifelogpedometer/activity/TopDateFragment.java
- app/src/main/java/com/dinhcv/lifelogpedometer/adapter/RankingAdapter.java
- app/src/main/java/com/dinhcv/lifelogpedometer/customview/CircularImageView.java
- app/src/main/res/drawable-xxhdpi/f2_ic.png
- app/src/main/res/drawable-xxhdpi/face_ic.png
- app/src/main/res/drawable-xxhdpi/history_ic.png
- app/src/main/res/drawable-xxhdpi/ic_ava.png
- app/src/main/res/drawable-xxhdpi/ic_detail.png
- app/src/main/res/drawable-xxhdpi/mail_ic.png
- app/src/main/res/drawable-xxhdpi/map_ic.png
- app/src/main/res/drawable-xxhdpi/no1.png
- app/src/main/res/drawable-xxhdpi/no2.png
- app/src/main/res/drawable-xxhdpi/no3.png
- app/src/main/res/drawable-xxhdpi/other_ic.png
- app/src/main/res/drawable-xxhdpi/rank_ic.png
- app/src/main/res/drawable-xxhdpi/sns_ic.png
- app/src/main/res/drawable-xxhdpi/today_ic.png
- app/src/main/res/drawable-xxhdpi/twitter_ic.png
- app/src/main/res/drawable-xxxhdpi/bg.png
- app/src/main/res/drawable/back_ic.PNG
- app/src/main/res/drawable/goout_ic.PNG
- app/src/main/res/drawable/home_ic.PNG
- app/src/main/res/drawable/ic_ava1.png
- app/src/main/res/drawable/list_ic.PNG
- app/src/main/res/drawable/next_ic.PNG
- app/src/main/res/drawable/step_type_enabled.xml
- app/src/main/res/drawable/tab_color_selector.xml
- app/src/main/res/drawable/walking_ic.PNG
- app/src/main/res/layout/activity_pedometer.xml
- app/src/main/res/layout/fragment_history.xml
- app/src/main/res/layout/fragment_history_content.xml
- app/src/main/res/layout/fragment_history_detail.xml
- app/src/main/res/layout/fragment_map.xml
- app/src/main/res/layout/fragment_rank.xml
- app/src/main/res/layout/fragment_sns.xml
- app/src/main/res/layout/fragment_sns_create_group.xml
- app/src/main/res/layout/fragment_sns_detail.xml
- app/src/main/res/layout/fragment_sns_my_group.xml
- app/src/main/res/layout/fragment_sns_search.xml
- app/src/main/res/layout/fragment_sns_topic.xml
- app/src/main/res/layout/fragment_top.xml
- app/src/main/res/layout/fragment_top_date.xml
- app/src/main/res/layout/fragment_top_today.xml
- app/src/main/res/layout/history_page_7_content.xml
- app/src/main/res/layout/layout_rank_row.xml
- app/src/main/res/layout/layout_sns_member_row.xml
- app/src/main/res/layout/layout_sns_search_row.xml
- app/src/main/res/layout/layout_sns_topic_row.xml
- app/src/main/res/layout/layout_toolbar.xml
- app/src/main/res/layout/type_step.xml
- app/src/main/res/mipmap-hdpi/ic_launcher.png
- app/src/main/res/mipmap-mdpi/ic_launcher.png
- app/src/main/res/mipmap-xhdpi/ic_launcher.png
- app/src/main/res/mipmap-xxhdpi/ic_launcher.png
- app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
- app/src/main/res/values/colors.xml
app/build.gradle
app/src/main/java/com/dinhcv/lifelogpedometer/activity/HistoryContentFragment.java
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | import android.widget.Button; |
| 12 | 12 | import android.widget.DatePicker; |
| 13 | 13 | import android.widget.ImageButton; |
| 14 | +import android.widget.ImageView; | |
| 14 | 15 | import android.widget.LinearLayout; |
| 15 | 16 | import android.widget.TextView; |
| 16 | 17 | |
| ... | ... | @@ -55,11 +56,11 @@ |
| 55 | 56 | TextView tvDate; |
| 56 | 57 | @BindView(R.id.tv_week_day) |
| 57 | 58 | TextView tvWeekDay; |
| 58 | - private Button btnFace; | |
| 59 | - private Button btnTwitter; | |
| 60 | - private Button btnLine; | |
| 61 | - private Button btnEmail; | |
| 62 | - private Button btnOther; | |
| 59 | + private ImageView btnFace; | |
| 60 | + private ImageView btnTwitter; | |
| 61 | + private ImageView btnLine; | |
| 62 | + private ImageView btnEmail; | |
| 63 | + private ImageView btnOther; | |
| 63 | 64 | @BindView(R.id.tv_steps) |
| 64 | 65 | TextView tvStep; |
| 65 | 66 | @BindView(R.id.tv_remainingStep) |
| ... | ... | @@ -139,11 +140,11 @@ |
| 139 | 140 | |
| 140 | 141 | |
| 141 | 142 | private void initView(View view) { |
| 142 | - btnFace = (Button) view.findViewById(R.id.btn_face); | |
| 143 | - btnTwitter = (Button) view.findViewById(R.id.btn_twitter); | |
| 144 | - btnLine = (Button) view.findViewById(R.id.btn_line); | |
| 145 | - btnEmail = (Button) view.findViewById(R.id.btn_email); | |
| 146 | - btnOther = (Button) view.findViewById(R.id.btn_other); | |
| 143 | + btnFace = (ImageView) view.findViewById(R.id.btn_face); | |
| 144 | + btnTwitter = (ImageView) view.findViewById(R.id.btn_twitter); | |
| 145 | + btnLine = (ImageView) view.findViewById(R.id.btn_line); | |
| 146 | + btnEmail = (ImageView) view.findViewById(R.id.btn_email); | |
| 147 | + btnOther = (ImageView) view.findViewById(R.id.btn_other); | |
| 147 | 148 | |
| 148 | 149 | mBarChart = (BarChart) view.findViewById(R.id.chart); |
| 149 | 150 | } |
app/src/main/java/com/dinhcv/lifelogpedometer/activity/PedometerActivity.java
| ... | ... | @@ -44,11 +44,11 @@ |
| 44 | 44 | private SnsFragment mSnsFragment; |
| 45 | 45 | |
| 46 | 46 | private int[] tabIcons = { |
| 47 | - com.dinhcv.lifelogpedometer.R.drawable.ic_date, | |
| 48 | - R.drawable.ic_history, | |
| 49 | - R.drawable.ic_rank, | |
| 50 | - R.drawable.ic_map, | |
| 51 | - R.drawable.ic_sns | |
| 47 | + R.drawable.today_ic, | |
| 48 | + R.drawable.history_ic, | |
| 49 | + R.drawable.rank_ic, | |
| 50 | + R.drawable.map_ic, | |
| 51 | + R.drawable.sns_ic | |
| 52 | 52 | }; |
| 53 | 53 | |
| 54 | 54 | public enum TAB { |
| ... | ... | @@ -251,7 +251,8 @@ |
| 251 | 251 | |
| 252 | 252 | @Override |
| 253 | 253 | public CharSequence getPageTitle(int position) { |
| 254 | - return mFragmentTitleList.get(position); | |
| 254 | + //return mFragmentTitleList.get(position); | |
| 255 | + return null; | |
| 255 | 256 | } |
| 256 | 257 | } |
| 257 | 258 |
app/src/main/java/com/dinhcv/lifelogpedometer/activity/RankFragment.java
app/src/main/java/com/dinhcv/lifelogpedometer/activity/TopDateFragment.java
| ... | ... | @@ -34,6 +34,8 @@ |
| 34 | 34 | import java.util.Date; |
| 35 | 35 | import java.util.List; |
| 36 | 36 | |
| 37 | +import de.hdodenhof.circleimageview.CircleImageView; | |
| 38 | + | |
| 37 | 39 | public class TopDateFragment extends FragmentBase implements SettingFragmentPresenter { |
| 38 | 40 | |
| 39 | 41 | private TextView tvDate; |
| ... | ... | @@ -57,7 +59,7 @@ |
| 57 | 59 | |
| 58 | 60 | private Const.STEP_TYPE stepType; |
| 59 | 61 | private TagetInfo mTagetInfo = new TagetInfo(); |
| 60 | - private ImageView ivToDay; | |
| 62 | + private CircleImageView ivToDay; | |
| 61 | 63 | private ExpandableListCustomView lvNotice; |
| 62 | 64 | private NoticeAdapter mNoticeAdapter; |
| 63 | 65 | private View mRootview; |
| ... | ... | @@ -91,7 +93,7 @@ |
| 91 | 93 | llWalking = (LinearLayout) rootView.findViewById(R.id.ll_walking); |
| 92 | 94 | llRunning = (LinearLayout) rootView.findViewById(R.id.ll_running); |
| 93 | 95 | |
| 94 | - ivToDay = (ImageView) rootView.findViewById(R.id.iv_toDay); | |
| 96 | + ivToDay = (CircleImageView) rootView.findViewById(R.id.iv_toDay); | |
| 95 | 97 | lvNotice = (ExpandableListCustomView) rootView.findViewById(R.id.lv_notice); |
| 96 | 98 | |
| 97 | 99 | handleEvent(); |
app/src/main/java/com/dinhcv/lifelogpedometer/adapter/RankingAdapter.java
| ... | ... | @@ -84,13 +84,13 @@ |
| 84 | 84 | } |
| 85 | 85 | switch (rankingInfo.getRank()) { |
| 86 | 86 | case 1: |
| 87 | - holder.mImvPosition.setBackground(Utils.getDrawableWrapper(mActivity, R.drawable.ic_first)); | |
| 87 | + holder.mImvPosition.setBackground(Utils.getDrawableWrapper(mActivity, R.drawable.no1)); | |
| 88 | 88 | break; |
| 89 | 89 | case 2: |
| 90 | - holder.mImvPosition.setBackground(Utils.getDrawableWrapper(mActivity, R.drawable.ic_second)); | |
| 90 | + holder.mImvPosition.setBackground(Utils.getDrawableWrapper(mActivity, R.drawable.no2)); | |
| 91 | 91 | break; |
| 92 | 92 | case 3: |
| 93 | - holder.mImvPosition.setBackground(Utils.getDrawableWrapper(mActivity, R.drawable.ic_third)); | |
| 93 | + holder.mImvPosition.setBackground(Utils.getDrawableWrapper(mActivity, R.drawable.no3)); | |
| 94 | 94 | break; |
| 95 | 95 | } |
| 96 | 96 | } |
app/src/main/java/com/dinhcv/lifelogpedometer/customview/CircularImageView.java
| 1 | +package com.dinhcv.lifelogpedometer.customview; | |
| 2 | + | |
| 3 | + | |
| 4 | +import android.annotation.SuppressLint; | |
| 5 | +import android.content.Context; | |
| 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.Shader; | |
| 13 | +import android.graphics.drawable.BitmapDrawable; | |
| 14 | +import android.graphics.drawable.Drawable; | |
| 15 | +import android.util.AttributeSet; | |
| 16 | +import android.util.Log; | |
| 17 | +import android.widget.ImageView; | |
| 18 | + | |
| 19 | + | |
| 20 | +@SuppressLint("AppCompatCustomView") | |
| 21 | +public class CircularImageView extends ImageView { | |
| 22 | + private static final ScaleType SCALE_TYPE = ScaleType.CENTER_CROP; | |
| 23 | + | |
| 24 | + private static final float DEFAULT_BORDER_WIDTH = 4; | |
| 25 | + private static final float DEFAULT_SHADOW_RADIUS = 8.0f; | |
| 26 | + private float borderWidth; | |
| 27 | + private int canvasSize; | |
| 28 | + private float shadowRadius; | |
| 29 | + private int shadowColor = Color.BLACK; | |
| 30 | + | |
| 31 | + private Bitmap image; | |
| 32 | + private Drawable drawable; | |
| 33 | + private Paint paint; | |
| 34 | + private Paint paintBorder; | |
| 35 | + | |
| 36 | + public CircularImageView(final Context context) { | |
| 37 | + this(context, null); | |
| 38 | + } | |
| 39 | + | |
| 40 | + public CircularImageView(Context context, AttributeSet attrs) { | |
| 41 | + this(context, attrs, 0); | |
| 42 | + } | |
| 43 | + | |
| 44 | + public CircularImageView(Context context, AttributeSet attrs, int defStyleAttr) { | |
| 45 | + super(context, attrs, defStyleAttr); | |
| 46 | + init(context, attrs, defStyleAttr); | |
| 47 | + } | |
| 48 | + | |
| 49 | + private void init(Context context, AttributeSet attrs, int defStyleAttr) { | |
| 50 | + paint = new Paint(); | |
| 51 | + paint.setAntiAlias(true); | |
| 52 | + | |
| 53 | + paintBorder = new Paint(); | |
| 54 | + paintBorder.setAntiAlias(true); | |
| 55 | + } | |
| 56 | + | |
| 57 | + public void setBorderWidth(float borderWidth) { | |
| 58 | + this.borderWidth = borderWidth; | |
| 59 | + requestLayout(); | |
| 60 | + invalidate(); | |
| 61 | + } | |
| 62 | + | |
| 63 | + public void setBorderColor(int borderColor) { | |
| 64 | + if (paintBorder != null) | |
| 65 | + paintBorder.setColor(borderColor); | |
| 66 | + invalidate(); | |
| 67 | + } | |
| 68 | + | |
| 69 | + public void addShadow() { | |
| 70 | + if (shadowRadius == 0) | |
| 71 | + shadowRadius = DEFAULT_SHADOW_RADIUS; | |
| 72 | + drawShadow(shadowRadius, shadowColor); | |
| 73 | + invalidate(); | |
| 74 | + } | |
| 75 | + | |
| 76 | + public void setShadowRadius(float shadowRadius) { | |
| 77 | + drawShadow(shadowRadius, shadowColor); | |
| 78 | + invalidate(); | |
| 79 | + } | |
| 80 | + | |
| 81 | + public void setShadowColor(int shadowColor) { | |
| 82 | + drawShadow(shadowRadius, shadowColor); | |
| 83 | + invalidate(); | |
| 84 | + } | |
| 85 | + | |
| 86 | + @Override | |
| 87 | + public ScaleType getScaleType() { | |
| 88 | + return SCALE_TYPE; | |
| 89 | + } | |
| 90 | + | |
| 91 | + @Override | |
| 92 | + public void setScaleType(ScaleType scaleType) { | |
| 93 | + if (scaleType != SCALE_TYPE) { | |
| 94 | + throw new IllegalArgumentException(String.format("ScaleType %s not supported. ScaleType.CENTER_CROP is used by default. So you don't need to use ScaleType.", scaleType)); | |
| 95 | + } | |
| 96 | + } | |
| 97 | + | |
| 98 | + @Override | |
| 99 | + public void onDraw(Canvas canvas) { | |
| 100 | + loadBitmap(); | |
| 101 | + | |
| 102 | + if (image == null) | |
| 103 | + return; | |
| 104 | + | |
| 105 | + if (!isInEditMode()) { | |
| 106 | + canvasSize = canvas.getWidth(); | |
| 107 | + if (canvas.getHeight() < canvasSize) { | |
| 108 | + canvasSize = canvas.getHeight(); | |
| 109 | + } | |
| 110 | + } | |
| 111 | + | |
| 112 | + int circleCenter = (int) (canvasSize - (borderWidth * 2)) / 2; | |
| 113 | + canvas.drawCircle(circleCenter + borderWidth, circleCenter + borderWidth, circleCenter + borderWidth - (shadowRadius + shadowRadius / 2), paintBorder); | |
| 114 | + canvas.drawCircle(circleCenter + borderWidth, circleCenter + borderWidth, circleCenter - (shadowRadius + shadowRadius / 2), paint); | |
| 115 | + } | |
| 116 | + | |
| 117 | + private void loadBitmap() { | |
| 118 | + if (this.drawable == getDrawable()) | |
| 119 | + return; | |
| 120 | + | |
| 121 | + this.drawable = getDrawable(); | |
| 122 | + this.image = drawableToBitmap(this.drawable); | |
| 123 | + updateShader(); | |
| 124 | + } | |
| 125 | + | |
| 126 | + @Override | |
| 127 | + protected void onSizeChanged(int w, int h, int oldw, int oldh) { | |
| 128 | + super.onSizeChanged(w, h, oldw, oldh); | |
| 129 | + canvasSize = w; | |
| 130 | + if (h < canvasSize) | |
| 131 | + canvasSize = h; | |
| 132 | + if (image != null) | |
| 133 | + updateShader(); | |
| 134 | + } | |
| 135 | + | |
| 136 | + private void drawShadow(float shadowRadius, int shadowColor) { | |
| 137 | + this.shadowRadius = shadowRadius; | |
| 138 | + this.shadowColor = shadowColor; | |
| 139 | + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { | |
| 140 | + setLayerType(LAYER_TYPE_SOFTWARE, paintBorder); | |
| 141 | + } | |
| 142 | + paintBorder.setShadowLayer(shadowRadius, 0.0f, shadowRadius / 2, shadowColor); | |
| 143 | + } | |
| 144 | + | |
| 145 | + private void updateShader() { | |
| 146 | + if (image == null) | |
| 147 | + return; | |
| 148 | + | |
| 149 | + image = cropBitmap(image); | |
| 150 | + | |
| 151 | + BitmapShader shader = new BitmapShader(image, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); | |
| 152 | + | |
| 153 | + Matrix matrix = new Matrix(); | |
| 154 | + matrix.setScale((float) canvasSize / (float) image.getWidth(), (float) canvasSize / (float) image.getHeight()); | |
| 155 | + shader.setLocalMatrix(matrix); | |
| 156 | + | |
| 157 | + paint.setShader(shader); | |
| 158 | + } | |
| 159 | + | |
| 160 | + private Bitmap cropBitmap(Bitmap bitmap) { | |
| 161 | + Bitmap bmp; | |
| 162 | + if (bitmap.getWidth() >= bitmap.getHeight()) { | |
| 163 | + bmp = Bitmap.createBitmap( | |
| 164 | + bitmap, | |
| 165 | + bitmap.getWidth() / 2 - bitmap.getHeight() / 2, | |
| 166 | + 0, | |
| 167 | + bitmap.getHeight(), bitmap.getHeight()); | |
| 168 | + } else { | |
| 169 | + bmp = Bitmap.createBitmap( | |
| 170 | + bitmap, | |
| 171 | + 0, | |
| 172 | + bitmap.getHeight() / 2 - bitmap.getWidth() / 2, | |
| 173 | + bitmap.getWidth(), bitmap.getWidth()); | |
| 174 | + } | |
| 175 | + return bmp; | |
| 176 | + } | |
| 177 | + | |
| 178 | + private Bitmap drawableToBitmap(Drawable drawable) { | |
| 179 | + if (drawable == null) { | |
| 180 | + return null; | |
| 181 | + } else if (drawable instanceof BitmapDrawable) { | |
| 182 | + return ((BitmapDrawable) drawable).getBitmap(); | |
| 183 | + } | |
| 184 | + | |
| 185 | + int intrinsicWidth = drawable.getIntrinsicWidth(); | |
| 186 | + int intrinsicHeight = drawable.getIntrinsicHeight(); | |
| 187 | + | |
| 188 | + if (!(intrinsicWidth > 0 && intrinsicHeight > 0)) | |
| 189 | + return null; | |
| 190 | + | |
| 191 | + try { | |
| 192 | + Bitmap bitmap = Bitmap.createBitmap(intrinsicWidth, intrinsicHeight, Bitmap.Config.ARGB_8888); | |
| 193 | + Canvas canvas = new Canvas(bitmap); | |
| 194 | + drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight()); | |
| 195 | + drawable.draw(canvas); | |
| 196 | + return bitmap; | |
| 197 | + } catch (OutOfMemoryError e) { | |
| 198 | + Log.e(getClass().toString(), "Encountered OutOfMemoryError while generating bitmap!"); | |
| 199 | + return null; | |
| 200 | + } | |
| 201 | + } | |
| 202 | + | |
| 203 | + @Override | |
| 204 | + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
| 205 | + int width = measureWidth(widthMeasureSpec); | |
| 206 | + int height = measureHeight(heightMeasureSpec); | |
| 207 | + setMeasuredDimension(width, height); | |
| 208 | + } | |
| 209 | + | |
| 210 | + private int measureWidth(int measureSpec) { | |
| 211 | + int result; | |
| 212 | + int specMode = MeasureSpec.getMode(measureSpec); | |
| 213 | + int specSize = MeasureSpec.getSize(measureSpec); | |
| 214 | + | |
| 215 | + if (specMode == MeasureSpec.EXACTLY) { | |
| 216 | + result = specSize; | |
| 217 | + } else if (specMode == MeasureSpec.AT_MOST) { | |
| 218 | + result = specSize; | |
| 219 | + } else { | |
| 220 | + result = canvasSize; | |
| 221 | + } | |
| 222 | + | |
| 223 | + return result; | |
| 224 | + } | |
| 225 | + | |
| 226 | + private int measureHeight(int measureSpecHeight) { | |
| 227 | + int result; | |
| 228 | + int specMode = MeasureSpec.getMode(measureSpecHeight); | |
| 229 | + int specSize = MeasureSpec.getSize(measureSpecHeight); | |
| 230 | + | |
| 231 | + if (specMode == MeasureSpec.EXACTLY) { | |
| 232 | + result = specSize; | |
| 233 | + } else if (specMode == MeasureSpec.AT_MOST) { | |
| 234 | + result = specSize; | |
| 235 | + } else { | |
| 236 | + result = canvasSize; | |
| 237 | + } | |
| 238 | + | |
| 239 | + return (result + 2); | |
| 240 | + } | |
| 241 | +} |
app/src/main/res/drawable-xxhdpi/f2_ic.png
6.81 KB
app/src/main/res/drawable-xxhdpi/face_ic.png
6.5 KB
app/src/main/res/drawable-xxhdpi/history_ic.png
7.29 KB
app/src/main/res/drawable-xxhdpi/ic_ava.png