Merge pull request '1' (#4) from zgh_branch into develop
@ -0,0 +1,37 @@
|
||||
package com.example;
|
||||
//导入所需的类和接口
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
public class ViewPagerAdapter extends FragmentPagerAdapter {
|
||||
private List<Fragment> fragments = new ArrayList<>();
|
||||
private List<String> fragmentTitles = new ArrayList<>();
|
||||
//两个列表将会存储即将被加入到ViewPager中的 Fragment 和 页面标题。
|
||||
public ViewPagerAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
}
|
||||
|
||||
public void addFragment(Fragment fragment, String title) {
|
||||
fragments.add(fragment);
|
||||
fragmentTitles.add(title);
|
||||
}//用于添加 Fragment 和对应的标题到 fragments 和 fragmentTitles 列表中。
|
||||
//重写 getItem() 方法是为了返回 ViewPager 中要求位置的 Fragment 实例。
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return fragments.get(position);
|
||||
}
|
||||
//getCount() 返回在适配器中的 Fragment 数量。
|
||||
@Override
|
||||
public int getCount() {
|
||||
return fragments.size();
|
||||
}
|
||||
//getPageTitle() 方法返回在 ViewPager 中要求位置的页面标题。
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return fragmentTitles.get(position);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,135 @@
|
||||
package com.example.sleep;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.app.ActivityCompat;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
import com.example.ViewPagerAdapter;
|
||||
import com.example.sleep.database.GetRecord;
|
||||
import com.example.sleep.database.RecordBean;
|
||||
import com.example.sleep.service.GoSleepService;
|
||||
|
||||
|
||||
import static com.example.sleep.database.GetRecord.getRecord;
|
||||
|
||||
|
||||
/**
|
||||
* 一开始的主界面
|
||||
*/
|
||||
public class MainScreen extends FragmentActivity {
|
||||
|
||||
private static final int REQUEST_READ_EXTERNAL_STORAGE = 1;
|
||||
private long exitTime = 0;
|
||||
private ViewPager viewPager;
|
||||
private TabLayout tabLayout;
|
||||
private Button backRl;
|
||||
|
||||
|
||||
//初始化
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
readLog();
|
||||
/*initView();*/
|
||||
startGoSleepService();
|
||||
|
||||
viewPager = findViewById(R.id.viewPager);
|
||||
backRl = findViewById(R.id.btn_AfterSleep);
|
||||
backRl.setOnClickListener(v -> finish());
|
||||
tabLayout = findViewById(R.id.tabLayout);
|
||||
|
||||
ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
|
||||
adapter.addFragment(new SleepFragment(), "睡眠");
|
||||
adapter.addFragment(new DreamAnalyszeScreen(), "解梦");
|
||||
adapter.addFragment(new Share(), "分享");
|
||||
adapter.addFragment(new SuggestScreen(), "报告");
|
||||
|
||||
viewPager.setAdapter(adapter);
|
||||
tabLayout.setupWithViewPager(viewPager);
|
||||
|
||||
// 检查权限
|
||||
if (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
// 请求权限
|
||||
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, REQUEST_READ_EXTERNAL_STORAGE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
|
||||
if (requestCode == REQUEST_READ_EXTERNAL_STORAGE) {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
// 权限已获得
|
||||
} else {
|
||||
// 权限被拒绝
|
||||
Toast.makeText(this, "Permission Denied!", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//按钮
|
||||
public void ClickRecord(View v) {
|
||||
Intent i = new Intent();
|
||||
i.setClass(MainScreen.this, CalendarPage.class);
|
||||
MainScreen.this.startActivity(i);
|
||||
MainScreen.this.finish();
|
||||
}
|
||||
|
||||
//按下返回键的效果
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||
if (System.currentTimeMillis() - exitTime > 2000) {
|
||||
Toast.makeText(getApplicationContext(), "再按一次退出程序", Toast.LENGTH_SHORT).show();
|
||||
exitTime = System.currentTimeMillis();
|
||||
} else {
|
||||
finish();
|
||||
System.exit(0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
//读睡眠记录,判断是否异常退出
|
||||
private void readLog() {
|
||||
RecordBean mRecord;
|
||||
GetRecord mGetRecord = getRecord();
|
||||
mRecord = mGetRecord.getLatestRecord();
|
||||
if (mRecord != null) {
|
||||
if (!mRecord.getValid()) {
|
||||
Intent i = new Intent();
|
||||
i.setClass(MainScreen.this, SleepMonitoringScreen.class);
|
||||
MainScreen.this.startActivity(i);
|
||||
MainScreen.this.finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void startGoSleepService() {
|
||||
Intent ifSleepIntent = new Intent(this, GoSleepService.class);
|
||||
this.startService(ifSleepIntent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.example.sleep.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.sleep.App;
|
||||
import com.example.sleep.R;
|
||||
import com.example.sleep.database.UserBean;
|
||||
import com.example.sleep.database.dao.DaoSession;
|
||||
import com.example.sleep.database.dao.UserBeanDao;
|
||||
//处理用户的注册操作
|
||||
public class RegisterActivity extends AppCompatActivity {
|
||||
|
||||
private EditText registerUsernameEditText;//用户名
|
||||
private EditText registerPasswordEditText;//密码
|
||||
private Button registerButton;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
//设置一些基本的视图元素,并为其中视图元素设置一个简单的事件处理程序。
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_register);
|
||||
|
||||
registerUsernameEditText = findViewById(R.id.usernameEditText);
|
||||
registerPasswordEditText = findViewById(R.id.passwordEditText);
|
||||
registerButton = findViewById(R.id.registerButton);
|
||||
findViewById(R.id.btn_AfterSleep).setOnClickListener(v -> finish());
|
||||
|
||||
registerButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// 处理注册逻辑
|
||||
String newUsername = registerUsernameEditText.getText().toString();
|
||||
String newPassword = registerPasswordEditText.getText().toString();
|
||||
// 将新用户的用户名和密码保存到GreenDAO数据库中
|
||||
// 执行注册操作
|
||||
// 创建一个新的 User 对象并设置用户名和密码
|
||||
UserBean newUser = new UserBean();
|
||||
newUser.setUsername(newUsername);
|
||||
newUser.setPassword(newPassword);
|
||||
// 获取 GreenDAO 的 DAOSession
|
||||
DaoSession mDaoSession = App.mDaoSession;
|
||||
UserBeanDao userBeanDao = mDaoSession.getUserBeanDao();
|
||||
long id = userBeanDao.insert(newUser);
|
||||
System.out.println("userDao: " + id);
|
||||
if (id != -1) Toast.makeText(RegisterActivity.this,"注册成功",Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="3dp"></corners>
|
||||
<solid android:color="#42000000" />
|
||||
<solid android:color="#fff"></solid>
|
||||
</shape>
|
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 62 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 69 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 51 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 64 KiB |
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@android:color/transparent"></solid>
|
||||
<corners android:radius="25dip"></corners>
|
||||
<stroke
|
||||
android:width="1px"
|
||||
android:color="#ff9c0e"></stroke>
|
||||
</shape>
|
After Width: | Height: | Size: 489 B |
After Width: | Height: | Size: 392 B |
After Width: | Height: | Size: 26 KiB |
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval"
|
||||
android:useLevel="false">
|
||||
<solid android:color="@color/white" />
|
||||
<size
|
||||
android:width="20dp"
|
||||
android:height="20dp" />
|
||||
</shape>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval"
|
||||
android:useLevel="false">
|
||||
<solid android:color="@color/colorPrimary" />
|
||||
<size
|
||||
android:width="20dp"
|
||||
android:height="20dp" />
|
||||
</shape>
|
After Width: | Height: | Size: 1018 B |
After Width: | Height: | Size: 908 B |
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval"
|
||||
android:useLevel="false">
|
||||
<solid android:color="@android:color/transparent" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/colorPrimary" />
|
||||
<size
|
||||
android:width="20dp"
|
||||
android:height="20dp" />
|
||||
</shape>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval"
|
||||
android:useLevel="false">
|
||||
<solid android:color="#ffff9c0e" />
|
||||
<size
|
||||
android:width="4dp"
|
||||
android:height="4dp" />
|
||||
</shape>
|
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/view_syllabus_active_mark_background" android:state_enabled="true"></item>
|
||||
<item android:drawable="@drawable/view_syllabus_unactive_mark_background" android:state_enabled="false"></item>
|
||||
</selector>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval"
|
||||
android:useLevel="false">
|
||||
<solid android:color="#cccccc" />
|
||||
<size
|
||||
android:width="4dp"
|
||||
android:height="4dp" />
|
||||
</shape>
|
After Width: | Height: | Size: 91 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 103 KiB |
After Width: | Height: | Size: 83 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 101 KiB |
After Width: | Height: | Size: 573 B |
After Width: | Height: | Size: 480 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 163 KiB |
After Width: | Height: | Size: 152 KiB |
After Width: | Height: | Size: 156 KiB |
After Width: | Height: | Size: 146 KiB |
After Width: | Height: | Size: 180 KiB |
After Width: | Height: | Size: 151 KiB |
After Width: | Height: | Size: 166 KiB |
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.5 KiB |
After Width: | Height: | Size: 2.6 KiB |
After Width: | Height: | Size: 828 B |
After Width: | Height: | Size: 711 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 676 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.5 KiB |
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<size
|
||||
android:width="150dp"
|
||||
android:height="150dp"/>
|
||||
<corners
|
||||
android:radius="80dp"/>
|
||||
<solid
|
||||
android:color="@color/cyan"/>
|
||||
</shape>
|
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 1023 B |
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle" >
|
||||
<solid android:color="#88000042" />
|
||||
<padding
|
||||
android:bottom="5dp"
|
||||
android:left="10dp"
|
||||
android:right="10dp"
|
||||
android:top="5dp" />
|
||||
</shape>
|
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 5.8 KiB |
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
|
||||
<size
|
||||
android:width="10dp"
|
||||
android:height="10dp" />
|
||||
<solid android:color="@color/silver" />
|
||||
</shape>
|
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,100 @@
|
||||
<!-- res/layout/activity_login.xml -->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/background">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layout_titlebar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="#191970">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_AfterSleep"
|
||||
android:layout_width="71dp"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="#191970"
|
||||
android:drawableLeft="@drawable/arrow_back"
|
||||
android:drawablePadding="6dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="5dp"
|
||||
android:singleLine="true"
|
||||
android:text="返回"
|
||||
android:textAlignment="center"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center_horizontal|center"
|
||||
android:singleLine="true"
|
||||
android:text="睡眠助手"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#fff"
|
||||
android:textSize="20dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<EditText
|
||||
android:padding="16dp"
|
||||
android:layout_below="@id/layout_titlebar"
|
||||
android:id="@+id/usernameEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:textColorHint="@color/transparent_gray"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Username"
|
||||
android:textColor="#fff"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
<EditText
|
||||
android:padding="16dp"
|
||||
android:id="@+id/passwordEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Password"
|
||||
android:textColor="#fff"
|
||||
android:textColorHint="@color/transparent_gray"
|
||||
android:layout_below="@+id/usernameEditText"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:inputType="textPassword"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
<Button
|
||||
android:layout_margin="16dp"
|
||||
android:id="@+id/loginButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="登陆"
|
||||
android:layout_below="@+id/passwordEditText"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
<Button
|
||||
android:layout_margin="16dp"
|
||||
android:id="@+id/registerButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="注册"
|
||||
android:layout_below="@+id/loginButton"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
</RelativeLayout>
|
@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/background">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layout_titlebar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:background="#191970">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_AfterSleep"
|
||||
android:layout_width="71dp"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="#191970"
|
||||
android:drawableLeft="@drawable/arrow_back"
|
||||
android:drawablePadding="6dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="5dp"
|
||||
android:singleLine="true"
|
||||
android:text="返回"
|
||||
android:textAlignment="center"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center_horizontal|center"
|
||||
android:singleLine="true"
|
||||
android:text="睡眠助手"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="20dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/viewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_below="@id/layout_titlebar"
|
||||
android:layout_above="@+id/tabLayout" />
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true" />
|
||||
|
||||
</RelativeLayout>
|
@ -0,0 +1,102 @@
|
||||
<!-- res/layout/activity_login.xml -->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:background="@mipmap/background">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layout_titlebar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="#191970">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_AfterSleep"
|
||||
android:layout_width="71dp"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="#191970"
|
||||
android:drawableLeft="@drawable/arrow_back"
|
||||
android:drawablePadding="6dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="5dp"
|
||||
android:singleLine="true"
|
||||
android:text="返回"
|
||||
android:textAlignment="center"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center_horizontal|center"
|
||||
android:singleLine="true"
|
||||
android:text="睡眠助手"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="20dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<EditText
|
||||
android:padding="16dp"
|
||||
android:layout_below="@id/layout_titlebar"
|
||||
android:id="@+id/usernameEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Username"
|
||||
android:textColor="#fff"
|
||||
android:textColorHint="@color/transparent_gray"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
<EditText
|
||||
android:padding="16dp"
|
||||
android:textColorHint="@color/transparent_gray"
|
||||
android:id="@+id/passwordEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Password"
|
||||
android:textColor="#fff"
|
||||
android:layout_below="@+id/usernameEditText"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:inputType="textPassword"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
<Button
|
||||
android:padding="16dp"
|
||||
android:id="@+id/loginButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="登陆"
|
||||
android:visibility="gone"
|
||||
android:layout_below="@+id/passwordEditText"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
<Button
|
||||
android:layout_margin="16dp"
|
||||
android:id="@+id/registerButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="注册"
|
||||
android:layout_below="@+id/loginButton"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
</RelativeLayout>
|
@ -0,0 +1,196 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout 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="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/background"
|
||||
tools:context="com.example.sleep.CalendarPage">
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/show_month_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="28dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="22sp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/right"
|
||||
app:layout_constraintHorizontal_bias="0.68"
|
||||
app:layout_constraintStart_toEndOf="@+id/left"
|
||||
app:layout_constraintTop_toBottomOf="@+id/layout_titlebar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/show_year_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="28dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="22sp"
|
||||
app:layout_constraintEnd_toStartOf="@+id/show_month_view"
|
||||
app:layout_constraintTop_toBottomOf="@+id/layout_titlebar" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layout_titlebar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:background="#191970"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center_horizontal|center"
|
||||
android:singleLine="true"
|
||||
android:text="睡眠记录"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_Remind"
|
||||
android:layout_width="71dp"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:layout_alignEnd="@+id/text_title"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginEnd="0dp"
|
||||
android:background="#191970"
|
||||
android:drawablePadding="6dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:onClick="onClickRemind"
|
||||
android:singleLine="true"
|
||||
android:text="提醒"
|
||||
android:textAlignment="center"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/left"
|
||||
android:layout_width="21dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="80dp"
|
||||
android:background="@drawable/arrows_left"
|
||||
android:onClick="ClickLeft"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/right"
|
||||
android:layout_width="21dp"
|
||||
android:layout_height="34dp"
|
||||
android:layout_alignTop="@+id/left"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginTop="80dp"
|
||||
android:layout_marginEnd="32dp"
|
||||
android:background="@drawable/arrows_right"
|
||||
android:onClick="ClickRight"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<android.support.constraint.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:layout_editor_absoluteX="0dp">
|
||||
|
||||
|
||||
<Button
|
||||
android:id="@+id/text_home_1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="#191970"
|
||||
android:drawableTop="@drawable/sleep_0"
|
||||
android:drawablePadding="2dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:onClick="ClickSleep"
|
||||
android:paddingTop="5dp"
|
||||
android:singleLine="true"
|
||||
android:text="睡觉"
|
||||
android:textAlignment="center"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/text_record_1"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/text_record_1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:background="#191970"
|
||||
android:drawableTop="@drawable/record_1"
|
||||
android:drawablePadding="2dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:paddingTop="5dp"
|
||||
android:singleLine="true"
|
||||
android:text="记录"
|
||||
android:textAlignment="center"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/text_home_1" />
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="300dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginTop="36dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_weight="1"
|
||||
app:layout_constraintBottom_toTopOf="@+id/constraintLayout"
|
||||
app:layout_constraintEnd_toStartOf="@+id/right"
|
||||
app:layout_constraintStart_toEndOf="@+id/left"
|
||||
app:layout_constraintTop_toBottomOf="@+id/layout_titlebar"
|
||||
app:layout_constraintVertical_bias="0.419">
|
||||
|
||||
<com.ldf.calendar.view.MonthPager
|
||||
android:id="@+id/calendar_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@android:color/transparent" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="#c2c2c2"
|
||||
app:layout_behavior="com.ldf.calendar.behavior.RecyclerViewBehavior" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.ldf.calendar.view.MonthPager
|
||||
android:id="@+id/calendar_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:background="#fff"
|
||||
app:layout_anchor="@+id/list"
|
||||
app:layout_anchorGravity="top|center" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="#c2c2c2"
|
||||
app:layout_behavior="com.ldf.calendar.behavior.RecyclerViewBehavior" />
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/activity_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:text="0"
|
||||
android:textSize="60sp"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/circlecyan"
|
||||
android:layout_alignParentRight="true"
|
||||
android:elevation="7dp"
|
||||
android:shadowDy="1.0"
|
||||
android:id="@+id/grade"/>
|
||||
<LinearLayout
|
||||
android:id="@+id/upper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="212dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/rect"
|
||||
android:elevation="5dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:text="您的近期睡眠综合评分:"
|
||||
android:gravity="center_vertical"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/white"
|
||||
android:id="@+id/recentGrade"/>
|
||||
|
||||
<TextView
|
||||
android:layout_marginTop="18dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:padding="3dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="眠眠助手的建议:"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/white"
|
||||
android:id="@+id/suggest"/>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<com.example.sleep.drawChart.SimpleLineChart
|
||||
android:id="@+id/simpleLineChart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="200dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:elevation="5dp"
|
||||
android:layout_below="@+id/grade"
|
||||
android:background="@drawable/rect"/>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="51.4dp"
|
||||
android:layout_height="45dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:id="@+id/today_background"
|
||||
android:layout_width="33dp"
|
||||
android:layout_height="33dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/today_background"
|
||||
android:visibility="gone" />
|
||||
|
||||
<View
|
||||
android:id="@+id/selected_background"
|
||||
android:layout_width="33dp"
|
||||
android:layout_height="33dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:background="@drawable/selected_background"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:text="17"
|
||||
android:textColor="#3666a2" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/maker"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:background="@drawable/view_syllabus_mark_background"
|
||||
android:visibility="visible" />
|
||||
</RelativeLayout>
|
@ -0,0 +1,17 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:gravity="center"
|
||||
app:layout_goneMarginBottom="15dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tab_text"
|
||||
android:textColor="#000"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="15sp"
|
||||
android:text="Person"/>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/background">
|
||||
|
||||
<RelativeLayout
|
||||
android:visibility="gone"
|
||||
android:id="@+id/layout_titlebar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:background="#191970">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_AfterSleep"
|
||||
android:layout_width="71dp"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="#191970"
|
||||
android:drawableLeft="@drawable/arrow_back"
|
||||
android:drawablePadding="6dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="5dp"
|
||||
android:singleLine="true"
|
||||
android:text="返回"
|
||||
android:textAlignment="center"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center_horizontal|center"
|
||||
android:singleLine="true"
|
||||
android:text="睡眠助手"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="20dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:layout_below="@id/layout_titlebar"
|
||||
android:id="@+id/text2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="20dp"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center_horizontal|center"
|
||||
android:singleLine="true"
|
||||
android:text="请上传图片发表动态"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="20dp" />
|
||||
|
||||
<ImageView
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@id/layout_titlebar"
|
||||
|
||||
android:id="@+id/event_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@mipmap/default_image_up" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/rl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/event_image"
|
||||
android:layout_marginTop="30dp"/>
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/background">
|
||||
|
||||
<RelativeLayout
|
||||
android:visibility="visible"
|
||||
android:id="@+id/layout_titlebar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:background="#191970">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_AfterSleep"
|
||||
android:layout_width="71dp"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="#191970"
|
||||
android:drawableLeft="@drawable/arrow_back"
|
||||
android:drawablePadding="6dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="5dp"
|
||||
android:singleLine="true"
|
||||
android:text="返回"
|
||||
android:textAlignment="center"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center_horizontal|center"
|
||||
android:singleLine="true"
|
||||
android:text="睡眠助手"
|
||||
android:textAlignment="center"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="20dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@id/layout_titlebar"
|
||||
android:id="@+id/event_image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_height="200dp"
|
||||
android:src="@mipmap/default_image_upload" />
|
||||
|
||||
<LinearLayout
|
||||
android:visibility="visible"
|
||||
android:id="@+id/edit_content_ll"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="100dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:orientation="vertical">
|
||||
<EditText
|
||||
android:id="@+id/event_content"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ImageView
|
||||
android:layout_gravity="right"
|
||||
android:src="@drawable/post_bar"
|
||||
android:id="@+id/event_content_post"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 文章标题 -->
|
||||
<TextView
|
||||
android:id="@+id/textViewTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:padding="8dp"
|
||||
android:textColor="@android:color/white"/>
|
||||
|
||||
<!-- 文章图片 -->
|
||||
<ImageView
|
||||
android:id="@+id/imageViewArticleImage"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="250dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:layout_margin="8dp"/>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/article_rl"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
</android.support.constraint.ConstraintLayout>
|
@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_take_photo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="拍摄"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_choose_from_gallery"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="从相册中选择"
|
||||
android:layout_marginBottom="8dp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_cancel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="取消" />
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/background">
|
||||
<Button
|
||||
android:id="@+id/btn_start"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/start"
|
||||
android:fontFamily="sans-serif"
|
||||
android:text="开始解梦"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"/>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_dream"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:src="@drawable/dream"/>
|
||||
|
||||
<EditText
|
||||
app:layout_constraintTop_toBottomOf="@id/image_dream"
|
||||
android:padding="16dp"
|
||||
android:id="@+id/dream_title"
|
||||
android:layout_width="match_parent"
|
||||
android:textColorHint="@color/transparent_gray"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="输入梦境"
|
||||
android:textColor="#fff"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
<TextView
|
||||
app:layout_constraintTop_toBottomOf="@id/dream_title"
|
||||
android:padding="16dp"
|
||||
android:id="@+id/dream_des"
|
||||
android:layout_width="match_parent"
|
||||
android:textColorHint="@color/transparent_gray"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#fff"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/cv_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:background="#e7e7e7">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.67dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@android:color/white" />
|
||||
</RelativeLayout>
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="150dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
android:layout_marginTop="15dp"
|
||||
android:id="@+id/textView"
|
||||
android:textSize="25sp"
|
||||
android:textColor="#fff"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Sample Text" />
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rlTimeline"
|
||||
android:layout_width="65dp"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/TopLine"
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="#999" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/Dot"
|
||||
android:layout_width="15dp"
|
||||
android:layout_height="15dp"
|
||||
android:layout_below="@id/TopLine"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="@drawable/timeline_dot" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="2dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/Dot"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:background="#999" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rlCenter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingBottom="6dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="2014/06/24 20:55:28"
|
||||
android:textColor="@color/silver"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/Time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/Date"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="时间"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="18sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout 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="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/background"
|
||||
tools:context="com.example.sleep.Record">
|
||||
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/layout_titlebar"
|
||||
app:layout_constraintVertical_bias="0.0">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/timelList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/layout_titlebar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:background="#191970"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_Records"
|
||||
android:layout_width="71dp"
|
||||
android:layout_height="match_parent"
|
||||
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="#191970"
|
||||
android:drawableLeft="@drawable/arrow_back"
|
||||
android:drawablePadding="6dp"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:onClick="ClickBack"
|
||||
android:paddingLeft="5dp"
|
||||
android:singleLine="true"
|
||||
android:text="返回"
|
||||
android:textAlignment="center"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:gravity="center_horizontal|center"
|
||||
android:text="睡眠记录"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/sleep_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/mRunTime"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="80dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:text=""
|
||||
android:textColor="@android:color/darker_gray"
|
||||
android:textSize="70sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_stop"
|
||||
android:layout_width="180dp"
|
||||
android:layout_height="180dp"
|
||||
android:layout_below="@+id/textView"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="50dp"
|
||||
android:background="@drawable/stop"
|
||||
android:onClick="onRunningClick2"
|
||||
android:text="@string/stop_record"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/mRunTime"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="50dp"
|
||||
android:text="@string/recording"
|
||||
android:textColor="@color/rightRight"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/btn_stop"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/mRunTime" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/musicName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@+id/play"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:text=""
|
||||
android:textColor="@color/rightRight"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/play"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="60dp"
|
||||
android:background="@drawable/ic_play_btn_play"
|
||||
android:onClick="onClickMedia"
|
||||
android:text=""
|
||||
android:textAlignment="viewStart" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/next"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_alignTop="@+id/play"
|
||||
android:layout_marginStart="36dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_toEndOf="@+id/play"
|
||||
android:background="@drawable/ic_play_btn_next"
|
||||
android:onClick="onClickMedia"
|
||||
android:text="" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/previous"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="60dp"
|
||||
android:layout_alignTop="@+id/play"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_marginEnd="36dp"
|
||||
android:layout_toStartOf="@+id/play"
|
||||
android:background="@drawable/ic_play_btn_prev"
|
||||
android:onClick="onClickMedia"
|
||||
android:text="" />
|
||||
|
||||
</RelativeLayout>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/splash"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 2.2 KiB |