rename CalendarImpl to MonthlyCalendarImpl

This commit is contained in:
tibbi
2016-10-20 18:22:34 +02:00
parent a38441f930
commit 6d0c83a01e
5 changed files with 19 additions and 19 deletions

View File

@ -4,6 +4,6 @@ import com.simplemobiletools.calendar.models.Day;
import java.util.List;
public interface Calendar {
void updateCalendar(String month, List<Day> days);
public interface MonthlyCalendar {
void updateMonthlyCalendar(String month, List<Day> days);
}

View File

@ -10,17 +10,17 @@ import org.joda.time.DateTime;
import java.util.ArrayList;
import java.util.List;
public class CalendarImpl implements DBHelper.DBOperationsListener {
public class MonthlyCalendarImpl implements DBHelper.DBOperationsListener {
private static final int DAYS_CNT = 42;
private static final String YEAR_PATTERN = "YYYY";
private final Calendar mCallback;
private final MonthlyCalendar mCallback;
private final String mToday;
private final Context mContext;
private DateTime mTargetDate;
private List<Event> mEvents;
public CalendarImpl(Calendar callback, Context context) {
public MonthlyCalendarImpl(MonthlyCalendar callback, Context context) {
mCallback = callback;
mContext = context;
mToday = new DateTime().toString(Formatter.DAYCODE_PATTERN);
@ -83,7 +83,7 @@ public class CalendarImpl implements DBHelper.DBOperationsListener {
value++;
}
mCallback.updateCalendar(getMonthName(), days);
mCallback.updateMonthlyCalendar(getMonthName(), days);
}
private boolean hasEvent(String dayCode) {

View File

@ -28,7 +28,7 @@ import org.joda.time.DateTime;
import java.util.List;
public class MyWidgetProvider extends AppWidgetProvider implements Calendar {
public class MyWidgetProvider extends AppWidgetProvider implements MonthlyCalendar {
private static final String PREV = "prev";
private static final String NEXT = "next";
@ -36,7 +36,7 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calendar {
private static AppWidgetManager mWidgetManager;
private static Intent mIntent;
private static Context mContext;
private static CalendarImpl mCalendar;
private static MonthlyCalendarImpl mCalendar;
private static Resources mRes;
private static float mDayTextSize;
@ -73,7 +73,7 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calendar {
final int bgColor = prefs.getInt(Constants.WIDGET_BG_COLOR, Color.BLACK);
mRemoteViews.setInt(R.id.calendar_holder, "setBackgroundColor", bgColor);
mCalendar = new CalendarImpl(this, mContext);
mCalendar = new MonthlyCalendarImpl(this, mContext);
mCalendar.updateMonthlyCalendar(new DateTime());
}
@ -186,7 +186,7 @@ public class MyWidgetProvider extends AppWidgetProvider implements Calendar {
}
@Override
public void updateCalendar(String month, List<Day> days) {
public void updateMonthlyCalendar(String month, List<Day> days) {
updateMonth(month);
updateDays(days);
updateWidget();

View File

@ -15,8 +15,8 @@ import android.widget.ImageView;
import android.widget.SeekBar;
import android.widget.TextView;
import com.simplemobiletools.calendar.Calendar;
import com.simplemobiletools.calendar.CalendarImpl;
import com.simplemobiletools.calendar.MonthlyCalendar;
import com.simplemobiletools.calendar.MonthlyCalendarImpl;
import com.simplemobiletools.calendar.Config;
import com.simplemobiletools.calendar.Constants;
import com.simplemobiletools.calendar.MyWidgetProvider;
@ -34,7 +34,7 @@ import butterknife.ButterKnife;
import butterknife.OnClick;
import yuku.ambilwarna.AmbilWarnaDialog;
public class WidgetConfigureActivity extends AppCompatActivity implements Calendar {
public class WidgetConfigureActivity extends AppCompatActivity implements MonthlyCalendar {
@BindView(R.id.top_left_arrow) ImageView mLeftArrow;
@BindView(R.id.top_right_arrow) ImageView mRightArrow;
@BindView(R.id.top_value) TextView mMonthTV;
@ -99,7 +99,7 @@ public class WidgetConfigureActivity extends AppCompatActivity implements Calend
mBgSeekBar.setProgress((int) (mBgAlpha * 100));
updateBgColor();
new CalendarImpl(this, getApplicationContext()).updateMonthlyCalendar(new DateTime());
new MonthlyCalendarImpl(this, getApplicationContext()).updateMonthlyCalendar(new DateTime());
}
private SharedPreferences initPrefs(Context context) {
@ -238,7 +238,7 @@ public class WidgetConfigureActivity extends AppCompatActivity implements Calend
};
@Override
public void updateCalendar(final String month, final List<Day> days) {
public void updateMonthlyCalendar(final String month, final List<Day> days) {
runOnUiThread(new Runnable() {
@Override
public void run() {

View File

@ -19,7 +19,7 @@ import kotlinx.android.synthetic.main.month_fragment.view.*
import kotlinx.android.synthetic.main.top_navigation.view.*
import org.joda.time.DateTime
class MonthFragment : Fragment(), Calendar {
class MonthFragment : Fragment(), MonthlyCalendar {
private var mDayTextSize = 0f
private var mTodayTextSize = 0f
private var mPackageName = ""
@ -35,7 +35,7 @@ class MonthFragment : Fragment(), Calendar {
lateinit var mRes: Resources
lateinit var mHolder: RelativeLayout
lateinit var mConfig: Config
lateinit var mCalendar: CalendarImpl
lateinit var mCalendar: MonthlyCalendarImpl
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater!!.inflate(R.layout.month_fragment, container, false)
@ -52,7 +52,7 @@ class MonthFragment : Fragment(), Calendar {
mDayTextSize = mRes.getDimension(R.dimen.day_text_size) / mRes.displayMetrics.density
mTodayTextSize = mRes.getDimension(R.dimen.today_text_size) / mRes.displayMetrics.density
setupLabels()
mCalendar = CalendarImpl(this, context)
mCalendar = MonthlyCalendarImpl(this, context)
val padding = resources.getDimension(R.dimen.activity_margin).toInt()
view.calendar_holder.setPadding(padding, padding, padding, padding)
@ -74,7 +74,7 @@ class MonthFragment : Fragment(), Calendar {
}
}
override fun updateCalendar(month: String, days: List<Day>) {
override fun updateMonthlyCalendar(month: String, days: List<Day>) {
activity?.runOnUiThread {
mHolder.top_value.text = month
updateDays(days)