个人信息补全界面
This commit is contained in:
@@ -17,9 +17,11 @@
|
||||
|
||||
<!-- 相机权限 -->
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.camera"
|
||||
android:required="false" />
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<application
|
||||
@@ -42,7 +44,9 @@
|
||||
<receiver
|
||||
android:name=".step.StepStarter"
|
||||
android:enabled="true"
|
||||
android:exported="true"></receiver>
|
||||
android:exported="true" />
|
||||
|
||||
<activity android:name=".modules.addinformation.AddActivity"></activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -11,6 +11,7 @@ import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.ToxicBakery.viewpager.transforms.CubeOutTransformer;
|
||||
@@ -19,6 +20,7 @@ import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.adapter.HomePagerAdapter;
|
||||
import com.example.ninefourone.nutritionmaster.base.BaseActivity;
|
||||
import com.example.ninefourone.nutritionmaster.camera.FoodMaterialCamera;
|
||||
import com.example.ninefourone.nutritionmaster.modules.addinformation.AddActivity;
|
||||
import com.example.ninefourone.nutritionmaster.ui.NoScrollViewPager;
|
||||
import com.example.ninefourone.nutritionmaster.utils.MessageUtils;
|
||||
import com.example.ninefourone.nutritionmaster.utils.PermissionUtils;
|
||||
@@ -81,6 +83,8 @@ public class MainActivity extends BaseActivity {
|
||||
BoomMenuButton boomMenuButton;
|
||||
@BindView(R.id.spider_view)
|
||||
RadarChart spiderView;
|
||||
@BindView(R.id.add_information_button)
|
||||
ImageView addInformationButton;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -166,13 +170,11 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
|
||||
//mDrawer.openMenu();
|
||||
|
||||
/**
|
||||
* 点击事件
|
||||
*/
|
||||
@OnClick(R.id.navigation_layout)
|
||||
public void onViewClicked() {
|
||||
mDrawer.openMenu();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -305,4 +307,17 @@ public class MainActivity extends BaseActivity {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
MessageUtils.MakeToast("权限赋予成功");
|
||||
}
|
||||
|
||||
@OnClick({R.id.navigation_layout, R.id.add_information_button})
|
||||
public void onViewClicked(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.navigation_layout:
|
||||
mDrawer.openMenu();
|
||||
break;
|
||||
case R.id.add_information_button:
|
||||
Intent intent = new Intent(MainActivity.this, AddActivity.class);
|
||||
startActivity(intent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.example.ninefourone.nutritionmaster.modules.addinformation;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.ninefourone.nutritionmaster.R;
|
||||
import com.example.ninefourone.nutritionmaster.utils.MessageUtils;
|
||||
import com.github.czy1121.view.TurnCardListView;
|
||||
import com.orhanobut.logger.Logger;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class AddActivity extends AppCompatActivity {
|
||||
|
||||
@BindView(R.id.card_list)
|
||||
TurnCardListView cardList;
|
||||
@BindView(R.id.bottom_content)
|
||||
RelativeLayout bottomContent;
|
||||
@BindView(R.id.back_button)
|
||||
ImageView backButton;
|
||||
|
||||
|
||||
private int[] colors = {0xff3F51B5, 0xff673AB7, 0xff006064, 0xffC51162, 0xffFFEB3B, 0xff795548, 0xff9E9E9E};
|
||||
private Button[] firstButtons = new Button[colors.length];
|
||||
private Button[] secondButtons = new Button[colors.length];
|
||||
private TextView[] titleViews = new TextView[colors.length];
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
//设置全屏
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||
WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_add);
|
||||
ButterKnife.bind(this);
|
||||
initAddView();
|
||||
}
|
||||
|
||||
private void initAddView() {
|
||||
BaseAdapter adapter = new BaseAdapter() {
|
||||
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return colors.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View child, ViewGroup parent) {
|
||||
|
||||
child = LayoutInflater.from(parent.getContext()).inflate(R.layout.add_item, parent, false);
|
||||
child.findViewById(R.id.image).setBackgroundColor(colors[position]);
|
||||
titleViews[position] = child.findViewById(R.id.title_view);
|
||||
firstButtons[position] = child.findViewById(R.id.choose_first);
|
||||
firstButtons[position].setBackgroundColor(colors[position] + 30);
|
||||
secondButtons[position] = child.findViewById(R.id.choose_second);
|
||||
secondButtons[position].setBackgroundColor(colors[position] + 30);
|
||||
|
||||
firstButtons[position].setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
firstButtons[position].setBackgroundColor(colors[position] - 60);
|
||||
secondButtons[position].setBackgroundColor(colors[position] + 30);
|
||||
cardList.turnTo(position + 1);
|
||||
}
|
||||
});
|
||||
secondButtons[position].setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
firstButtons[position].setBackgroundColor(colors[position] + 30);
|
||||
secondButtons[position].setBackgroundColor(colors[position] - 60);
|
||||
cardList.turnTo(position + 1);
|
||||
}
|
||||
});
|
||||
return child;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
cardList.setAdapter(adapter);
|
||||
cardList.setOnTurnListener(new TurnCardListView.OnTurnListener() {
|
||||
@Override
|
||||
public void onTurned(int position) {
|
||||
Toast.makeText(AddActivity.this, "position = " + position, Toast.LENGTH_SHORT).show();
|
||||
bottomContent.setBackgroundColor(colors[position] - 60);
|
||||
}
|
||||
});
|
||||
// cardList.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// cardList.turnTo(1);
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
}
|
||||
|
||||
@OnClick(R.id.back_button)
|
||||
public void onViewClicked() {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
4
app/src/main/res/drawable/ic_back_button.xml
Normal file
4
app/src/main/res/drawable/ic_back_button.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<vector android:height="24dp" android:viewportHeight="1024.0"
|
||||
android:viewportWidth="1024.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#2c2c2c" android:pathData="M228.9,535.7l238.5,238.5a51.2,51.2 0,0 1,-72.4 72.4L69.1,520.8a51.1,51.1 0,0 1,-9.7 -13.5,51.2 51.2,0 0,1 6.8,-64.1l325.8,-325.8A51.2,51.2 0,1 1,464.4 189.8L220.9,433.3H888.8a51.2,51.2 0,0 1,0 102.4H228.9z"/>
|
||||
</vector>
|
||||
5
app/src/main/res/drawable/ic_data_add.xml
Normal file
5
app/src/main/res/drawable/ic_data_add.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<vector android:height="24dp" android:viewportHeight="1024.0"
|
||||
android:viewportWidth="1024.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#ffffff" android:pathData="M512,967.1A455.1,455.1 0,1 0,512 56.9a455.1,455.1 0,0 0,0 910.2zM512,1024A512,512 0,1 1,512 0a512,512 0,0 1,0 1024z"/>
|
||||
<path android:fillColor="#ffffff" android:pathData="M712.2,606.7c-69.3,-16.3 -104.8,-55.1 -110.9,-63.2 -6.1,-8.2 -6.1,-18.4 -6.1,-30.6 0,-4.1 2,-10.2 4.1,-14.2l2,-4.1c2,-4.1 10.1,-24.5 16.3,-36.8 0,-2 4,-8.2 8.1,-12.2 6.1,-4.1 12.2,-10.2 22.4,-22.4 16.3,-24.5 8.2,-46.9 -6.1,-57.1v-4c8.1,-22.5 12.2,-48.9 10.2,-81.6 -2.1,-34.7 -34.7,-87.7 -118.3,-87.7 -83.6,0 -116.2,51 -118.2,87.7 -2,32.6 2,59.1 10.2,79.5V364.1c-14.3,12.3 -20.5,34.7 -6.1,59.2 8.1,12.2 16.3,18.3 22.4,22.4 4.1,4.1 8.2,10.2 8.2,12.2 6.1,12.3 14.3,30.6 16.3,36.8l2,4c2,6.1 4,10.2 4,14.2 0,10.2 0,22.5 -6.1,30.7 -6.1,8.1 -40.8,46.9 -110.1,63.1 -61.2,14.3 -100.7,49.3 -100.7,129.8 0,4.1 4.1,10.2 10.2,10.2h533.7c4,0 10.2,-4.1 10.2,-10.2 0,-84.5 -34.7,-115.5 -97.8,-129.7z"/>
|
||||
</vector>
|
||||
25
app/src/main/res/layout/activity_add.xml
Normal file
25
app/src/main/res/layout/activity_add.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/bottom_content"
|
||||
android:layout_width="match_parent"
|
||||
android:background="#334397"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="com.example.ninefourone.nutritionmaster.modules.addinformation.AddActivity">
|
||||
|
||||
|
||||
<com.github.czy1121.view.TurnCardListView
|
||||
android:id="@+id/card_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</com.github.czy1121.view.TurnCardListView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_button"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:src="@drawable/ic_back_button" />
|
||||
</RelativeLayout>
|
||||
@@ -193,6 +193,7 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/information_layout"
|
||||
android:layout_width="110dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
@@ -227,6 +228,15 @@
|
||||
android:layout_marginEnd="10dp"
|
||||
android:alpha="0.2"
|
||||
android:src="@drawable/icon_black" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/add_information_button"
|
||||
android:layout_width="23dp"
|
||||
android:layout_height="23dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="25dp"
|
||||
android:layout_marginTop="15dp"
|
||||
android:src="@drawable/ic_data_add" />
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
53
app/src/main/res/layout/add_item.xml
Normal file
53
app/src/main/res/layout/add_item.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="400dp"
|
||||
android:layout_gravity="center"
|
||||
app:cardCornerRadius="20dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="17sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/choose_first"
|
||||
android:layout_width="200dp"
|
||||
android:textSize="13sp"
|
||||
android:layout_height="50dp"
|
||||
android:text="是">
|
||||
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
android:id="@+id/choose_second"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="否"
|
||||
android:textSize="13sp">
|
||||
|
||||
</Button>
|
||||
|
||||
</LinearLayout>
|
||||
</android.support.v7.widget.CardView>
|
||||
Reference in New Issue
Block a user