Infinite 3 роки тому
батько
коміт
ce6821f54c

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

@@ -51,6 +51,7 @@ public class PostRecyclerAdapter extends RecyclerView.Adapter<PostRecyclerAdapte
 
         holder.title.setText(object.title);
         holder.subtitle.setText(Html.fromHtml(object.subtitle));
+        holder.author.setText(object.author);
 
         Picasso.get()
                 .load(object.Image)
@@ -124,7 +125,7 @@ public class PostRecyclerAdapter extends RecyclerView.Adapter<PostRecyclerAdapte
     public class ViewHolder extends RecyclerView.ViewHolder {
 
 
-        TextView title, subtitle;
+        TextView title, subtitle, author;
         ImageView imageView;
         CardView cardView;
 
@@ -136,6 +137,7 @@ public class PostRecyclerAdapter extends RecyclerView.Adapter<PostRecyclerAdapte
             title = itemView.findViewById(R.id.title);
             subtitle = itemView.findViewById(R.id.subtitle);
             imageView = itemView.findViewById(R.id.Icon);
+            author = itemView.findViewById(R.id.author);
         }
     }
 

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

@@ -1,19 +1,20 @@
 package club.thepenguins.android.data;
 
 public class Model {
-    public String title, subtitle, Image, Content;
+    public String title, subtitle, Image, Content, author;
 
-    public Model(String mtitle, String msubtitle, String image) {
-
-        this.title = mtitle;
-        this.subtitle = msubtitle;
+    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) {
+    public Model(String title, String subtitle, String image, String content, String author) {
         this.title = title;
         this.subtitle = subtitle;
         this.Image = image;
         this.Content = content;
+        this.author = author;
     }
 }

+ 1 - 1
app/src/main/java/club/thepenguins/android/fragments/HomeFragment.java

@@ -135,7 +135,7 @@ public class HomeFragment extends Fragment {
                 mListPost = response.body();
                 for (int i = 0; i < response.body().size(); i++) {
 
-                    list.add(new Model(response.body().get(i).getTitle().getRendered(), response.body().get(i).getContent().getRendered(), response.body().get(i).getEmbedded().getWpFeaturedmedia().get(0).getSourceUrl(), response.body().get(i).getContent().getRendered()));
+                    list.add(new Model(response.body().get(i).getTitle().getRendered(), response.body().get(i).getContent().getRendered(), response.body().get(i).getEmbedded().getWpFeaturedmedia().get(0).getSourceUrl(), response.body().get(i).getContent().getRendered(), response.body().get(i).getEmbedded().getAuthor().get(0).getName()));
 
                     Log.d("Home", "onResponse: " + response.body().get(i).getEmbedded().getWpFeaturedmedia().get(0).getSourceUrl());
                 }

+ 1 - 1
app/src/main/java/club/thepenguins/android/fragments/LinuxFragment.java

@@ -148,7 +148,7 @@ public class LinuxFragment extends Fragment {
                 mListPost = response.body();
                 for (int i = 0; i < response.body().size(); i++) {
 
-                    list.add(new Model(response.body().get(i).getTitle().getRendered(), response.body().get(i).getContent().getRendered(), response.body().get(i).getEmbedded().getWpFeaturedmedia().get(0).getSourceUrl(), response.body().get(i).getContent().getRendered()));
+                    list.add(new Model(response.body().get(i).getTitle().getRendered(), response.body().get(i).getContent().getRendered(), response.body().get(i).getEmbedded().getWpFeaturedmedia().get(0).getSourceUrl(), response.body().get(i).getContent().getRendered(), response.body().get(i).getEmbedded().getAuthor().get(0).getName()));
 
                     //Log.d("Linux", "onResponse: " + response.body().get(i).getEmbedded().getWpFeaturedmedia().get(0).getSourceUrl());
                 }

+ 1 - 1
app/src/main/java/club/thepenguins/android/fragments/NixFragment.java

@@ -148,7 +148,7 @@ public class NixFragment extends Fragment {
                 mListPost = response.body();
                 for (int i = 0; i < response.body().size(); i++) {
 
-                    list.add(new Model(response.body().get(i).getTitle().getRendered(), response.body().get(i).getContent().getRendered(), response.body().get(i).getEmbedded().getWpFeaturedmedia().get(0).getSourceUrl(), response.body().get(i).getContent().getRendered()));
+                    list.add(new Model(response.body().get(i).getTitle().getRendered(), response.body().get(i).getContent().getRendered(), response.body().get(i).getEmbedded().getWpFeaturedmedia().get(0).getSourceUrl(), response.body().get(i).getContent().getRendered(),response.body().get(i).getEmbedded().getAuthor().get(0).getName()));
 
                     //Log.d("Linux", "onResponse: " + response.body().get(i).getEmbedded().getWpFeaturedmedia().get(0).getSourceUrl());
                 }

+ 27 - 0
app/src/main/res/layout/post_item.xml

@@ -37,7 +37,34 @@
                 android:gravity="left"
                 android:id="@+id/title"
                 android:padding="5dp"
+                android:textSize="20sp"
                 android:layout_marginBottom="5dp"/>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="horizontal"
+                >
+
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textSize="16sp"
+                android:textStyle="bold"
+                android:padding="5dp"
+                android:gravity="left"
+                android:text="Author:"/>
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:textSize="15sp"
+                    android:padding="5dp"
+                    android:gravity="right"
+                    android:text="Name"
+                    android:id="@+id/author"/>
+
+            </LinearLayout>
+
             <TextView
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"