UserSurveyInvitationActivity.java 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. package com.epson.mobilephone.common.license;
  2. import android.content.Context;
  3. import android.content.Intent;
  4. import android.os.Bundle;
  5. import android.support.annotation.NonNull;
  6. import android.support.p003v7.app.AppCompatActivity;
  7. import android.support.p003v7.widget.Toolbar;
  8. import android.view.View;
  9. import android.view.ViewGroup;
  10. import android.widget.Button;
  11. import android.widget.TextView;
  12. import com.epson.mobilephone.common.license.SimpleMessageDialogFragment;
  13. import epson.common.Constants;
  14. public class UserSurveyInvitationActivity extends AppCompatActivity implements SimpleMessageDialogFragment.DialogCallback {
  15. private static final int DIALOG_ID_CHANGE_DIALOG = 1;
  16. private static final String PARAM_DISPLAY_CHANGE_DIALOG = "display_change_dialog";
  17. private static final String PARAM_LICENSE_INFO = "license_info";
  18. private static final String PARAM_USER_SURVEY_INFO = "user_survey_info";
  19. private boolean mDisplayChangeDialog;
  20. private LicenseInfo mLicenseInfo;
  21. private UserSurveyInfo mUserSurveyInfo;
  22. public void onButtonClicked(int i) {
  23. if (i == 1) {
  24. }
  25. }
  26. protected void onCreate(Bundle bundle) {
  27. UserSurveyInfo userSurveyInfo;
  28. super.onCreate(bundle);
  29. setContentView(C1066R.layout.activity_user_survey_invitation);
  30. setSupportActionBar((Toolbar) findViewById(C1066R.C1068id.toolbar));
  31. setTitle(C1066R.string.GALicense);
  32. Button button = (Button) findViewById(C1066R.C1068id.disagreeButton);
  33. button.setOnClickListener(new View.OnClickListener() {
  34. public void onClick(View view) {
  35. UserSurveyInvitationActivity.this.finishWithStatus(false);
  36. }
  37. });
  38. Button button2 = (Button) findViewById(C1066R.C1068id.agreeButton);
  39. button2.setOnClickListener(new View.OnClickListener() {
  40. public void onClick(View view) {
  41. UserSurveyInvitationActivity.this.finishWithStatus(true);
  42. }
  43. });
  44. ((ViewGroup) findViewById(C1066R.C1068id.privacyStatementViewGroup)).setOnClickListener(new View.OnClickListener() {
  45. public void onClick(View view) {
  46. UserSurveyInvitationActivity.this.startPrivacyStatementDisplayActivity();
  47. }
  48. });
  49. TextView textView = (TextView) findViewById(C1066R.C1068id.analytics_content);
  50. this.mDisplayChangeDialog = false;
  51. Intent intent = getIntent();
  52. if (intent != null) {
  53. this.mUserSurveyInfo = (UserSurveyInfo) intent.getSerializableExtra(PARAM_USER_SURVEY_INFO);
  54. this.mLicenseInfo = (LicenseInfo) intent.getSerializableExtra(PARAM_LICENSE_INFO);
  55. String str = null;
  56. UserSurveyInfo userSurveyInfo2 = this.mUserSurveyInfo;
  57. if (userSurveyInfo2 != null) {
  58. str = userSurveyInfo2.getUserSurveyInvitationText(this);
  59. }
  60. if (str == null) {
  61. str = C1073Util.getStringFromRawResource(getApplicationContext(), C1066R.raw.user_survey);
  62. }
  63. textView.setText(str);
  64. changeButtonText(button2, 1, this.mUserSurveyInfo, this);
  65. changeButtonText(button, 0, this.mUserSurveyInfo, this);
  66. updateAppNameText(this.mLicenseInfo);
  67. this.mDisplayChangeDialog = intent.getBooleanExtra(PARAM_DISPLAY_CHANGE_DIALOG, false);
  68. if (this.mDisplayChangeDialog && bundle == null && (userSurveyInfo = this.mUserSurveyInfo) != null && userSurveyInfo.getResponseStatus(this) == 1) {
  69. showUpdateDialog();
  70. }
  71. }
  72. }
  73. /* access modifiers changed from: private */
  74. public void startPrivacyStatementDisplayActivity() {
  75. LicenseInfo licenseInfo = this.mLicenseInfo;
  76. if (licenseInfo != null) {
  77. startActivity(InfoDisplayActivity.getStartIntent(this, licenseInfo, 2));
  78. }
  79. }
  80. private void updateAppNameText(LicenseInfo licenseInfo) {
  81. String applicationName;
  82. if (licenseInfo != null && (applicationName = licenseInfo.getApplicationName(this)) != null) {
  83. ((TextView) findViewById(C1066R.C1068id.appNameText)).setText(applicationName);
  84. }
  85. }
  86. private void showUpdateDialog() {
  87. SimpleMessageDialogFragment.newInstance(getString(C1066R.string.Update_Message) + Constants.BREAK_LINE + getString(C1066R.string.GALicense), 1).show(getSupportFragmentManager(), (String) null);
  88. }
  89. private void changeButtonText(Button button, int i, UserSurveyInfo userSurveyInfo, @NonNull Context context) {
  90. String buttonString;
  91. if (userSurveyInfo != null && (buttonString = userSurveyInfo.getButtonString(context, i)) != null) {
  92. button.setText(buttonString);
  93. }
  94. }
  95. /* access modifiers changed from: private */
  96. public void finishWithStatus(boolean z) {
  97. UserSurveyInfo userSurveyInfo = this.mUserSurveyInfo;
  98. if (userSurveyInfo != null) {
  99. userSurveyInfo.setUserSurveyAgreement(this, z);
  100. }
  101. setResult(z ? -1 : 0);
  102. finish();
  103. }
  104. public void onBackPressed() {
  105. if (!this.mDisplayChangeDialog) {
  106. finishWithStatus(false);
  107. }
  108. }
  109. @NonNull
  110. private static Intent getStartIntent(@NonNull Context context, UserSurveyInfo userSurveyInfo, LicenseInfo licenseInfo, boolean z) {
  111. Intent intent = new Intent(context, UserSurveyInvitationActivity.class);
  112. intent.putExtra(PARAM_USER_SURVEY_INFO, userSurveyInfo);
  113. intent.putExtra(PARAM_DISPLAY_CHANGE_DIALOG, z);
  114. intent.putExtra(PARAM_LICENSE_INFO, licenseInfo);
  115. return intent;
  116. }
  117. @NonNull
  118. static Intent getStartWithDialogIntent(@NonNull Context context, UserSurveyInfo userSurveyInfo, LicenseInfo licenseInfo) {
  119. return getStartIntent(context, userSurveyInfo, licenseInfo, true);
  120. }
  121. @NonNull
  122. public static Intent getStartIntent(@NonNull Context context, @NonNull UserSurveyInfo userSurveyInfo, LicenseInfo licenseInfo) {
  123. return getStartIntent(context, userSurveyInfo, licenseInfo, false);
  124. }
  125. }