ParticipateActivity.java 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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.AnalyticsUtils;
  35. import com.owncloud.android.utils.ThemeUtils;
  36. /**
  37. * Activity providing information about ways to participate in the app's development.
  38. */
  39. public class ParticipateActivity extends FileActivity {
  40. private static final String TAG = ParticipateActivity.class.getSimpleName();
  41. private static final String SCREEN_NAME = "Participate";
  42. @Override
  43. protected void onCreate(Bundle savedInstanceState) {
  44. super.onCreate(savedInstanceState);
  45. setContentView(R.layout.participate_layout);
  46. // setup toolbar
  47. setupToolbar();
  48. // setup drawer
  49. setupDrawer(R.id.nav_participate);
  50. if (getSupportActionBar() != null) {
  51. getSupportActionBar().setTitle(ThemeUtils.getColoredTitle(getString(R.string.drawer_participate),
  52. ThemeUtils.fontColor()));
  53. }
  54. setupContent();
  55. }
  56. @Override
  57. protected void onResume() {
  58. super.onResume();
  59. AnalyticsUtils.setCurrentScreenName(this, SCREEN_NAME, TAG);
  60. }
  61. private void setupContent() {
  62. TextView rcView = (TextView) findViewById(R.id.participate_release_candidate_text);
  63. rcView.setMovementMethod(LinkMovementMethod.getInstance());
  64. TextView contributeIrcView = (TextView) findViewById(R.id.participate_contribute_irc_text);
  65. contributeIrcView.setMovementMethod(LinkMovementMethod.getInstance());
  66. contributeIrcView.setText(Html.fromHtml(getString(R.string.participate_contribute_irc_text) + " " +
  67. getString(R.string.participate_contribute_irc_text_link,
  68. ThemeUtils.colorToHexString(ThemeUtils.primaryColor()),
  69. getString(R.string.irc_weblink))));
  70. TextView contributeForumView = (TextView) findViewById(R.id.participate_contribute_forum_text);
  71. contributeForumView.setMovementMethod(LinkMovementMethod.getInstance());
  72. contributeForumView.setText(Html.fromHtml(getString(R.string.participate_contribute_forum_text) + " " +
  73. getString(R.string.participate_contribute_forum_text_link,
  74. ThemeUtils.colorToHexString(ThemeUtils.primaryColor()),
  75. getString(R.string.help_link), getString(R.string.participate_contribute_forum_forum))));
  76. TextView contributeTranslationView = (TextView) findViewById(R.id.participate_contribute_translate_text);
  77. contributeTranslationView.setMovementMethod(LinkMovementMethod.getInstance());
  78. contributeTranslationView.setText(Html.fromHtml(
  79. getString(R.string.participate_contribute_translate_link,
  80. ThemeUtils.colorToHexString(ThemeUtils.primaryColor()),
  81. getString(R.string.translation_link),
  82. getString(R.string.participate_contribute_translate_translate)) + " " +
  83. getString(R.string.participate_contribute_translate_text)));
  84. TextView contributeGithubView = (TextView) findViewById(R.id.participate_contribute_github_text);
  85. contributeGithubView.setMovementMethod(LinkMovementMethod.getInstance());
  86. contributeGithubView.setText(Html.fromHtml(
  87. getString(R.string.participate_contribute_github_text,
  88. getString(R.string.participate_contribute_github_text_link,
  89. ThemeUtils.colorToHexString(ThemeUtils.primaryColor()),
  90. getString(R.string.contributing_link)))));
  91. AppCompatButton reportButton = (AppCompatButton) findViewById(R.id.participate_testing_report);
  92. reportButton.getBackground().setColorFilter(ThemeUtils.primaryColor(), PorterDuff.Mode.SRC_ATOP);
  93. reportButton.setTextColor(ThemeUtils.fontColor());
  94. reportButton.setOnClickListener(new View.OnClickListener() {
  95. @Override
  96. public void onClick(View v) {
  97. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.report_issue_link))));
  98. }
  99. });
  100. }
  101. public void onGetBetaFDroidClick(View view) {
  102. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.fdroid_beta_link))));
  103. }
  104. public void onGetRCFDroidClick(View view) {
  105. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.fdroid_link))));
  106. }
  107. public void onGetRCPlayStoreClick(View view) {
  108. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.play_store_register_beta))));
  109. }
  110. public void onGetBetaApkClick(View view) {
  111. startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.beta_apk_link))));
  112. }
  113. @Override
  114. public boolean onOptionsItemSelected(MenuItem item) {
  115. boolean retval = true;
  116. switch (item.getItemId()) {
  117. case android.R.id.home: {
  118. if (isDrawerOpen()) {
  119. closeDrawer();
  120. } else {
  121. openDrawer();
  122. }
  123. break;
  124. }
  125. default:
  126. retval = super.onOptionsItemSelected(item);
  127. break;
  128. }
  129. return retval;
  130. }
  131. @Override
  132. public void showFiles(boolean onDeviceOnly) {
  133. super.showFiles(onDeviceOnly);
  134. Intent fileDisplayActivity = new Intent(getApplicationContext(),
  135. FileDisplayActivity.class);
  136. fileDisplayActivity.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  137. startActivity(fileDisplayActivity);
  138. }
  139. }