Added 'special thanks' screen
This commit is contained in:
parent
06315821d5
commit
d38c7a442a
|
@ -0,0 +1,3 @@
|
|||
221 Pixels;Logo design;https://avatars2.githubusercontent.com/u/58243143?s=60&v=4
|
||||
ByteHamster;Forum admin;https://avatars2.githubusercontent.com/u/5811634?s=60&v=4
|
||||
Keunes;Communications;https://avatars2.githubusercontent.com/u/11229646?s=60&v=4
|
|
|
@ -10,6 +10,7 @@ import de.danoeh.antennapod.R;
|
|||
import de.danoeh.antennapod.activity.BugReportActivity;
|
||||
import de.danoeh.antennapod.activity.PreferenceActivity;
|
||||
import de.danoeh.antennapod.core.util.IntentUtils;
|
||||
import de.danoeh.antennapod.fragment.preferences.about.AboutFragment;
|
||||
|
||||
public class MainPreferencesFragment extends PreferenceFragmentCompat {
|
||||
private static final String TAG = "MainPreferencesFragment";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.fragment.preferences;
|
||||
package de.danoeh.antennapod.fragment.preferences.about;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
|
@ -27,14 +27,9 @@ public class AboutFragment extends PreferenceFragmentCompat {
|
|||
Snackbar.make(getView(), R.string.copied_to_clipboard, Snackbar.LENGTH_SHORT).show();
|
||||
return true;
|
||||
});
|
||||
findPreference("about_developers").setOnPreferenceClickListener((preference) -> {
|
||||
getFragmentManager().beginTransaction().replace(R.id.content, new AboutDevelopersFragment())
|
||||
.addToBackStack(getString(R.string.developers)).commit();
|
||||
return true;
|
||||
});
|
||||
findPreference("about_translators").setOnPreferenceClickListener((preference) -> {
|
||||
getFragmentManager().beginTransaction().replace(R.id.content, new AboutTranslatorsFragment())
|
||||
.addToBackStack(getString(R.string.translators)).commit();
|
||||
findPreference("about_contributors").setOnPreferenceClickListener((preference) -> {
|
||||
getParentFragmentManager().beginTransaction().replace(R.id.content, new ContributorsPagerFragment())
|
||||
.addToBackStack(getString(R.string.contributors)).commit();
|
||||
return true;
|
||||
});
|
||||
findPreference("about_privacy_policy").setOnPreferenceClickListener((preference) -> {
|
||||
|
@ -42,7 +37,7 @@ public class AboutFragment extends PreferenceFragmentCompat {
|
|||
return true;
|
||||
});
|
||||
findPreference("about_licenses").setOnPreferenceClickListener((preference) -> {
|
||||
getFragmentManager().beginTransaction().replace(R.id.content, new AboutLicensesFragment())
|
||||
getParentFragmentManager().beginTransaction().replace(R.id.content, new LicensesFragment())
|
||||
.addToBackStack(getString(R.string.translators)).commit();
|
||||
return true;
|
||||
});
|
|
@ -0,0 +1,95 @@
|
|||
package de.danoeh.antennapod.fragment.preferences.about;
|
||||
|
||||
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.viewpager2.adapter.FragmentStateAdapter;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.PreferenceActivity;
|
||||
|
||||
/**
|
||||
* Displays the 'about->Contributors' pager screen.
|
||||
*/
|
||||
public class ContributorsPagerFragment extends Fragment {
|
||||
|
||||
public static final String TAG = "StatisticsFragment";
|
||||
|
||||
private static final int POS_DEVELOPERS = 0;
|
||||
private static final int POS_TRANSLATORS = 1;
|
||||
private static final int POS_SPECIAL_THANKS = 2;
|
||||
private static final int TOTAL_COUNT = 3;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
super.onCreateView(inflater, container, savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
View rootView = inflater.inflate(R.layout.pager_fragment, container, false);
|
||||
ViewPager2 viewPager = rootView.findViewById(R.id.viewpager);
|
||||
viewPager.setAdapter(new StatisticsPagerAdapter(this));
|
||||
// Give the TabLayout the ViewPager
|
||||
TabLayout tabLayout = rootView.findViewById(R.id.sliding_tabs);
|
||||
new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> {
|
||||
switch (position) {
|
||||
case POS_DEVELOPERS:
|
||||
tab.setText(R.string.developers);
|
||||
break;
|
||||
case POS_TRANSLATORS:
|
||||
tab.setText(R.string.translators);
|
||||
break;
|
||||
case POS_SPECIAL_THANKS:
|
||||
tab.setText(R.string.special_thanks);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}).attach();
|
||||
|
||||
rootView.findViewById(R.id.toolbar).setVisibility(View.GONE);
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
((PreferenceActivity) getActivity()).getSupportActionBar().setTitle(R.string.contributors);
|
||||
}
|
||||
|
||||
public static class StatisticsPagerAdapter extends FragmentStateAdapter {
|
||||
|
||||
StatisticsPagerAdapter(@NonNull Fragment fragment) {
|
||||
super(fragment);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int position) {
|
||||
switch (position) {
|
||||
case POS_TRANSLATORS:
|
||||
return new TranslatorsFragment();
|
||||
case POS_SPECIAL_THANKS:
|
||||
return new SpecialThanksFragment();
|
||||
default:
|
||||
case POS_DEVELOPERS:
|
||||
return new DevelopersFragment();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return TOTAL_COUNT;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.fragment.preferences;
|
||||
package de.danoeh.antennapod.fragment.preferences.about;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
@ -19,7 +19,7 @@ import java.io.BufferedReader;
|
|||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AboutDevelopersFragment extends ListFragment {
|
||||
public class DevelopersFragment extends ListFragment {
|
||||
private Disposable developersLoader;
|
||||
|
||||
@Override
|
||||
|
@ -44,7 +44,7 @@ public class AboutDevelopersFragment extends ListFragment {
|
|||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
developers -> setListAdapter(new SimpleIconListAdapter<>(getContext(), developers)),
|
||||
error -> Toast.makeText(getContext(), "Error while loading developers", Toast.LENGTH_LONG).show()
|
||||
error -> Toast.makeText(getContext(), error.getMessage(), Toast.LENGTH_LONG).show()
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -56,10 +56,4 @@ public class AboutDevelopersFragment extends ListFragment {
|
|||
developersLoader.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
((PreferenceActivity) getActivity()).getSupportActionBar().setTitle(R.string.developers);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.fragment.preferences;
|
||||
package de.danoeh.antennapod.fragment.preferences.about;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
@ -28,7 +28,7 @@ import java.io.InputStream;
|
|||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AboutLicensesFragment extends ListFragment {
|
||||
public class LicensesFragment extends ListFragment {
|
||||
private Disposable licensesLoader;
|
||||
private final ArrayList<LicenseItem> licenses = new ArrayList<>();
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class AboutLicensesFragment extends ListFragment {
|
|||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
developers -> setListAdapter(new SimpleIconListAdapter<LicenseItem>(getContext(), developers)),
|
||||
error -> Toast.makeText(getContext(), "Error while loading licenses", Toast.LENGTH_LONG).show()
|
||||
error -> Toast.makeText(getContext(), error.getMessage(), Toast.LENGTH_LONG).show()
|
||||
);
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package de.danoeh.antennapod.fragment.preferences.about;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.ListFragment;
|
||||
import de.danoeh.antennapod.R;
|
||||
import de.danoeh.antennapod.activity.PreferenceActivity;
|
||||
import de.danoeh.antennapod.adapter.SimpleIconListAdapter;
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleOnSubscribe;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SpecialThanksFragment extends ListFragment {
|
||||
private Disposable translatorsLoader;
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
getListView().setDivider(null);
|
||||
getListView().setSelector(android.R.color.transparent);
|
||||
|
||||
translatorsLoader = Single.create((SingleOnSubscribe<ArrayList<SimpleIconListAdapter.ListItem>>) emitter -> {
|
||||
ArrayList<SimpleIconListAdapter.ListItem> translators = new ArrayList<>();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(
|
||||
getContext().getAssets().open("special_thanks.csv")));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
String[] info = line.split(";");
|
||||
translators.add(new SimpleIconListAdapter.ListItem(info[0], info[1], info[2]));
|
||||
}
|
||||
emitter.onSuccess(translators);
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
translators -> setListAdapter(new SimpleIconListAdapter<>(getContext(), translators)),
|
||||
error -> Toast.makeText(getContext(), error.getMessage(), Toast.LENGTH_LONG).show()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
if (translatorsLoader != null) {
|
||||
translatorsLoader.dispose();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package de.danoeh.antennapod.fragment.preferences;
|
||||
package de.danoeh.antennapod.fragment.preferences.about;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
@ -19,7 +19,7 @@ import java.io.BufferedReader;
|
|||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AboutTranslatorsFragment extends ListFragment {
|
||||
public class TranslatorsFragment extends ListFragment {
|
||||
private Disposable translatorsLoader;
|
||||
|
||||
@Override
|
||||
|
@ -43,7 +43,7 @@ public class AboutTranslatorsFragment extends ListFragment {
|
|||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
translators -> setListAdapter(new SimpleIconListAdapter<>(getContext(), translators)),
|
||||
error -> Toast.makeText(getContext(), "Error while loading translators", Toast.LENGTH_LONG).show()
|
||||
error -> Toast.makeText(getContext(), error.getMessage(), Toast.LENGTH_LONG).show()
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -55,10 +55,4 @@ public class AboutTranslatorsFragment extends ListFragment {
|
|||
translatorsLoader.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
((PreferenceActivity) getActivity()).getSupportActionBar().setTitle(R.string.translators);
|
||||
}
|
||||
}
|
|
@ -10,15 +10,10 @@
|
|||
android:icon="?attr/ic_unfav"
|
||||
android:summary="1.7.2 (asd8qs)"/>
|
||||
<Preference
|
||||
android:key="about_developers"
|
||||
android:key="about_contributors"
|
||||
android:icon="?attr/ic_settings"
|
||||
android:summary="@string/developers_summary"
|
||||
android:title="@string/developers"/>
|
||||
<Preference
|
||||
android:key="about_translators"
|
||||
android:icon="?attr/ic_chat"
|
||||
android:summary="@string/translators_summary"
|
||||
android:title="@string/translators"/>
|
||||
android:summary="@string/contributors_summary"
|
||||
android:title="@string/contributors"/>
|
||||
<Preference
|
||||
android:key="about_privacy_policy"
|
||||
android:icon="?attr/ic_questionmark"
|
||||
|
|
|
@ -530,10 +530,11 @@
|
|||
<!-- About screen -->
|
||||
<string name="about_pref">About</string>
|
||||
<string name="antennapod_version">AntennaPod version</string>
|
||||
<string name="contributors">Contributors</string>
|
||||
<string name="contributors_summary">Everyone can help to make AntennaPod better - with code, translations or by helping users in our forum</string>
|
||||
<string name="developers">Developers</string>
|
||||
<string name="developers_summary">Everyone can help to make AntennaPod better</string>
|
||||
<string name="translators">Translators</string>
|
||||
<string name="translators_summary">Translations are created by users of AntennaPod using Transifex</string>
|
||||
<string name="special_thanks">Special thanks</string>
|
||||
<string name="privacy_policy">Privacy policy</string>
|
||||
<string name="licenses">Licenses</string>
|
||||
<string name="licenses_summary">AntennaPod uses other great software</string>
|
||||
|
|
Loading…
Reference in New Issue