use of io.github.izzyleung.zhihudailypurify.ui.fragment.NewsListFragment in project ZhihuDailyPurify by izzyleung.
the class SingleDayNewsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle bundle = getIntent().getExtras();
Fragment newFragment = new NewsListFragment();
String dateString = bundle.getString(Constants.BundleKeys.DATE);
Calendar calendar = Calendar.getInstance();
try {
Date date = Constants.Dates.simpleDateFormat.parse(dateString);
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_YEAR, -1);
} catch (ParseException ignored) {
}
//noinspection ConstantConditions
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle(DateFormat.getDateInstance().format(calendar.getTime()));
bundle.putString(Constants.BundleKeys.DATE, dateString);
bundle.putBoolean(Constants.BundleKeys.IS_FIRST_PAGE, isSameDay(calendar, Calendar.getInstance()));
bundle.putBoolean(Constants.BundleKeys.IS_SINGLE, true);
newFragment.setArguments(bundle);
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_frame, newFragment).commit();
}
Aggregations