Infinite 3 anni fa
parent
commit
3ea9b719f7

+ 1 - 2
app/src/main/java/club/thepenguins/android/activities/PostActivity.java

@@ -236,7 +236,6 @@ public class PostActivity extends AppCompatActivity {
                             response.body().get(i).getDate(),
                             response.body().get(i).getContent().getRendered()));
 
-                    System.out.println(response.body().get(i).getContent());
                 }
 
                 commentAdapter.notifyDataSetChanged();
@@ -258,7 +257,7 @@ public class PostActivity extends AppCompatActivity {
 
     }
 
-    public static void sharePost(Context context, String uri) {
+    public void sharePost(Context context, String uri) {
         Intent sendIntent = new Intent();
         sendIntent.setAction(Intent.ACTION_SEND);
         sendIntent.putExtra(Intent.EXTRA_TEXT, uri);

+ 90 - 0
app/src/main/java/club/thepenguins/android/adapters/ThanksAdapter.java

@@ -0,0 +1,90 @@
+package club.thepenguins.android.adapters;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.annotation.NonNull;
+
+import androidx.recyclerview.widget.RecyclerView;
+
+
+import java.util.ArrayList;
+
+import club.thepenguins.android.R;
+import es.dmoral.toasty.Toasty;
+
+public class ThanksAdapter extends RecyclerView.Adapter<ThanksAdapter.ViewHolder> {
+
+
+    private ArrayList<String> data;
+    private Context ctx;
+
+    public ThanksAdapter(ArrayList<String> list, Context context) {
+        this.data = list;
+        this.ctx = context;
+    }
+
+    @NonNull
+    @Override
+    public ThanksAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+
+        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.thanks, parent, false);
+
+        return new ThanksAdapter.ViewHolder(view);
+    }
+
+    @SuppressLint("SetTextI18n")
+    @Override
+    public void onBindViewHolder(@NonNull ThanksAdapter.ViewHolder holder, int position) {
+
+        final String object = data.get(position);
+
+        holder.name.setText(object);
+        holder.name.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                Toasty.success(ctx, object, Toast.LENGTH_SHORT, false).show();
+            }
+        });
+
+    }
+
+    public void clear() {
+
+        data.clear();
+
+        notifyDataSetChanged();
+
+    }
+
+
+    @Override
+    public int getItemCount() {
+        return data.size();
+    }
+
+    public class ViewHolder extends RecyclerView.ViewHolder {
+
+
+        TextView name;
+
+
+        public ViewHolder(@NonNull View itemView) {
+            super(itemView);
+
+            name = itemView.findViewById(R.id.people);
+        }
+    }
+
+    public void setData(ArrayList<String> data) {
+        this.data = data;
+        notifyDataSetChanged();
+    }
+
+
+}

+ 61 - 10
app/src/main/java/club/thepenguins/android/fragments/AboutFragment.java

@@ -1,20 +1,25 @@
 package club.thepenguins.android.fragments;
 
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
 import android.os.Bundle;
 
 import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
 
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-import android.widget.Toast;
+import android.widget.ImageView;
+import android.widget.TextView;
 
-import club.thepenguins.android.R;
-import es.dmoral.toasty.Toasty;
+import java.util.ArrayList;
+import java.util.Arrays;
 
-import static club.thepenguins.android.utils.Constants.noImplemented;
+import club.thepenguins.android.R;
+import club.thepenguins.android.adapters.ThanksAdapter;
 
 public class AboutFragment extends Fragment {
 
@@ -23,6 +28,11 @@ public class AboutFragment extends Fragment {
 
     private String mParam1;
     private String mParam2;
+    private LinearLayoutManager LayoutManager;
+    private ThanksAdapter adapter;
+    private ArrayList<String> list;
+    private TextView textView1, textView2, textView3;
+    private ImageView imageView;
 
     public AboutFragment() {
         // Required empty public constructor
@@ -52,15 +62,56 @@ public class AboutFragment extends Fragment {
                              Bundle savedInstanceState) {
         View rootView = inflater.inflate(R.layout.fragment_about, container, false);
 
-        ListView listView = rootView.findViewById(R.id.aboutLV);
+        RecyclerView recyclerView = rootView.findViewById(R.id.aboutRV);
         String[] listItem = getResources().getStringArray(R.array.thanksTo);
+        ArrayList<String> peopleList = new ArrayList<>(Arrays.asList(listItem));
+
+        textView1 = rootView.findViewById(R.id.dev);
+        textView2 = rootView.findViewById(R.id.bn);
+        textView3 = rootView.findViewById(R.id.international);
+        imageView = rootView.findViewById(R.id.git);
+
+
+        textView1.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                linkOpener(rootView.getContext(), rootView.getContext().getResources().getString(R.string.github));
+            }
+        });
 
+        imageView.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                linkOpener(rootView.getContext(), rootView.getContext().getResources().getString(R.string.github));
+            }
+        });
 
-        listView.setAdapter(new ArrayAdapter<>(rootView.getContext(), R.layout.thanks, R.id.people, listItem));
-        listView.setDivider(null);
+        textView2.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                linkOpener(rootView.getContext(), rootView.getContext().getResources().getString(R.string.penguins));
+            }
+        });
 
+        textView3.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                linkOpener(rootView.getContext(), rootView.getContext().getResources().getString(R.string.inter));
+            }
+        });
+
+
+        LayoutManager = new LinearLayoutManager(rootView.getContext(), LinearLayoutManager.VERTICAL, false);
+        recyclerView.setLayoutManager(LayoutManager);
+
+        adapter = new ThanksAdapter(peopleList, rootView.getContext());
+        recyclerView.setAdapter(adapter);
 
-        Toasty.info(rootView.getContext(), noImplemented, Toast.LENGTH_LONG).show();
         return rootView;
     }
+
+    public void linkOpener(Context context, String uri) {
+        Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
+        context.startActivity(browserIntent);
+    }
 }

+ 118 - 79
app/src/main/res/layout/fragment_about.xml

@@ -4,124 +4,163 @@
     android:id="@+id/aboutfrag"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:descendantFocusability="blocksDescendants"
     tools:context=".fragments.AboutFragment">
 
-
-    <LinearLayout
+    <androidx.core.widget.NestedScrollView
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical">
+        android:layout_height="wrap_content">
 
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center"
-            android:fontFamily="@font/unifrakturcook"
-            android:text="@string/logo"
-            android:textColor="@color/textColor"
-            android:textSize="80sp" />
 
-        <TextView
+        <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_margin="10dp"
-            android:text="@string/appDesc"
-            android:textColor="@color/textColor"
-            android:textSize="20sp" />
+            android:orientation="vertical">
 
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center"
-            android:text="@string/credits"
-            android:textColor="@color/textColor"
-            android:textSize="25sp"
-            android:textStyle="bold" />
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center"
+                android:fontFamily="@font/unifrakturcook"
+                android:text="@string/logo"
+                android:textColor="@color/textColor"
+                android:textSize="80sp" />
 
-        <LinearLayout
-            android:layout_width="wrap_content"
-            android:layout_height="match_parent"
-            android:layout_gravity="center"
-            android:layout_margin="10dp"
-            android:orientation="horizontal">
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center"
+                android:layout_margin="10dp"
+                android:text="@string/appDesc"
+                android:textColor="@color/textColor"
+                android:textSize="20sp" />
 
             <TextView
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:padding="5dp"
+                android:layout_gravity="center"
                 android:text="@string/created"
                 android:textColor="@color/textColor"
-                android:textSize="20sp" />
+                android:textSize="25sp" />
 
-            <ImageView
-                android:layout_width="wrap_content"
+
+            <LinearLayout
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:padding="2dp"
-                android:src="@drawable/ic_gihub" />
+                android:layout_gravity="center"
+                android:orientation="vertical">
+
+                <ImageView
+                    android:id="@+id/git"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center"
+                    android:padding="2dp"
+                    android:src="@drawable/ic_gihub" />
+
+                <TextView
+                    android:id="@+id/dev"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_gravity="center"
+                    android:padding="5dp"
+                    android:text="@string/dev"
+                    android:textColor="@color/colorPrimary"
+                    android:textSize="22sp" />
+
+            </LinearLayout>
+
 
             <TextView
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_gravity="center"
-                android:padding="5dp"
-                android:text="@string/dev"
+                android:text="@string/powered"
                 android:textColor="@color/textColor"
-                android:textSize="20sp" />
+                android:textSize="25sp"
+                android:textStyle="bold" />
 
+            <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center"
+                android:layout_margin="10dp">
 
-        </LinearLayout>
+                <TextView
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:text="@string/technoFaq"
+                    android:textColor="@color/textColor"
+                    android:textSize="22sp" />
 
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center"
-            android:text="@string/powered"
-            android:textColor="@color/textColor"
-            android:textSize="25sp"
-            android:textStyle="bold" />
 
-        <LinearLayout
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center"
-            android:layout_margin="10dp">
+            </LinearLayout>
 
             <TextView
-                android:layout_width="match_parent"
+                android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:text="@string/technoFaq"
+                android:layout_gravity="center"
+                android:text="@string/community"
                 android:textColor="@color/textColor"
-                android:textSize="22sp" />
+                android:textSize="25sp"
+                android:textStyle="bold" />
 
+            <LinearLayout
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center"
+                android:layout_margin="10dp"
+                android:orientation="vertical">
+
+                <TextView
+                    android:id="@+id/bn"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginBottom="5dp"
+                    android:gravity="center"
+                    android:text="@string/bn"
+                    android:textColor="@color/colorPrimary"
+                    android:textSize="22sp" />
+
+                <TextView
+                    android:id="@+id/international"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:gravity="center"
+                    android:text="@string/international"
+                    android:textColor="@color/colorPrimary"
+                    android:textSize="22sp" />
+
+
+            </LinearLayout>
 
-        </LinearLayout>
-
-        <TextView
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center"
-            android:text="@string/thanks"
-            android:textColor="@color/textColor"
-            android:textSize="25sp"
-            android:textStyle="bold" />
-
-        <LinearLayout
-            android:layout_width="wrap_content"
-            android:layout_height="match_parent"
-            android:layout_margin="10dp"
-            android:orientation="vertical">
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="center"
+                android:text="@string/thanks"
+                android:textColor="@color/textColor"
+                android:textSize="25sp"
+                android:textStyle="bold" />
 
-            <ListView
-                android:id="@+id/aboutLV"
+            <LinearLayout
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center" />
+                android:layout_height="match_parent"
+                android:layout_gravity="center"
+                android:layout_margin="10dp"
+                android:orientation="vertical">
 
+                <androidx.recyclerview.widget.RecyclerView
+                    android:id="@+id/aboutRV"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content" />
 
-        </LinearLayout>
+
+            </LinearLayout>
 
 
-    </LinearLayout>
+        </LinearLayout>
+    </androidx.core.widget.NestedScrollView>
 
 
 </FrameLayout>

+ 3 - 2
app/src/main/res/values/strings.xml

@@ -17,8 +17,9 @@
     <string name="github">https://github.com/r00t3d0</string>
     <string name="community">Our community:</string>
     <string name="penguins">https://t.me/joinchat/F9jtaRUVVujT8Gdi7SzbeQ</string>
-    <string name="bn">Bangla</string>
-    <string name="international">International</string>
+    <string name="bn">The Penguins - Linux and FOSS</string>
+    <string name="international">Techno FAQ</string>
+    <string name="inter">https://t.me/Techno_FAQ</string>
     <string name="thanks">Special thanks to:</string>
 
     <string-array name="thanksTo">