From: TrillGates Date: Tue, 1 Jun 2021 10:10:29 +0000 (+0800) Subject: adjust ui. X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=c277395642dfe5958520e66f39599035a342114d;p=ichardware.git adjust ui. --- diff --git a/app/src/main/java/com/ic/sport/adapter/PedRecordAdapter.java b/app/src/main/java/com/ic/sport/adapter/PedRecordAdapter.java index 985b879..c48ce5b 100644 --- a/app/src/main/java/com/ic/sport/adapter/PedRecordAdapter.java +++ b/app/src/main/java/com/ic/sport/adapter/PedRecordAdapter.java @@ -60,15 +60,15 @@ public class PedRecordAdapter extends RecyclerView.Adapter 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); } } diff --git a/app/src/main/java/com/ic/sport/fragment/pedometer/PedSetupDialogFragment.java b/app/src/main/java/com/ic/sport/fragment/pedometer/PedSetupDialogFragment.java index ea08c99..2227247 100644 --- a/app/src/main/java/com/ic/sport/fragment/pedometer/PedSetupDialogFragment.java +++ b/app/src/main/java/com/ic/sport/fragment/pedometer/PedSetupDialogFragment.java @@ -9,6 +9,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.ImageButton; +import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -85,14 +86,17 @@ public class PedSetupDialogFragment extends DialogFragment { 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; diff --git a/app/src/main/java/com/ic/sport/fragment/pedometer/PedSetupFragment.java b/app/src/main/java/com/ic/sport/fragment/pedometer/PedSetupFragment.java index 07ee5e3..e9f6a45 100644 --- a/app/src/main/java/com/ic/sport/fragment/pedometer/PedSetupFragment.java +++ b/app/src/main/java/com/ic/sport/fragment/pedometer/PedSetupFragment.java @@ -1,6 +1,7 @@ package com.ic.sport.fragment.pedometer; import android.content.Context; +import android.graphics.Rect; import android.os.Bundle; import androidx.annotation.NonNull; @@ -17,11 +18,11 @@ import com.ic.sport.R; 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); } @@ -60,14 +61,20 @@ public class PedSetupFragment extends Fragment{ } 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(); @@ -75,8 +82,8 @@ public class PedSetupFragment extends Fragment{ 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); } } diff --git a/app/src/main/java/com/ic/sport/presenter/PedometerPresenter.java b/app/src/main/java/com/ic/sport/presenter/PedometerPresenter.java index f7cc78f..8ad6d49 100644 --- a/app/src/main/java/com/ic/sport/presenter/PedometerPresenter.java +++ b/app/src/main/java/com/ic/sport/presenter/PedometerPresenter.java @@ -25,8 +25,8 @@ public class PedometerPresenter { private MutableLiveData mObsPedCount; private MutableLiveData> mObsPedRecord; - public PedometerPresenter(Context context){ - mContext=context; + public PedometerPresenter(Context context) { + mContext = context; mObsPedCount = new MutableLiveData<>(); mObsPedRecord = new MutableLiveData<>(); } @@ -39,20 +39,20 @@ public class PedometerPresenter { 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; } } @@ -76,7 +76,7 @@ public class PedometerPresenter { } } - public void syncPedHeightSetting(int height){ + public void syncPedHeightSetting(int height) { if (mService != null) { try { mService.syncPedHeightSetting(height); @@ -86,7 +86,7 @@ public class PedometerPresenter { } } - public void syncPedWeightSetting(int weight){ + public void syncPedWeightSetting(int weight) { if (mService != null) { try { mService.syncPedWeightSetting(weight); @@ -111,17 +111,18 @@ public class PedometerPresenter { @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 record) throws RemoteException { + public void updatePedRecord(List record) { mObsPedRecord.postValue(record); } }; diff --git a/app/src/main/java/com/ic/sport/widget/picker/WheelView.java b/app/src/main/java/com/ic/sport/widget/picker/WheelView.java index a75eb11..651957a 100644 --- a/app/src/main/java/com/ic/sport/widget/picker/WheelView.java +++ b/app/src/main/java/com/ic/sport/widget/picker/WheelView.java @@ -21,6 +21,7 @@ package com.ic.sport.widget.picker; 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; @@ -65,13 +66,13 @@ public class WheelView extends View { * 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 @@ -160,8 +161,8 @@ public class WheelView extends View { boolean isCyclic = false; // Listeners - private List changingListeners = new LinkedList(); - private List scrollingListeners = new LinkedList(); + private List changingListeners = new LinkedList<>(); + private List scrollingListeners = new LinkedList<>(); /** * Constructor @@ -716,11 +717,11 @@ public class WheelView extends View { 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 @@ -771,7 +772,7 @@ public class WheelView extends View { 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(); @@ -780,11 +781,9 @@ public class WheelView extends View { // 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(); } diff --git a/app/src/main/res/layout/activity_pedometer.xml b/app/src/main/res/layout/activity_pedometer.xml index cfd5b7f..f3c0bbf 100644 --- a/app/src/main/res/layout/activity_pedometer.xml +++ b/app/src/main/res/layout/activity_pedometer.xml @@ -17,5 +17,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|center_horizontal" + android:layout_marginBottom="5dp" android:overScrollMode="never" /> \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_ped_setup_layout.xml b/app/src/main/res/layout/dialog_ped_setup_layout.xml index 19cfc56..2323b15 100644 --- a/app/src/main/res/layout/dialog_ped_setup_layout.xml +++ b/app/src/main/res/layout/dialog_ped_setup_layout.xml @@ -1,50 +1,50 @@ - + android:layout_height="match_parent" + android:layout_gravity="center"> + android:layout_height="260dp" + android:layout_gravity="center" + android:layout_marginLeft="26dp" /> - + android:src="@mipmap/ic_cancel" /> - + android:src="@mipmap/ic_ok" /> - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_ped_main.xml b/app/src/main/res/layout/fragment_ped_main.xml index 03fc7bb..6cf06a0 100644 --- a/app/src/main/res/layout/fragment_ped_main.xml +++ b/app/src/main/res/layout/fragment_ped_main.xml @@ -28,7 +28,7 @@ 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" diff --git a/app/src/main/res/layout/fragment_ped_record.xml b/app/src/main/res/layout/fragment_ped_record.xml index cdff5c3..0dd1d25 100644 --- a/app/src/main/res/layout/fragment_ped_record.xml +++ b/app/src/main/res/layout/fragment_ped_record.xml @@ -3,7 +3,7 @@ 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"> @@ -11,14 +11,15 @@ + android:textColor="@color/main_text_color" + android:textSize="42sp" /> + android:layout_marginTop="10dp" /> \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_ped_setup.xml b/app/src/main/res/layout/fragment_ped_setup.xml index 384fdfa..d21e029 100644 --- a/app/src/main/res/layout/fragment_ped_setup.xml +++ b/app/src/main/res/layout/fragment_ped_setup.xml @@ -3,7 +3,7 @@ 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"> @@ -11,15 +11,14 @@ + android:textColor="@color/main_text_color" + android:textSize="42sp" /> + android:overScrollMode="never" /> \ No newline at end of file diff --git a/app/src/main/res/layout/item_indicator_layout.xml b/app/src/main/res/layout/item_indicator_layout.xml index 8ca6c6d..94225bf 100644 --- a/app/src/main/res/layout/item_indicator_layout.xml +++ b/app/src/main/res/layout/item_indicator_layout.xml @@ -10,7 +10,9 @@ + android:layout_height="wrap_content" + android:layout_marginLeft="5dp" + android:layout_marginRight="5dp"> + android:layout_height="140dp" + android:layout_marginStart="5dp" + android:layout_marginEnd="5dp" + app:cardBackgroundColor="#303233" + app:cardCornerRadius="5dp"> + android:layout_marginStart="15dp" + android:layout_marginTop="20dp" + android:text="@{recordDate}" + android:textColor="@color/white" /> + icApp:widgetImageValue="@{recordCalories}" /> + icApp:widgetImageValue="@{recordDistance}" /> diff --git a/app/src/main/res/layout/item_ped_setup.xml b/app/src/main/res/layout/item_ped_setup.xml index 7541dde..cb1f69d 100644 --- a/app/src/main/res/layout/item_ped_setup.xml +++ b/app/src/main/res/layout/item_ped_setup.xml @@ -45,24 +45,24 @@ 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"/> diff --git a/app/src/main/res/layout/widget_image_text_layout.xml b/app/src/main/res/layout/widget_image_text_layout.xml index cab81c0..8347291 100644 --- a/app/src/main/res/layout/widget_image_text_layout.xml +++ b/app/src/main/res/layout/widget_image_text_layout.xml @@ -1,22 +1,25 @@ + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:orientation="horizontal"> + android:layout_height="wrap_content" /> + style="@style/RecordTextStyle" + android:layout_marginStart="2dp" + android:textColor="@color/white" /> + style="@style/RecordTextStyle" + android:layout_marginStart="2dp" + android:textColor="@color/white" /> \ No newline at end of file diff --git a/app/src/main/res/mipmap-mdpi/calorie.png b/app/src/main/res/mipmap-mdpi/calorie.png new file mode 100644 index 0000000..683af49 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/calorie.png differ diff --git a/app/src/main/res/mipmap-mdpi/flag.png b/app/src/main/res/mipmap-mdpi/flag.png new file mode 100644 index 0000000..17896e9 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/flag.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_cancel.png b/app/src/main/res/mipmap-mdpi/ic_cancel.png index 29a4bc8..dfb6992 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_cancel.png and b/app/src/main/res/mipmap-mdpi/ic_cancel.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_ok.png b/app/src/main/res/mipmap-mdpi/ic_ok.png index 5001e57..0e72578 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_ok.png and b/app/src/main/res/mipmap-mdpi/ic_ok.png differ diff --git a/app/src/main/res/mipmap-mdpi/map.png b/app/src/main/res/mipmap-mdpi/map.png new file mode 100644 index 0000000..936f823 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/map.png differ diff --git a/app/src/main/res/mipmap-mdpi/step.png b/app/src/main/res/mipmap-mdpi/step.png new file mode 100644 index 0000000..0b5ef64 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/step.png differ diff --git a/app/src/main/res/mipmap-mdpi/tall.png b/app/src/main/res/mipmap-mdpi/tall.png new file mode 100644 index 0000000..8cb64c2 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/tall.png differ diff --git a/app/src/main/res/mipmap-mdpi/weight.png b/app/src/main/res/mipmap-mdpi/weight.png new file mode 100644 index 0000000..716fe0c Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/weight.png differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 6a1975d..7ddcf69 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -31,6 +31,7 @@ #22ddb0 #E6F9F7 #50000000 + #2492F0 #06C1AE