ParticipateActivity.java 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * Nextcloud Android client application
  3. *
  4. * @author Andy Scherzinger
  5. * @author Tobias Kaminsky
  6. * Copyright (C) 2016 Andy Scherzinger
  7. * Copyright (C) 2016 Nextcloud
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
  11. * License as published by the Free Software Foundation; either
  12. * version 3 of the License, or any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public
  20. * License along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. */
  22. package com.owncloud.android.ui.activity;
  23. import android.content.Intent;
  24. import android.graphics.PorterDuff;
  25. import android.net.Uri;
  26. import android.os.Bundle;
  27. import android.support.v7.widget.AppCompatButton;
  28. import android.text.Html;
  29. import android.text.method.LinkMovementMethod;
  30. import android.view.MenuItem;
  31. import android.view.View;
  32. import android.widget.TextView;
  33. import com.owncloud.android.R;
  34. import com.owncloud.android.utils.ThemeUtils;
  35. /**
  36. * Activity providing information about ways to participate in the app's development.
  37. */
  38. public class ParticipateActivity extends FileActivity {
  39. @Override
  40. protected void onCreate(Bundle savedInstanceState) {
  41. super.onCreate(savedInstanceState);
  42. setContentView(R.layout.participate_layout);
  43. // setup toolbar
  44. setupToolbar();
  45. // setup drawer
  46. setupDrawer(R.id.nav_participate);
  47. ThemeUtils.setColoredTitle(getSupportActionBar(), R.string.drawer_participate, this);
  48. setupContent();
  49. }
  50. private void setupContent() {
  51. TextView rcView = findViewById(R.id.participate_release_candidate_text);
  52. rcView.setMovementMethod(LinkMovementMethod.getInstance());
  53. TextView contributeIrcView = findViewById(R.id.participate_contribute_irc_text);
  54. contributeIrcView.setMovementMethod(LinkMovementMethod.getInstance());
  55. contributeIrcView.setText(Html.fromHtml(getString(R.string.participate_contribute_irc_text) + " " +
  56. getString(R.string.participate_contribute_irc_text_link,
  57. ThemeUtils.colorToHexString(ThemeUtils.primaryColor(this, true)),
  58. getString(R.string.irc_weblink))));
  59. TextView contributeForumView = findViewById(R.id.participate_contribute_forum_text);
  60. contributeForumView.setMovementMethod(LinkMovementMethod.getInstance());
  61. contributeForumView.setText(Html.fromHtml(getString(R.string.participate_contribute_forum_text) + " " +
  62. getString(R.string.participate_contribute_forum_text_link,
  63. ThemeUtils.colorToHexString(ThemeUtils.primaryColor(this, true)),
  64. getString(R.string.help_link), getString(R.string.participate_contribute_forum_forum))));
  65. TextView contributeTranslationView = findViewById(R.id.participate_contribute_translate_text);
  66. contributeTranslationView.setMovementMethod(LinkMovementMethod.getInstance());
  67. contributeTranslationView.setText(Html.fromHtml(
  68. getString(R.string.participate_contribute_translate_link,
  69. ThemeUtils.colorToHexString(ThemeUtils.primaryColor(this, true)),
  70. getString(R.string.translation_link),
  71. getString(R.string.participate_contribute_translate_translate)) + " " +
  72. getString(R.string.participate_contribute_translate_text)));
  73. TextView contributeGithubView = findViewById(R.id.participate_contribute_github_text);
  74. contributeGithubView.setMovementMethod(LinkMovementMethod.getInstance());
  75. contributeGithubView.setText(Html.fromHtml(
  76. getString(R.string.participate_contribute_github_text,
  77. getString(R.string.participate_contribute_github_text_link,
  78. ThemeUtils.colorToHexString(ThemeUtils.primaryColor(this, true)),
  79. getString(R.string.contributing_link)))));
  80. AppCompatButton reportButton = findViewById(R.id.participate_testing_report);
  81. reportButton.getBackground().setColorFilter(ThemeUtils.primaryColor(this, true), PorterDuff.Mode.SRC_ATOP);
  82. reportButton.setTextColor(ThemeUtils.fontColor(this));
  83. reportButton.setOnClickListener(new View.OnClickListener() {
  84. @Override
  85. public void onClick(View v) {
  86. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.report_issue_link))));
  87. }
  88. });
  89. }
  90. public void onGetBetaFDroidClick(View view) {
  91. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.fdroid_beta_link))));
  92. }
  93. public void onGetRCFDroidClick(View view) {
  94. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.fdroid_link))));
  95. }
  96. public void onGetRCPlayStoreClick(View view) {
  97. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.play_store_register_beta))));
  98. }
  99. public void onGetBetaApkClick(View view) {
  100. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.beta_apk_link))));
  101. }
  102. @Override
  103. public boolean onOptionsItemSelected(MenuItem item) {
  104. boolean retval = true;
  105. switch (item.getItemId()) {
  106. case android.R.id.home: {
  107. if (isDrawerOpen()) {
  108. closeDrawer();
  109. } else {
  110. openDrawer();
  111. }
  112. break;
  113. }
  114. default:
  115. retval = super.onOptionsItemSelected(item);
  116. break;
  117. }
  118. return retval;
  119. }
  120. @Override
  121. public void showFiles(boolean onDeviceOnly) {
  122. super.showFiles(onDeviceOnly);
  123. Intent fileDisplayActivity = new Intent(getApplicationContext(),
  124. FileDisplayActivity.class);
  125. fileDisplayActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  126. startActivity(fileDisplayActivity);
  127. }
  128. }