Android Open Source - HexNanoController_Android Hud Activity






From Project

Back to project page HexNanoController_Android.

License

The source code is released under:

Code license GNU GPL v2 http://www.gnu.org/licenses/gpl.html Content license CC BY-NC-SA 4.0 http://creativecommons.org/licenses/by-nc-sa/4.0/

If you think the Android project HexNanoController_Android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.hexairbot.hexmini;
/*from  w  w  w .  jav  a2s.  c  o  m*/
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;

import com.hexairbot.hexmini.HexMiniApplication.AppStage;
import com.hexairbot.hexmini.modal.ApplicationSettings;
import com.hexairbot.hexmini.modal.Transmitter;


@SuppressLint("NewApi")
public class HudActivity extends FragmentActivity implements SettingsDialogDelegate, OnTouchListener, HudViewControllerDelegate{
  private static final String TAG = HudActivity.class.getSimpleName();
  
  private SettingsDialog settingsDialog;
    private HudViewController hudVC;
    
    public static final int REQUEST_ENABLE_BT = 1;
    
    boolean isFirstRun =  true;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); 
    hudVC = new HudViewController(this, this);  
    hudVC.onCreate();
    
    ApplicationSettings settings = HexMiniApplication.sharedApplicaion()
        .getAppSettings();

    /*
    if (settings.isFirstRun()) {
      Intent intent = new Intent(this, HelpActivity.class);
      startActivity(intent);
      settings.setIsFirstRun(false);
      settings.save();
    }
    */
  }
  
  @Override
  protected void onResume() {
    super.onResume();
    HexMiniApplication.sharedApplicaion().setAppStage(AppStage.HUD);
    hudVC.onResume();
  }
  
  @Override
  protected void onPause() {
    super.onPause();
    hudVC.onPause();
  }
  
    protected void showSettingsDialog()
    {        
        FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.addToBackStack(null);
        
        if(settingsDialog == null){
          Log.d(TAG, "settingsDialog is null");
          settingsDialog = new SettingsDialog(this, this);
        }
        
        settingsDialog.show(ft, "settings");
    }


  @Override
  public void prepareDialog(SettingsDialog dialog) {
    
  }


  @Override
  public void onDismissed(SettingsDialog settingsDialog) {
    hudVC.setSettingsButtonEnabled(true);
  }

  
  @Override
  public boolean onTouch(View v, MotionEvent event) {
    return false;
  }
    
  
    private ApplicationSettings getSettings()
    {
        return ((HexMiniApplication) getApplication()).getAppSettings();
    }

    
  @Override
  public void settingsBtnDidClick(View settingsBtn) {
    hudVC.setSettingsButtonEnabled(false);
    showSettingsDialog();    
  }
  
  
  public ViewController getViewController() {
    return hudVC;
  }
  
   @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          if (requestCode == REQUEST_ENABLE_BT && resultCode == Activity.RESULT_CANCELED) {
              finish();
              return;
          }
          super.onActivityResult(requestCode, resultCode, data);
      }
   
   @Override
  protected void onDestroy() {
    super.onDestroy();
    
    if (Transmitter.sharedTransmitter().getBleConnectionManager() != null) {
      Transmitter.sharedTransmitter().getBleConnectionManager().close();
    }
    
    hudVC.onDestroy();
  }
}




Java Source Code List

.FileHelper.java
.Input.java
.Output.java
.Serializable.java
com.hexairbot.hexmini.HelpActivity.java
com.hexairbot.hexmini.HexMiniApplication.java
com.hexairbot.hexmini.HudActivity.java
com.hexairbot.hexmini.HudViewControllerDelegate.java
com.hexairbot.hexmini.HudViewController.java
com.hexairbot.hexmini.SettingsDialogDelegate.java
com.hexairbot.hexmini.SettingsDialog.java
com.hexairbot.hexmini.SettingsViewControllerDelegate.java
com.hexairbot.hexmini.SettingsViewController.java
com.hexairbot.hexmini.ViewController.java
com.hexairbot.hexmini.adapter.SettingsViewAdapter.java
com.hexairbot.hexmini.ble.BleConnectinManagerDelegate.java
com.hexairbot.hexmini.ble.BleConnectinManager.java
com.hexairbot.hexmini.ble.BluetoothLeService.java
com.hexairbot.hexmini.gestures.EnhancedGestureDetector.java
com.hexairbot.hexmini.modal.ApplicationSettings.java
com.hexairbot.hexmini.modal.Channel.java
com.hexairbot.hexmini.modal.OSDCommon.java
com.hexairbot.hexmini.modal.Transmitter.java
com.hexairbot.hexmini.sensors.DeviceOrientationChangeDelegate.java
com.hexairbot.hexmini.sensors.DeviceOrientationManager.java
com.hexairbot.hexmini.sensors.DeviceSensorManagerWrapper.java
com.hexairbot.hexmini.sensors.SensorManagerWrapper.java
com.hexairbot.hexmini.services.ConnectStateManager.java
com.hexairbot.hexmini.services.IpcControlService.java
com.hexairbot.hexmini.services.IpcProxy.java
com.hexairbot.hexmini.services.NavData.java
com.hexairbot.hexmini.services.OnIpcConnectChangedListener.java
com.hexairbot.hexmini.services.VIConfig.java
com.hexairbot.hexmini.ui.Button.java
com.hexairbot.hexmini.ui.Image.java
com.hexairbot.hexmini.ui.Indicator.java
com.hexairbot.hexmini.ui.Sprite.java
com.hexairbot.hexmini.ui.Text.java
com.hexairbot.hexmini.ui.ToggleButton.java
com.hexairbot.hexmini.ui.UIRenderer.java
com.hexairbot.hexmini.ui.control.CustomSeekBar.java
com.hexairbot.hexmini.ui.control.ViewPagerIndicator.java
com.hexairbot.hexmini.ui.gl.GLSprite.java
com.hexairbot.hexmini.ui.joystick.AcceleratorJoystick.java
com.hexairbot.hexmini.ui.joystick.AnalogueJoystick.java
com.hexairbot.hexmini.ui.joystick.JoystickBase.java
com.hexairbot.hexmini.ui.joystick.JoystickFactory.java
com.hexairbot.hexmini.ui.joystick.JoystickListener.java
com.hexairbot.hexmini.util.DebugHandler.java
com.hexairbot.hexmini.util.FontUtils.java
com.hexairbot.hexmini.util.SystemUiHiderBase.java
com.hexairbot.hexmini.util.SystemUiHiderHoneycomb.java
com.hexairbot.hexmini.util.SystemUiHider.java
com.hexairbot.hexmini.util.SystemUtil.java
com.hexairbot.hexmini.util.TextureUtils.java
fix.android.opengl.GLES20.java