CheckEulaActivity.java 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package epson.maintain.activity;
  2. import android.os.Bundle;
  3. import android.view.View;
  4. import android.widget.Button;
  5. import android.widget.TextView;
  6. import androidx.appcompat.app.AppCompatActivity;
  7. import com.epson.mobilephone.common.license.RestoreScrollView;
  8. import epson.common.IprintLicenseInfo;
  9. import epson.print.R;
  10. public class CheckEulaActivity extends AppCompatActivity {
  11. private static final String KEY_SCROLL_Y = "scroll_y";
  12. private RestoreScrollView mScrollView;
  13. public void onBackPressed() {
  14. }
  15. protected void onCreate(Bundle bundle) {
  16. super.onCreate(bundle);
  17. setContentView(R.layout.activity_check_eula);
  18. ((Button) findViewById(R.id.eulaAgreeButton)).setOnClickListener(new View.OnClickListener() {
  19. public void onClick(View view) {
  20. CheckEulaActivity.this.finishWithResult(-1);
  21. }
  22. });
  23. ((Button) findViewById(R.id.eulaDisagreeButton)).setOnClickListener(new View.OnClickListener() {
  24. public void onClick(View view) {
  25. CheckEulaActivity.this.finishWithResult(0);
  26. }
  27. });
  28. mScrollView = (RestoreScrollView) findViewById(R.id.eulaCheckMainScrollView);
  29. ((TextView) findViewById(R.id.eulaTextView)).setText(new IprintLicenseInfo().getDocumentString(this, 1));
  30. if (bundle != null) {
  31. mScrollView.setScrollY(bundle.getInt(KEY_SCROLL_Y, 0));
  32. }
  33. }
  34. protected void onSaveInstanceState(Bundle bundle) {
  35. super.onSaveInstanceState(bundle);
  36. bundle.putInt(KEY_SCROLL_Y, mScrollView.getLastY());
  37. }
  38. private void finishWithResult(int i) {
  39. setResult(i);
  40. finish();
  41. }
  42. }