Search in sources :

Example 1 with ComplaintTag

use of app.insti.ComplaintTag in project IITB-App by wncc.

the class FileComplaintFragment method populateTags.

private void populateTags(String cs, Boolean userAddedTag) {
    if (!(cs.isEmpty())) {
        tagList2.add(new ComplaintTag(cs));
        ArrayList<Tag> tags = new ArrayList<>();
        Tag tag;
        for (int i = 0; i < tagList2.size(); i++) {
            tag = new Tag(tagList2.get(i).getName());
            tag.radius = 10f;
            tag.isDeletable = true;
            tags.add(tag);
        }
        tagView.addTags(tags);
        for (int i = 0; i < tagList2.size(); i++) {
            if (userAddedTag && tagList2.get(i).getName() == cs)
                tagList2.get(i).setName(cs + " (U)");
        }
    } else {
        linearLayoutScrollTags.setVisibility(View.INVISIBLE);
        linearLayoutScrollTags.setVisibility(View.GONE);
        Toast.makeText(getContext(), "Please enter some tags", Toast.LENGTH_SHORT).show();
    }
}
Also used : ComplaintTag(app.insti.ComplaintTag) ArrayList(java.util.ArrayList) Tag(com.cunoraz.tagview.Tag) ComplaintTag(app.insti.ComplaintTag)

Example 2 with ComplaintTag

use of app.insti.ComplaintTag in project IITB-App by wncc.

the class FileComplaintFragment method prepareTags.

private void prepareTags() {
    try {
        RetrofitInterface retrofitInterface = Utils.getRetrofitInterface();
        retrofitInterface.getTags("sessionid=" + getArguments().getString(Constants.SESSION_ID)).enqueue(new Callback<List<Venter.TagUri>>() {

            @Override
            public void onResponse(Call<List<Venter.TagUri>> call, Response<List<Venter.TagUri>> response) {
                if (response != null && response.isSuccessful()) {
                    List<Venter.TagUri> tagsApiList = response.body();
                    tagList = new ArrayList<>();
                    for (int i = 0; i < tagsApiList.size(); i++) {
                        Venter.TagUri tagUri = tagsApiList.get(i);
                        ComplaintTag complaintTag = new ComplaintTag(tagUri.getTagUri());
                        tagList.add(complaintTag);
                    }
                    swipeContainer.setRefreshing(false);
                    linearLayoutAll.setVisibility(View.VISIBLE);
                    error_message_me.setVisibility(View.GONE);
                    getMapReady();
                } else {
                    error_message_me.setVisibility(View.VISIBLE);
                    error_message_me.setText(getString(R.string.no_complaints));
                    swipeContainer.setRefreshing(false);
                    linearLayoutAll.setVisibility(View.GONE);
                }
            }

            @Override
            public void onFailure(Call<List<Venter.TagUri>> call, Throwable t) {
                Log.i(TAG, "failure in getting Tags: " + t.toString());
                swipeContainer.setRefreshing(false);
                error_message_me.setVisibility(View.VISIBLE);
                linearLayoutAll.setVisibility(View.GONE);
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
        swipeContainer.setRefreshing(false);
        linearLayoutAll.setVisibility(View.GONE);
    }
}
Also used : Venter(app.insti.api.model.Venter) ComplaintTag(app.insti.ComplaintTag) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) ApiException(com.google.android.gms.common.api.ApiException) ResolvableApiException(com.google.android.gms.common.api.ResolvableApiException) RetrofitInterface(app.insti.api.RetrofitInterface)

Aggregations

ComplaintTag (app.insti.ComplaintTag)2 ArrayList (java.util.ArrayList)2 RetrofitInterface (app.insti.api.RetrofitInterface)1 Venter (app.insti.api.model.Venter)1 Tag (com.cunoraz.tagview.Tag)1 ApiException (com.google.android.gms.common.api.ApiException)1 ResolvableApiException (com.google.android.gms.common.api.ResolvableApiException)1 List (java.util.List)1