mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-04-23 14:27:30 +02:00
misc changes to the widget
This commit is contained in:
parent
3bd2c6296d
commit
d0c6f6e973
@ -10,6 +10,7 @@ import android.graphics.PorterDuff;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -32,6 +33,7 @@ public class MyWidgetConfigure extends AppCompatActivity implements Calendar {
|
|||||||
@Bind(R.id.config_bg_seekbar) SeekBar bgSeekBar;
|
@Bind(R.id.config_bg_seekbar) SeekBar bgSeekBar;
|
||||||
@Bind(R.id.config_text_color) View textColorPicker;
|
@Bind(R.id.config_text_color) View textColorPicker;
|
||||||
@Bind(R.id.config_calendar) View widgetBackground;
|
@Bind(R.id.config_calendar) View widgetBackground;
|
||||||
|
@Bind(R.id.config_save) Button saveBtn;
|
||||||
@BindDimen(R.dimen.day_text_size) float dayTextSize;
|
@BindDimen(R.dimen.day_text_size) float dayTextSize;
|
||||||
@BindDimen(R.dimen.today_text_size) float todayTextSize;
|
@BindDimen(R.dimen.today_text_size) float todayTextSize;
|
||||||
|
|
||||||
@ -75,9 +77,15 @@ public class MyWidgetConfigure extends AppCompatActivity implements Calendar {
|
|||||||
textColorWithoutTransparency = prefs.getInt(Constants.WIDGET_TEXT_COLOR, Color.WHITE);
|
textColorWithoutTransparency = prefs.getInt(Constants.WIDGET_TEXT_COLOR, Color.WHITE);
|
||||||
updateTextColors();
|
updateTextColors();
|
||||||
|
|
||||||
bgColor = prefs.getInt(Constants.WIDGET_BG_COLOR, Color.BLACK);
|
bgColor = prefs.getInt(Constants.WIDGET_BG_COLOR, 0);
|
||||||
bgColorWithoutTransparency = Color.rgb(Color.red(bgColor), Color.green(bgColor), Color.blue(bgColor));
|
if (bgColor == 0) {
|
||||||
|
bgColor = Color.BLACK;
|
||||||
|
bgAlpha = .5f;
|
||||||
|
} else {
|
||||||
bgAlpha = Color.alpha(bgColor) / (float) 255;
|
bgAlpha = Color.alpha(bgColor) / (float) 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
bgColorWithoutTransparency = Color.rgb(Color.red(bgColor), Color.green(bgColor), Color.blue(bgColor));
|
||||||
bgSeekBar.setOnSeekBarChangeListener(bgSeekbarChangeListener);
|
bgSeekBar.setOnSeekBarChangeListener(bgSeekbarChangeListener);
|
||||||
bgSeekBar.setProgress((int) (bgAlpha * 100));
|
bgSeekBar.setProgress((int) (bgAlpha * 100));
|
||||||
updateBgColor();
|
updateBgColor();
|
||||||
@ -156,6 +164,7 @@ public class MyWidgetConfigure extends AppCompatActivity implements Calendar {
|
|||||||
rightArrow.getDrawable().mutate().setColorFilter(textColor, PorterDuff.Mode.SRC_ATOP);
|
rightArrow.getDrawable().mutate().setColorFilter(textColor, PorterDuff.Mode.SRC_ATOP);
|
||||||
monthTV.setTextColor(textColor);
|
monthTV.setTextColor(textColor);
|
||||||
textColorPicker.setBackgroundColor(textColor);
|
textColorPicker.setBackgroundColor(textColor);
|
||||||
|
saveBtn.setTextColor(textColor);
|
||||||
updateLabels();
|
updateLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,6 +172,7 @@ public class MyWidgetConfigure extends AppCompatActivity implements Calendar {
|
|||||||
bgColor = Helpers.adjustAlpha(bgColorWithoutTransparency, bgAlpha);
|
bgColor = Helpers.adjustAlpha(bgColorWithoutTransparency, bgAlpha);
|
||||||
widgetBackground.setBackgroundColor(bgColor);
|
widgetBackground.setBackgroundColor(bgColor);
|
||||||
bgColorPicker.setBackgroundColor(bgColor);
|
bgColorPicker.setBackgroundColor(bgColor);
|
||||||
|
saveBtn.setBackgroundColor(bgColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDays() {
|
private void updateDays() {
|
||||||
|
6
app/src/main/res/drawable/button.xml
Normal file
6
app/src/main/res/drawable/button.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:drawable="@drawable/button_pressed"
|
||||||
|
android:state_pressed="true"/>
|
||||||
|
</selector>
|
6
app/src/main/res/drawable/button_pressed.xml
Normal file
6
app/src/main/res/drawable/button_pressed.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid
|
||||||
|
android:color="@color/dark_grey_pressed_mask"/>
|
||||||
|
</shape>
|
@ -53,5 +53,6 @@
|
|||||||
android:paddingLeft="@dimen/activity_margin"
|
android:paddingLeft="@dimen/activity_margin"
|
||||||
android:paddingRight="@dimen/activity_margin"
|
android:paddingRight="@dimen/activity_margin"
|
||||||
android:text="OK"
|
android:text="OK"
|
||||||
android:textSize="18sp"/>
|
android:textColor="@android:color/white"
|
||||||
|
android:textSize="@dimen/config_text_size"/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
@ -3,4 +3,5 @@
|
|||||||
<color name="colorPrimary">#3F51B5</color>
|
<color name="colorPrimary">#3F51B5</color>
|
||||||
<color name="colorPrimaryDark">#303F9F</color>
|
<color name="colorPrimaryDark">#303F9F</color>
|
||||||
<color name="colorAccent">#FF4081</color>
|
<color name="colorAccent">#FF4081</color>
|
||||||
|
<color name="dark_grey_pressed_mask">#22000000</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -2,4 +2,5 @@
|
|||||||
<dimen name="activity_margin">16dp</dimen>
|
<dimen name="activity_margin">16dp</dimen>
|
||||||
<dimen name="day_text_size">16sp</dimen>
|
<dimen name="day_text_size">16sp</dimen>
|
||||||
<dimen name="today_text_size">32sp</dimen>
|
<dimen name="today_text_size">32sp</dimen>
|
||||||
|
<dimen name="config_text_size">18sp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="colorPrimary">@color/colorPrimary</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
<item name="colorAccent">@color/colorAccent</item>
|
||||||
|
<item name="buttonStyle">@style/MyButton</item>
|
||||||
|
<item name="android:buttonStyle">@style/MyButton</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="DayView">
|
<style name="DayView">
|
||||||
@ -16,4 +18,10 @@
|
|||||||
<item name="android:windowShowWallpaper">true</item>
|
<item name="android:windowShowWallpaper">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="MyButton" parent="Widget.AppCompat.Button">
|
||||||
|
<item name="android:textColor">@android:color/white</item>
|
||||||
|
<item name="background">@drawable/button</item>
|
||||||
|
<item name="android:background">@drawable/button</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user