1
This commit is contained in:
@@ -55,4 +55,8 @@ dependencies {
|
||||
implementation project(':todaystepcounterlib')
|
||||
//打分ui
|
||||
compile 'com.github.CB-ysx:CBRatingBar:3.0.1'
|
||||
//蛛网
|
||||
implementation 'me.panpf:spider-web-score-view:1.0.1'
|
||||
//折线
|
||||
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.example.ninefourone.nutritionmaster.modules;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.ToxicBakery.viewpager.transforms.CubeOutTransformer;
|
||||
import com.cb.ratingbar.CBRatingBar;
|
||||
@@ -15,12 +15,15 @@ import com.example.ninefourone.nutritionmaster.adapter.HomePagerAdapter;
|
||||
import com.example.ninefourone.nutritionmaster.base.BaseActivity;
|
||||
import com.example.ninefourone.nutritionmaster.ui.NoScrollViewPager;
|
||||
import com.flyco.tablayout.SlidingTabLayout;
|
||||
import com.github.siyamed.shapeimageview.CircularImageView;
|
||||
import com.mxn.soul.flowingdrawer_core.ElasticDrawer;
|
||||
import com.mxn.soul.flowingdrawer_core.FlowingDrawer;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import me.panpf.swsv.CircularLayout;
|
||||
import me.panpf.swsv.SpiderWebScoreView;
|
||||
|
||||
public class MainActivity extends BaseActivity {
|
||||
|
||||
@@ -36,6 +39,14 @@ public class MainActivity extends BaseActivity {
|
||||
FrameLayout barCover;
|
||||
@BindView(R.id.cb_rating_bar)
|
||||
CBRatingBar cbRatingBar;
|
||||
@BindView(R.id.toolbar_user_avatar)
|
||||
CircularImageView toolbarUserAvatar;
|
||||
@BindView(R.id.drawer_user_avatar)
|
||||
CircularImageView drawerUserAvatar;
|
||||
@BindView(R.id.spiderWeb_mainActivity)
|
||||
SpiderWebScoreView spiderWebMainActivity;
|
||||
@BindView(R.id.layout_mainActivity_circular)
|
||||
CircularLayout layoutMainActivityCircular;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -62,7 +73,7 @@ public class MainActivity extends BaseActivity {
|
||||
// Logger.i("openRatio=" + openRatio + " ,offsetPixels=" + offsetPixels);
|
||||
}
|
||||
});
|
||||
|
||||
initSpiderView();
|
||||
initViewPager();
|
||||
}
|
||||
|
||||
@@ -107,4 +118,21 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化蛛网图
|
||||
*/
|
||||
private void initSpiderView() {
|
||||
float[] scores = {9.1f, 5.5f, 7.7f, 8.9f, 4.6f};
|
||||
String[] flags = {"糖分", "淡水", "蛋白质", "维生素", "矿物质"};
|
||||
spiderWebMainActivity.setScores(10f, scores);
|
||||
layoutMainActivityCircular.removeAllViews();
|
||||
for (String flag : flags) {
|
||||
TextView scoreTextView = (TextView) LayoutInflater.from(getBaseContext()).inflate(R.layout.score,
|
||||
layoutMainActivityCircular, false);
|
||||
scoreTextView.setText(flag);
|
||||
layoutMainActivityCircular.addView(scoreTextView);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -36,17 +36,12 @@ import me.itangqi.waveloadingview.WaveLoadingView;
|
||||
|
||||
public class BodyInformationFragment extends BaseFragment {
|
||||
|
||||
@BindView(R.id.progress_1)
|
||||
RoundCornerProgressBar progress1;
|
||||
|
||||
Unbinder unbinder;
|
||||
@BindView(R.id.step_text_view)
|
||||
TextView stepTextView;
|
||||
@BindView(R.id.waveLoadingView)
|
||||
WaveLoadingView waveLoadingView;
|
||||
@BindView(R.id.button_10)
|
||||
Button button10;
|
||||
@BindView(R.id.button_80)
|
||||
Button button80;
|
||||
|
||||
private int stepCount = 0;
|
||||
private static final int REFRESH_STEP_WHAT = 0;
|
||||
@@ -66,14 +61,7 @@ public class BodyInformationFragment extends BaseFragment {
|
||||
|
||||
@Override
|
||||
public void initView(Bundle state) {
|
||||
progress1.setProgressColor(Color.parseColor("#ed3b27"));
|
||||
progress1.setProgressBackgroundColor(Color.parseColor("#808080"));
|
||||
progress1.setMax(70);
|
||||
progress1.setProgress(15);
|
||||
|
||||
|
||||
initStepCounter();
|
||||
// Logger.d(((MainActivity)getActivity()).getStepCount());
|
||||
}
|
||||
|
||||
|
||||
@@ -130,18 +118,6 @@ public class BodyInformationFragment extends BaseFragment {
|
||||
stepTextView.setText(stepCount + "步");
|
||||
}
|
||||
|
||||
@OnClick({R.id.button_10, R.id.button_80})
|
||||
public void onViewClicked(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.button_10:
|
||||
waveLoadingView.setProgressValue(10);
|
||||
break;
|
||||
case R.id.button_80:
|
||||
waveLoadingView.setProgressValue(80);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 定时器,修改UI
|
||||
|
||||
@@ -234,6 +234,31 @@
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp" />
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:clipChildren="false">
|
||||
|
||||
<me.panpf.swsv.SpiderWebScoreView
|
||||
android:id="@+id/spiderWeb_mainActivity"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_gravity="center"
|
||||
app:scoreColor="@color/colorPrimary"
|
||||
app:scoreStrokeColor="@color/colorPrimary"/>
|
||||
|
||||
<me.panpf.swsv.CircularLayout
|
||||
android:id="@+id/layout_mainActivity_circular"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_gravity="center"
|
||||
android:clipChildren="false" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp" />
|
||||
|
||||
@@ -6,33 +6,18 @@
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar
|
||||
android:id="@+id/progress_1"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="40dp"
|
||||
app:rcBackgroundPadding="5dp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="30dp" />
|
||||
|
||||
<me.itangqi.waveloadingview.WaveLoadingView
|
||||
android:id="@+id/waveLoadingView"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="200dp"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
app:wlv_borderColor="@color/colorAccent"
|
||||
app:wlv_borderWidth="3dp"
|
||||
app:wlv_progressValue="40"
|
||||
app:wlv_round_rectangle="true"
|
||||
app:wlv_shapeType="circle"
|
||||
app:wlv_titleCenter="卡路里值"
|
||||
app:wlv_titleCenter="今日卡路里值"
|
||||
app:wlv_titleCenterColor="@android:color/white"
|
||||
app:wlv_titleCenterSize="24sp"
|
||||
app:wlv_titleCenterSize="18sp"
|
||||
app:wlv_titleCenterStrokeColor="@android:color/holo_blue_dark"
|
||||
app:wlv_titleCenterStrokeWidth="3dp"
|
||||
app:wlv_triangle_direction="north"
|
||||
@@ -45,23 +30,5 @@
|
||||
android:layout_height="30dp"
|
||||
android:textColor="#4d4a4a" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_10"
|
||||
android:layout_width="80dp"
|
||||
android:text="10"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button_80"
|
||||
android:layout_width="80dp"
|
||||
android:text="80"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
8
app/src/main/res/layout/score.xml
Normal file
8
app/src/main/res/layout/score.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="10sp">
|
||||
|
||||
|
||||
</TextView>
|
||||
Reference in New Issue
Block a user