فهرست منبع

Minor cleaning

Infinite 3 سال پیش
والد
کامیت
c7179ae402

+ 1 - 1
app/build.gradle

@@ -32,6 +32,7 @@ android {
 
 dependencies {
 
+    implementation platform('com.google.firebase:firebase-bom:28.2.1')
     implementation 'androidx.appcompat:appcompat:1.3.0'
     implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
     implementation 'androidx.legacy:legacy-support-v4:1.0.0'
@@ -48,7 +49,6 @@ dependencies {
     implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
     implementation 'androidx.recyclerview:recyclerview:1.2.1'
     implementation 'com.facebook.shimmer:shimmer:0.5.0'
-    implementation platform('com.google.firebase:firebase-bom:28.2.1')
     implementation 'com.google.firebase:firebase-messaging'
     implementation 'com.github.GrenderG:Toasty:1.5.0'
     implementation 'androidx.webkit:webkit:1.4.0'

+ 3 - 20
app/src/main/java/club/thepenguins/android/adapters/PostRecyclerAdapter.java

@@ -75,16 +75,6 @@ public class PostRecyclerAdapter extends RecyclerView.Adapter<PostRecyclerAdapte
                     }
                 });
 
-        /*
-        final Handler handler = new Handler();
-        handler.postDelayed(new Runnable() {
-            @Override
-            public void run() {
-
-            }
-        }, 1000);
-         */
-
 
         holder.cardView.setOnClickListener(new View.OnClickListener() {
             @Override
@@ -98,14 +88,6 @@ public class PostRecyclerAdapter extends RecyclerView.Adapter<PostRecyclerAdapte
                 intent.putExtra("link", object.link);
                 ctx.startActivity(intent);
 
-                /*
-
-                FragmentManager fragmentManager = ((AppCompatActivity) ctx).getSupportFragmentManager();
-
-                fragmentManager.beginTransaction().replace(R.id.flContent, PostFragment.newInstance(object.Content, object.Image, object.title, object.author)).addToBackStack(null).commit();
-
-
-                 */
             }
         });
 
@@ -122,9 +104,11 @@ public class PostRecyclerAdapter extends RecyclerView.Adapter<PostRecyclerAdapte
 
     public void addAll(ArrayList<Model> list) {
 
+        int lastIndex = list.size() - 1;
+
         list.addAll(list);
 
-        notifyDataSetChanged();
+        notifyItemRangeInserted(lastIndex, list.size());
 
     }
 
@@ -144,7 +128,6 @@ public class PostRecyclerAdapter extends RecyclerView.Adapter<PostRecyclerAdapte
             super(itemView);
 
             cardView = itemView.findViewById(R.id.card);
-
             title = itemView.findViewById(R.id.title);
             subtitle = itemView.findViewById(R.id.subtitle);
             imageView = itemView.findViewById(R.id.Icon);

+ 0 - 4
app/src/main/java/club/thepenguins/android/api/APIService.java

@@ -4,7 +4,6 @@ import java.util.List;
 
 import club.thepenguins.android.data.Category;
 import club.thepenguins.android.data.Comments;
-import club.thepenguins.android.data.Image;
 import club.thepenguins.android.data.IndividualPost;
 import club.thepenguins.android.data.Posts;
 import retrofit2.Call;
@@ -19,9 +18,6 @@ public interface APIService {
     @GET("wp-json/wp/v2/posts?_embed")
     Call<List<Posts>> getPostsPerPage(@Query("per_page") String count);
 
-    @GET(".")
-    Call<Image> getFeaturedImageLink();
-
     @GET("wp-json/wp/v2/posts?_embed")
     Call<List<Posts>> getCategoryPosts(@Query("categories") String id);
 

+ 0 - 933
app/src/main/java/club/thepenguins/android/data/Image.java

@@ -1,933 +0,0 @@
-package club.thepenguins.android.data;
-
-import com.google.gson.annotations.Expose;
-import com.google.gson.annotations.SerializedName;
-
-import java.util.List;
-
-
-/*
-    Created from: https://www.jsonschema2pojo.org/
- */
-
-
-public class Image {
-
-    @SerializedName("id")
-    @Expose
-    private Integer id;
-    @SerializedName("date")
-    @Expose
-    private String date;
-    @SerializedName("date_gmt")
-    @Expose
-    private String dateGmt;
-    @SerializedName("guid")
-    @Expose
-    private Guid guid;
-    @SerializedName("modified")
-    @Expose
-    private String modified;
-    @SerializedName("modified_gmt")
-    @Expose
-    private String modifiedGmt;
-    @SerializedName("slug")
-    @Expose
-    private String slug;
-    @SerializedName("status")
-    @Expose
-    private String status;
-    @SerializedName("type")
-    @Expose
-    private String type;
-    @SerializedName("link")
-    @Expose
-    private String link;
-    @SerializedName("title")
-    @Expose
-    private Title title;
-    @SerializedName("author")
-    @Expose
-    private Integer author;
-    @SerializedName("comment_status")
-    @Expose
-    private String commentStatus;
-    @SerializedName("ping_status")
-    @Expose
-    private String pingStatus;
-    @SerializedName("template")
-    @Expose
-    private String template;
-    @SerializedName("meta")
-    @Expose
-    private List<Object> meta = null;
-    @SerializedName("description")
-    @Expose
-    private Description description;
-    @SerializedName("caption")
-    @Expose
-    private Caption caption;
-    @SerializedName("alt_text")
-    @Expose
-    private String altText;
-    @SerializedName("media_type")
-    @Expose
-    private String mediaType;
-    @SerializedName("mime_type")
-    @Expose
-    private String mimeType;
-    @SerializedName("media_details")
-    @Expose
-    private MediaDetails mediaDetails;
-    @SerializedName("post")
-    @Expose
-    private Integer post;
-    @SerializedName("source_url")
-    @Expose
-    private String sourceUrl;
-    @SerializedName("_links")
-    @Expose
-    private Links links;
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public String getDate() {
-        return date;
-    }
-
-    public void setDate(String date) {
-        this.date = date;
-    }
-
-    public String getDateGmt() {
-        return dateGmt;
-    }
-
-    public void setDateGmt(String dateGmt) {
-        this.dateGmt = dateGmt;
-    }
-
-    public Guid getGuid() {
-        return guid;
-    }
-
-    public void setGuid(Guid guid) {
-        this.guid = guid;
-    }
-
-    public String getModified() {
-        return modified;
-    }
-
-    public void setModified(String modified) {
-        this.modified = modified;
-    }
-
-    public String getModifiedGmt() {
-        return modifiedGmt;
-    }
-
-    public void setModifiedGmt(String modifiedGmt) {
-        this.modifiedGmt = modifiedGmt;
-    }
-
-    public String getSlug() {
-        return slug;
-    }
-
-    public void setSlug(String slug) {
-        this.slug = slug;
-    }
-
-    public String getStatus() {
-        return status;
-    }
-
-    public void setStatus(String status) {
-        this.status = status;
-    }
-
-    public String getType() {
-        return type;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    public String getLink() {
-        return link;
-    }
-
-    public void setLink(String link) {
-        this.link = link;
-    }
-
-    public Title getTitle() {
-        return title;
-    }
-
-    public void setTitle(Title title) {
-        this.title = title;
-    }
-
-    public Integer getAuthor() {
-        return author;
-    }
-
-    public void setAuthor(Integer author) {
-        this.author = author;
-    }
-
-    public String getCommentStatus() {
-        return commentStatus;
-    }
-
-    public void setCommentStatus(String commentStatus) {
-        this.commentStatus = commentStatus;
-    }
-
-    public String getPingStatus() {
-        return pingStatus;
-    }
-
-    public void setPingStatus(String pingStatus) {
-        this.pingStatus = pingStatus;
-    }
-
-    public String getTemplate() {
-        return template;
-    }
-
-    public void setTemplate(String template) {
-        this.template = template;
-    }
-
-    public List<Object> getMeta() {
-        return meta;
-    }
-
-    public void setMeta(List<Object> meta) {
-        this.meta = meta;
-    }
-
-    public Description getDescription() {
-        return description;
-    }
-
-    public void setDescription(Description description) {
-        this.description = description;
-    }
-
-    public Caption getCaption() {
-        return caption;
-    }
-
-    public void setCaption(Caption caption) {
-        this.caption = caption;
-    }
-
-    public String getAltText() {
-        return altText;
-    }
-
-    public void setAltText(String altText) {
-        this.altText = altText;
-    }
-
-    public String getMediaType() {
-        return mediaType;
-    }
-
-    public void setMediaType(String mediaType) {
-        this.mediaType = mediaType;
-    }
-
-    public String getMimeType() {
-        return mimeType;
-    }
-
-    public void setMimeType(String mimeType) {
-        this.mimeType = mimeType;
-    }
-
-    public MediaDetails getMediaDetails() {
-        return mediaDetails;
-    }
-
-    public void setMediaDetails(MediaDetails mediaDetails) {
-        this.mediaDetails = mediaDetails;
-    }
-
-    public Integer getPost() {
-        return post;
-    }
-
-    public void setPost(Integer post) {
-        this.post = post;
-    }
-
-    public String getSourceUrl() {
-        return sourceUrl;
-    }
-
-    public void setSourceUrl(String sourceUrl) {
-        this.sourceUrl = sourceUrl;
-    }
-
-    public Links getLinks() {
-        return links;
-    }
-
-    public void setLinks(Links links) {
-        this.links = links;
-    }
-
-
-    public class About {
-
-        @SerializedName("href")
-        @Expose
-        private String href;
-
-        public String getHref() {
-            return href;
-        }
-
-        public void setHref(String href) {
-            this.href = href;
-        }
-
-    }
-
-    public class Author {
-
-        @SerializedName("embeddable")
-        @Expose
-        private Boolean embeddable;
-        @SerializedName("href")
-        @Expose
-        private String href;
-
-        public Boolean getEmbeddable() {
-            return embeddable;
-        }
-
-        public void setEmbeddable(Boolean embeddable) {
-            this.embeddable = embeddable;
-        }
-
-        public String getHref() {
-            return href;
-        }
-
-        public void setHref(String href) {
-            this.href = href;
-        }
-
-    }
-
-    public class Caption {
-
-        @SerializedName("rendered")
-        @Expose
-        private String rendered;
-
-        public String getRendered() {
-            return rendered;
-        }
-
-        public void setRendered(String rendered) {
-            this.rendered = rendered;
-        }
-
-    }
-
-    public class Collection {
-
-        @SerializedName("href")
-        @Expose
-        private String href;
-
-        public String getHref() {
-            return href;
-        }
-
-        public void setHref(String href) {
-            this.href = href;
-        }
-
-    }
-
-    public class Description {
-
-        @SerializedName("rendered")
-        @Expose
-        private String rendered;
-
-        public String getRendered() {
-            return rendered;
-        }
-
-        public void setRendered(String rendered) {
-            this.rendered = rendered;
-        }
-
-    }
-
-    public class Full {
-
-        @SerializedName("file")
-        @Expose
-        private String file;
-        @SerializedName("width")
-        @Expose
-        private Integer width;
-        @SerializedName("height")
-        @Expose
-        private Integer height;
-        @SerializedName("mime_type")
-        @Expose
-        private String mimeType;
-        @SerializedName("source_url")
-        @Expose
-        private String sourceUrl;
-
-        public String getFile() {
-            return file;
-        }
-
-        public void setFile(String file) {
-            this.file = file;
-        }
-
-        public Integer getWidth() {
-            return width;
-        }
-
-        public void setWidth(Integer width) {
-            this.width = width;
-        }
-
-        public Integer getHeight() {
-            return height;
-        }
-
-        public void setHeight(Integer height) {
-            this.height = height;
-        }
-
-        public String getMimeType() {
-            return mimeType;
-        }
-
-        public void setMimeType(String mimeType) {
-            this.mimeType = mimeType;
-        }
-
-        public String getSourceUrl() {
-            return sourceUrl;
-        }
-
-        public void setSourceUrl(String sourceUrl) {
-            this.sourceUrl = sourceUrl;
-        }
-
-    }
-
-    public class Guid {
-
-        @SerializedName("rendered")
-        @Expose
-        private String rendered;
-
-        public String getRendered() {
-            return rendered;
-        }
-
-        public void setRendered(String rendered) {
-            this.rendered = rendered;
-        }
-
-    }
-
-    public class ImageMeta {
-
-        @SerializedName("aperture")
-        @Expose
-        private String aperture;
-        @SerializedName("credit")
-        @Expose
-        private String credit;
-        @SerializedName("camera")
-        @Expose
-        private String camera;
-        @SerializedName("caption")
-        @Expose
-        private String caption;
-        @SerializedName("created_timestamp")
-        @Expose
-        private String createdTimestamp;
-        @SerializedName("copyright")
-        @Expose
-        private String copyright;
-        @SerializedName("focal_length")
-        @Expose
-        private String focalLength;
-        @SerializedName("iso")
-        @Expose
-        private String iso;
-        @SerializedName("shutter_speed")
-        @Expose
-        private String shutterSpeed;
-        @SerializedName("title")
-        @Expose
-        private String title;
-        @SerializedName("orientation")
-        @Expose
-        private String orientation;
-        @SerializedName("keywords")
-        @Expose
-        private List<Object> keywords = null;
-
-        public String getAperture() {
-            return aperture;
-        }
-
-        public void setAperture(String aperture) {
-            this.aperture = aperture;
-        }
-
-        public String getCredit() {
-            return credit;
-        }
-
-        public void setCredit(String credit) {
-            this.credit = credit;
-        }
-
-        public String getCamera() {
-            return camera;
-        }
-
-        public void setCamera(String camera) {
-            this.camera = camera;
-        }
-
-        public String getCaption() {
-            return caption;
-        }
-
-        public void setCaption(String caption) {
-            this.caption = caption;
-        }
-
-        public String getCreatedTimestamp() {
-            return createdTimestamp;
-        }
-
-        public void setCreatedTimestamp(String createdTimestamp) {
-            this.createdTimestamp = createdTimestamp;
-        }
-
-        public String getCopyright() {
-            return copyright;
-        }
-
-        public void setCopyright(String copyright) {
-            this.copyright = copyright;
-        }
-
-        public String getFocalLength() {
-            return focalLength;
-        }
-
-        public void setFocalLength(String focalLength) {
-            this.focalLength = focalLength;
-        }
-
-        public String getIso() {
-            return iso;
-        }
-
-        public void setIso(String iso) {
-            this.iso = iso;
-        }
-
-        public String getShutterSpeed() {
-            return shutterSpeed;
-        }
-
-        public void setShutterSpeed(String shutterSpeed) {
-            this.shutterSpeed = shutterSpeed;
-        }
-
-        public String getTitle() {
-            return title;
-        }
-
-        public void setTitle(String title) {
-            this.title = title;
-        }
-
-        public String getOrientation() {
-            return orientation;
-        }
-
-        public void setOrientation(String orientation) {
-            this.orientation = orientation;
-        }
-
-        public List<Object> getKeywords() {
-            return keywords;
-        }
-
-        public void setKeywords(List<Object> keywords) {
-            this.keywords = keywords;
-        }
-
-    }
-
-    public class Links {
-
-        @SerializedName("self")
-        @Expose
-        private List<Self> self = null;
-        @SerializedName("collection")
-        @Expose
-        private List<Collection> collection = null;
-        @SerializedName("about")
-        @Expose
-        private List<About> about = null;
-        @SerializedName("author")
-        @Expose
-        private List<Author> author = null;
-        @SerializedName("replies")
-        @Expose
-        private List<Reply> replies = null;
-
-        public List<Self> getSelf() {
-            return self;
-        }
-
-        public void setSelf(List<Self> self) {
-            this.self = self;
-        }
-
-        public List<Collection> getCollection() {
-            return collection;
-        }
-
-        public void setCollection(List<Collection> collection) {
-            this.collection = collection;
-        }
-
-        public List<About> getAbout() {
-            return about;
-        }
-
-        public void setAbout(List<About> about) {
-            this.about = about;
-        }
-
-        public List<Author> getAuthor() {
-            return author;
-        }
-
-        public void setAuthor(List<Author> author) {
-            this.author = author;
-        }
-
-        public List<Reply> getReplies() {
-            return replies;
-        }
-
-        public void setReplies(List<Reply> replies) {
-            this.replies = replies;
-        }
-
-    }
-
-    public class MediaDetails {
-
-        @SerializedName("width")
-        @Expose
-        private Integer width;
-        @SerializedName("height")
-        @Expose
-        private Integer height;
-        @SerializedName("file")
-        @Expose
-        private String file;
-        @SerializedName("sizes")
-        @Expose
-        private Sizes sizes;
-        @SerializedName("image_meta")
-        @Expose
-        private ImageMeta imageMeta;
-
-        public Integer getWidth() {
-            return width;
-        }
-
-        public void setWidth(Integer width) {
-            this.width = width;
-        }
-
-        public Integer getHeight() {
-            return height;
-        }
-
-        public void setHeight(Integer height) {
-            this.height = height;
-        }
-
-        public String getFile() {
-            return file;
-        }
-
-        public void setFile(String file) {
-            this.file = file;
-        }
-
-        public Sizes getSizes() {
-            return sizes;
-        }
-
-        public void setSizes(Sizes sizes) {
-            this.sizes = sizes;
-        }
-
-        public ImageMeta getImageMeta() {
-            return imageMeta;
-        }
-
-        public void setImageMeta(ImageMeta imageMeta) {
-            this.imageMeta = imageMeta;
-        }
-
-    }
-
-    public class Medium {
-
-        @SerializedName("file")
-        @Expose
-        private String file;
-        @SerializedName("width")
-        @Expose
-        private Integer width;
-        @SerializedName("height")
-        @Expose
-        private Integer height;
-        @SerializedName("mime_type")
-        @Expose
-        private String mimeType;
-        @SerializedName("source_url")
-        @Expose
-        private String sourceUrl;
-
-        public String getFile() {
-            return file;
-        }
-
-        public void setFile(String file) {
-            this.file = file;
-        }
-
-        public Integer getWidth() {
-            return width;
-        }
-
-        public void setWidth(Integer width) {
-            this.width = width;
-        }
-
-        public Integer getHeight() {
-            return height;
-        }
-
-        public void setHeight(Integer height) {
-            this.height = height;
-        }
-
-        public String getMimeType() {
-            return mimeType;
-        }
-
-        public void setMimeType(String mimeType) {
-            this.mimeType = mimeType;
-        }
-
-        public String getSourceUrl() {
-            return sourceUrl;
-        }
-
-        public void setSourceUrl(String sourceUrl) {
-            this.sourceUrl = sourceUrl;
-        }
-
-    }
-
-    public class Reply {
-
-        @SerializedName("embeddable")
-        @Expose
-        private Boolean embeddable;
-        @SerializedName("href")
-        @Expose
-        private String href;
-
-        public Boolean getEmbeddable() {
-            return embeddable;
-        }
-
-        public void setEmbeddable(Boolean embeddable) {
-            this.embeddable = embeddable;
-        }
-
-        public String getHref() {
-            return href;
-        }
-
-        public void setHref(String href) {
-            this.href = href;
-        }
-
-    }
-
-    public class Self {
-
-        @SerializedName("href")
-        @Expose
-        private String href;
-
-        public String getHref() {
-            return href;
-        }
-
-        public void setHref(String href) {
-            this.href = href;
-        }
-
-    }
-
-    public class Sizes {
-
-        @SerializedName("medium")
-        @Expose
-        private Medium medium;
-        @SerializedName("thumbnail")
-        @Expose
-        private Thumbnail thumbnail;
-        @SerializedName("full")
-        @Expose
-        private Full full;
-
-        public Medium getMedium() {
-            return medium;
-        }
-
-        public void setMedium(Medium medium) {
-            this.medium = medium;
-        }
-
-        public Thumbnail getThumbnail() {
-            return thumbnail;
-        }
-
-        public void setThumbnail(Thumbnail thumbnail) {
-            this.thumbnail = thumbnail;
-        }
-
-        public Full getFull() {
-            return full;
-        }
-
-        public void setFull(Full full) {
-            this.full = full;
-        }
-
-    }
-
-    public class Thumbnail {
-
-        @SerializedName("file")
-        @Expose
-        private String file;
-        @SerializedName("width")
-        @Expose
-        private Integer width;
-        @SerializedName("height")
-        @Expose
-        private Integer height;
-        @SerializedName("mime_type")
-        @Expose
-        private String mimeType;
-        @SerializedName("source_url")
-        @Expose
-        private String sourceUrl;
-
-        public String getFile() {
-            return file;
-        }
-
-        public void setFile(String file) {
-            this.file = file;
-        }
-
-        public Integer getWidth() {
-            return width;
-        }
-
-        public void setWidth(Integer width) {
-            this.width = width;
-        }
-
-        public Integer getHeight() {
-            return height;
-        }
-
-        public void setHeight(Integer height) {
-            this.height = height;
-        }
-
-        public String getMimeType() {
-            return mimeType;
-        }
-
-        public void setMimeType(String mimeType) {
-            this.mimeType = mimeType;
-        }
-
-        public String getSourceUrl() {
-            return sourceUrl;
-        }
-
-        public void setSourceUrl(String sourceUrl) {
-            this.sourceUrl = sourceUrl;
-        }
-
-    }
-
-    public class Title {
-
-        @SerializedName("rendered")
-        @Expose
-        private String rendered;
-
-        public String getRendered() {
-            return rendered;
-        }
-
-        public void setRendered(String rendered) {
-            this.rendered = rendered;
-        }
-
-    }
-}

+ 0 - 7
app/src/main/java/club/thepenguins/android/data/Model.java

@@ -3,13 +3,6 @@ package club.thepenguins.android.data;
 public class Model {
     public String title, subtitle, Image, Content, author, link;
 
-    public Model(String title, String subtitle, String image, String content) {
-        this.title = title;
-        this.subtitle = subtitle;
-        this.Image = image;
-        this.Content = content;
-    }
-
     public Model(String title, String subtitle, String image, String content, String author, String link) {
         this.title = title;
         this.subtitle = subtitle;