Skip to content
This repository was archived by the owner on Nov 18, 2024. It is now read-only.

Commit ea3bea4

Browse files
committed
Bug fixes
1 parent 15a074e commit ea3bea4

5 files changed

Lines changed: 38 additions & 0 deletions

File tree

app/src/main/java/apps/jizzu/simpletodo/activity/AddTaskActivity.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,24 @@
44
import android.app.DatePickerDialog;
55
import android.app.DialogFragment;
66
import android.app.TimePickerDialog;
7+
import android.content.Context;
78
import android.content.Intent;
89
import android.os.Bundle;
910
import android.support.design.widget.TextInputLayout;
1011
import android.support.v7.app.AppCompatActivity;
1112
import android.support.v7.widget.SwitchCompat;
1213
import android.support.v7.widget.Toolbar;
14+
import android.util.Log;
15+
import android.view.Display;
1316
import android.view.MenuItem;
1417
import android.view.View;
18+
import android.view.WindowManager;
1519
import android.view.inputmethod.InputMethodManager;
1620
import android.widget.Button;
1721
import android.widget.DatePicker;
1822
import android.widget.EditText;
1923
import android.widget.RelativeLayout;
24+
import android.widget.TextView;
2025
import android.widget.TimePicker;
2126

2227
import java.util.Calendar;
@@ -26,6 +31,8 @@
2631
import apps.jizzu.simpletodo.fragment.TimePickerFragment;
2732
import apps.jizzu.simpletodo.utils.Utils;
2833

34+
import static android.content.ContentValues.TAG;
35+
2936
/**
3037
* Activity for adding a new task to RecyclerView.
3138
*/
@@ -62,6 +69,17 @@ protected void onCreate(Bundle savedInstanceState) {
6269
mTime = findViewById(R.id.taskTime);
6370
Button addTaskButton = findViewById(R.id.addTaskButton);
6471
mReminderSwitch = findViewById(R.id.reminderSwitch);
72+
TextView reminderText = findViewById(R.id.tvSetReminder);
73+
74+
// Get the resolution of the user's screen
75+
Display d = ((WindowManager) this.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
76+
int width = d.getWidth();
77+
int height = d.getHeight();
78+
Log.d(TAG, "width = " + width + ", height = " + height);
79+
80+
if (width >= 480 || height >= 800) {
81+
reminderText.setText(R.string.set_reminder_short);
82+
}
6583

6684
mReminderLayout.setVisibility(View.INVISIBLE);
6785

app/src/main/java/apps/jizzu/simpletodo/activity/EditTaskActivity.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.app.DatePickerDialog;
66
import android.app.DialogFragment;
77
import android.app.TimePickerDialog;
8+
import android.content.Context;
89
import android.content.DialogInterface;
910
import android.content.Intent;
1011
import android.support.design.widget.TextInputLayout;
@@ -13,14 +14,17 @@
1314
import android.support.v7.widget.SwitchCompat;
1415
import android.support.v7.widget.Toolbar;
1516
import android.util.Log;
17+
import android.view.Display;
1618
import android.view.Menu;
1719
import android.view.MenuItem;
1820
import android.view.View;
21+
import android.view.WindowManager;
1922
import android.view.inputmethod.InputMethodManager;
2023
import android.widget.Button;
2124
import android.widget.DatePicker;
2225
import android.widget.EditText;
2326
import android.widget.RelativeLayout;
27+
import android.widget.TextView;
2428
import android.widget.TimePicker;
2529
import android.widget.Toast;
2630

@@ -78,7 +82,17 @@ protected void onCreate(Bundle savedInstanceState) {
7882
mTimeEditText = findViewById(R.id.taskTime);
7983
Button addTaskButton = findViewById(R.id.addTaskButton);
8084
mReminderSwitch = findViewById(R.id.reminderSwitch);
85+
TextView reminderText = findViewById(R.id.tvSetReminder);
8186

87+
// Get the resolution of the user's screen
88+
Display d = ((WindowManager) this.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
89+
int width = d.getWidth();
90+
int height = d.getHeight();
91+
Log.d(TAG, "width = " + width + ", height = " + height);
92+
93+
if (width >= 480 || height >= 800) {
94+
reminderText.setText(R.string.set_reminder_short);
95+
}
8296

8397
// Get Intent data
8498
Intent intent = getIntent();

app/src/main/java/apps/jizzu/simpletodo/activity/MainActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
179179
int resId = R.anim.layout_animation;
180180
LayoutAnimationController animation = AnimationUtils.loadLayoutAnimation(this, resId);
181181
mRecyclerView.setLayoutAnimation(animation);
182+
} else {
183+
mFab.setVisibility(View.VISIBLE);
182184
}
183185
}
184186

@@ -300,6 +302,8 @@ public void run() {
300302
mFab.startAnimation(myAnim);
301303
}
302304
}, 300);
305+
} else {
306+
mFab.setVisibility(View.VISIBLE);
303307
}
304308
MyApplication.activityResumed();
305309
}

app/src/main/res/values-ru/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<string name="empty_view_text">Создайте новые задачи \n с помощью кнопки +</string>
55
<string name="create_task">Новая задача</string>
66
<string name="set_reminder">Добавить напоминание</string>
7+
<string name="set_reminder_short">Напоминание</string>
78
<string name="hint_title">Заголовок</string>
89
<string name="hint_date">Дата</string>
910
<string name="hint_time">Время</string>

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<string name="empty_view_text">You can create new tasks \n using the + button</string>
55
<string name="create_task">NEW TASK</string>
66
<string name="set_reminder">Set reminder</string>
7+
<string name="set_reminder_short">Reminder</string>
78
<string name="hint_title">Title</string>
89
<string name="hint_date">Date</string>
910
<string name="hint_time">Time</string>

0 commit comments

Comments
 (0)