aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/AcknowledgementRecyclerViewAdapter.java (renamed from app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementRecyclerViewAdapter.java)7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/TranslationFragmentRecyclerViewAdapter.java82
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/Acknowledgement.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementFragment.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/Translation.java42
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Settings/TranslationFragment.java58
7 files changed, 191 insertions, 4 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/AcknowledgementRecyclerViewAdapter.java
index 6b081ad1..3958054a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/AcknowledgementRecyclerViewAdapter.java
@@ -1,4 +1,4 @@
-package ml.docilealligator.infinityforreddit.Settings;
+package ml.docilealligator.infinityforreddit.Adapter;
import android.content.Context;
import android.content.Intent;
@@ -16,12 +16,13 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Activity.LinkResolverActivity;
import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.Settings.Acknowledgement;
-class AcknowledgementRecyclerViewAdapter extends RecyclerView.Adapter<AcknowledgementRecyclerViewAdapter.AcknowledgementViewHolder> {
+public class AcknowledgementRecyclerViewAdapter extends RecyclerView.Adapter<AcknowledgementRecyclerViewAdapter.AcknowledgementViewHolder> {
private ArrayList<Acknowledgement> acknowledgements;
private Context context;
- AcknowledgementRecyclerViewAdapter(Context context, ArrayList<Acknowledgement> acknowledgements) {
+ public AcknowledgementRecyclerViewAdapter(Context context, ArrayList<Acknowledgement> acknowledgements) {
this.context = context;
this.acknowledgements = acknowledgements;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/TranslationFragmentRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/TranslationFragmentRecyclerViewAdapter.java
new file mode 100644
index 00000000..a31381c5
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/TranslationFragmentRecyclerViewAdapter.java
@@ -0,0 +1,82 @@
+package ml.docilealligator.infinityforreddit.Adapter;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+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.Activity.LinkResolverActivity;
+import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
+import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.Settings.Translation;
+
+public class TranslationFragmentRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
+ private Activity activity;
+ private int primaryTextColor;
+ private int secondaryTextColor;
+ private ArrayList<Translation> translationContributors;
+
+ public TranslationFragmentRecyclerViewAdapter(Activity activity, CustomThemeWrapper customThemeWrapper) {
+ this.activity = activity;
+ primaryTextColor = customThemeWrapper.getPrimaryTextColor();
+ secondaryTextColor = customThemeWrapper.getSecondaryTextColor();
+ translationContributors = Translation.getTranslationContributors();
+ }
+
+ @NonNull
+ @Override
+ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ return new TranslationContributorViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_translation_contributor, parent, false));
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
+ if (holder instanceof TranslationContributorViewHolder) {
+ Translation translation = translationContributors.get(position);
+ ((TranslationContributorViewHolder) holder).countryFlagImageView.setImageResource(translation.flagDrawableId);
+ ((TranslationContributorViewHolder) holder).languageNameTextView.setText(translation.language);
+ ((TranslationContributorViewHolder) holder).contributorNamesTextView.setText(translation.contributors);
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return translationContributors.size();
+ }
+
+ class TranslationContributorViewHolder extends RecyclerView.ViewHolder {
+
+ @BindView(R.id.country_flag_image_view_item_translation_contributor)
+ ImageView countryFlagImageView;
+ @BindView(R.id.language_name_text_view_item_translation_contributor)
+ TextView languageNameTextView;
+ @BindView(R.id.contributor_names_text_view_item_translation_contributor)
+ TextView contributorNamesTextView;
+
+ public TranslationContributorViewHolder(@NonNull View itemView) {
+ super(itemView);
+
+ ButterKnife.bind(this, itemView);
+
+ languageNameTextView.setTextColor(primaryTextColor);
+ contributorNamesTextView.setTextColor(secondaryTextColor);
+
+ itemView.setOnClickListener(view -> {
+ Intent intent = new Intent(activity, LinkResolverActivity.class);
+ intent.setData(Uri.parse("https://poeditor.com/join/project?hash=b2IRyfaJv6"));
+ activity.startActivity(intent);
+ });
+ }
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
index e7c8e456..e537b248 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/AppComponent.java
@@ -71,6 +71,7 @@ import ml.docilealligator.infinityforreddit.Settings.NotificationPreferenceFragm
import ml.docilealligator.infinityforreddit.Settings.NsfwAndBlurringFragment;
import ml.docilealligator.infinityforreddit.Settings.SecurityPreferenceFragment;
import ml.docilealligator.infinityforreddit.Settings.ThemePreferenceFragment;
+import ml.docilealligator.infinityforreddit.Settings.TranslationFragment;
import ml.docilealligator.infinityforreddit.Settings.VideoPreferenceFragment;
@Singleton
@@ -215,4 +216,6 @@ public interface AppComponent {
void inject(CustomizeBottomAppBarFragment customizeBottomAppBarFragment);
void inject(GiveAwardActivity giveAwardActivity);
+
+ void inject(TranslationFragment translationFragment);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/Acknowledgement.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/Acknowledgement.java
index 9291b53c..f3466268 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/Acknowledgement.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/Acknowledgement.java
@@ -2,7 +2,7 @@ package ml.docilealligator.infinityforreddit.Settings;
import android.net.Uri;
-class Acknowledgement {
+public class Acknowledgement {
private String name;
private String introduction;
private Uri link;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementFragment.java
index c765682e..feb13e66 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/AcknowledgementFragment.java
@@ -18,6 +18,7 @@ import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
+import ml.docilealligator.infinityforreddit.Adapter.AcknowledgementRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.R;
/**
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/Translation.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/Translation.java
new file mode 100644
index 00000000..3d809a7f
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/Translation.java
@@ -0,0 +1,42 @@
+package ml.docilealligator.infinityforreddit.Settings;
+
+import java.util.ArrayList;
+
+import ml.docilealligator.infinityforreddit.R;
+
+public class Translation {
+ public String language;
+ public String contributors;
+ public int flagDrawableId;
+
+ public Translation(String language, String contributors, int flagDrawableId) {
+ this.language = language;
+ this.contributors = contributors;
+ this.flagDrawableId = flagDrawableId;
+ }
+
+ public static ArrayList<Translation> getTranslationContributors() {
+ ArrayList<Translation> translationContributors = new ArrayList<>();
+ translationContributors.add(new Translation("简体中文", "Gloria, Justin", R.drawable.flag_china));
+ translationContributors.add(new Translation("繁體中文", "", R.drawable.flag_china));
+ translationContributors.add(new Translation("Hrvatski", "Josip", R.drawable.flag_croatia));
+ translationContributors.add(new Translation("Française", "367, oursonbleu, Owen, pinembour", R.drawable.flag_france));
+ translationContributors.add(new Translation("Deutsche", "Jorge, Netto Hikari, translatewingman, translatorwiz", R.drawable.flag_germany));
+ translationContributors.add(new Translation("Ελληνικά", "Marios, Viktor", R.drawable.flag_greece));
+ translationContributors.add(new Translation("हिंदी", "a, Arya, charu, Mrigendra Bhandari, raghav, Sachin, Ved", R.drawable.flag_india));
+ translationContributors.add(new Translation("Magyar", "Zoltan", R.drawable.flag_hungary));
+ translationContributors.add(new Translation("Italiana", "Daniele Basso, DanOlivaw, Gianni00palmieri, Gillauino, ztiaa", R.drawable.flag_italy));
+ translationContributors.add(new Translation("日本語", "Issa, Mrigendra Bhandari, Ryan", R.drawable.flag_japan));
+ translationContributors.add(new Translation("한국어", "noname", R.drawable.flag_south_korea));
+ translationContributors.add(new Translation("norsk", "", R.drawable.flag_norway));
+ translationContributors.add(new Translation("Português", "Bruno Guerreiro, Lucas", R.drawable.flag_portugal));
+ translationContributors.add(new Translation("Português (BR)", "Laura Vasconcellos Pereira Felippe, Ricky, Super_Iguanna", R.drawable.flag_brazil));
+ translationContributors.add(new Translation("Română", "", R.drawable.flag_romania));
+ translationContributors.add(new Translation("русский язык", "aveblazer, flexagoon, Georgiy, Vova", R.drawable.flag_russia));
+ translationContributors.add(new Translation("Español", "Jorge, Miguel, mvstermoe, Nana Snixx, Sofia Flores", R.drawable.flag_spain));
+ translationContributors.add(new Translation("svenska", "Marcus Nordberg", R.drawable.flag_sweden));
+ translationContributors.add(new Translation("Türk", "Emir481, Faoiltiarna, Mehmet Yavuz, Serif", R.drawable.flag_turkey));
+ translationContributors.add(new Translation("Tiếng Việt", "Kai, Laezzy, Lmao, Ryan, viecdet69", R.drawable.flag_vietnam));
+ return translationContributors;
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/TranslationFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/TranslationFragment.java
new file mode 100644
index 00000000..44ad57e8
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Settings/TranslationFragment.java
@@ -0,0 +1,58 @@
+package ml.docilealligator.infinityforreddit.Settings;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.fragment.app.Fragment;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import javax.inject.Inject;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import ml.docilealligator.infinityforreddit.Adapter.TranslationFragmentRecyclerViewAdapter;
+import ml.docilealligator.infinityforreddit.CustomTheme.CustomThemeWrapper;
+import ml.docilealligator.infinityforreddit.Infinity;
+import ml.docilealligator.infinityforreddit.R;
+
+public class TranslationFragment extends Fragment {
+
+ @BindView(R.id.recycler_view_translation_fragment)
+ RecyclerView recyclerView;
+ @Inject
+ CustomThemeWrapper customThemeWrapper;
+ private Activity activity;
+
+ public TranslationFragment() {
+ // Required empty public constructor
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ // Inflate the layout for this fragment
+ View rootView = inflater.inflate(R.layout.fragment_translation, container, false);
+
+ ((Infinity) activity.getApplication()).getAppComponent().inject(this);
+
+ ButterKnife.bind(this, rootView);
+
+ TranslationFragmentRecyclerViewAdapter adapter = new TranslationFragmentRecyclerViewAdapter(activity, customThemeWrapper);
+ recyclerView.setLayoutManager(new LinearLayoutManager(activity));
+ recyclerView.setAdapter(adapter);
+
+ return rootView;
+ }
+
+ @Override
+ public void onAttach(@NonNull Context context) {
+ super.onAttach(context);
+ activity = (Activity) context;
+ }
+} \ No newline at end of file