@Override
 protected void onCreate(Bundle savedInstanceState) {
   Log.d(TAG, "onCreate() + " + this.hashCode());
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_nexrad_view);
   eventBusProvider.getEventBus().register(this);
   mGoogleApiClient =
       new GoogleApiClient.Builder(this)
           .addConnectionCallbacks(this)
           .addOnConnectionFailedListener(this)
           .addApi(LocationServices.API)
           .build();
   // Create the LocationRequest object
   mLocationRequest =
       LocationRequest.create()
           .setPriority(LocationRequest.PRIORITY_LOW_POWER)
           .setInterval(10 * 60 * 1000) // 10 seconds, in milliseconds
           .setFastestInterval(1 * 60 * 1000); // 1 second, in milliseconds
   if (PackageManager.PERMISSION_GRANTED
       != ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)) {
     ActivityCompat.requestPermissions(this, INITIAL_PERMS, INITIAL_REQUEST);
   }
   if (PreferenceManager.getDefaultSharedPreferences(this)
           .getString(SettingsActivity.KEY_PREF_NEXRAD_EMAILADDRESS, null)
       == null) {
     startSettings(true);
   } else {
     if (((NexradApp) getApplication()).getLastKnownLocation() != null) {
       RadarBitmapView radarView = (RadarBitmapView) findViewById(R.id.radarView);
       radarView.onEvent(
           new LocationChangeEvent(((NexradApp) getApplication()).getLastKnownLocation()));
     }
   }
 }
 @Override
 public void onPause() {
   super.onPause();
   if (mGoogleApiClient.isConnected()) {
     mGoogleApiClient.disconnect();
   }
 }
 @Override
 protected void onRestoreInstanceState(Bundle savedInstanceState) {
   super.onRestoreInstanceState(savedInstanceState);
   // Bundle viewBundle = savedInstanceState.getBundle("com.nexradnow.android.radarViewState");
   // if (viewBundle != null) {
   //    RadarBitmapView radarView = (RadarBitmapView)findViewById(R.id.radarView);
   //    radarView.readBundle(viewBundle);
   // }
 }
 @Override
 protected void onDestroy() {
   Log.d(TAG, "onDestroy() + " + this.hashCode());
   super.onDestroy();
   eventBusProvider.getEventBus().unregister(this);
   RadarBitmapView radarView = (RadarBitmapView) findViewById(R.id.radarView);
   if (radarView != null) {
     radarView.releaseBitmap();
   }
 }
 @Override
 public void onRequestPermissionsResult(
     int requestCode, String[] permissions, int[] grantResults) {
   super.onRequestPermissionsResult(requestCode, permissions, grantResults);
   if (mGoogleApiClient.isConnected()
       && PackageManager.PERMISSION_GRANTED
           == ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)) {
     onConnected(null);
   }
 }
예제 #6
0
  @Override
  public void onBackPressed() {

    if (activeView.equals(loginChoiceView)) {
      // Perform a normal back
      super.onBackPressed();
    } else {
      // If the user decided to register or login before, animate now back to
      // the choice screen
      showView(loginChoiceView);
    }
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setSupportActionBar(toolbar);
   setStatusBarColor(getResources().getColor(R.color.primary_dark));
   getSupportActionBar().setDisplayHomeAsUpEnabled(true);
   if (savedInstanceState == null) {
     Location currentLocation = getIntent().getExtras().getParcelable(CURRENT_LOCATION_ARG);
     Poi seed = (Poi) getIntent().getExtras().getSerializable(SEED_ARG);
     getSupportFragmentManager()
         .beginTransaction()
         .replace(R.id.content, RecommendedRouteFragment.newInstance(currentLocation, seed))
         .commit();
   }
 }
예제 #8
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    // setSupportActionBar(toolbar);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      Window window = getWindow();
      window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
      window.setStatusBarColor(getResources().getColor(R.color.primary_dark));
    }

    Resources res = getResources();
    registerFirstName
        .getBackground()
        .setColorFilter(res.getColor(R.color.primary_light), PorterDuff.Mode.SRC_ATOP);
    registerLastName
        .getBackground()
        .setColorFilter(res.getColor(R.color.primary_light), PorterDuff.Mode.SRC_ATOP);
    registerPassword
        .getBackground()
        .setColorFilter(res.getColor(R.color.primary_light), PorterDuff.Mode.SRC_ATOP);
    registerEmail
        .getBackground()
        .setColorFilter(res.getColor(R.color.primary_light), PorterDuff.Mode.SRC_ATOP);
    loginEmail
        .getBackground()
        .setColorFilter(res.getColor(R.color.primary_light), PorterDuff.Mode.SRC_ATOP);
    loginPassword
        .getBackground()
        .setColorFilter(res.getColor(R.color.primary_light), PorterDuff.Mode.SRC_ATOP);

    // Animation to blend over from the login choice view to registerButton or login view
    animationDuration = res.getInteger(android.R.integer.config_shortAnimTime);

    // Remember the currently shown layout/view
    activeView = loginChoiceView;

    // The user can decide to login (with registerEmail and password)...
    chooseLoginButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            showView(loginView);
          }
        });

    // ... or to registerButton with a new account
    chooseRegisterButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            showView(registerView);
          }
        });

    // REGISTER LAYOUT
    registerButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            // Check if first and last name are entered
            if (TextUtils.isEmpty(registerFirstName.getText().toString())
                || TextUtils.isEmpty(registerLastName.getText().toString())) {
              Toast.makeText(
                      getApplication().getApplicationContext(),
                      getResources().getString(R.string.first_last_mandatory),
                      Toast.LENGTH_SHORT)
                  .show();
            }
            // Check the validity of the entered email address using Regex
            else if (!validate(registerEmail.getText().toString())) {
              Toast.makeText(
                      getApplication().getApplicationContext(),
                      getResources().getString(R.string.email_invalid),
                      Toast.LENGTH_SHORT)
                  .show();
            } else
              registerUser(
                  registerFirstName.getText().toString(),
                  registerLastName.getText().toString(),
                  registerEmail.getText().toString(),
                  registerPassword.getText().toString());
          }
        });

    // LOGIN LAYOUT
    loginButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View view) {
            loginUser(loginEmail.getText().toString(), loginPassword.getText().toString());
          }
        });

    // SKIP login
    findViewById(R.id.skip)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                setResult(RESULT_SKIPPED);
                finish();
              }
            });
  }
 @Override
 protected void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   // RadarBitmapView radarView = (RadarBitmapView)findViewById(R.id.radarView);
   // outState.putBundle("com.nexradnow.android.radarViewState", radarView.writeBundle());
 }
 @Override
 public void onResume() {
   super.onResume();
   mGoogleApiClient.connect();
 }
예제 #11
0
 @Override
 protected void onStart() {
   super.onStart();
   lifecycleSubject.onNext(LifecycleEvent.START);
 }
예제 #12
0
 @Override
 protected void onDestroy() {
   lifecycleSubject.onNext(LifecycleEvent.DESTROY);
   super.onDestroy();
 }
예제 #13
0
 @Override
 protected void onStop() {
   lifecycleSubject.onNext(LifecycleEvent.STOP);
   super.onStop();
 }
예제 #14
0
 @Override
 protected void onPause() {
   lifecycleSubject.onNext(LifecycleEvent.PAUSE);
   super.onPause();
 }
예제 #15
0
 @Override
 protected void onResume() {
   super.onResume();
   lifecycleSubject.onNext(LifecycleEvent.RESUME);
 }
 @Override
 protected void onStop() {
   super.onStop();
 }
예제 #17
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   lifecycleSubject.onNext(LifecycleEvent.CREATE);
 }