setup the widget config screen + misc cleanup
This commit is contained in:
parent
9ff1cfc469
commit
7382ddab1c
|
@ -25,4 +25,5 @@ dependencies {
|
|||
compile 'com.android.support:appcompat-v7:23.1.1'
|
||||
compile 'joda-time:joda-time:2.9.1'
|
||||
compile 'com.jakewharton:butterknife:7.0.1'
|
||||
compile 'com.github.yukuku:ambilwarna:2.0.1'
|
||||
}
|
||||
|
|
|
@ -31,6 +31,15 @@
|
|||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/widget_info"/>
|
||||
</receiver>
|
||||
|
||||
<activity
|
||||
android:name=".MyWidgetConfigure"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/MyWidgetConfigTheme">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package calendar.simplemobiletools.com;
|
||||
|
||||
public class Constants {
|
||||
public static final String DATE = "date";
|
||||
public static final float LOW_ALPHA = 0.3f;
|
||||
public static final float HIGH_ALPHA = 0.9f;
|
||||
|
||||
public static final String PREFS = "prefs";
|
||||
public static final String WIDGET_TEXT_COLOR = "widget_text_color";
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package calendar.simplemobiletools.com;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
public class Helpers {
|
||||
public static int adjustAlpha(int color, float factor) {
|
||||
final int alpha = Math.round(Color.alpha(color) * factor);
|
||||
final int red = Color.red(color);
|
||||
final int green = Color.green(color);
|
||||
final int blue = Color.blue(color);
|
||||
return Color.argb(alpha, red, green, blue);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package calendar.simplemobiletools.com;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
@ -12,25 +13,22 @@ import org.joda.time.DateTime;
|
|||
import java.util.List;
|
||||
|
||||
import butterknife.Bind;
|
||||
import butterknife.BindColor;
|
||||
import butterknife.BindDimen;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
||||
public class MainActivity extends AppCompatActivity implements MyDatePickerDialog.DatePickedListener, Calendar {
|
||||
public static final String DATE = "date";
|
||||
|
||||
@Bind(R.id.left_arrow) ImageView leftArrow;
|
||||
@Bind(R.id.right_arrow) ImageView rightArrow;
|
||||
@Bind(R.id.table_month) TextView monthTV;
|
||||
@BindColor(R.color.darkGrey) int darkGrey;
|
||||
@BindColor(R.color.lightGrey) int lightGrey;
|
||||
@BindDimen(R.dimen.day_text_size) float dayTextSize;
|
||||
@BindDimen(R.dimen.today_text_size) float todayTextSize;
|
||||
|
||||
private CalendarImpl calendar;
|
||||
private Resources res;
|
||||
private String packageName;
|
||||
private int textColor;
|
||||
private int weakTextColor;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -38,18 +36,19 @@ public class MainActivity extends AppCompatActivity implements MyDatePickerDialo
|
|||
setContentView(R.layout.activity_main);
|
||||
ButterKnife.bind(this);
|
||||
|
||||
leftArrow.getDrawable().mutate().setColorFilter(darkGrey, PorterDuff.Mode.SRC_ATOP);
|
||||
rightArrow.getDrawable().mutate().setColorFilter(darkGrey, PorterDuff.Mode.SRC_ATOP);
|
||||
textColor = Helpers.adjustAlpha(Color.BLACK, Constants.HIGH_ALPHA);
|
||||
weakTextColor = Helpers.adjustAlpha(Color.BLACK, Constants.LOW_ALPHA);
|
||||
leftArrow.getDrawable().mutate().setColorFilter(textColor, PorterDuff.Mode.SRC_ATOP);
|
||||
rightArrow.getDrawable().mutate().setColorFilter(textColor, PorterDuff.Mode.SRC_ATOP);
|
||||
|
||||
res = getResources();
|
||||
packageName = getPackageName();
|
||||
dayTextSize /= res.getDisplayMetrics().density;
|
||||
todayTextSize /= res.getDisplayMetrics().density;
|
||||
setupLabels();
|
||||
|
||||
calendar = new CalendarImpl(this);
|
||||
calendar.updateCalendar(new DateTime());
|
||||
|
||||
setupLabelSizes();
|
||||
}
|
||||
|
||||
private void updateDays(List<Day> days) {
|
||||
|
@ -58,19 +57,20 @@ public class MainActivity extends AppCompatActivity implements MyDatePickerDialo
|
|||
for (int i = 0; i < len; i++) {
|
||||
final Day day = days.get(i);
|
||||
final TextView dayTV = (TextView) findViewById(res.getIdentifier("day_" + i, "id", packageName));
|
||||
dayTV.setText(String.valueOf(day.getValue()));
|
||||
int curTextColor = weakTextColor;
|
||||
float curTextSize = dayTextSize;
|
||||
|
||||
if (day.getIsThisMonth()) {
|
||||
dayTV.setTextColor(darkGrey);
|
||||
} else {
|
||||
dayTV.setTextColor(lightGrey);
|
||||
curTextColor = textColor;
|
||||
}
|
||||
|
||||
if (day.getIsToday()) {
|
||||
dayTV.setTextSize(todayTextSize);
|
||||
} else {
|
||||
dayTV.setTextSize(dayTextSize);
|
||||
curTextSize = todayTextSize;
|
||||
}
|
||||
|
||||
dayTV.setText(String.valueOf(day.getValue()));
|
||||
dayTV.setTextColor(curTextColor);
|
||||
dayTV.setTextSize(curTextSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class MainActivity extends AppCompatActivity implements MyDatePickerDialo
|
|||
public void pickMonth() {
|
||||
final MyDatePickerDialog dialog = new MyDatePickerDialog();
|
||||
final Bundle bundle = new Bundle();
|
||||
bundle.putString(DATE, calendar.getTargetDate().toString());
|
||||
bundle.putString(Constants.DATE, calendar.getTargetDate().toString());
|
||||
dialog.setArguments(bundle);
|
||||
dialog.show(getSupportFragmentManager(), "datepicker");
|
||||
}
|
||||
|
@ -108,10 +108,11 @@ public class MainActivity extends AppCompatActivity implements MyDatePickerDialo
|
|||
monthTV.setText(month);
|
||||
}
|
||||
|
||||
private void setupLabelSizes() {
|
||||
private void setupLabels() {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
final TextView dayTV = (TextView) findViewById(res.getIdentifier("label_" + i, "id", packageName));
|
||||
dayTV.setTextSize(dayTextSize);
|
||||
dayTV.setTextColor(weakTextColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ public class MyDatePickerDialog extends DialogFragment {
|
|||
hideDayPicker(datePicker);
|
||||
|
||||
final Bundle bundle = getArguments();
|
||||
if (bundle != null && bundle.containsKey(MainActivity.DATE)) {
|
||||
final DateTime dateTime = new DateTime(bundle.getString(MainActivity.DATE));
|
||||
if (bundle != null && bundle.containsKey(Constants.DATE)) {
|
||||
final DateTime dateTime = new DateTime(bundle.getString(Constants.DATE));
|
||||
datePicker.init(dateTime.getYear(), dateTime.getMonthOfYear() - 1, 1, null);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,174 @@
|
|||
package calendar.simplemobiletools.com;
|
||||
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.Bind;
|
||||
import butterknife.BindDimen;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
import yuku.ambilwarna.AmbilWarnaDialog;
|
||||
|
||||
public class MyWidgetConfigure extends AppCompatActivity implements Calendar {
|
||||
@Bind(R.id.left_arrow) ImageView leftArrow;
|
||||
@Bind(R.id.right_arrow) ImageView rightArrow;
|
||||
@Bind(R.id.table_month) TextView monthTV;
|
||||
@Bind(R.id.config_text_color) View textColorPicker;
|
||||
@BindDimen(R.dimen.day_text_size) float dayTextSize;
|
||||
@BindDimen(R.dimen.today_text_size) float todayTextSize;
|
||||
|
||||
private int widgetId;
|
||||
private CalendarImpl calendar;
|
||||
private Resources res;
|
||||
private String packageName;
|
||||
private List<Day> days;
|
||||
private static int textColorWithoutTransparency;
|
||||
private static int textColor;
|
||||
private static int weakTextColor;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setResult(RESULT_CANCELED);
|
||||
setContentView(R.layout.widget_config);
|
||||
ButterKnife.bind(this);
|
||||
initVariables();
|
||||
|
||||
final Intent intent = getIntent();
|
||||
final Bundle extras = intent.getExtras();
|
||||
if (extras != null)
|
||||
widgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
|
||||
|
||||
if (widgetId == AppWidgetManager.INVALID_APPWIDGET_ID)
|
||||
finish();
|
||||
}
|
||||
|
||||
private void initVariables() {
|
||||
res = getResources();
|
||||
packageName = getPackageName();
|
||||
dayTextSize /= res.getDisplayMetrics().density;
|
||||
todayTextSize /= res.getDisplayMetrics().density;
|
||||
|
||||
textColorWithoutTransparency = Color.WHITE;
|
||||
updateTextColors();
|
||||
|
||||
calendar = new CalendarImpl(this);
|
||||
calendar.updateCalendar(new DateTime());
|
||||
}
|
||||
|
||||
@OnClick(R.id.config_save)
|
||||
public void saveConfig() {
|
||||
storeWidgetColors();
|
||||
requestWidgetUpdate();
|
||||
|
||||
final Intent resultValue = new Intent();
|
||||
resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId);
|
||||
setResult(RESULT_OK, resultValue);
|
||||
finish();
|
||||
}
|
||||
|
||||
private void storeWidgetColors() {
|
||||
final SharedPreferences prefs = getSharedPreferences(Constants.PREFS, Context.MODE_PRIVATE);
|
||||
prefs.edit().putInt(Constants.WIDGET_TEXT_COLOR, textColorWithoutTransparency).apply();
|
||||
}
|
||||
|
||||
@OnClick(R.id.config_text_color)
|
||||
public void pickTextColor() {
|
||||
AmbilWarnaDialog dialog = new AmbilWarnaDialog(this, textColor, new AmbilWarnaDialog.OnAmbilWarnaListener() {
|
||||
@Override
|
||||
public void onCancel(AmbilWarnaDialog dialog) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOk(AmbilWarnaDialog dialog, int color) {
|
||||
textColorWithoutTransparency = color;
|
||||
updateTextColors();
|
||||
updateDays();
|
||||
}
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void requestWidgetUpdate() {
|
||||
final Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE, null, this, MyWidgetProvider.class);
|
||||
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[]{widgetId});
|
||||
sendBroadcast(intent);
|
||||
}
|
||||
|
||||
private void updateTextColors() {
|
||||
textColor = Helpers.adjustAlpha(textColorWithoutTransparency, Constants.HIGH_ALPHA);
|
||||
weakTextColor = Helpers.adjustAlpha(textColorWithoutTransparency, Constants.LOW_ALPHA);
|
||||
|
||||
leftArrow.getDrawable().mutate().setColorFilter(textColor, PorterDuff.Mode.SRC_ATOP);
|
||||
rightArrow.getDrawable().mutate().setColorFilter(textColor, PorterDuff.Mode.SRC_ATOP);
|
||||
monthTV.setTextColor(textColor);
|
||||
textColorPicker.setBackgroundColor(textColor);
|
||||
updateLabels();
|
||||
}
|
||||
|
||||
private void updateDays() {
|
||||
final int len = days.size();
|
||||
for (int i = 0; i < len; i++) {
|
||||
final Day day = days.get(i);
|
||||
final TextView dayTV = (TextView) findViewById(res.getIdentifier("day_" + i, "id", packageName));
|
||||
int curTextColor = weakTextColor;
|
||||
float curTextSize = dayTextSize;
|
||||
|
||||
if (day.getIsThisMonth()) {
|
||||
curTextColor = textColor;
|
||||
}
|
||||
|
||||
if (day.getIsToday()) {
|
||||
curTextSize = todayTextSize;
|
||||
}
|
||||
|
||||
dayTV.setText(String.valueOf(day.getValue()));
|
||||
dayTV.setTextColor(curTextColor);
|
||||
dayTV.setTextSize(curTextSize);
|
||||
}
|
||||
}
|
||||
|
||||
@OnClick(R.id.left_arrow)
|
||||
public void leftArrowClicked() {
|
||||
calendar.getPrevMonth();
|
||||
}
|
||||
|
||||
@OnClick(R.id.right_arrow)
|
||||
public void rightArrowClicked() {
|
||||
calendar.getNextMonth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCalendar(String month, List<Day> days) {
|
||||
this.days = days;
|
||||
updateMonth(month);
|
||||
updateDays();
|
||||
}
|
||||
|
||||
private void updateMonth(String month) {
|
||||
monthTV.setText(month);
|
||||
}
|
||||
|
||||
private void updateLabels() {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
final TextView dayTV = (TextView) findViewById(res.getIdentifier("label_" + i, "id", packageName));
|
||||
dayTV.setTextSize(dayTextSize);
|
||||
dayTV.setTextColor(weakTextColor);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ import android.appwidget.AppWidgetProvider;
|
|||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
|
@ -23,7 +24,6 @@ import java.util.List;
|
|||
public class MyWidgetProvider extends AppWidgetProvider implements Calendar {
|
||||
private static final String PREV = "prev";
|
||||
private static final String NEXT = "next";
|
||||
private static final float LOW_ALPHA = 0.3f;
|
||||
|
||||
private static RemoteViews remoteViews;
|
||||
private static int[] widgetIds;
|
||||
|
@ -47,8 +47,11 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calendar {
|
|||
cxt = context;
|
||||
res = cxt.getResources();
|
||||
bgColor = Color.BLACK;
|
||||
textColor = Color.WHITE;
|
||||
weakTextColor = adjustAlpha(textColor, LOW_ALPHA);
|
||||
|
||||
final SharedPreferences prefs = initPrefs(cxt);
|
||||
final int storedTextColor = prefs.getInt(Constants.WIDGET_TEXT_COLOR, Color.WHITE);
|
||||
textColor = Helpers.adjustAlpha(storedTextColor, Constants.HIGH_ALPHA);
|
||||
weakTextColor = Helpers.adjustAlpha(storedTextColor, Constants.LOW_ALPHA);
|
||||
|
||||
dayTextSize = res.getDimension(R.dimen.day_text_size) / res.getDisplayMetrics().density;
|
||||
todayTextSize = res.getDimension(R.dimen.today_text_size) / res.getDisplayMetrics().density;
|
||||
|
@ -80,6 +83,10 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calendar {
|
|||
setupIntent(NEXT, R.id.right_arrow);
|
||||
}
|
||||
|
||||
private SharedPreferences initPrefs(Context context) {
|
||||
return context.getSharedPreferences(Constants.PREFS, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (remoteViews == null || widgetManager == null || widgetIds == null || calendar == null)
|
||||
|
@ -143,22 +150,13 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calendar {
|
|||
}
|
||||
|
||||
private void updateLabelColor() {
|
||||
int labelColor = adjustAlpha(textColor, LOW_ALPHA);
|
||||
final String packageName = cxt.getPackageName();
|
||||
for (int i = 0; i < 7; i++) {
|
||||
final int id = res.getIdentifier("label_" + i, "id", packageName);
|
||||
remoteViews.setInt(id, "setTextColor", labelColor);
|
||||
remoteViews.setInt(id, "setTextColor", weakTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
private int adjustAlpha(int color, float factor) {
|
||||
final int alpha = Math.round(Color.alpha(color) * factor);
|
||||
final int red = Color.red(color);
|
||||
final int green = Color.green(color);
|
||||
final int blue = Color.blue(color);
|
||||
return Color.argb(alpha, red, green, blue);
|
||||
}
|
||||
|
||||
private Bitmap getColoredIcon(Context context, int newTextColor, int id) {
|
||||
final BitmapFactory.Options options = new BitmapFactory.Options();
|
||||
options.inMutable = true;
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
android:gravity="center_horizontal"
|
||||
android:paddingBottom="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:textColor="@color/darkGrey"
|
||||
android:textSize="22sp"/>
|
||||
|
||||
<ImageView
|
||||
|
@ -65,49 +64,49 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/day_0"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_1"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_2"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_3"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_4"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_5"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_6"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
@ -121,49 +120,49 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/day_7"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_8"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_9"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_10"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_11"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_12"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_13"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
@ -177,49 +176,49 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/day_14"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_15"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_16"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_17"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_18"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_19"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_20"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
@ -233,49 +232,49 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/day_21"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_22"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_23"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_24"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_25"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_26"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_27"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
@ -289,49 +288,49 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/day_28"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_29"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_30"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_31"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_32"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_33"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_34"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
@ -345,49 +344,49 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/day_35"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_36"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_37"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_38"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_39"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_40"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/day_41"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/label_0"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
@ -16,7 +16,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/label_1"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/label_2"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
@ -32,7 +32,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/label_3"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
@ -40,7 +40,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/label_4"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
@ -48,7 +48,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/label_5"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
@ -56,7 +56,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/label_6"
|
||||
style="@style/dayView"
|
||||
style="@style/DayView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_margin="@dimen/activity_margin">
|
||||
|
||||
<include
|
||||
android:id="@+id/config_calendar"
|
||||
layout="@layout/activity_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@+id/config_bottom"
|
||||
android:layout_marginBottom="@dimen/activity_margin"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/config_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
<Button
|
||||
android:id="@+id/config_text_color"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/config_save"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"
|
||||
android:text="Save"
|
||||
android:textSize="18sp"/>
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
|
@ -3,7 +3,4 @@
|
|||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
|
||||
<color name="lightGrey">#22000000</color>
|
||||
<color name="darkGrey">#cc000000</color>
|
||||
</resources>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<resources>
|
||||
<dimen name="activity_margin">16dp</dimen>
|
||||
<dimen name="day_text_size">16sp</dimen>
|
||||
<dimen name="today_text_size">30sp</dimen>
|
||||
<dimen name="today_text_size">32sp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="dayView">
|
||||
<style name="DayView">
|
||||
<item name="android:gravity">center</item>
|
||||
<item name="android:textColor">@color/lightGrey</item>
|
||||
<item name="android:textSize">@dimen/day_text_size</item>
|
||||
</style>
|
||||
|
||||
<style name="MyWidgetConfigTheme" parent="@style/AppTheme">
|
||||
<item name="android:windowBackground">@android:color/transparent</item>
|
||||
<item name="android:windowShowWallpaper">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:configure="calendar.simplemobiletools.com.MyWidgetConfigure"
|
||||
android:initialLayout="@layout/activity_main"
|
||||
android:minHeight="250dp"
|
||||
android:minWidth="250dp">
|
||||
|
|
Loading…
Reference in New Issue