diff --git a/app/src/main/java/org/mian/gitnex/activities/CreditsActivity.java b/app/src/main/java/org/mian/gitnex/activities/CreditsActivity.java index 37e3ebee..9c3bddb7 100644 --- a/app/src/main/java/org/mian/gitnex/activities/CreditsActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/CreditsActivity.java @@ -1,12 +1,18 @@ package org.mian.gitnex.activities; import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.DividerItemDecoration; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import android.content.res.Resources; import android.os.Bundle; -import android.text.method.LinkMovementMethod; import android.view.View; import android.widget.ImageView; -import android.widget.TextView; import org.mian.gitnex.R; +import org.mian.gitnex.adapters.CreditsAdapter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; /** * Author M M Arif @@ -22,14 +28,28 @@ public class CreditsActivity extends AppCompatActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_credits); - TextView creditKasun = findViewById(R.id.creditKasun); ImageView closeActivity = findViewById(R.id.close); - creditKasun.setMovementMethod(LinkMovementMethod.getInstance()); - initCloseListener(); closeActivity.setOnClickListener(onClickListener); + Resources res = getResources(); + CharSequence[] creditsInfo = res.getTextArray(R.array.creditsInfo); + + List creditsList = new ArrayList<>(Arrays.asList(creditsInfo)); + + RecyclerView mRecyclerView = findViewById(R.id.recyclerView); + + mRecyclerView.setHasFixedSize(true); + mRecyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext())); + + DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), + DividerItemDecoration.VERTICAL); + mRecyclerView.addItemDecoration(dividerItemDecoration); + + CreditsAdapter adapter = new CreditsAdapter(creditsList); + mRecyclerView.setAdapter(adapter); + } private void initCloseListener() { diff --git a/app/src/main/java/org/mian/gitnex/activities/SponsorsActivity.java b/app/src/main/java/org/mian/gitnex/activities/SponsorsActivity.java index 8db47f6c..4acf0279 100644 --- a/app/src/main/java/org/mian/gitnex/activities/SponsorsActivity.java +++ b/app/src/main/java/org/mian/gitnex/activities/SponsorsActivity.java @@ -1,12 +1,18 @@ package org.mian.gitnex.activities; import androidx.appcompat.app.AppCompatActivity; +import androidx.recyclerview.widget.DividerItemDecoration; +import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.RecyclerView; +import android.content.res.Resources; import android.os.Bundle; -import android.text.method.LinkMovementMethod; import android.view.View; import android.widget.ImageView; -import android.widget.TextView; import org.mian.gitnex.R; +import org.mian.gitnex.adapters.SponsorsAdapter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; /** * Author M M Arif @@ -22,12 +28,27 @@ public class SponsorsActivity extends AppCompatActivity { setContentView(R.layout.activity_sponsors); ImageView closeActivity = findViewById(R.id.close); - TextView liberaPaySponsorsThomas = findViewById(R.id.liberaPaySponsorsThomas); - - liberaPaySponsorsThomas.setMovementMethod(LinkMovementMethod.getInstance()); initCloseListener(); closeActivity.setOnClickListener(onClickListener); + + Resources res = getResources(); + CharSequence[] sponsorsInfo = res.getTextArray(R.array.sponsorsInfo); + + List sponsorsList = new ArrayList<>(Arrays.asList(sponsorsInfo)); + + RecyclerView mRecyclerView = findViewById(R.id.recyclerView); + + mRecyclerView.setHasFixedSize(true); + mRecyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext())); + + DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mRecyclerView.getContext(), + DividerItemDecoration.VERTICAL); + mRecyclerView.addItemDecoration(dividerItemDecoration); + + SponsorsAdapter adapter = new SponsorsAdapter(sponsorsList); + mRecyclerView.setAdapter(adapter); + } private void initCloseListener() { diff --git a/app/src/main/java/org/mian/gitnex/adapters/CreditsAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/CreditsAdapter.java new file mode 100644 index 00000000..2ec35f66 --- /dev/null +++ b/app/src/main/java/org/mian/gitnex/adapters/CreditsAdapter.java @@ -0,0 +1,59 @@ +package org.mian.gitnex.adapters; + +import android.text.SpannableStringBuilder; +import android.text.method.LinkMovementMethod; +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 org.mian.gitnex.R; +import java.util.List; + +/** + * Author M M Arif + */ + +public class CreditsAdapter extends RecyclerView.Adapter { + + private List creditsList; + + static class CreditsViewHolder extends RecyclerView.ViewHolder { + + private TextView creditText; + + private CreditsViewHolder(View itemView) { + super(itemView); + + creditText = itemView.findViewById(R.id.creditText); + + } + } + + public CreditsAdapter(List creditsListMain) { + this.creditsList = creditsListMain; + } + + @NonNull + @Override + public CreditsAdapter.CreditsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.credits, parent, false); + return new CreditsAdapter.CreditsViewHolder(v); + } + + @Override + public void onBindViewHolder(@NonNull CreditsAdapter.CreditsViewHolder holder, int position) { + + SpannableStringBuilder strBuilder = new SpannableStringBuilder(creditsList.get(position)); + holder.creditText.setText((strBuilder)); + holder.creditText.setMovementMethod(LinkMovementMethod.getInstance()); + + } + + @Override + public int getItemCount() { + return creditsList.size(); + } + +} diff --git a/app/src/main/java/org/mian/gitnex/adapters/SponsorsAdapter.java b/app/src/main/java/org/mian/gitnex/adapters/SponsorsAdapter.java new file mode 100644 index 00000000..a1120cbe --- /dev/null +++ b/app/src/main/java/org/mian/gitnex/adapters/SponsorsAdapter.java @@ -0,0 +1,59 @@ +package org.mian.gitnex.adapters; + +import android.text.SpannableStringBuilder; +import android.text.method.LinkMovementMethod; +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 org.mian.gitnex.R; +import java.util.List; + +/** + * Author M M Arif + */ + +public class SponsorsAdapter extends RecyclerView.Adapter { + + private List sponsorsList; + + static class SponsorsViewHolder extends RecyclerView.ViewHolder { + + private TextView sponsorText; + + private SponsorsViewHolder(View itemView) { + super(itemView); + + sponsorText = itemView.findViewById(R.id.sponsorText); + + } + } + + public SponsorsAdapter(List sponsorsListMain) { + this.sponsorsList = sponsorsListMain; + } + + @NonNull + @Override + public SponsorsAdapter.SponsorsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { + View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.sponsors, parent, false); + return new SponsorsAdapter.SponsorsViewHolder(v); + } + + @Override + public void onBindViewHolder(@NonNull SponsorsAdapter.SponsorsViewHolder holder, int position) { + + SpannableStringBuilder strBuilder = new SpannableStringBuilder(sponsorsList.get(position)); + holder.sponsorText.setText((strBuilder)); + holder.sponsorText.setMovementMethod(LinkMovementMethod.getInstance()); + + } + + @Override + public int getItemCount() { + return sponsorsList.size(); + } + +} diff --git a/app/src/main/res/layout/activity_credits.xml b/app/src/main/res/layout/activity_credits.xml index aa65ad27..09999d87 100644 --- a/app/src/main/res/layout/activity_credits.xml +++ b/app/src/main/res/layout/activity_credits.xml @@ -1,4 +1,6 @@ - + - + android:layout_height="wrap_content" + android:orientation="vertical"> - + android:layout_height="match_parent" + android:background="@color/colorPrimary" + android:padding="4dp" + android:scrollbars="vertical" /> - - - - - - - - - + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_sponsors.xml b/app/src/main/res/layout/activity_sponsors.xml index 3673b1ab..30f1cbfc 100644 --- a/app/src/main/res/layout/activity_sponsors.xml +++ b/app/src/main/res/layout/activity_sponsors.xml @@ -1,4 +1,6 @@ - + - + - + android:layout_height="match_parent" + android:background="@color/colorPrimary" + android:padding="4dp" + android:scrollbars="vertical" /> - - - - - - - - - - - + \ No newline at end of file diff --git a/app/src/main/res/layout/credits.xml b/app/src/main/res/layout/credits.xml new file mode 100644 index 00000000..2c2b1749 --- /dev/null +++ b/app/src/main/res/layout/credits.xml @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/sponsors.xml b/app/src/main/res/layout/sponsors.xml new file mode 100644 index 00000000..7820d034 --- /dev/null +++ b/app/src/main/res/layout/sponsors.xml @@ -0,0 +1,21 @@ + + + + + + diff --git a/app/src/main/res/values/credits.xml b/app/src/main/res/values/credits.xml new file mode 100644 index 00000000..91bb10a8 --- /dev/null +++ b/app/src/main/res/values/credits.xml @@ -0,0 +1,8 @@ + + + + + Logo by Kasun @kasun + + + \ No newline at end of file diff --git a/app/src/main/res/values/sponsors.xml b/app/src/main/res/values/sponsors.xml new file mode 100644 index 00000000..dbd9feab --- /dev/null +++ b/app/src/main/res/values/sponsors.xml @@ -0,0 +1,10 @@ + + + + + Fabian Stamm + Thomas Schneider @Fedilab + Ljoonal @ljoonal + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d7b393b9..275aa2de 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -285,10 +285,6 @@ Design - - Logo by Kasun @Mastodon - - Authorization Error It seems that the Access Token is revoked OR your are not allowed to see these contents. In case of revoked Token, please logout and login again Cancel @@ -408,12 +404,6 @@ User already exists - - Liberapay - Fabian Stamm - Thomas Schneider @Fedilab - - Edit Issue #%1$s Issue updated.