Skip to content

Commit

Permalink
Updated time textviews
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatachiblob committed Apr 5, 2018
1 parent 0fb20e4 commit d2352a7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public void onClick(DialogInterface dialogInterface, int i) { //this is where no

String defaulttime = etTime.getText().toString();
int hrs = Integer.parseInt(defaulttime.substring(0, defaulttime.indexOf(":")));
int minutes = Integer.parseInt(defaulttime.substring(defaulttime.indexOf(":") + 1)) + 1;
int minutes = Integer.parseInt(defaulttime.substring(defaulttime.indexOf(":") + 1));
String mins = String.format(Locale.getDefault(), "%02d", minutes);

tv.setText(hrs + ":" + mins);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,13 @@ private void setupUI(){
if (time == null || time.isEmpty()) {
notif_days_before_text_view.setText("0");
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.US);
notif_time_text_view.setText("" + sdf.format(Calendar.getInstance().getTime()));
String currenttime = sdf.format(Calendar.getInstance().getTime());

int hrs = Integer.parseInt(currenttime.substring(0, currenttime.indexOf(":")));
int minutes = Integer.parseInt(currenttime.substring(currenttime.indexOf(":") + 1)) + 1;
String mins = String.format(Locale.getDefault(), "%02d", minutes);

notif_time_text_view.setText(hrs + ":" + mins);
} else {
notif_days_before_text_view.setText(time.substring(0, 1));
notif_time_text_view.setText(time.substring(1));
Expand Down Expand Up @@ -259,7 +265,13 @@ else if(mediaCategory == CategoryAdapter.CATEGORY_BOOKS) {
if (time == null || time.isEmpty()) {
notif_days_before_text_view.setText("0");
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.US);
notif_time_text_view.setText("" + sdf.format(Calendar.getInstance().getTime()));
String currenttime = sdf.format(Calendar.getInstance().getTime());

int hrs = Integer.parseInt(currenttime.substring(0, currenttime.indexOf(":")));
int minutes = Integer.parseInt(currenttime.substring(currenttime.indexOf(":") + 1)) + 1;
String mins = String.format(Locale.getDefault(), "%02d", minutes);

notif_time_text_view.setText(hrs + ":" + mins);
} else {
notif_days_before_text_view.setText(time.substring(0, 1));
notif_time_text_view.setText(time.substring(1));
Expand Down Expand Up @@ -311,7 +323,13 @@ else if(mediaCategory == CategoryAdapter.CATEGORY_BOOKS) {
if (time == null || time.isEmpty()) {
notif_days_before_text_view.setText("0");
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.US);
notif_time_text_view.setText("" + sdf.format(Calendar.getInstance().getTime()));
String currenttime = sdf.format(Calendar.getInstance().getTime());

int hrs = Integer.parseInt(currenttime.substring(0, currenttime.indexOf(":")));
int minutes = Integer.parseInt(currenttime.substring(currenttime.indexOf(":") + 1)) + 1;
String mins = String.format(Locale.getDefault(), "%02d", minutes);

notif_time_text_view.setText(hrs + ":" + mins);
} else {
notif_days_before_text_view.setText(time.substring(0, 1));
notif_time_text_view.setText(time.substring(1));
Expand Down

0 comments on commit d2352a7

Please sign in to comment.