Skip to content

Commit

Permalink
Merge pull request BriAlpha#2 from Float-E/master
Browse files Browse the repository at this point in the history
Log updated
  • Loading branch information
BriAlpha authored and HSQ7777 committed Dec 1, 2023
2 parents e7d0fa6 + 6e31df4 commit 2ace5ba
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType){
@Override
public void onBindViewHolder(final ViewHolder holder , final int position){
Plan plan = mDataList.get(position);
holder.time.setText(plan.getMonth() + "" + plan.getDay() + "");
holder.time.setText(plan.getMonth() + "Month" + plan.getDay() + "Day");
holder.schedule.setText(plan.getWritePlan());

holder.scheduleView.setOnClickListener(new View.OnClickListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void onClick(View view) {
else{
log.setLogWrite(newLog);
log.updateAll("logWrite = ?",oldLog); //不能使用save的方法
Toast.makeText(AlterLogActivity.this, "修改成功", Toast.LENGTH_SHORT).show();
Toast.makeText(AlterLogActivity.this, "Updated successfully", Toast.LENGTH_SHORT).show();
}
finish();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@ protected void onCreate(Bundle savedInstanceState) {
editText = (EditText) findViewById(R.id.old_text);
finish = (Button)findViewById(R.id.finish);
Intent intent = getIntent();
oldWrite = intent.getStringExtra("write"); //得到之前的数据
editText.setText(oldWrite); //将之前的数据显示在EditText上
oldWrite = intent.getStringExtra("write"); //get the previous data
editText.setText(oldWrite); //Displays the previous data on the EditText

finish.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String newWrite = editText.getText().toString(); //得到用户修改之后的新数据
String newWrite = editText.getText().toString(); //Get the new data after the user changes
if(newWrite.isEmpty()){
LitePal.deleteAll(Plan.class,"writePlan = ?",oldWrite); //如果修改之后为空则自动删除
LitePal.deleteAll(Plan.class,"writePlan = ?",oldWrite); //If the value is null after modification, it is automatically deleted
}
else{
plan.setWritePlan(newWrite); //LitePal语法,先设置新的内容,再寻找条件更新
plan.setWritePlan(newWrite); //LitePal syntax, first set the new content, and then look for conditional updates
plan.updateAll("writePlan = ?",oldWrite);
Toast.makeText(AlterScheduleActivity.this, "修改成功", Toast.LENGTH_SHORT).show();
Toast.makeText(AlterScheduleActivity.this, "Changed successfully!", Toast.LENGTH_SHORT).show();
}
finish();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected void onCreate(Bundle savedInstanceState) {
back = (Button)findViewById(R.id.back);
calendarView = (MaterialCalendarView)findViewById(R.id.calendarView);

Calendar calendar = Calendar.getInstance(); //得到今天的时间
Calendar calendar = Calendar.getInstance(); //Get the time today
calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
final String todayYear = String.valueOf(calendar.get(Calendar.YEAR));
final String todayMonth = String.valueOf(calendar.get(Calendar.MONTH)+1);
Expand All @@ -47,12 +47,12 @@ public void onClick(View view) {
calendarView.setOnDateChangedListener(new OnDateSelectedListener() {
@Override
public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) {
String year = String.valueOf(date.getYear()); //得到选中的时间
String year = String.valueOf(date.getYear()); //get chosen time
String month = String.valueOf(date.getMonth()+1);
String day = String.valueOf(date.getDay());

if(((year.equals(todayYear) && month.equals(todayMonth) && Integer.parseInt(day) < Integer.parseInt(todayDay))) || (year.equals(todayYear) && Integer.parseInt(month) < Integer.parseInt(todayMonth)) || (Integer.parseInt(year) < Integer.parseInt(todayYear))){ //如果选中的是今天,则会创建失败
Toast.makeText(ScheduleActivity.this, "请选择未来的时间点哦", Toast.LENGTH_SHORT).show();
if(((year.equals(todayYear) && month.equals(todayMonth) && Integer.parseInt(day) < Integer.parseInt(todayDay))) || (year.equals(todayYear) && Integer.parseInt(month) < Integer.parseInt(todayMonth)) || (Integer.parseInt(year) < Integer.parseInt(todayYear))){ //If today is selected, the creation will fail
Toast.makeText(ScheduleActivity.this, "Please choose a future time", Toast.LENGTH_SHORT).show();
}
else {
Intent intent = new Intent(ScheduleActivity.this, ScheduleCreateActivity.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_schedule_create);
finish = (Button)findViewById(R.id.finish);
editText = (EditText)findViewById(R.id.edit_text);
calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00")); //设置为中国区的时间
calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00")); //Set to the time in China

Intent intent = getIntent();
final String scheduleYear = intent.getStringExtra("year");
Expand All @@ -47,7 +47,7 @@ public void onClick(View view) {
plan.setDay(scheduleDay);
date = new Date(calendar.get(Calendar.YEAR),calendar.get(Calendar.MONTH)+1,calendar.get(Calendar.DATE));
plan.save();
Toast.makeText(ScheduleCreateActivity.this, "创建成功,记得要完成哦", Toast.LENGTH_SHORT).show();
Toast.makeText(ScheduleCreateActivity.this, "Created successfully, remember to finish it", Toast.LENGTH_SHORT).show();
}
finish();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void onResume(){
create.setVisibility(View.VISIBLE);


Calendar calendar = Calendar.getInstance(); //获取到今天的时间
Calendar calendar = Calendar.getInstance(); //get today's time
calendar.setTimeZone(TimeZone.getTimeZone("GMT+8:00"));
String year = String.valueOf(calendar.get(Calendar.YEAR));
String month = String.valueOf(calendar.get(Calendar.MONTH)+1);
Expand All @@ -75,9 +75,9 @@ public void onResume(){
if (dataList.size() > 0){
scheduleList.clear();
for(Plan plan : dataList){
if((plan.getYear().equals(year) && plan.getMonth().equals(month) && Integer.parseInt(plan.getDay()) > Integer.parseInt(day) ) || ( plan.getYear().equals(year) && Integer.parseInt(plan.getMonth()) > Integer.parseInt(month) ) || (Integer.parseInt(plan.getYear()) > Integer.parseInt(year)) ){ //只要不是今天的就会显示在计划列表当中
if((plan.getYear().equals(year) && plan.getMonth().equals(month) && Integer.parseInt(plan.getDay()) > Integer.parseInt(day) ) || ( plan.getYear().equals(year) && Integer.parseInt(plan.getMonth()) > Integer.parseInt(month) ) || (Integer.parseInt(plan.getYear()) > Integer.parseInt(year)) ){ //Anything that isn't today will show up in the plan list
scheduleList.add(plan);
//排序
//Sort
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_alter_schedule.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:textSize="20dp"
android:hint="写下今天的计划吧!"
android:hint="Write down your plans for today!"
android:singleLine="true"/>

<Button
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/activity_log.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textSize="22sp"
android:text="Log"
android:textColor="#000"
android:text="日志" />
android:textSize="22sp" />

<Button
android:id="@+id/back"
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/activity_log_create.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
android:id="@+id/edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="来记录一下吧!"
android:layout_marginLeft="19sp"
android:hint="Record things here!"
android:textColor="#000"
android:textSize="20dp"
android:textCursorDrawable="@null"/>
android:textCursorDrawable="@null"
android:textSize="20dp" />

</LinearLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_schedule.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:layout_marginTop="13dp"
android:textSize="22sp"
android:textColor="#000"
android:text="计划" />
android:text="Schedule" />

<Button
android:id="@+id/back"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_schedule_create.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
android:layout_gravity="center_vertical"
android:layout_marginLeft="5dp"
android:textSize="20dp"
android:hint="写下这一天的计划吧!"
android:hint="Write down your plans for today!"
android:singleLine="true"/>

<Button
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_schedule_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
android:layout_centerInParent="true"
android:textSize="22sp"
android:textColor="#000"
android:text="计划" />
android:text="Schedule" />

<Button
android:id="@+id/back"
Expand Down

0 comments on commit 2ace5ba

Please sign in to comment.