mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-16 20:00:39 +01:00
write todays day with bigger letters
This commit is contained in:
parent
0a4724302c
commit
486682630d
@ -15,18 +15,24 @@ import java.text.DateFormatSymbols;
|
|||||||
|
|
||||||
import butterknife.Bind;
|
import butterknife.Bind;
|
||||||
import butterknife.BindColor;
|
import butterknife.BindColor;
|
||||||
|
import butterknife.BindDimen;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
import butterknife.OnClick;
|
import butterknife.OnClick;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
private static final String PATTERN = "ddMMYYYY";
|
||||||
|
|
||||||
@Bind(R.id.left_arrow) ImageView leftArrow;
|
@Bind(R.id.left_arrow) ImageView leftArrow;
|
||||||
@Bind(R.id.right_arrow) ImageView rightArrow;
|
@Bind(R.id.right_arrow) ImageView rightArrow;
|
||||||
@Bind(R.id.table_month) TextView monthTV;
|
@Bind(R.id.table_month) TextView monthTV;
|
||||||
@Bind(R.id.table_holder) TableLayout tableHolder;
|
@Bind(R.id.table_holder) TableLayout tableHolder;
|
||||||
@BindColor(R.color.darkGrey) int darkGrey;
|
@BindColor(R.color.darkGrey) int darkGrey;
|
||||||
@BindColor(R.color.lightGrey) int lightGrey;
|
@BindColor(R.color.lightGrey) int lightGrey;
|
||||||
|
@BindDimen(R.dimen.day_text_size) float dayTextSize;
|
||||||
|
@BindDimen(R.dimen.today_text_size) float todayTextSize;
|
||||||
|
|
||||||
private DateTime targetDate;
|
private DateTime targetDate;
|
||||||
|
private String today;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -37,6 +43,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
leftArrow.getDrawable().mutate().setColorFilter(darkGrey, PorterDuff.Mode.SRC_ATOP);
|
leftArrow.getDrawable().mutate().setColorFilter(darkGrey, PorterDuff.Mode.SRC_ATOP);
|
||||||
rightArrow.getDrawable().mutate().setColorFilter(darkGrey, PorterDuff.Mode.SRC_ATOP);
|
rightArrow.getDrawable().mutate().setColorFilter(darkGrey, PorterDuff.Mode.SRC_ATOP);
|
||||||
targetDate = new DateTime();
|
targetDate = new DateTime();
|
||||||
|
today = new DateTime().toString(PATTERN);
|
||||||
|
|
||||||
createDays();
|
createDays();
|
||||||
fillCalendar();
|
fillCalendar();
|
||||||
@ -68,12 +75,17 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
final TableRow row = (TableRow) tableHolder.getChildAt(i);
|
final TableRow row = (TableRow) tableHolder.getChildAt(i);
|
||||||
for (int j = 0; j < 7; j++) {
|
for (int j = 0; j < 7; j++) {
|
||||||
final TextView day = (TextView) row.getChildAt(j);
|
final TextView day = (TextView) row.getChildAt(j);
|
||||||
|
day.setTextSize(dayTextSize);
|
||||||
|
|
||||||
int currDate = thisMonthDays;
|
int currDate = thisMonthDays;
|
||||||
if (cur < firstDayIndex) {
|
if (cur < firstDayIndex) {
|
||||||
currDate = prevMonthStart + cur;
|
currDate = prevMonthStart + cur;
|
||||||
day.setTextColor(lightGrey);
|
day.setTextColor(lightGrey);
|
||||||
} else if (currDate <= currMonthDays) {
|
} else if (currDate <= currMonthDays) {
|
||||||
|
if (targetDate.withDayOfMonth(thisMonthDays).toString(PATTERN).equals(today)) {
|
||||||
|
day.setTextSize(todayTextSize);
|
||||||
|
}
|
||||||
|
|
||||||
thisMonthDays++;
|
thisMonthDays++;
|
||||||
day.setTextColor(darkGrey);
|
day.setTextColor(darkGrey);
|
||||||
} else {
|
} else {
|
||||||
|
@ -7,4 +7,4 @@
|
|||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textColor="@color/lightGrey"
|
android:textColor="@color/lightGrey"
|
||||||
android:textSize="18sp"/>
|
android:textSize="@dimen/day_text_size"/>
|
||||||
|
@ -5,6 +5,4 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"/>
|
||||||
|
|
||||||
</TableRow>
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<dimen name="activity_margin">16dp</dimen>
|
<dimen name="activity_margin">16dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="day_text_size">10sp</dimen>
|
||||||
|
<dimen name="today_text_size">20sp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user