@Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   switch (requestCode) {
     case EVIDENCE_CODE:
       if (resultCode == RESULT_OK) {
         inspection.evidence = data.getStringExtra("evidance");
         // Toast.makeText(getApplicationContext(), evidence,
         // Toast.LENGTH_LONG).show();
       }
       break;
     case CAPTURE_REQUEST_ID:
       if (resultCode == RESULT_OK) {
         String key = data.getStringExtra("KEY");
         @SuppressWarnings("unchecked")
         ArrayList<InspectionPest> arr =
             (ArrayList<InspectionPest>)
                 ((FieldworkApplication) getApplication()).getStoredObject(key);
         ((FieldworkApplication) getApplication()).removeStoredObject(key);
         m_inspectionPests = arr;
       }
       break;
     case MATERIAL_REQUEST_ID:
       if (resultCode == RESULT_OK) {
         m_inspection_material = InspectionMaterial.getAll();
         bindMaterial(m_inspection_material);
       }
       break;
     default:
       break;
   }
 }
  public ResultScene(Camera mCamera) {
    super(mCamera);
    activity = BaseActivity.getSharedInstance();
    setBackgroundEnabled(false);
    GameScene scene = (GameScene) activity.mCurrentScene;
    float accureay = 1 - (float) scene.missCount / scene.bulletCount;
    if (Float.isNaN(accureay)) accureay = 0;
    accureay *= 100;
    Text result =
        new Text(
            0,
            0,
            activity.mFont,
            activity.getString(R.string.accuracy) + ": " + String.format("%.2f", accureay) + "%",
            BaseActivity.getSharedInstance().getVertexBufferObjectManager());

    final int x = (int) (mCamera.getWidth() / 2 - result.getWidth() / 2);
    final int y = (int) (mCamera.getHeight() / 2 - result.getHeight() / 2);

    done = false;
    result.setPosition(x, mCamera.getHeight() + result.getHeight());
    MoveYModifier mod =
        new MoveYModifier(5, result.getY(), y) {
          @Override
          protected void onModifierFinished(IEntity pItem) {
            done = true;
          }
        };
    attachChild(result);
    result.registerEntityModifier(mod);
    setOnSceneTouchListener(this);
  }
  @Override
  public void onBackPressed() {
    int count = getSupportFragmentManager().getBackStackEntryCount();
    if (count <= 1) {
      if (doubleBackToExitPressedOnce) {
        super.onBackPressed();
        System.exit(1);
      }

      this.doubleBackToExitPressedOnce = true;
      Toast.makeText(this, "Please click BACK again to exit", Toast.LENGTH_SHORT).show();
      new Handler()
          .postDelayed(
              new Runnable() {

                @Override
                public void run() {
                  doubleBackToExitPressedOnce = false;
                }
              },
              2000);
    } else {
      super.onBackPressed();
    }
  }
Example #4
0
  @Override
  public boolean onMenuItemClicked(MenuScene arg0, IMenuItem arg1, float arg2, float arg3) {
    switch (arg1.getID()) {
      case MENU_MAINMENU:
        if (activity.isSfx()) activity.menuClickSound.play();
        detachChildren();
        activity.setCurrentScene(new MainMenuScene());

        activity.runOnUiThread(
            new Runnable() {
              @Override
              public void run() {
                if (activity.interstitialAd.isLoaded()) {
                  activity.interstitialAd.show();
                } else {
                  activity.interstitialAd.loadAd(activity.adRequest);
                  if (activity.interstitialAd.isLoaded()) {
                    activity.interstitialAd.show();
                  }
                }
              }
            });

        return true;
      default:
        break;
    }
    return false;
  }
Example #5
0
 /**
  * 关闭除了指定activity以外的全部activity 如果cls不存在于栈中,则栈全部清空
  *
  * @param cls
  */
 public void finishOthersActivity(Class<?> cls) {
   for (BaseActivity activity : activityStack) {
     if (!(activity.getClass().equals(cls))) {
       finishActivity(activity);
     }
   }
 }
  private void toggleActionBar() {
    if (!isAdded()) {
      return;
    }

    BaseActivity baseActivity = (BaseActivity) getActivity();
    baseActivity.toggleActionBar(R.id.toolbarPhotoList);
  }
Example #7
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   // TODO Auto-generated method stub
   super.onCreateBase(savedInstanceState);
   super.setContentViewBase(R.layout.home, true);
   init();
   loadData();
 }
Example #8
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_stadistics);
   super.onCreateDrawer();
   // Action bar needs to be instatiate in every Activity that has layout
   setUpActionBar();
 }
 @Override
 protected void run(Object... params) {
   final Intent intent =
       new Intent(BaseActivity.getApplicationContext(), PreferenceActivity.class);
   if (params.length == 1 && params[0] instanceof String) {
     intent.putExtra(PreferenceActivity.SCREEN_KEY, (String) params[0]);
   }
   BaseActivity.startActivityForResult(intent, FBReader.REQUEST_PREFERENCES);
 }
Example #10
0
 /** 获取当前Activity(栈顶Activity) 没有找到则返回null */
 public BaseActivity findActivity(Class<?> cls) {
   BaseActivity activity = null;
   for (BaseActivity aty : activityStack) {
     if (aty.getClass().equals(cls)) {
       activity = aty;
       break;
     }
   }
   return activity;
 }
 @Override
 public void onBackPressed() {
   if (itemEditFragment != null) {
     if (itemEditFragment.onBackPressed()) {
       super.onBackPressed();
     }
   } else {
     super.onBackPressed();
   }
 }
Example #12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    super.onCreateDrawer();

    ViewStub stub = (ViewStub) findViewById(R.id.layout_stub);
    stub.setLayoutResource(R.layout.content_stamp);
    View inflated = stub.inflate();
    /* your logic here */

  }
Example #13
0
 public void run()
 {
     if (BaseActivity.a(a) != null && BaseActivity.a(a).isShowing())
     {
         e.b(new Object[] {
             "closeProgress"
         });
         BaseActivity.a(a).dismiss();
         BaseActivity.a(a, null);
     }
     BaseActivity.a(a, false);
 }
  @Override
  public void onBackPressed() {

    if (getSupportFragmentManager().getBackStackEntryCount() == 1) {

      if (!closeRealTimeLocation()) {
        super.onBackPressed();
        this.finish();
      }
    } else {
      super.onBackPressed();
    }
  }
 /**
  * Return to Physician activity or Nurse Activity depending on the type of user operating the
  * activity.
  */
 public void onBackPressed() {
   String id = user.split(" ")[0];
   if (id.equals("Nurse")) {
     Intent intent = new Intent(this, MainActivity.class);
     intent.putExtra("user", user);
     startActivity(intent);
     super.onBackPressed();
   } else {
     Intent intent = new Intent(this, PhysicianMain.class);
     intent.putExtra("user", user);
     startActivity(intent);
     super.onBackPressed();
   }
 }
Example #16
0
  public void shieldCollide() {
    detachChild(activity.shieldSpriteP);
    attachChild(activity.shieldSprite);

    if (activity.isSfx()) activity.getShieldSound.play();

    shieldHit = true;
    activity.isShield = true;

    spriteTimerHandlerShield.reset();

    activity.editor.putInt("shieldsCollected", activity.prefs.getInt("shieldsCollected", 0) + 1);
    activity.editor.commit();
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_user_profile);
   setupUserProfileGrid();
   setupRevealBackground(savedInstanceState);
 }
Example #18
0
  @Override
  protected void onResume() {

    super.onResume();

    // Get the data form the database

    cursor =
        db.query(DbHelper.TABLE, null, null, null, null, null, DbHelper.C_CREATED_AT + " DESC");
    startManagingCursor(cursor);

    // Setup the adapter
    adapter = new SimpleCursorAdapter(this, R.layout.row, cursor, FROM, TO);
    listTimeline.setAdapter(adapter);

    // Register the receiver

    registerReceiver(receiver, filter);

    // Iterate over all the data and print it out
    // String user,text,output;
    // while(cursor.moveToNext()){

    //	user = cursor.getString(cursor.getColumnIndex(DbHelper.C_USER));

    //	text = cursor.getString(cursor.getColumnIndex(DbHelper.C_TEXT));

    //	output = String.format("%s: %s\n", user,text);

    // textTimeline.append(output);
    // }

  }
Example #19
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    App.appContext = StartActivity.this;

    load();
  }
  @Override
  protected void onResume() {
    super.onResume();
    activeCamera();

    bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    chatService = new BluetoothChatService(context, handler);

    if (bluetoothAdapter == null) {
      Toast.makeText(
              context,
              context.getResources().getString(R.string.bt_not_available),
              Toast.LENGTH_LONG)
          .show();
      finish();
      return;
    }

    if (statut != BluetoothChatService.STATE_CONNECTED) {
      Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
      discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300);
      // startActivityForResult(discoverableIntent, DISCOVERABLE);
    }
    chatService.start();

    /*
    if (chatService != null) {
              if (chatService.getState() == BluetoothChatService.STATE_NONE) {
              	chatService.start();
              }
          }
          */
  }
Example #21
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    activateToolbar();

    mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));

    flickrRecyclerViewAdapter =
        new FlickrRecyclerViewAdapter(MainActivity.this, new ArrayList<Photo>());
    mRecyclerView.setAdapter(flickrRecyclerViewAdapter);
    mRecyclerView.addOnItemTouchListener(
        new RecyclerItemClickListener(
            this,
            mRecyclerView,
            new RecyclerItemClickListener.OnItemClickListener() {
              @Override
              public void onItemClick(View view, int position) {
                Toast.makeText(MainActivity.this, "Normal tap", Toast.LENGTH_SHORT).show();
              }

              @Override
              public void onItemLongClick(View view, int position) {
                //                Toast.makeText(MainActivity.this, "Long tap",
                // Toast.LENGTH_SHORT).show();
                Intent intent = new Intent(MainActivity.this, ViewPhotoDetailsActivity.class);

                // additional data to be sent to and accessed by next activity
                intent.putExtra(PHOTO_TRANSFER, flickrRecyclerViewAdapter.getPhoto(position));
                startActivity(intent);
              }
            }));
  }
  public void onResume() {
    super.onResume();

    if (!NetUtil.isNetworkAvailable(this)) {
      NetErrorDialog.getInstance().show(this);
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_tarot_feedback);

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

    final ActionBar ab = getSupportActionBar();
    ab.setDisplayHomeAsUpEnabled(false);

    FloatingActionButton fablogin = (FloatingActionButton) findViewById(R.id.fab_login);
    fablogin.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            if (TextUtils.isEmpty(getUsername())) {
              facebookLogin();
            } else {
              addFeedback(getUsername());
            }
          }
        });
    RecyclerView rv = (RecyclerView) findViewById(R.id.recyclerview);
    rv.setHasFixedSize(true);
    LinearLayoutManager llm = new LinearLayoutManager(this);
    llm.setOrientation(LinearLayoutManager.VERTICAL);
    rv.setLayoutManager(llm);
    updateList();
  }
 @Override
 protected void onNewIntent(Intent intent) {
   // TODO Auto-generated method stub
   super.onNewIntent(intent);
   // after detecting tag..
   ScanTag(intent);
 }
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (receiver != null) {
     unregisterReceiver(receiver);
   }
 }
 @Override
 public void onStop() {
   super.onStop();
   if (mReceiver != null) {
     unregisterReceiver(mReceiver); // 注销网络监听的广播
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // creating pending intent
    pendingIntent =
        PendingIntent.getActivity(
            this,
            0,
            new Intent(getApplicationContext(), this.getClass())
                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY),
            0);

    i[0] = new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED);
    // creating tech list for tag
    techListsArray =
        new String[][] {
          new String[] {
            NfcV.class.getName(),
            NfcA.class.getName(),
            NfcB.class.getName(),
            NfcF.class.getName(),
            Ndef.class.getName(),
            NdefFormatable.class.getName(),
            MifareClassic.class.getName(),
            MifareUltralight.class.getName()
          }
        };

    // creating object of nfc adapter of mobile device
    NFCAdapter = NfcAdapter.getDefaultAdapter(this);

    // if app is opened after pop up....
    ScanTag(getIntent());
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_invitation);
   mLocationClient = new LocationClient(getApplicationContext());
   initViews();
 }
 @Override
 protected void onResume() {
   // TODO Auto-generated method stub
   super.onResume();
   if (NFCAdapter != null)
     NFCAdapter.enableForegroundDispatch(this, pendingIntent, i, techListsArray);
 }
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   if (facebookCallbackManager != null) {
     facebookCallbackManager.onActivityResult(requestCode, resultCode, data);
   }
 }