use of org.storymaker.app.model.JobTable in project storymaker by StoryMaker.
the class PublishFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
initFragment();
// purgePublishTables(); // FIXME for debuging, don't purgePublishTables on load!
int layout = getArguments().getInt("layout");
mView = inflater.inflate(layout, null);
String storyPathInstancePath = mActivity.getProject().getTemplatePath();
if (storyPathInstancePath != null && !storyPathInstancePath.equals("")) {
File f = new File(storyPathInstancePath);
// FIXME don't hardcode "en"
String jsonString = JsonHelper.loadJSON(f.getPath(), getActivity().getApplicationContext(), "en");
if (jsonString != null) {
// should not need to insert dependencies to check metadata
ArrayList<String> referencedFiles = new ArrayList<String>();
String language = StoryMakerApp.getCurrentLocale().getLanguage();
mStoryPathInstance = JsonHelper.deserializeStoryPathLibrary(jsonString, f.getAbsolutePath(), referencedFiles, getActivity(), language);
}
}
// mStoryPathInstance = JsonHelper.deserializeStoryPathLibrary(json, storyPathInstancePath, referencedFiles, this, );
if (layout == R.layout.fragment_complete_story) {
// FIXME not sure why this check exists
ProjectInfoFragment infoFrag = ProjectInfoFragment.newInstance(mActivity.getProject().getId(), false, false);
this.getChildFragmentManager().beginTransaction().replace(R.id.fl_info_container, infoFrag).commit();
View view = mView.findViewById(R.id.fl_info_container);
view.findViewById(R.id.fl_info_container).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
launchStoryInfoEditMode();
}
});
// view.setOnTouchListener(new OnTouchListener() {
//
// @Override
// public boolean onTouch(View v, MotionEvent event) {
// // TODO Auto-generated method stub
// return true;
// }
// }) ;
ImageView ivThumb = (ImageView) mView.findViewById(R.id.storyThumb);
Media[] medias = mActivity.mMPM.mScene.getMediaAsArray();
if (medias.length > 0) {
Bitmap bitmap = Media.getThumbnail(mActivity, medias[0], mActivity.mMPM.mProject);
if (bitmap != null) {
ivThumb.setImageBitmap(bitmap);
}
}
// FIXME figure out what spec we need to try to fetch for preview... could be audio or video
mMatchingRenderJob = (new JobTable()).getMatchingFinishedJob(getActivity(), mActivity.mMPM.mProject.getId(), JobTable.TYPE_RENDER, VideoRenderer.SPEC_KEY, mActivity.mMPM.mProject.getUpdatedAt());
if (mMatchingRenderJob != null) {
mFileLastExport = new File(mMatchingRenderJob.getResult());
}
mProgressText = (TextView) mView.findViewById(R.id.textViewProgress);
mProgressText.setText("");
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(mActivity, R.array.story_sections, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mButtonPlay = (ToggleImageButton) mView.findViewById(R.id.btnPlay);
mButtonPlay.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
playClicked();
}
});
mButtonUpload = (ToggleImageButton) mView.findViewById(R.id.btnUpload);
mButtonUpload.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
uploadClicked();
}
});
}
return mView;
}
Aggregations