Получите подробную информацию из переработчика и покажите результат в другом упражнении, используя карточный просмотр с модификацией 2 - PullRequest
0 голосов
/ 26 сентября 2018

Я использую CardView в RecyclerView, чтобы перечислить результат запроса на модификацию, затем я хочу получить подробную информацию о просмотре карты, по которой щелкнули, и отобразить детали Cardview (json) в другом упражнении. Код ниже - это мое первое действие, в котором яизвлекаю json с помощью дооснащения 2. Этот код работает нормально, выдавая json.

public class featured_listing extends AppCompatActivity {
      private RecyclerView featured_item_view;
      List<featuredListingModel> featuredListingModel;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_featured_listing);

        featured_item_view = (RecyclerView) findViewById(R.id.ui_featured_listing);

        Window window = getWindow();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            window.setStatusBarColor(getColor(R.color.login_statusbar_color));
        }
        else {
            window.setStatusBarColor(getResources().getColor(R.color.login_statusbar_color));
        }

        StaggeredGridLayoutManager mStaggeredGridLayoutManager = new StaggeredGridLayoutManager(1 , StaggeredGridLayoutManager.VERTICAL);
        featured_item_view.setLayoutManager(mStaggeredGridLayoutManager);
        getData();

    }

    public void getData(){
        final Call<List<featuredListingModel>> featured_listingCall = RetrofitClient.getInstance().getApi().getFeaturedListing();
        featured_listingCall.enqueue(new Callback<List<featuredListingModel>>() {
            @Override
            public void onResponse(Call<List<featuredListingModel>> call, Response<List<featuredListingModel>> response) {
                int statusCode = response.code();
                  featuredListingModel = response.body();
                  featured_listing_adapter featuredListingAdapter = new featured_listing_adapter(featuredListingModel , getApplicationContext());
                  featured_item_view.setAdapter(featuredListingAdapter);
            }

            @Override
            public void onFailure(Call<List<featuredListingModel>> call, Throwable t) {

            }
        });

    }
}

Вот адаптер, который я использую для получения данных карты ...

public class featured_listing_adapter extends RecyclerView.Adapter<featured_listing_adapter.featured_listing_ViewHolder> {
    private static final String TAG = "RecyclerViewAdapter";
    private Context context;
    List<featuredListingModel> featuredItems;

    public featured_listing_adapter (List<featuredListingModel> _featuredItems  , Context _context){
             featuredItems =  _featuredItems;
        context = _context;
    }

    @Override
    public featured_listing_ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View viewItem = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_featured_listing_result , parent , false);
        featured_listing_ViewHolder featuredListingViewHolder = new featured_listing_ViewHolder(viewItem);
        return featuredListingViewHolder;
    }

    @Override
    public void onBindViewHolder(featured_listing_ViewHolder holder, final int position) {

        holder.mDoc_name.setText(featuredItems.get(position).getName());
        holder.mDoc_email.setText(featuredItems.get(position).getEmail());
        holder.mDoc_phone.setText(featuredItems.get(position).getPhone());
        holder.mDoc_like.setText(featuredItems.get(position).getLikes());
        holder.mDoc_directory_type.setText(featuredItems.get(position).getDirectoryTypeName());
        Picasso.get().load(featuredItems.get(position).getImgUrl()).into(holder.mDoc_image);

        holder.featured_listing_card_view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
             Intent intent = new Intent(v.getContext() , Search_Result.class);
             v.getContext().startActivity(intent);
            }
        });
   }

    @Override
    public int getItemCount() {
        return featuredItems.size();
    }


    public static class featured_listing_ViewHolder extends RecyclerView.ViewHolder{

        @BindView(R.id.featured_listing_cardview) CardView featured_listing_card_view;

        @BindView(R.id.doc_img)  ImageView mDoc_image;

        @BindView(R.id.home_doc_name) TextView mDoc_name;

        @BindView(R.id.home_doc_phone) TextView mDoc_phone;

        @BindView(R.id.home_doc_email) TextView mDoc_email;

        @BindView(R.id.ui_likes) TextView mDoc_like;

        @BindView(R.id.ui_directory_type) TextView mDoc_directory_type;


        public featured_listing_ViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this , itemView);
        }
    }
}

и теперь я хочу получить подробную информацию о каждом просмотре карты в другой деятельности ..... и я не могу понять, как это сделать ..... У меня есть еще один запрос на модификацию для этой работы ....

@FormUrlEncoded
    @POST("doc/doc_detail")
    Call<List<DocDetail>> getDocDetail(@Query("id") int id);

и это класс модели для получения подробной информации о каждой карте с сервера с помощью модернизации ....

public class DocDetail {

    @SerializedName("name")
    @Expose
    private String name;
    @SerializedName("id")
    @Expose
    private String id;
    @SerializedName("image")
    @Expose
    private String image;
    @SerializedName("banner")
    @Expose
    private String banner;
    @SerializedName("directory_type")
    @Expose
    private Object directoryType;
    @SerializedName("directory_type_name")
    @Expose
    private String directoryTypeName;
    @SerializedName("directory_type_url")
    @Expose
    private Boolean directoryTypeUrl;
    @SerializedName("video_url")
    @Expose
    private Object videoUrl;
    @SerializedName("address")
    @Expose
    private Object address;
    @SerializedName("fax")
    @Expose
    private Object fax;
    @SerializedName("website")
    @Expose
    private Object website;
    @SerializedName("language")
    @Expose
    private Object language;
    @SerializedName("verify")
    @Expose
    private Object verify;
    @SerializedName("user_featured")
    @Expose
    private String userFeatured;
    @SerializedName("latitude")
    @Expose
    private Object latitude;
    @SerializedName("longitude")
    @Expose
    private Object longitude;
    @SerializedName("location")
    @Expose
    private Object location;
    @SerializedName("views")
    @Expose
    private Object views;
    @SerializedName("facebook")
    @Expose
    private Object facebook;
    @SerializedName("twitter")
    @Expose
    private Object twitter;
    @SerializedName("linkedin")
    @Expose
    private Object linkedin;
    @SerializedName("pinterest")
    @Expose
    private Object pinterest;
    @SerializedName("google_plus")
    @Expose
    private Object googlePlus;
    @SerializedName("tumblr")
    @Expose
    private Object tumblr;
    @SerializedName("instagram")
    @Expose
    private Object instagram;
    @SerializedName("skype")
    @Expose
    private Object skype;
    @SerializedName("zip")
    @Expose
    private Object zip;
    @SerializedName("tagline")
    @Expose
    private Object tagline;
    @SerializedName("description")
    @Expose
    private Object description;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getBanner() {
        return banner;
    }

    public void setBanner(String banner) {
        this.banner = banner;
    }

    public Object getDirectoryType() {
        return directoryType;
    }

    public void setDirectoryType(Object directoryType) {
        this.directoryType = directoryType;
    }

    public String getDirectoryTypeName() {
        return directoryTypeName;
    }

    public void setDirectoryTypeName(String directoryTypeName) {
        this.directoryTypeName = directoryTypeName;
    }

    public Boolean getDirectoryTypeUrl() {
        return directoryTypeUrl;
    }

    public void setDirectoryTypeUrl(Boolean directoryTypeUrl) {
        this.directoryTypeUrl = directoryTypeUrl;
    }

    public Object getVideoUrl() {
        return videoUrl;
    }

    public void setVideoUrl(Object videoUrl) {
        this.videoUrl = videoUrl;
    }

    public Object getAddress() {
        return address;
    }

    public void setAddress(Object address) {
        this.address = address;
    }

    public Object getFax() {
        return fax;
    }

    public void setFax(Object fax) {
        this.fax = fax;
    }

    public Object getWebsite() {
        return website;
    }

    public void setWebsite(Object website) {
        this.website = website;
    }

    public Object getLanguage() {
        return language;
    }

    public void setLanguage(Object language) {
        this.language = language;
    }

    public Object getVerify() {
        return verify;
    }

    public void setVerify(Object verify) {
        this.verify = verify;
    }

    public String getUserFeatured() {
        return userFeatured;
    }

    public void setUserFeatured(String userFeatured) {
        this.userFeatured = userFeatured;
    }

    public Object getLatitude() {
        return latitude;
    }

    public void setLatitude(Object latitude) {
        this.latitude = latitude;
    }

    public Object getLongitude() {
        return longitude;
    }

    public void setLongitude(Object longitude) {
        this.longitude = longitude;
    }

    public Object getLocation() {
        return location;
    }

    public void setLocation(Object location) {
        this.location = location;
    }

    public Object getViews() {
        return views;
    }

    public void setViews(Object views) {
        this.views = views;
    }

    public Object getFacebook() {
        return facebook;
    }

    public void setFacebook(Object facebook) {
        this.facebook = facebook;
    }

    public Object getTwitter() {
        return twitter;
    }

    public void setTwitter(Object twitter) {
        this.twitter = twitter;
    }

    public Object getLinkedin() {
        return linkedin;
    }

    public void setLinkedin(Object linkedin) {
        this.linkedin = linkedin;
    }

    public Object getPinterest() {
        return pinterest;
    }

    public void setPinterest(Object pinterest) {
        this.pinterest = pinterest;
    }

    public Object getGooglePlus() {
        return googlePlus;
    }

    public void setGooglePlus(Object googlePlus) {
        this.googlePlus = googlePlus;
    }

    public Object getTumblr() {
        return tumblr;
    }

    public void setTumblr(Object tumblr) {
        this.tumblr = tumblr;
    }

    public Object getInstagram() {
        return instagram;
    }

    public void setInstagram(Object instagram) {
        this.instagram = instagram;
    }

    public Object getSkype() {
        return skype;
    }

    public void setSkype(Object skype) {
        this.skype = skype;
    }

    public Object getZip() {
        return zip;
    }

    public void setZip(Object zip) {
        this.zip = zip;
    }

    public Object getTagline() {
        return tagline;
    }

    public void setTagline(Object tagline) {
        this.tagline = tagline;
    }

    public Object getDescription() {
        return description;
    }

    public void setDescription(Object description) {
        this.description = description;
    }
}

, пожалуйста, помогите ....

...