diff --git a/app/src/main/java/calendar/simplemobiletools/com/MainActivity.java b/app/src/main/java/calendar/simplemobiletools/com/MainActivity.java index a2f9d32fa..a943f62a3 100644 --- a/app/src/main/java/calendar/simplemobiletools/com/MainActivity.java +++ b/app/src/main/java/calendar/simplemobiletools/com/MainActivity.java @@ -7,6 +7,8 @@ import android.widget.TableLayout; import android.widget.TableRow; import android.widget.TextView; +import org.joda.time.DateTime; + public class MainActivity extends AppCompatActivity { @Override @@ -17,11 +19,18 @@ public class MainActivity extends AppCompatActivity { TableLayout tableHolder = (TableLayout) findViewById(R.id.table_holder); LayoutInflater inflater = getLayoutInflater(); + DateTime dateTime = new DateTime(); + final int currMonthDays = dateTime.dayOfMonth().getMaximumValue(); + for (int i = 0; i < 5; i++) { final TableRow row = (TableRow) inflater.inflate(R.layout.table_row, tableHolder, false); for (int j = 1; j < 8; j++) { + final int currDate = i * 7 + j; + if (currDate > currMonthDays) + break; + final TextView day = (TextView) inflater.inflate(R.layout.table_day, row, false); - day.setText("" + (i * 7 + j)); + day.setText(String.valueOf(currDate)); row.addView(day); }