update current months label
This commit is contained in:
parent
0da07ee79d
commit
ba0b94b6cb
|
@ -15,15 +15,15 @@ public class CalendarImpl implements DBHelper.DBOperationsListener {
|
|||
private static final String YEAR_PATTERN = "YYYY";
|
||||
|
||||
private final Calendar mCallback;
|
||||
private final String mDay;
|
||||
private final String mToday;
|
||||
private final Context mContext;
|
||||
private DateTime mTargetDate;
|
||||
private List<Event> mEvents;
|
||||
|
||||
public CalendarImpl(Calendar callback, Context context, String day) {
|
||||
public CalendarImpl(Calendar callback, Context context) {
|
||||
mCallback = callback;
|
||||
mContext = context;
|
||||
mDay = day;
|
||||
mToday = new DateTime().toString(Formatter.DAYCODE_PATTERN);
|
||||
}
|
||||
|
||||
public void updateCalendar(DateTime targetDate) {
|
||||
|
@ -90,7 +90,7 @@ public class CalendarImpl implements DBHelper.DBOperationsListener {
|
|||
}
|
||||
|
||||
private boolean isToday(DateTime targetDate, int curDayInMonth) {
|
||||
return targetDate.withDayOfMonth(curDayInMonth).toString(Formatter.DAYCODE_PATTERN).equals(mDay);
|
||||
return targetDate.withDayOfMonth(curDayInMonth).toString(Formatter.DAYCODE_PATTERN).equals(mToday);
|
||||
}
|
||||
|
||||
private String getMonthName() {
|
||||
|
|
|
@ -73,8 +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);
|
||||
|
||||
final String today = new DateTime().toString(Formatter.DAYCODE_PATTERN);
|
||||
mCalendar = new CalendarImpl(this, mContext, today);
|
||||
mCalendar = new CalendarImpl(this, mContext);
|
||||
mCalendar.updateCalendar(new DateTime());
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ import butterknife.OnClick;
|
|||
public class MainActivity extends SimpleActivity {
|
||||
/*@BindView(R.id.top_left_arrow) ImageView mLeftArrow;
|
||||
@BindView(R.id.top_right_arrow) ImageView mRightArrow;
|
||||
@BindView(R.id.top_text) TextView mMonthTV;
|
||||
@BindView(R.id.calendar_holder) View mCalendarHolder;*/
|
||||
@BindView(R.id.view_pager) MyViewPager mPager;
|
||||
|
||||
|
@ -219,10 +218,6 @@ public class MainActivity extends SimpleActivity {
|
|||
dayPicker.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void updateMonth(String month) {
|
||||
//mMonthTV.setText(month);
|
||||
}
|
||||
|
||||
private void setupLabels() {
|
||||
int letters[] = Utils.getLetterIDs();
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ import android.widget.TextView;
|
|||
import com.simplemobiletools.calendar.Calendar;
|
||||
import com.simplemobiletools.calendar.CalendarImpl;
|
||||
import com.simplemobiletools.calendar.Constants;
|
||||
import com.simplemobiletools.calendar.Formatter;
|
||||
import com.simplemobiletools.calendar.MyWidgetProvider;
|
||||
import com.simplemobiletools.calendar.R;
|
||||
import com.simplemobiletools.calendar.Utils;
|
||||
|
@ -99,8 +98,7 @@ public class WidgetConfigureActivity extends AppCompatActivity implements Calend
|
|||
mBgSeekBar.setProgress((int) (mBgAlpha * 100));
|
||||
updateBgColor();
|
||||
|
||||
final String today = new DateTime().toString(Formatter.DAYCODE_PATTERN);
|
||||
mCalendar = new CalendarImpl(this, getApplicationContext(), today);
|
||||
mCalendar = new CalendarImpl(this, getApplicationContext());
|
||||
mCalendar.updateCalendar(new DateTime());
|
||||
|
||||
mFab.setVisibility(View.GONE);
|
||||
|
|
|
@ -5,30 +5,38 @@ import android.support.v4.app.Fragment;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.simplemobiletools.calendar.Calendar;
|
||||
import com.simplemobiletools.calendar.CalendarImpl;
|
||||
import com.simplemobiletools.calendar.Constants;
|
||||
import com.simplemobiletools.calendar.Formatter;
|
||||
import com.simplemobiletools.calendar.R;
|
||||
import com.simplemobiletools.calendar.models.Day;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class MonthFragment extends Fragment implements Calendar {
|
||||
@BindView(R.id.top_text) TextView mMonthTV;
|
||||
private CalendarImpl mCalendar;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
final View view = inflater.inflate(R.layout.calendar_layout, container, false);
|
||||
ButterKnife.bind(this, view);
|
||||
|
||||
final String code = getArguments().getString(Constants.DAY_CODE);
|
||||
mCalendar = new CalendarImpl(this, getActivity().getApplicationContext(), code);
|
||||
mCalendar = new CalendarImpl(this, getActivity().getApplicationContext());
|
||||
mCalendar.updateCalendar(Formatter.getDateTimeFromCode(code));
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateCalendar(String month, List<Day> days) {
|
||||
|
||||
mMonthTV.setText(month);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue