Search in sources :

Example 6 with JobTable

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;
}
Also used : PublishJobTable(org.storymaker.app.model.PublishJobTable) JobTable(org.storymaker.app.model.JobTable) ArrayList(java.util.ArrayList) Media(org.storymaker.app.model.Media) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) DraggableGridView(com.animoto.android.views.DraggableGridView) SuppressLint(android.annotation.SuppressLint) Bitmap(android.graphics.Bitmap) OnClickListener(android.view.View.OnClickListener) ImageView(android.widget.ImageView) File(java.io.File)

Aggregations

JobTable (org.storymaker.app.model.JobTable)6 PublishJobTable (org.storymaker.app.model.PublishJobTable)6 SQLiteDatabase (net.sqlcipher.database.SQLiteDatabase)4 AudioClipTable (org.storymaker.app.model.AudioClipTable)4 AuthTable (org.storymaker.app.model.AuthTable)4 LessonTable (org.storymaker.app.model.LessonTable)4 MediaTable (org.storymaker.app.model.MediaTable)4 ProjectTable (org.storymaker.app.model.ProjectTable)4 SceneTable (org.storymaker.app.model.SceneTable)4 TagTable (org.storymaker.app.model.TagTable)4 Nullable (android.support.annotation.Nullable)2 SuppressLint (android.annotation.SuppressLint)1 Intent (android.content.Intent)1 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)1 Bitmap (android.graphics.Bitmap)1 View (android.view.View)1 OnClickListener (android.view.View.OnClickListener)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 DraggableGridView (com.animoto.android.views.DraggableGridView)1