mlkit-translate/app/src/main/java/com/google/firebase/samples/apps/mlkit/translate/java/TranslateViewModel.java
private void fetchDownloadedModels() {
        modelManager.getAvailableModels(FirebaseApp.getInstance()).addOnSuccessListener(
                new OnSuccessListener<Set<FirebaseTranslateRemoteModel>>() {
                    @Override
                    public void onSuccess(Set<FirebaseTranslateRemoteModel> remoteModels) {
                        List<String> modelCodes = new ArrayList<>(remoteModels.size());
                        for (FirebaseTranslateRemoteModel model : remoteModels) {
                            modelCodes.add(model.getLanguageCode());
                        }
                        Collections.sort(modelCodes);
                        availableModels.setValue(modelCodes);
                    }
                });
    }
// Updates the list of downloaded models available for local translation.
Updates the list of downloaded models available for local translation.
Updates the list of downloaded models available for local translation .
private void fetchDownloadedModels() {
        modelManager.getAvailableModels(FirebaseApp.getInstance()).addOnSuccessListener(
                new OnSuccessListener<Set<FirebaseTranslateRemoteModel>>() {
                    @Override
                    public void onSuccess(Set<FirebaseTranslateRemoteModel> remoteModels) {
                        List<String> modelCodes = new ArrayList<>(remoteModels.size());
                        for (FirebaseTranslateRemoteModel model : remoteModels) {
                            modelCodes.add(model.getLanguageCode());
                        }
                        Collections.sort(modelCodes);
                        availableModels.setValue(modelCodes);
                    }
                });
    }
private void fetchDownloadedModels ( ) { modelManager . getAvailableModels ( FirebaseApp . getInstance ( ) ) . addOnSuccessListener ( new OnSuccessListener < Set < FirebaseTranslateRemoteModel > > ( ) { @ Override public void onSuccess ( Set < FirebaseTranslateRemoteModel > remoteModels ) { List < String > modelCodes = new ArrayList < > ( remoteModels . size ( ) ) ; for ( FirebaseTranslateRemoteModel model : remoteModels ) { modelCodes . add ( model . getLanguageCode ( ) ) ; } Collections . sort ( modelCodes ) ; availableModels . setValue ( modelCodes ) ; } } ) ; }
Updates the list of downloaded models available for local translation.
Updates the list of downloaded models available for local translation .