aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/Settings
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2019-08-24 08:27:34 +0000
committerAlex Ning <chineseperson5@gmail.com>2019-08-24 08:27:34 +0000
commit4d4e6165f0e1bcd72c54fa015a9e1112103e9062 (patch)
treeba276cfc847fd2addc888078784998a2df957554 /app/src/main/java/Settings
parent4a3266e68994b55bf1fc40256cd65c3ac831d2e8 (diff)
downloadinfinity-for-reddit-4d4e6165f0e1bcd72c54fa015a9e1112103e9062.tar
infinity-for-reddit-4d4e6165f0e1bcd72c54fa015a9e1112103e9062.tar.gz
infinity-for-reddit-4d4e6165f0e1bcd72c54fa015a9e1112103e9062.tar.bz2
infinity-for-reddit-4d4e6165f0e1bcd72c54fa015a9e1112103e9062.tar.lz
infinity-for-reddit-4d4e6165f0e1bcd72c54fa015a9e1112103e9062.tar.xz
infinity-for-reddit-4d4e6165f0e1bcd72c54fa015a9e1112103e9062.tar.zst
infinity-for-reddit-4d4e6165f0e1bcd72c54fa015a9e1112103e9062.zip
Add an acknowledgement page in settings.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/Settings/Acknowledgement.java27
-rw-r--r--app/src/main/java/Settings/AcknowledgementFragment.java106
-rw-r--r--app/src/main/java/Settings/AcknowledgementRecyclerViewAdapter.java67
3 files changed, 200 insertions, 0 deletions
diff --git a/app/src/main/java/Settings/Acknowledgement.java b/app/src/main/java/Settings/Acknowledgement.java
new file mode 100644
index 00000000..26a5a064
--- /dev/null
+++ b/app/src/main/java/Settings/Acknowledgement.java
@@ -0,0 +1,27 @@
+package Settings;
+
+import android.net.Uri;
+
+class Acknowledgement {
+ private String name;
+ private String introduction;
+ private Uri link;
+
+ Acknowledgement(String name, String introduction, Uri link) {
+ this.name = name;
+ this.introduction = introduction;
+ this.link = link;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getIntroduction() {
+ return introduction;
+ }
+
+ public Uri getLink() {
+ return link;
+ }
+}
diff --git a/app/src/main/java/Settings/AcknowledgementFragment.java b/app/src/main/java/Settings/AcknowledgementFragment.java
new file mode 100644
index 00000000..7a19a0a5
--- /dev/null
+++ b/app/src/main/java/Settings/AcknowledgementFragment.java
@@ -0,0 +1,106 @@
+package Settings;
+
+
+import android.app.Activity;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import java.util.ArrayList;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import ml.docilealligator.infinityforreddit.R;
+
+/**
+ * A simple {@link Fragment} subclass.
+ */
+public class AcknowledgementFragment extends Fragment {
+
+
+ public AcknowledgementFragment() {
+ // Required empty public constructor
+ }
+
+ @BindView(R.id.recycler_view_acknowledgement_fragment) RecyclerView recyclerView;
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ View rootView = inflater.inflate(R.layout.fragment_acknowledgement, container, false);
+ ButterKnife.bind(this, rootView);
+
+ Activity activity = getActivity();
+
+ ArrayList<Acknowledgement> acknowledgements = new ArrayList<>();
+ acknowledgements.add(new Acknowledgement("ExoPlayer",
+ "An application level media player for Android",
+ Uri.parse("https://github.com/google/ExoPlayer")));
+ acknowledgements.add(new Acknowledgement("GestureViews",
+ "ImageView and FrameLayout with gestures control and position animation",
+ Uri.parse("https://github.com/alexvasilkov/GestureViews")));
+ acknowledgements.add(new Acknowledgement("Glide",
+ "A fast and efficient open source media management and image loading framework for Android",
+ Uri.parse("https://github.com/bumptech/glide")));
+ acknowledgements.add(new Acknowledgement("Swipe",
+ "Detects swipe events on Android with listener and RxJava Observable",
+ Uri.parse("https://github.com/pwittchen/swipe")));
+ acknowledgements.add(new Acknowledgement("RxAndroid",
+ "Android specific bindings for RxJava 2",
+ Uri.parse("https://github.com/ReactiveX/RxAndroid")));
+ acknowledgements.add(new Acknowledgement("RxJava",
+ "Reactive extensions for the JVM",
+ Uri.parse("https://github.com/ReactiveX/RxJava")));
+ acknowledgements.add(new Acknowledgement("Retrofit",
+ "Type-safe HTTP client for Android and Java by Square, Inc.",
+ Uri.parse("https://github.com/square/retrofit")));
+ acknowledgements.add(new Acknowledgement("Dagger",
+ "A fast dependency injector for Java and Android.",
+ Uri.parse("https://github.com/google/dagger")));
+ acknowledgements.add(new Acknowledgement("Butter Knife",
+ "Field and method binding for Android views",
+ Uri.parse("https://github.com/JakeWharton/butterknife")));
+ acknowledgements.add(new Acknowledgement("Aspect Ratio ImageView",
+ "A simple imageview which scales the width or height aspect with the given ratio",
+ Uri.parse("https://github.com/santalu/aspect-ratio-imageview")));
+ acknowledgements.add(new Acknowledgement("MaterialLoadingProgressBar",
+ "A styled ProgressBar",
+ Uri.parse("https://github.com/lsjwzh/MaterialLoadingProgressBar")));
+ acknowledgements.add(new Acknowledgement("Markwon",
+ "A markdown library for Android",
+ Uri.parse("https://github.com/noties/Markwon")));
+ acknowledgements.add(new Acknowledgement("android-gif-drawable",
+ "Views and Drawable for animated GIFs in Android.",
+ Uri.parse("https://github.com/koral--/android-gif-drawable")));
+ acknowledgements.add(new Acknowledgement("SimpleSearchView",
+ "A simple SearchView for Android based on Material Design",
+ Uri.parse("https://github.com/Ferfalk/SimpleSearchView")));
+ acknowledgements.add(new Acknowledgement("EventBus",
+ "A publish/subscribe event bus for Android and Java",
+ Uri.parse("https://github.com/greenrobot/EventBus")));
+ acknowledgements.add(new Acknowledgement("Customized and Expandable TextView",
+ "Simple library to change the Textview as rectangle, circle and square shapes",
+ Uri.parse("https://github.com/Rajagopalr3/CustomizedTextView")));
+ acknowledgements.add(new Acknowledgement("Rounded Bottom Sheet",
+ "Bottom sheet with rounded corners",
+ Uri.parse("https://github.com/Deishelon/RoundedBottomSheet")));
+ acknowledgements.add(new Acknowledgement("Bridge",
+ "A library for avoiding TransactionTooLargeException during state saving and restoration",
+ Uri.parse("https://github.com/livefront/bridge")));
+ acknowledgements.add(new Acknowledgement("Android-State",
+ "A utility library for Android to save objects in a Bundle without any boilerplate",
+ Uri.parse("https://github.com/evernote/android-state")));
+
+ AcknowledgementRecyclerViewAdapter adapter = new AcknowledgementRecyclerViewAdapter(activity, acknowledgements);
+ recyclerView.setLayoutManager(new LinearLayoutManager(activity));
+ recyclerView.setAdapter(adapter);
+
+ return rootView;
+ }
+}
diff --git a/app/src/main/java/Settings/AcknowledgementRecyclerViewAdapter.java b/app/src/main/java/Settings/AcknowledgementRecyclerViewAdapter.java
new file mode 100644
index 00000000..81286903
--- /dev/null
+++ b/app/src/main/java/Settings/AcknowledgementRecyclerViewAdapter.java
@@ -0,0 +1,67 @@
+package Settings;
+
+import android.content.Context;
+import android.content.Intent;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import java.util.ArrayList;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import ml.docilealligator.infinityforreddit.LinkResolverActivity;
+import ml.docilealligator.infinityforreddit.R;
+
+class AcknowledgementRecyclerViewAdapter extends RecyclerView.Adapter<AcknowledgementRecyclerViewAdapter.AcknowledgementViewHolder> {
+ private ArrayList<Acknowledgement> acknowledgements;
+ private Context context;
+
+ AcknowledgementRecyclerViewAdapter(Context context, ArrayList<Acknowledgement> acknowledgements) {
+ this.context = context;
+ this.acknowledgements = acknowledgements;
+ }
+
+ @NonNull
+ @Override
+ public AcknowledgementViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ return new AcknowledgementViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_acknowledgement, parent, false));
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull AcknowledgementViewHolder holder, int position) {
+ Acknowledgement acknowledgement = acknowledgements.get(holder.getAdapterPosition());
+ if(acknowledgement != null) {
+ holder.nameTextView.setText(acknowledgement.getName());
+ holder.introductionTextView.setText(acknowledgement.getIntroduction());
+ holder.itemView.setOnClickListener(view -> {
+ if(context != null) {
+ Intent intent = new Intent(context, LinkResolverActivity.class);
+ intent.setData(acknowledgement.getLink());
+ context.startActivity(intent);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return acknowledgements == null ? 0 : acknowledgements.size();
+ }
+
+ class AcknowledgementViewHolder extends RecyclerView.ViewHolder {
+ View itemView;
+ @BindView(R.id.name_text_view_item_acknowledgement) TextView nameTextView;
+ @BindView(R.id.introduction_text_view_item_acknowledgement) TextView introductionTextView;
+
+ AcknowledgementViewHolder(@NonNull View itemView) {
+ super(itemView);
+ ButterKnife.bind(this, itemView);
+ this.itemView = itemView;
+ }
+ }
+}