Search in sources :

Example 6 with ListReportModel

use of com.ushahidi.android.app.models.ListReportModel in project Ushahidi_Android by ushahidi.

the class FetchReports method clearCachedData.

/**
	 * Clear saved reports
	 */
public void clearCachedData() {
    // delete reports
    new ListReportModel().deleteReport();
    // delete comment data
    new ListCommentModel().deleteComments();
    // delete fetched photos
    ImageManager.deleteImages(this);
    // delete pending photos
    ImageManager.deletePendingImages(this);
    // delete Open GeoSMS reports
    Database.mOpenGeoSmsDao.deleteReports();
}
Also used : ListReportModel(com.ushahidi.android.app.models.ListReportModel) ListCommentModel(com.ushahidi.android.app.models.ListCommentModel)

Example 7 with ListReportModel

use of com.ushahidi.android.app.models.ListReportModel in project Ushahidi_Android by ushahidi.

the class AddReportActivity method showCategories.

// fetch categories
public String[] showCategories() {
    ListReportModel mListReportModel = new ListReportModel();
    List<CategoryEntity> listCategories = mListReportModel.getAllCategories();
    if (listCategories != null && listCategories.size() > 0) {
        int categoryCount = listCategories.size();
        int categoryAmount = 0;
        if (categoryCount > 0) {
            categoryAmount = categoryCount;
        } else {
            mCategoriesId.clear();
            mCategoriesTitle.clear();
            categoryAmount = 1;
        }
        String[] categories = new String[categoryAmount];
        mCategoryLength = categories.length;
        int i = 0;
        for (CategoryEntity category : mListReportModel.getAllCategories()) {
            categories[i] = category.getCategoryTitle();
            mCategoriesTitle.put(String.valueOf(category.getCategoryId()), category.getCategoryTitle());
            mCategoriesId.add(category.getCategoryId());
            i++;
        }
        return categories;
    }
    return null;
}
Also used : ListReportModel(com.ushahidi.android.app.models.ListReportModel) CategoryEntity(com.ushahidi.android.app.entities.CategoryEntity)

Example 8 with ListReportModel

use of com.ushahidi.android.app.models.ListReportModel in project Ushahidi_Android by ushahidi.

the class MapFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    mListReportModel = new ListReportModel();
    mListReportModel.load();
    mReportModel = mListReportModel.getReports();
    showCategories();
    mHandler = new Handler();
    if (checkForGMap()) {
        map = getMap();
        Preferences.loadSettings(getActivity());
        initMap();
        map.setInfoWindowAdapter(new PopupAdapter(getLayoutInflater(savedInstanceState)));
        map.setOnInfoWindowClickListener(this);
    }
}
Also used : Handler(android.os.Handler) ListReportModel(com.ushahidi.android.app.models.ListReportModel) PopupAdapter(com.ushahidi.android.app.adapters.PopupAdapter)

Aggregations

ListReportModel (com.ushahidi.android.app.models.ListReportModel)8 CategoryEntity (com.ushahidi.android.app.entities.CategoryEntity)3 Handler (android.os.Handler)1 ViewPager (android.support.v4.view.ViewPager)1 ViewGroup (android.view.ViewGroup)1 GooglePlayServicesNotAvailableException (com.google.android.gms.common.GooglePlayServicesNotAvailableException)1 PopupAdapter (com.ushahidi.android.app.adapters.PopupAdapter)1 ListCommentModel (com.ushahidi.android.app.models.ListCommentModel)1 ViewReportView (com.ushahidi.android.app.views.ViewReportView)1