当前位置: 首页>>代码示例>>Java>>正文


Java MissingMediaException类代码示例

本文整理汇总了Java中org.commcare.resources.model.MissingMediaException的典型用法代码示例。如果您正苦于以下问题:Java MissingMediaException类的具体用法?Java MissingMediaException怎么用?Java MissingMediaException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MissingMediaException类属于org.commcare.resources.model包,在下文中一共展示了MissingMediaException类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doTaskBackground

import org.commcare.resources.model.MissingMediaException; //导入依赖的package包/类
@Override
protected SizeBoundVector<MissingMediaException> doTaskBackground(Void... params) {
    AndroidCommCarePlatform platform = CommCareApplication.instance().getCommCarePlatform();

    // This is replicated in the application in a few places.
    ResourceTable global = platform.getGlobalResourceTable();
    SizeBoundUniqueVector<MissingMediaException> problems =
            new SizeBoundUniqueVector<>(10);

    setTableListeners(global);
    global.verifyInstallation(problems, platform);
    unsetTableListeners(global);

    if (problems.size() > 0) {
        return problems;
    }
    return null;
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:19,代码来源:VerificationTask.java

示例2: checkReferenceURI

import org.commcare.resources.model.MissingMediaException; //导入依赖的package包/类
public static void checkReferenceURI(Resource r, String URI, Vector<MissingMediaException> problems) throws IOException {
    try {
        Reference mRef = ReferenceManager.instance().DeriveReference(URI);

        if (!mRef.doesBinaryExist()) {
            String mLocalReference = mRef.getLocalURI();
            problems.addElement(new MissingMediaException(r, "Missing external media: " + mLocalReference, mLocalReference));
        }

    } catch (InvalidReferenceException ire) {
        //do nothing for now
    }
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:14,代码来源:FileUtil.java

示例3: handleVerificationProblems

import org.commcare.resources.model.MissingMediaException; //导入依赖的package包/类
private void handleVerificationProblems(SizeBoundVector<MissingMediaException> problems) {
    String message = Localization.get("verification.fail.message");

    Hashtable<String, Vector<String>> problemList = new Hashtable<>();
    for (Enumeration en = problems.elements(); en.hasMoreElements(); ) {
        MissingMediaException ure = (MissingMediaException)en.nextElement();
        String res = ure.getResource().getResourceId();

        Vector<String> list;
        if (problemList.containsKey(res)) {
            list = problemList.get(res);
        } else {
            list = new Vector<>();
        }
        list.addElement(ure.getMessage());

        problemList.put(res, list);

    }

    for (Enumeration en = problemList.keys(); en.hasMoreElements(); ) {
        String resource = (String)en.nextElement();

        message += "\n-----------";
        for (String s : problemList.get(resource)) {
            message += "\n" + prettyString(s);
        }
    }
    if (problems.getAdditional() > 0) {
        message += "\n\n..." + problems.getAdditional() + " more";
    }

    missingMediaPrompt.setText(message);
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:35,代码来源:CommCareVerificationActivity.java

示例4: verifyInstallation

import org.commcare.resources.model.MissingMediaException; //导入依赖的package包/类
@Override
public boolean verifyInstallation(Resource r,
                                  Vector<MissingMediaException> problems,
                                  CommCarePlatform platform) {
    try {
        Reference local = ReferenceManager.instance().DeriveReference(localLocation);
        Suite suite = AndroidSuiteParser.buildVerifyParser(local.getStream(), new DummyResourceTable()).parse();
        Hashtable<String, Entry> mHashtable = suite.getEntries();
        for (Enumeration en = mHashtable.keys(); en.hasMoreElements(); ) {
            String key = (String)en.nextElement();
            Entry mEntry = mHashtable.get(key);

            FileUtil.checkReferenceURI(r, mEntry.getAudioURI(), problems);
            FileUtil.checkReferenceURI(r, mEntry.getImageURI(), problems);
        }

        for (Menu menu : suite.getMenus()) {
            FileUtil.checkReferenceURI(r, menu.getAudioURI(), problems);
            FileUtil.checkReferenceURI(r, menu.getImageURI(), problems);
        }
    } catch (Exception e) {
        Logger.log("e", "suite validation failed with: " + e.getMessage());
        Log.d(TAG, "Suite validation failed");
        e.printStackTrace();
    }

    return problems.size() != 0;
}
 
开发者ID:dimagi,项目名称:commcare-android,代码行数:29,代码来源:SuiteAndroidInstaller.java

示例5: verifyInstallation

import org.commcare.resources.model.MissingMediaException; //导入依赖的package包/类
@Override
public boolean verifyInstallation(Resource r, Vector<MissingMediaException> problems, CommCarePlatform platform) {
    SizeBoundUniqueVector<MissingMediaException> sizeBoundProblems =
            (SizeBoundUniqueVector<MissingMediaException>)problems;

    InstallerUtil.checkMedia(r, Localization.get("icon.demo.path"), sizeBoundProblems, InstallerUtil.MediaType.IMAGE);
    InstallerUtil.checkMedia(r, Localization.get("icon.login.path"), sizeBoundProblems, InstallerUtil.MediaType.IMAGE);

    //Check to see whether the formDef exists and reads correctly
    Suite suite;
    try {
        suite = storage(platform).read(cacheLocation);
    } catch (Exception e) {
        e.printStackTrace();
        sizeBoundProblems.addElement(new MissingMediaException(r, "Suite did not properly save into persistent storage"));
        return true;
    }
    //Otherwise, we want to figure out if the form has media, and we need to see whether it's properly
    //available
    try {
        for (Menu menu : suite.getMenus()) {
            String aURI = menu.getAudioURI();
            if (aURI != null) {
                InstallerUtil.checkMedia(r, aURI, sizeBoundProblems, InstallerUtil.MediaType.AUDIO);
            }

            String iURI = menu.getImageURI();
            if (iURI != null) {
                InstallerUtil.checkMedia(r, iURI, sizeBoundProblems, InstallerUtil.MediaType.IMAGE);
            }
        }
    } catch (Exception exc) {
        System.out.println("fail: " + exc.getMessage());
        System.out.println("fail: " + exc.toString());
    }
    return problems.size() != 0;
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:38,代码来源:SuiteInstaller.java

示例6: validate

import org.commcare.resources.model.MissingMediaException; //导入依赖的package包/类
public static String validate(ResourceTable mResourceTable){

        SizeBoundUniqueVector<MissingMediaException> problems = new SizeBoundUniqueVector<MissingMediaException>(10);

        mResourceTable.verifyInstallation(problems);
        if(problems.size() > 0 ) {
            int badImageRef = problems.getBadImageReferenceCount();
            int badAudioRef = problems.getBadAudioReferenceCount();
            int badVideoRef = problems.getBadVideoReferenceCount();
            String errorMessage    = "CommCare cannot start because you are missing multimedia files.";
            String message = CommCareStartupInteraction.failSafeText("install.bad",errorMessage, new String[] {""+badImageRef,""+badAudioRef,""+badVideoRef});
            Hashtable<String, Vector<String>> problemList = new Hashtable<String,Vector<String>>();
            for(Enumeration en = problems.elements() ; en.hasMoreElements() ;) {
                MissingMediaException mme = (MissingMediaException)en.nextElement();

                String res = mme.getResource().getResourceId();

                Vector<String> list;
                if(problemList.containsKey(res)) {
                    list = problemList.get(res);
                } else{
                    list = new Vector<String>();
                }

                // code to pretty up the output for mealz

                int substringIndex = mme.getMessage().indexOf("/commcare");

                String shortenedMessage = (mme.getMessage()).substring(substringIndex+1);

                list.addElement(shortenedMessage);

                problemList.put(res, list);

            }

            message += "\n-----------";

            for(Enumeration en = problemList.keys(); en.hasMoreElements();) {

                String resource = (String)en.nextElement();
                //message += "\n-----------";
                for(String s : problemList.get(resource)) {
                    message += "\n" + s;
                }
            }
            if(problems.getAdditional() > 0) {
                message += "\n\n..." + problems.getAdditional() + " more";
            }

            return message;
        }
        return null;
    }
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:55,代码来源:CommCareStatic.java

示例7: verifyInstallation

import org.commcare.resources.model.MissingMediaException; //导入依赖的package包/类
public boolean verifyInstallation(Resource r, Vector<MissingMediaException> resources) {
    return false;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:4,代码来源:CacheInstaller.java

示例8: verifyInstallation

import org.commcare.resources.model.MissingMediaException; //导入依赖的package包/类
public boolean verifyInstallation(Resource r, Vector<MissingMediaException> problems) {
    //Work by default
    return true;
}
 
开发者ID:dimagi,项目名称:commcare-j2me,代码行数:5,代码来源:BasicInstaller.java

示例9: verifyInstallation

import org.commcare.resources.model.MissingMediaException; //导入依赖的package包/类
@Override
public boolean verifyInstallation(Resource r, Vector<MissingMediaException> resources, CommCarePlatform platform) {
    return false;
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:5,代码来源:CacheInstaller.java

示例10: verifyInstallation

import org.commcare.resources.model.MissingMediaException; //导入依赖的package包/类
@Override
public boolean verifyInstallation(Resource r, Vector<MissingMediaException> problems, CommCarePlatform platform) {
    //Work by default
    return true;
}
 
开发者ID:dimagi,项目名称:commcare-core,代码行数:6,代码来源:BasicInstaller.java


注:本文中的org.commcare.resources.model.MissingMediaException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。