@Override
public void onDialogUpdate(int type, int value) {
- ((PedSetupFragment) myAdapter.getFragment(0)).updateSetuUpValue(type, value);
+ ((PedSetupFragment) myAdapter.getFragment(0)).updateSetUpValue(type, value);
switch (type) {
case 0:
pedometerModel.syncPedHeightSetting(value);
break;
case 1:
pedometerModel.syncPedWeightSetting(value);
- SPUtils.setPedWighttSP(getApplicationContext(), value);
+ SPUtils.setPedWightSP(getApplicationContext(), value);
break;
+ case 2:
+ //不需要通知远程服务
+ SPUtils.setPedTargetSP(getApplicationContext(), value);
}
}
setupArray = new PedSetupEntity[3];
int[] valueArray = new int[]{
SPUtils.getPedHeightSP(context),
- SPUtils.getPedWighttSP(context),
+ SPUtils.getPedWeightSP(context),
SPUtils.getPedTargetSP(context)
};
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.collection.ArrayMap;
import androidx.fragment.app.DialogFragment;
+import com.ic.iclooger.ICLogger;
import com.ic.sport.R;
import com.ic.sport.util.SPUtils;
import com.ic.sport.widget.picker.NumericWheelAdapter;
private final ArrayMap<Integer, int[]> limil = new ArrayMap<>();
- private final String[] UNIT_RES = new String[2];
- private final int[] VALUE_CURR = new int[2];
+ private final String[] UNIT_RES = new String[3];
+ private final int[] VALUE_CURR = new int[3];
private NoticeDialogListener mListener;
}
VALUE_CURR[0] = SPUtils.getPedHeightSP(mContext);
- VALUE_CURR[1] = SPUtils.getPedWighttSP(mContext);
+ VALUE_CURR[1] = SPUtils.getPedWeightSP(mContext);
+ VALUE_CURR[2] = SPUtils.getPedTargetSP(mContext);
+
+ ICLogger.d("height value ==> " + VALUE_CURR[0]);
+ ICLogger.d("weight value ==> " + VALUE_CURR[0]);
+ ICLogger.d("petTarget value ==> " + VALUE_CURR[0]);
UNIT_RES[0] = getString(R.string.tips_height_unit);
UNIT_RES[1] = getString(R.string.tips_weight_unit);
+ UNIT_RES[2] = getString(R.string.step_unit);
limil.put(0, new int[]{30, 250});
limil.put(1, new int[]{15, 150});
+ limil.put(2, new int[]{3000, 50000});
}
@Override
}
View popView = inflater.inflate(R.layout.dialog_ped_setup_layout, container);
- numberPicker = (WheelView) popView.findViewById(R.id.dialog_value_picker);
+ numberPicker = popView.findViewById(R.id.dialog_value_picker);
setNumberPicker(limil.get(mCurrType)[0],
limil.get(mCurrType)[1],
UNIT_RES[mCurrType],
VALUE_CURR[mCurrType]);
- ImageView bt = (ImageView) popView.findViewById(R.id.dialog_picker_ok);
+ ImageView bt = popView.findViewById(R.id.dialog_picker_ok);
bt.setOnClickListener(v -> {
- mListener.onDialogUpdate(mCurrType,limil.get(mCurrType)[0]+numberPicker.getCurrentItem());
+ mListener.onDialogUpdate(mCurrType,
+ limil.get(mCurrType)[0] + numberPicker.getCurrentItem());
dismiss();
});
- ImageView cancel = (ImageView) popView.findViewById(R.id.dialog_picker_cancel);
+ ImageView cancel = popView.findViewById(R.id.dialog_picker_cancel);
cancel.setOnClickListener(v -> dismiss());
-
return popView;
}
numberPicker.setAdapter(new NumericWheelAdapter(numberMin, numberMax));
numberPicker.setLabel(label);
numberPicker.setCyclic(true);
- numberPicker.TEXT_SIZE = (int) spToPx(65);
- numberPicker.ITEM_TEXT_SIZE = (int) spToPx(42);
-
+ if (mCurrType == 2) {
+ numberPicker.TEXT_SIZE = (int) spToPx(42);
+ numberPicker.ITEM_TEXT_SIZE = (int) spToPx(32);
+ } else {
+ numberPicker.TEXT_SIZE = (int) spToPx(65);
+ numberPicker.ITEM_TEXT_SIZE = (int) spToPx(42);
+ }
numberPicker.setCurrentItem(numberDefault - numberMin);
}
import android.content.Context;
import android.graphics.Rect;
import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-
import com.ic.sport.R;
import com.ic.sport.adapter.PedSetupAdapter;
mSetupRv.setAdapter(setupAdapter);
}
- private OnPedSetupItemClickListener listener = pos -> {
- if (pos == 2) {
- return;
- }
+ private final OnPedSetupItemClickListener listener = pos -> {
FragmentManager fm = getChildFragmentManager();
PedSetupDialogFragment alertDialog = PedSetupDialogFragment.newInstance(pos);
alertDialog.show(fm, "PedSetupDialog");
};
- public void updateSetuUpValue(int type, int value) {
+ public void updateSetUpValue(int type, int value) {
setupAdapter.notifyUpdateValue(type, value);
}
public void syncPedWeightSetting(int weight) {
pedometerPresenter.syncPedWeightSetting(weight);
}
-
public static class Factory extends ViewModelProvider.NewInstanceFactory {
@NonNull
import android.content.Context;
import android.content.ServiceConnection;
import android.os.IBinder;
-import android.os.RemoteException;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import com.ic.sport.util.IcLog;
import com.ic.sport.util.ServiceUtil;
-import java.net.FileNameMap;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutorService;
return getSp(context).getInt(Ped_Height, 170);
}
- public static int getPedWighttSP(Context context) {
+ public static int getPedWeightSP(Context context) {
return getSp(context).getInt(Ped_Weight, 75);
}
}
}
- public static void setPedWighttSP(Context context,int weight) {
+ public static void setPedWightSP(Context context, int weight) {
SharedPreferences.Editor editor = getSp(context).edit();
if (editor != null) {
editor.putInt(Ped_Weight, weight);
android:layout_width="match_parent"
android:layout_height="260dp"
android:layout_gravity="center"
- android:layout_marginLeft="26dp" />
+ android:layout_marginLeft="60dp" />
</LinearLayout>
<ImageView
android:id="@+id/dialog_picker_cancel"
- android:layout_width="80dp"
- android:layout_height="80dp"
+ android:layout_width="100dp"
+ android:layout_height="100dp"
android:layout_gravity="bottom"
android:background="@color/transparent"
android:contentDescription="@null"
<ImageView
android:id="@+id/dialog_picker_ok"
- android:layout_width="80dp"
- android:layout_height="80dp"
+ android:layout_width="100dp"
+ android:layout_height="100dp"
android:layout_alignParentEnd="true"
android:layout_gravity="bottom|end"
android:background="@color/transparent"
<string name="pedometer_unit_foot">feet</string>
<string name="reached_step_goal">completed</string>
<string name="target_text">aim:</string>
+ <string name="step_unit">step</string>
</resources>
<string name="pedometer_unit_foot">英尺</string>
<string name="reached_step_goal">已达到目标步数</string>
<string name="target_text">目標:</string>
+ <string name="step_unit">step</string>
</resources>
<string name="pedometer_unit_foot">英尺</string>
<string name="reached_step_goal">已达到目标步数</string>
<string name="target_text">目标:</string>
+ <string name="step_unit">step</string>
</resources>
<string name="pedometer_unit_foot">英尺</string>
<string name="reached_step_goal">已达到目标步数</string>
<string name="target_text">目标:</string>
+ <string name="step_unit">step</string>
</resources>