Exemplo n.º 1
0
 public void onResume() {
   super.onResume();
   Services.setContext(getActivity());
   IntentFilter iff = new IntentFilter();
   iff.addAction("com.treshna.hornet.serviceBroadcast");
   getActivity().registerReceiver(this.mBroadcastReceiver, iff);
   getList();
 }
Exemplo n.º 2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Services.setContext(getActivity());
    context = getActivity().getApplicationContext();
    mLoader = this.getLoaderManager();
    if (cur != null) cur.close();

    /** the below code needs to run on app start. */
    /*Intent updateInt = new Intent(getActivity(), HornetDBService.class);
    updateInt.putExtra(Services.Statics.KEY, Services.Statics.FREQUENT_SYNC);
    PendingIntent pintent = PendingIntent.getService(getActivity(), 0, updateInt, PendingIntent.FLAG_UPDATE_CURRENT);
    //polling = new PollingHandler(this, pintent);
    Services.setFreqPollingHandler(getActivity(), pintent);
    startReciever();*/
    /** ********************************* */
    // different views look different, build the views differently?
    getList();
  }
Exemplo n.º 3
0
  private SecretKeySpec generatekey() {
    SecretKeySpec key = null;
    // try {
    // String passphrase = "serialbatteryostrichscreen";
    String hex_pass = "******";
    // MessageDigest digest = MessageDigest.getInstance("MD5");
    // digest.update(passphrase.getBytes());
    // byte[] result = digest.digest();
    byte[] result = Services.hexStringToByteArray(hex_pass);
    Log.e(TAG, Arrays.toString(result));
    key = new SecretKeySpec(result, "AES"); // 0, 16,

    /*} catch (NoSuchAlgorithmException e) {
    	e.printStackTrace();
    	return null;
    } */

    return key;
  }
Exemplo n.º 4
0
 public void startReciever() {
   IntentFilter intentFilter = new IntentFilter();
   intentFilter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION);
   getActivity().registerReceiver(Services.getFreqPollingHandler(), intentFilter);
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Intent intent = getIntent();
    Services.setContext(getActivity());
    ArrayList<String> tagInfo = this.getArguments().getStringArrayList(Services.Statics.KEY);
    bookingID = tagInfo.get(0);

    contentResolver = getActivity().getContentResolver();
    frm = this.getChildFragmentManager();
    FragmentTransaction ft = frm.beginTransaction();

    // setContentView(R.layout.empty_activity);
    mInflater = inflater;
    view = mInflater.inflate(R.layout.activity_empty, null);
    if (savedInstanceState == null) {
      if (Integer.parseInt(bookingID) > 0) {
        Cursor cur;

        bookingID = tagInfo.get(1);

        cur =
            contentResolver.query(
                ContentDescriptor.Booking.CONTENT_URI,
                null,
                ContentDescriptor.Booking.Cols.BID + " = " + bookingID,
                null,
                null);
        if (cur.moveToFirst()) {
          classid = cur.getInt(cur.getColumnIndex(ContentDescriptor.Booking.Cols.CLASSID));
          System.out.print("\n\n** CLASS ID:" + classid + " **\n\n");
        }

        if (classid > 0) {
          // it's a class, show the class-booking page instead.
          // ClassDetailsFragment f;
          ClassDetailsSuperFragment f;
          Bundle bdl;

          // f = new ClassDetailsFragment();
          f = new ClassDetailsSuperFragment();
          tagFoundListener = (TagFoundListener) f;
          bdl = new Bundle(1);
          bdl.putString(Services.Statics.KEY, bookingID);
          f.setArguments(bdl);
          ft.add(R.id.empty_layout, f);
        } else {
          bookingID = tagInfo.get(1);
          BookingDetailsFragment f = new BookingDetailsFragment();
          Bundle bdl = new Bundle(1);
          bdl.putString(Services.Statics.KEY, bookingID);
          f.setArguments(bdl);
          ft.add(R.id.empty_layout, f);
        }
      } else {
        // add Booking
        BookingAddFragment f =
            (BookingAddFragment) getChildFragmentManager().findFragmentByTag("AddBooking");
        if (f == null) {
          f = new BookingAddFragment();
          starttime = tagInfo.get(1);
          Bundle bdl = new Bundle(2);
          bdl.putString(Services.Statics.KEY, starttime);
          bdl.putString(Services.Statics.DATE, tagInfo.get(2));
          f.setArguments(bdl);
          ft.add(R.id.empty_layout, f, "AddBooking");
          ft.addToBackStack(null);
        }
      }
      ft.commit();
    }
    return view;
  }