Search in sources :

Example 1 with DiaryActivity

use of com.kiminonawa.mydiary.entries.DiaryActivity in project MyDiary by erttyy8821.

the class DiaryViewerDialogFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    callback = (DiaryViewerCallback) getTargetFragment();
    diaryId = getArguments().getLong("diaryId", -1L);
    if (diaryId != -1) {
        if (isEditMode) {
            diaryViewerHandler = new DiaryViewerHandler(this);
            diaryFileManager = new FileManager(getActivity(), FileManager.DIARY_EDIT_CACHE_DIR);
            diaryFileManager.clearDir();
            PB_diary_item_content_hint.setVisibility(View.VISIBLE);
            mTask = new CopyDiaryToEditCacheTask(getActivity(), diaryFileManager, this);
            //Make ths ProgressBar show 0.7s+.
            loadDiaryHandler = new Handler();
            initHandlerOrTaskIsRunning = true;
            loadDiaryHandler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    //Copy the file into editCash
                    mTask.execute(((DiaryActivity) getActivity()).getTopicId(), diaryId);
                }
            }, 700);
        } else {
            diaryFileManager = new FileManager(getActivity(), ((DiaryActivity) getActivity()).getTopicId(), diaryId);
            initData();
        }
    }
}
Also used : DiaryActivity(com.kiminonawa.mydiary.entries.DiaryActivity) Handler(android.os.Handler) FileManager(com.kiminonawa.mydiary.shared.FileManager)

Aggregations

Handler (android.os.Handler)1 DiaryActivity (com.kiminonawa.mydiary.entries.DiaryActivity)1 FileManager (com.kiminonawa.mydiary.shared.FileManager)1