use of cn.snowt.diary.adapter.DiaryAdapter in project Diary by HibaraAi.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 禁止截屏设置
boolean notAllowScreenshot = BaseUtils.getDefaultSharedPreferences().getBoolean("notAllowScreenshot", true);
if (notAllowScreenshot) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
}
setContentView(R.layout.activity_main);
// 导航栏透明
// 设置状态栏和导航栏颜色为透明
View decorView = getWindow().getDecorView();
int option = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
decorView.setSystemUiVisibility(option);
// 设置导航栏颜色为透明
getWindow().setNavigationBarColor(Color.TRANSPARENT);
// 设置通知栏颜色为透明
getWindow().setStatusBarColor(Color.TRANSPARENT);
// 读取往年今日等提醒
new Thread(() -> {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
LoginService loginService = new LoginServiceImpl();
if (MyConfiguration.getInstance().isNeedFirstLoginNotice() && loginService.isFirstLoginInTheDay()) {
loginService.doFirstLoginOfTheDay();
}
}).start();
bindViewAndSetListener();
getDiaryForFirstShow();
diaryAdapter = new DiaryAdapter(voList);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setAdapter(diaryAdapter);
}
use of cn.snowt.diary.adapter.DiaryAdapter in project Diary by HibaraAi.
the class DiaryDetailActivity method showDiaryDetail.
private void showDiaryDetail() {
if (-1 != diaryId) {
SimpleResult result = diaryService.getDiaryVoById(diaryId);
if (result.getSuccess()) {
DiaryVo diaryVo = (DiaryVo) result.getData();
List<DiaryVo> diaryVos = new ArrayList<>();
diaryVos.add(diaryVo);
adapter = new DiaryAdapter(diaryVos);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(layoutManager);
} else {
toolbar.setTitle(result.getMsg());
}
} else {
BaseUtils.shortTipInCoast(this, "日记貌似找不到呢...");
finish();
}
}
use of cn.snowt.diary.adapter.DiaryAdapter in project Diary by HibaraAi.
the class TimeAscActivity method onCreate.
@SuppressLint("NotifyDataSetChanged")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 禁止截屏设置
boolean notAllowScreenshot = BaseUtils.getDefaultSharedPreferences().getBoolean("notAllowScreenshot", true);
if (notAllowScreenshot) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
}
setContentView(R.layout.activity_time_asc);
bindViewAndSetListener();
Intent intent = getIntent();
int intExtra = intent.getIntExtra(OPEN_FROM_TYPE, -1);
switch(intExtra) {
case OPEN_FROM_FORMER_YEARS:
{
actionBar.setTitle("往年今日");
stopRefreshLayout();
showForMerYears();
break;
}
case OPEN_FROM_SIMPLE_DIARY_LIST:
{
actionBar.setTitle("临时信息流");
stopRefreshLayout();
showByIds(intent.getIntegerArrayListExtra("ids"), intent.getIntExtra("sortType", 1));
break;
}
default:
{
getDiaryForFirstShow();
break;
}
}
diaryAdapter = new DiaryAdapter(voList);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setAdapter(diaryAdapter);
}
Aggregations