mirror of
				https://github.com/SimpleMobileTools/Simple-Calendar.git
				synced 2025-06-05 21:59:17 +02:00 
			
		
		
		
	update widget config screen
This commit is contained in:
		| @@ -64,7 +64,7 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calendar { | |||||||
|         mTodayTextSize = mRes.getDimension(R.dimen.today_text_size) / mRes.getDisplayMetrics().density; |         mTodayTextSize = mRes.getDimension(R.dimen.today_text_size) / mRes.getDisplayMetrics().density; | ||||||
|         mWidgetManager = AppWidgetManager.getInstance(mContext); |         mWidgetManager = AppWidgetManager.getInstance(mContext); | ||||||
|  |  | ||||||
|         mRemoteViews = new RemoteViews(mContext.getPackageName(), R.layout.calendar_layout); |         mRemoteViews = new RemoteViews(mContext.getPackageName(), R.layout.month_fragment); | ||||||
|         mIntent = new Intent(mContext, MyWidgetProvider.class); |         mIntent = new Intent(mContext, MyWidgetProvider.class); | ||||||
|         setupButtons(); |         setupButtons(); | ||||||
|         updateLabelColor(); |         updateLabelColor(); | ||||||
| @@ -104,7 +104,7 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calendar { | |||||||
|     private void setupButtons() { |     private void setupButtons() { | ||||||
|         setupIntent(PREV, R.id.top_left_arrow); |         setupIntent(PREV, R.id.top_left_arrow); | ||||||
|         setupIntent(NEXT, R.id.top_right_arrow); |         setupIntent(NEXT, R.id.top_right_arrow); | ||||||
|         setupAppOpenIntent(R.id.month_value); |         setupAppOpenIntent(R.id.top_value); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private SharedPreferences initPrefs(Context context) { |     private SharedPreferences initPrefs(Context context) { | ||||||
| @@ -161,7 +161,7 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calendar { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void updateTopViews() { |     private void updateTopViews() { | ||||||
|         mRemoteViews.setInt(R.id.month_value, "setTextColor", mTextColor); |         mRemoteViews.setInt(R.id.top_value, "setTextColor", mTextColor); | ||||||
|  |  | ||||||
|         Bitmap bmp = getColoredIcon(mContext, mTextColor, R.mipmap.arrow_left); |         Bitmap bmp = getColoredIcon(mContext, mTextColor, R.mipmap.arrow_left); | ||||||
|         mRemoteViews.setImageViewBitmap(R.id.top_left_arrow, bmp); |         mRemoteViews.setImageViewBitmap(R.id.top_left_arrow, bmp); | ||||||
| @@ -171,7 +171,7 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calendar { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void updateMonth(String month) { |     public void updateMonth(String month) { | ||||||
|         mRemoteViews.setTextViewText(R.id.month_value, month); |         mRemoteViews.setTextViewText(R.id.top_value, month); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|   | |||||||
| @@ -6,10 +6,12 @@ import android.content.Intent; | |||||||
| import android.content.SharedPreferences; | import android.content.SharedPreferences; | ||||||
| import android.content.res.Resources; | import android.content.res.Resources; | ||||||
| import android.graphics.Color; | import android.graphics.Color; | ||||||
|  | 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.Button; | ||||||
|  | import android.widget.ImageView; | ||||||
| import android.widget.SeekBar; | import android.widget.SeekBar; | ||||||
| import android.widget.TextView; | import android.widget.TextView; | ||||||
|  |  | ||||||
| @@ -32,15 +34,14 @@ import butterknife.OnClick; | |||||||
| import yuku.ambilwarna.AmbilWarnaDialog; | import yuku.ambilwarna.AmbilWarnaDialog; | ||||||
|  |  | ||||||
| public class WidgetConfigureActivity extends AppCompatActivity implements Calendar { | public class WidgetConfigureActivity extends AppCompatActivity implements Calendar { | ||||||
|     //@BindView(R.id.top_left_arrow) ImageView mLeftArrow; |     @BindView(R.id.top_left_arrow) ImageView mLeftArrow; | ||||||
|     //@BindView(R.id.top_right_arrow) ImageView mRightArrow; |     @BindView(R.id.top_right_arrow) ImageView mRightArrow; | ||||||
|     //@BindView(R.id.top_text) TextView mMonthTV; |     @BindView(R.id.top_value) TextView mMonthTV; | ||||||
|     @BindView(R.id.config_bg_color) View mBgColorPicker; |     @BindView(R.id.config_bg_color) View mBgColorPicker; | ||||||
|     @BindView(R.id.config_bg_seekbar) SeekBar mBgSeekBar; |     @BindView(R.id.config_bg_seekbar) SeekBar mBgSeekBar; | ||||||
|     @BindView(R.id.config_text_color) View mTextColorPicker; |     @BindView(R.id.config_text_color) View mTextColorPicker; | ||||||
|     @BindView(R.id.config_calendar) View mWidgetBackground; |     @BindView(R.id.config_calendar) View mWidgetBackground; | ||||||
|     @BindView(R.id.config_save) Button mSaveBtn; |     @BindView(R.id.config_save) Button mSaveBtn; | ||||||
|     @BindView(R.id.calendar_fab) View mFab; |  | ||||||
|  |  | ||||||
|     @BindDimen(R.dimen.day_text_size) float mDayTextSize; |     @BindDimen(R.dimen.day_text_size) float mDayTextSize; | ||||||
|     @BindDimen(R.dimen.today_text_size) float mTodayTextSize; |     @BindDimen(R.dimen.today_text_size) float mTodayTextSize; | ||||||
| @@ -100,8 +101,6 @@ public class WidgetConfigureActivity extends AppCompatActivity implements Calend | |||||||
|  |  | ||||||
|         mCalendar = new CalendarImpl(this, getApplicationContext()); |         mCalendar = new CalendarImpl(this, getApplicationContext()); | ||||||
|         mCalendar.updateCalendar(new DateTime()); |         mCalendar.updateCalendar(new DateTime()); | ||||||
|  |  | ||||||
|         mFab.setVisibility(View.GONE); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private SharedPreferences initPrefs(Context context) { |     private SharedPreferences initPrefs(Context context) { | ||||||
| @@ -170,9 +169,9 @@ public class WidgetConfigureActivity extends AppCompatActivity implements Calend | |||||||
|         mTextColor = Utils.adjustAlpha(mTextColorWithoutTransparency, Constants.HIGH_ALPHA); |         mTextColor = Utils.adjustAlpha(mTextColorWithoutTransparency, Constants.HIGH_ALPHA); | ||||||
|         mWeakTextColor = Utils.adjustAlpha(mTextColorWithoutTransparency, Constants.LOW_ALPHA); |         mWeakTextColor = Utils.adjustAlpha(mTextColorWithoutTransparency, Constants.LOW_ALPHA); | ||||||
|  |  | ||||||
|         //mLeftArrow.getDrawable().mutate().setColorFilter(mTextColor, PorterDuff.Mode.SRC_ATOP); |         mLeftArrow.getDrawable().mutate().setColorFilter(mTextColor, PorterDuff.Mode.SRC_ATOP); | ||||||
|         //mRightArrow.getDrawable().mutate().setColorFilter(mTextColor, PorterDuff.Mode.SRC_ATOP); |         mRightArrow.getDrawable().mutate().setColorFilter(mTextColor, PorterDuff.Mode.SRC_ATOP); | ||||||
|         //mMonthTV.setTextColor(mTextColor); |         mMonthTV.setTextColor(mTextColor); | ||||||
|         mTextColorPicker.setBackgroundColor(mTextColor); |         mTextColorPicker.setBackgroundColor(mTextColor); | ||||||
|         mSaveBtn.setTextColor(mTextColor); |         mSaveBtn.setTextColor(mTextColor); | ||||||
|         updateLabels(); |         updateLabels(); | ||||||
| @@ -201,9 +200,9 @@ public class WidgetConfigureActivity extends AppCompatActivity implements Calend | |||||||
|                 curTextSize = mTodayTextSize; |                 curTextSize = mTodayTextSize; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             /*dayTV.setText(String.valueOf(day.getValue())); |             dayTV.setText(String.valueOf(day.getValue())); | ||||||
|             dayTV.setTextColor(curTextColor); |             dayTV.setTextColor(curTextColor); | ||||||
|             dayTV.setTextSize(curTextSize);*/ |             dayTV.setTextSize(curTextSize); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -238,14 +237,14 @@ public class WidgetConfigureActivity extends AppCompatActivity implements Calend | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void updateMonth(String month) { |     private void updateMonth(String month) { | ||||||
|         //mMonthTV.setText(month); |         mMonthTV.setText(month); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void updateLabels() { |     private void updateLabels() { | ||||||
|         for (int i = 0; i < 7; i++) { |         for (int i = 0; i < 7; i++) { | ||||||
|             final TextView dayTV = (TextView) findViewById(mRes.getIdentifier("label_" + i, "id", mPackageName)); |             final TextView dayTV = (TextView) findViewById(mRes.getIdentifier("label_" + i, "id", mPackageName)); | ||||||
|             //dayTV.setTextSize(mDayTextSize); |             dayTV.setTextSize(mDayTextSize); | ||||||
|             //dayTV.setTextColor(mWeakTextColor); |             dayTV.setTextColor(mWeakTextColor); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -50,8 +50,8 @@ class DayFragment : Fragment(), DBHelper.DBOperationsListener, AdapterView.OnIte | |||||||
|         mDayCode = arguments.getString(Constants.DAY_CODE) |         mDayCode = arguments.getString(Constants.DAY_CODE) | ||||||
|  |  | ||||||
|         val day = Formatter.getEventDate(activity.applicationContext, mDayCode) |         val day = Formatter.getEventDate(activity.applicationContext, mDayCode) | ||||||
|         mHolder.month_value.text = day |         mHolder.top_value.text = day | ||||||
|         mHolder.month_value.setOnClickListener { pickDay() } |         mHolder.top_value.setOnClickListener { pickDay() } | ||||||
|  |  | ||||||
|         setupButtons() |         setupButtons() | ||||||
|         return view |         return view | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ import android.widget.* | |||||||
| import com.simplemobiletools.calendar.* | import com.simplemobiletools.calendar.* | ||||||
| import com.simplemobiletools.calendar.activities.DayActivity | import com.simplemobiletools.calendar.activities.DayActivity | ||||||
| import com.simplemobiletools.calendar.models.Day | import com.simplemobiletools.calendar.models.Day | ||||||
| import kotlinx.android.synthetic.main.calendar_layout.view.* | import kotlinx.android.synthetic.main.month_fragment.view.* | ||||||
| import kotlinx.android.synthetic.main.top_navigation.view.* | import kotlinx.android.synthetic.main.top_navigation.view.* | ||||||
| import org.joda.time.DateTime | import org.joda.time.DateTime | ||||||
|  |  | ||||||
| @@ -37,7 +37,7 @@ class MonthFragment : Fragment(), Calendar { | |||||||
|     lateinit var mConfig: Config |     lateinit var mConfig: Config | ||||||
|  |  | ||||||
|     override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? { |     override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? { | ||||||
|         val view = inflater!!.inflate(R.layout.calendar_layout, container, false) |         val view = inflater!!.inflate(R.layout.month_fragment, container, false) | ||||||
|         mRes = resources |         mRes = resources | ||||||
|  |  | ||||||
|         mHolder = view.calendar_holder |         mHolder = view.calendar_holder | ||||||
| @@ -71,7 +71,7 @@ class MonthFragment : Fragment(), Calendar { | |||||||
|  |  | ||||||
|     override fun updateCalendar(month: String, days: List<Day>) { |     override fun updateCalendar(month: String, days: List<Day>) { | ||||||
|         activity?.runOnUiThread { |         activity?.runOnUiThread { | ||||||
|             mHolder.month_value.text = month |             mHolder.top_value.text = month | ||||||
|             updateDays(days) |             updateDays(days) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -101,7 +101,7 @@ class MonthFragment : Fragment(), Calendar { | |||||||
|                 mListener?.goRight() |                 mListener?.goRight() | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             month_value.setOnClickListener { showMonthDialog() } |             top_value.setOnClickListener { showMonthDialog() } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ | |||||||
|         android:id="@+id/day_events" |         android:id="@+id/day_events" | ||||||
|         android:layout_width="match_parent" |         android:layout_width="match_parent" | ||||||
|         android:layout_height="wrap_content" |         android:layout_height="wrap_content" | ||||||
|         android:layout_below="@+id/month_value" |         android:layout_below="@+id/top_value" | ||||||
|         android:choiceMode="multipleChoiceModal" |         android:choiceMode="multipleChoiceModal" | ||||||
|         android:clipToPadding="false" |         android:clipToPadding="false" | ||||||
|         android:paddingLeft="@dimen/activity_margin"/> |         android:paddingLeft="@dimen/activity_margin"/> | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ | |||||||
|         android:id="@+id/table_holder" |         android:id="@+id/table_holder" | ||||||
|         android:layout_width="match_parent" |         android:layout_width="match_parent" | ||||||
|         android:layout_height="match_parent" |         android:layout_height="match_parent" | ||||||
|         android:layout_below="@+id/month_value" |         android:layout_below="@+id/top_value" | ||||||
|         android:gravity="center" |         android:gravity="center" | ||||||
|         android:orientation="vertical"> |         android:orientation="vertical"> | ||||||
| 
 | 
 | ||||||
| @@ -8,13 +8,13 @@ | |||||||
|         style="@style/ArrowStyle" |         style="@style/ArrowStyle" | ||||||
|         android:layout_width="wrap_content" |         android:layout_width="wrap_content" | ||||||
|         android:layout_height="match_parent" |         android:layout_height="match_parent" | ||||||
|         android:layout_alignBottom="@+id/month_value" |         android:layout_alignBottom="@+id/top_value" | ||||||
|         android:layout_alignTop="@+id/month_value" |         android:layout_alignTop="@+id/top_value" | ||||||
|         android:padding="@dimen/activity_margin" |         android:padding="@dimen/activity_margin" | ||||||
|         android:src="@mipmap/arrow_left"/> |         android:src="@mipmap/arrow_left"/> | ||||||
|  |  | ||||||
|     <TextView |     <TextView | ||||||
|         android:id="@+id/month_value" |         android:id="@+id/top_value" | ||||||
|         style="@style/MonthStyle" |         style="@style/MonthStyle" | ||||||
|         android:layout_width="match_parent" |         android:layout_width="match_parent" | ||||||
|         android:layout_height="wrap_content" |         android:layout_height="wrap_content" | ||||||
| @@ -30,9 +30,9 @@ | |||||||
|         style="@style/ArrowStyle" |         style="@style/ArrowStyle" | ||||||
|         android:layout_width="wrap_content" |         android:layout_width="wrap_content" | ||||||
|         android:layout_height="match_parent" |         android:layout_height="match_parent" | ||||||
|         android:layout_alignBottom="@+id/month_value" |         android:layout_alignBottom="@+id/top_value" | ||||||
|         android:layout_alignParentRight="true" |         android:layout_alignParentRight="true" | ||||||
|         android:layout_alignTop="@+id/month_value" |         android:layout_alignTop="@+id/top_value" | ||||||
|         android:padding="@dimen/activity_margin" |         android:padding="@dimen/activity_margin" | ||||||
|         android:src="@mipmap/arrow_right"/> |         android:src="@mipmap/arrow_right"/> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,5 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <RelativeLayout | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|     xmlns:android="http://schemas.android.com/apk/res/android" |  | ||||||
|     android:layout_width="match_parent" |     android:layout_width="match_parent" | ||||||
|     android:layout_height="wrap_content" |     android:layout_height="wrap_content" | ||||||
|     android:layout_centerHorizontal="true" |     android:layout_centerHorizontal="true" | ||||||
| @@ -8,7 +7,7 @@ | |||||||
|  |  | ||||||
|     <include |     <include | ||||||
|         android:id="@+id/config_calendar" |         android:id="@+id/config_calendar" | ||||||
|         layout="@layout/activity_main" |         layout="@layout/month_fragment" | ||||||
|         android:layout_width="match_parent" |         android:layout_width="match_parent" | ||||||
|         android:layout_height="match_parent" |         android:layout_height="match_parent" | ||||||
|         android:layout_above="@+id/config_bg_color" |         android:layout_above="@+id/config_bg_color" | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> | <?xml version="1.0" encoding="utf-8"?> | ||||||
| <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" | <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" | ||||||
|                     android:configure="com.simplemobiletools.calendar.activities.WidgetConfigureActivity" |                     android:configure="com.simplemobiletools.calendar.activities.WidgetConfigureActivity" | ||||||
|                     android:initialLayout="@layout/calendar_layout" |                     android:initialLayout="@layout/month_fragment" | ||||||
|                     android:minHeight="@dimen/min_widget_height" |                     android:minHeight="@dimen/min_widget_height" | ||||||
|                     android:minWidth="@dimen/min_widget_width" |                     android:minWidth="@dimen/min_widget_width" | ||||||
|                     android:previewImage="@mipmap/widget_preview" |                     android:previewImage="@mipmap/widget_preview" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user