return;
}
- binding.setTakingIcon(R.drawable.ic_ped_taking);
+ binding.setTakingIcon(R.mipmap.step);
binding.setTakingColor(Color.parseColor("#FFA500"));
binding.setTakingUnit(context.getString(R.string.tips_target_unit));
- binding.setCaloriesIcon(R.drawable.ic_ped_calories);
+ binding.setCaloriesIcon(R.mipmap.calorie);
binding.setCaloriesColor(Color.WHITE);
binding.setCaloriesUnit(context.getString(R.string.tips_calories_unit));
- binding.setDistanceIcon(R.drawable.ic_ped_distance);
+ binding.setDistanceIcon(R.mipmap.map);
binding.setDistanceColor(Color.WHITE);
binding.setDistanceUnit(context.getString(R.string.tips_distance_unit));
};
private static final int[] ICON_RES = new int[]{
- R.drawable.ic_ped_height,
- R.drawable.ic_ped_weight,
- R.drawable.ic_ped_task,
+ R.mipmap.tall,
+ R.mipmap.weight,
+ R.mipmap.flag,
};
private PedSetupFragment.OnPedSetupItemClickListener mListener;
- public PedSetupAdapter(Context context, PedSetupFragment.OnPedSetupItemClickListener listener){
+ public PedSetupAdapter(Context context, PedSetupFragment.OnPedSetupItemClickListener listener) {
setupArray = new PedSetupEntity[3];
int[] valueArray = new int[]{
SPUtils.getPedHeightSP(context),
SPUtils.getPedTargetSP(context)
};
- for (int i=0; i<setupArray.length; i++){
+ for (int i = 0; i < setupArray.length; i++) {
PedSetupEntity entity = new PedSetupEntity();
entity.setTitle(context.getString(TITLE_RES[i]));
entity.setUnit(context.getString(UNIT_RES[i]));
entity.setValue(String.valueOf(valueArray[i]));
- entity.setIcon(ContextCompat.getDrawable(context,ICON_RES[i]));
- setupArray[i]=entity;
+ entity.setIcon(ContextCompat.getDrawable(context, ICON_RES[i]));
+ setupArray[i] = entity;
}
- this.mListener=listener;
+ this.mListener = listener;
}
- public void notifyUpdateValue(int type,int value){
+ public void notifyUpdateValue(int type, int value) {
setupArray[type].setValue(String.valueOf(value));
notifyDataSetChanged();
}
@NonNull
@Override
public SetUpHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- return new SetUpHolder(ItemPedSetupBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false));
+ return new SetUpHolder(ItemPedSetupBinding.inflate(LayoutInflater.from(parent.getContext()),
+ parent, false));
}
@Override
public void onBindViewHolder(@NonNull SetUpHolder holder, int position) {
- holder.bindItem(setupArray[position],mListener,position);
+ holder.bindItem(setupArray[position], mListener, position);
}
@Override
binding = itemView;
}
- public void bindItem(PedSetupEntity entity,PedSetupFragment.OnPedSetupItemClickListener listener,int position) {
+ public void bindItem(PedSetupEntity entity, PedSetupFragment.OnPedSetupItemClickListener listener, int position) {
if (binding != null) {
binding.setSetupItemIcon(entity.getIcon());
binding.setSetupItemTitle(entity.getTitle());
private void setupRingProgress(int number) {
RingProgress mRingProgress = pedMainBinding.ringProgress;
- mRingProgress.setProgress(500);
+ mRingProgress.setProgress(number);
}
private void setupRingProgressNumberTv(int number) {
private Context mContext;
private RecyclerView mSetupRv;
- private PedRecordAdapter setupAdapte;
- private QueryPedometerRecordListener queryListner;
+ private PedRecordAdapter setupAdapter;
+ private QueryPedometerRecordListener queryListener;
@Override
public void onAttach(Context context) {
this.mContext = context;
try {
- queryListner = (QueryPedometerRecordListener) context;
+ queryListener = (QueryPedometerRecordListener) context;
} catch (ClassCastException e) {
}
}
View view = inflater.inflate(R.layout.fragment_ped_record, container, false);
mSetupRv = view.findViewById(R.id.ped_record_rv);
initRecyclerView();
- queryListner.onQueryRecord();
+ queryListener.onQueryRecord();
return view;
}
public void updatePedRecord(List<RecordParcelable> records) {
- setupAdapte.updatePedRecordList(records);
+ setupAdapter.updatePedRecordList(records);
//移动到第一个位置上
mSetupRv.scrollToPosition(records.size() - 1);
}
private void initRecyclerView() {
- setupAdapte = new PedRecordAdapter(mContext);
+ setupAdapter = new PedRecordAdapter(mContext);
LinearLayoutManager mLayoutManager =
new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, true);
mSetupRv.setLayoutManager(mLayoutManager);
- mSetupRv.setAdapter(setupAdapte);
+ mSetupRv.setAdapter(setupAdapter);
}
}
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ImageButton;
+import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
View popView = inflater.inflate(R.layout.dialog_ped_setup_layout, container);
numberPicker = (WheelView) popView.findViewById(R.id.dialog_value_picker);
- setNumberPicker(limil.get(mCurrType)[0], limil.get(mCurrType)[1], UNIT_RES[mCurrType], VALUE_CURR[mCurrType]);
+ setNumberPicker(limil.get(mCurrType)[0],
+ limil.get(mCurrType)[1],
+ UNIT_RES[mCurrType],
+ VALUE_CURR[mCurrType]);
- ImageButton bt = (ImageButton) popView.findViewById(R.id.dialog_picker_ok);
+ ImageView bt = (ImageView) popView.findViewById(R.id.dialog_picker_ok);
bt.setOnClickListener(v -> {
mListener.onDialogUpdate(mCurrType,limil.get(mCurrType)[0]+numberPicker.getCurrentItem());
dismiss();
});
- ImageButton cancel = (ImageButton) popView.findViewById(R.id.dialog_picker_cancel);
+ ImageView cancel = (ImageView) popView.findViewById(R.id.dialog_picker_cancel);
cancel.setOnClickListener(v -> dismiss());
return popView;
package com.ic.sport.fragment.pedometer;
import android.content.Context;
+import android.graphics.Rect;
import android.os.Bundle;
import androidx.annotation.NonNull;
import com.ic.sport.adapter.PedSetupAdapter;
-public class PedSetupFragment extends Fragment{
+public class PedSetupFragment extends Fragment {
private static final String TAG = "PedSetupFragment";
- public interface OnPedSetupItemClickListener{
+ public interface OnPedSetupItemClickListener {
void onPedSetupItem(int pos);
}
}
private void initRecyclerView() {
- setupAdapter = new PedSetupAdapter(mContext,listener);
+ setupAdapter = new PedSetupAdapter(mContext, listener);
LinearLayoutManager mLayoutManager = new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false);
mSetupRv.setLayoutManager(mLayoutManager);
+ mSetupRv.addItemDecoration(new RecyclerView.ItemDecoration() {
+ @Override
+ public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
+ outRect.bottom = 5;
+ }
+ });
mSetupRv.setAdapter(setupAdapter);
}
private OnPedSetupItemClickListener listener = pos -> {
- if(pos == 2){
+ if (pos == 2) {
return;
}
FragmentManager fm = getChildFragmentManager();
alertDialog.show(fm, "PedSetupDialog");
};
- public void updateSetuUpValue(int type,int value){
- setupAdapter.notifyUpdateValue(type,value);
+ public void updateSetuUpValue(int type, int value) {
+ setupAdapter.notifyUpdateValue(type, value);
}
}
private MutableLiveData<Integer> mObsPedCount;
private MutableLiveData<List<RecordParcelable>> mObsPedRecord;
- public PedometerPresenter(Context context){
- mContext=context;
+ public PedometerPresenter(Context context) {
+ mContext = context;
mObsPedCount = new MutableLiveData<>();
mObsPedRecord = new MutableLiveData<>();
}
return mObsPedRecord;
}
- public void bindService(){
+ public void bindService() {
ServiceUtil.bindServiceUtil(mContext, "com.ic.action.WORK_SERVICE",
- connection,mContext.getPackageName(), 103);
+ connection, mContext.getPackageName(), 103);
}
- public void unbindService(){
+ public void unbindService() {
try {
mService.unregisterCallback(pedInterface);
- ServiceUtil.unBindServiceUtil(mContext,connection);
+ ServiceUtil.unBindServiceUtil(mContext, connection);
} catch (Exception e) {
- IcLog.e(TAG,"unbindService");
- }finally {
- mService=null;
- pedInterface=null;
+ IcLog.e(TAG, "unbindService");
+ } finally {
+ mService = null;
+ pedInterface = null;
}
}
}
}
- public void syncPedHeightSetting(int height){
+ public void syncPedHeightSetting(int height) {
if (mService != null) {
try {
mService.syncPedHeightSetting(height);
}
}
- public void syncPedWeightSetting(int weight){
+ public void syncPedWeightSetting(int weight) {
if (mService != null) {
try {
mService.syncPedWeightSetting(weight);
@Override
public void onServiceDisconnected(ComponentName name) {
+
}
};
private IPedAidlInterface.Stub pedInterface = new IPedAidlInterface.Stub() {
@Override
- public void updatePedCount(int count) throws RemoteException {
+ public void updatePedCount(int count) {
mObsPedCount.postValue(count);
}
@Override
- public void updatePedRecord(List<RecordParcelable> record) throws RemoteException {
+ public void updatePedRecord(List<RecordParcelable> record) {
mObsPedRecord.postValue(record);
}
};
import android.content.Context;
import android.graphics.Canvas;
+import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
* Current value & label text color
*/
// private static final int VALUE_TEXT_COLOR = 0xF0000000;
- private static final int VALUE_TEXT_COLOR = 0xFFFFA70D;
+ private static final int VALUE_TEXT_COLOR = Color.parseColor("#2492F0");
/**
* Items text color
*/
// private static final int ITEMS_TEXT_COLOR = 0xFF000000;
- private static final int ITEMS_TEXT_COLOR = 0xFFA9A9A9;
+ private static final int ITEMS_TEXT_COLOR = Color.parseColor("#B1B1B1");
/**
* Top and bottom shadows colors
boolean isCyclic = false;
// Listeners
- private List<OnWheelChangedListener> changingListeners = new LinkedList<OnWheelChangedListener>();
- private List<OnWheelScrollListener> scrollingListeners = new LinkedList<OnWheelScrollListener>();
+ private List<OnWheelChangedListener> changingListeners = new LinkedList<>();
+ private List<OnWheelScrollListener> scrollingListeners = new LinkedList<>();
/**
* Constructor
height = getDesiredHeight(itemsLayout);
if (heightMode == MeasureSpec.AT_MOST) {
- height = Math.min(height, heightSize);
+ height = Math.max(height, heightSize);
}
}
- setMeasuredDimension(width, height);
+ setMeasuredDimension(width, heightMeasureSpec);
}
@Override
valuePaint.setColor(VALUE_TEXT_COLOR);
valuePaint.drawableState = getDrawableState();
- labelPaint.setColor(ITEMS_TEXT_COLOR);
+ labelPaint.setColor(Color.parseColor("#E6E6E6"));
labelPaint.drawableState = getDrawableState();
Rect bounds = new Rect();
// draw label
if (labelLayout != null) {
canvas.save();
-// canvas.translate(itemsLayout.getWidth() + LABEL_OFFSET,
-// bounds.top + ((bounds.height() - labelLayout.getHeight()) / 2));
// 确保 Label 与 Value 中线对齐
- canvas.translate(itemsLayout.getWidth() + LABEL_OFFSET,
- baseLine - (labelLayout.getHeight()/2));
+ canvas.translate(itemsLayout.getWidth(),
+ baseLine - (labelLayout.getHeight()) + 8);
labelLayout.draw(canvas);
canvas.restore();
}
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
+ android:layout_marginBottom="5dp"
android:overScrollMode="never" />
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@mipmap/qs_background"
+ android:background="@mipmap/bg"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_gravity="center"
- android:layout_marginTop="10dp"
- android:layout_weight="1">
+ android:layout_height="match_parent"
+ android:layout_gravity="center">
<com.ic.sport.widget.picker.WheelView
android:id="@+id/dialog_value_picker"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_gravity="center" />
+ android:layout_height="260dp"
+ android:layout_gravity="center"
+ android:layout_marginLeft="26dp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
android:layout_marginBottom="10dp">
- <ImageButton
+ <ImageView
android:id="@+id/dialog_picker_cancel"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
android:layout_gravity="bottom"
- android:background="#0000"
+ android:layout_marginStart="10dp"
+ android:background="@color/transparent"
android:contentDescription="@null"
- android:src="@mipmap/ic_cancel"
- android:layout_marginStart="20dp"/>
+ android:src="@mipmap/ic_cancel" />
- <ImageButton
+ <ImageView
android:id="@+id/dialog_picker_ok"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_width="80dp"
+ android:layout_height="80dp"
+ android:layout_alignParentEnd="true"
android:layout_gravity="bottom|end"
- android:background="#0000"
+ android:layout_marginEnd="10dp"
+ android:background="@color/transparent"
android:contentDescription="@null"
- android:src="@mipmap/ic_ok"
- android:layout_alignParentEnd="true"
- android:layout_marginEnd="20dp"/>
+ android:src="@mipmap/ic_ok" />
</RelativeLayout>
-</LinearLayout>
\ No newline at end of file
+</RelativeLayout>
\ No newline at end of file
app:isClockwise="true"
app:isDecimal="true"
app:isShowPercentText="false"
- app:maxProgress="1000"
+ app:maxProgress="10000"
app:neiYuanColor="@color/transparent"
app:progress="1000"
app:ringColor="@color/top_color2"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@mipmap/qs_background"
+ android:background="@mipmap/bg"
android:gravity="center_horizontal"
android:orientation="vertical"
tools:context=".fragment.pedometer.PedRecordFragment">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
android:text="@string/ped_record_name"
- android:textColor="#FFFFFF"
- android:textSize="42sp"
- android:layout_marginTop="10dp"/>
+ android:textColor="@color/main_text_color"
+ android:textSize="42sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/ped_record_rv"
android:layout_width="match_parent"
+ android:overScrollMode="never"
android:layout_height="match_parent"
- android:layout_marginTop="10dp"/>
+ android:layout_marginTop="10dp" />
</LinearLayout>
\ No newline at end of file
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@mipmap/qs_background"
+ android:background="@mipmap/bg"
android:gravity="center_horizontal"
android:orientation="vertical"
tools:context=".fragment.pedometer.PedSetupFragment">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
android:text="@string/ped_head_name"
- android:textColor="#FFFFFF"
- android:textSize="42sp"
- android:layout_marginTop="10dp"/>
+ android:textColor="@color/main_text_color"
+ android:textSize="42sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/ped_setup_rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginTop="10dp"
- android:overScrollMode="never"/>
+ android:overScrollMode="never" />
</LinearLayout>
\ No newline at end of file
<LinearLayout
android:layout_width="wrap_content"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="5dp"
+ android:layout_marginRight="5dp">
<ImageView
android:layout_width="wrap_content"
<com.google.android.material.card.MaterialCardView
style="@style/Widget.MaterialComponents.CardView"
android:layout_width="match_parent"
- android:layout_height="100dp"
- android:layout_marginStart="10dp"
- android:layout_marginEnd="10dp"
- app:cardBackgroundColor="#305C5C5C"
- app:cardCornerRadius="25dp">
+ android:layout_height="140dp"
+ android:layout_marginStart="5dp"
+ android:layout_marginEnd="5dp"
+ app:cardBackgroundColor="#303233"
+ app:cardCornerRadius="5dp">
<TextView
android:id="@+id/item_record_date"
style="@style/RecordTextStyle"
- android:layout_marginStart="5dp"
- android:layout_marginTop="5dp"
- android:text="@{recordDate}" />
+ android:layout_marginStart="15dp"
+ android:layout_marginTop="20dp"
+ android:text="@{recordDate}"
+ android:textColor="@color/white" />
<com.ic.sport.widget.WidgetImageTextLayout
android:id="@+id/item_record_taking"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginStart="5dp"
+ android:layout_marginBottom="10dp"
+ icApp:widgetImageColor="@{takingColor}"
icApp:widgetImageIcon="@{takingIcon}"
icApp:widgetImageUnit="@{takingUnit}"
- icApp:widgetImageColor="@{takingColor}"
icApp:widgetImageValue="@{recordTaking}" />
<com.ic.sport.widget.WidgetImageTextLayout
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginStart="5dp"
+ android:layout_marginTop="5dp"
+ android:layout_marginEnd="5dp"
+ icApp:widgetImageColor="@{caloriesColor}"
icApp:widgetImageIcon="@{caloriesIcon}"
icApp:widgetImageUnit="@{caloriesUnit}"
- icApp:widgetImageColor="@{caloriesColor}"
- icApp:widgetImageValue="@{recordCalories}"
- android:layout_marginTop="5dp"
- android:layout_marginEnd="5dp"/>
+ icApp:widgetImageValue="@{recordCalories}" />
<com.ic.sport.widget.WidgetImageTextLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
+ android:layout_marginEnd="5dp"
+ android:layout_marginBottom="10dp"
+ icApp:widgetImageColor="@{distanceColor}"
icApp:widgetImageIcon="@{distanceIcon}"
icApp:widgetImageUnit="@{distanceUnit}"
- icApp:widgetImageColor="@{distanceColor}"
- icApp:widgetImageValue="@{recordDistance}"
- android:layout_marginEnd="5dp"/>
+ icApp:widgetImageValue="@{recordDistance}" />
</com.google.android.material.card.MaterialCardView>
</layout>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{setupItemTitle}"
- android:textColor="#50FFFFFF"
- android:textSize="36sp"
+ android:textColor="@color/white"
+ android:textSize="30sp"
android:layout_marginStart="5dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{setupItemValue}"
- android:textColor="#80FFFFFF"
- android:textSize="36sp"
+ android:textColor="@color/white"
+ android:textSize="30sp"
android:layout_marginStart="5dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{setupItemUnit}"
- android:textColor="#80FFFFFF"
- android:textSize="36sp"
+ android:textColor="@color/white"
+ android:textSize="30sp"
android:layout_marginStart="5dp"/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="horizontal"
android:layout_width="wrap_content"
- android:layout_height="wrap_content">
+ android:layout_height="wrap_content"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
<ImageView
android:id="@+id/widget_image_icon"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ android:layout_height="wrap_content" />
<TextView
- style="@style/RecordTextStyle"
android:id="@+id/widget_image_value"
- android:layout_marginStart="5dp"/>
+ style="@style/RecordTextStyle"
+ android:layout_marginStart="2dp"
+ android:textColor="@color/white" />
<TextView
- style="@style/RecordTextStyle"
android:id="@+id/widget_image_unit"
- android:layout_marginStart="5dp"/>
+ style="@style/RecordTextStyle"
+ android:layout_marginStart="2dp"
+ android:textColor="@color/white" />
</LinearLayout>
\ No newline at end of file
<color name="green2">#22ddb0</color>
<color name="green_qian">#E6F9F7</color>
<color name="gray_ban">#50000000</color>
+ <color name="main_text_color">#2492F0</color>
<color name="home_green">#06C1AE</color>