Ejemplo n.º 1
2
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_customize);

    Bundle bundle = getIntent().getExtras();
    if (bundle != null) {
      type = bundle.getString("Type");
    }

    bundle = getIntent().getBundleExtra("user_details");

    if (bundle != null) {
      if (type.equals("Name")) {
        this.givenValue = bundle.getString("user_name");
      } else {
        this.givenValue = bundle.getString("user_phone");
        ((EditText) findViewById(R.id.customize_old)).setInputType(InputType.TYPE_CLASS_PHONE);
        ((EditText) findViewById(R.id.customize_new)).setInputType(InputType.TYPE_CLASS_PHONE);
      }
    }

    ((TextView) findViewById(R.id.customize_title))
        .setText(getString(R.string.customize_title) + " " + type);
    ((EditText) findViewById(R.id.customize_old))
        .setHint(getString(R.string.customize_old) + " " + type);
    ((EditText) findViewById(R.id.customize_new))
        .setHint(getString(R.string.customize_new) + " " + type);
    ((Button) findViewById(R.id.customize_btn))
        .setText(getString(R.string.customize_btn) + " " + type);

    ActionBar mainActionBar = getSupportActionBar();
    mainActionBar.setDisplayHomeAsUpEnabled(true);
  }
Ejemplo n.º 2
0
  @Override
  protected void onHandleIntent(Intent intent) {
    Bundle extras = intent.getExtras();

    if (!extras.isEmpty()) {
      String tipo = extras.getString("tipo");

      switch (tipo) {
        case Constantes.TipoGCM.CHOFER_ASIGNADO:
          String choferJson = extras.getString("object");
          Chofer chofer = new Gson().fromJson(choferJson, Chofer.class);
          notificar(
              "RapiTaxi - Chofer asignado.",
              chofer.getNombre() + " " + chofer.getApellido(),
              ViajeActivity.class);
          break;
        case Constantes.TipoGCM.VIAJE_CANCELADO:
          notificar("RapiTaxi", "El viaje ha sido cancelado.", SolicitarActivity.class);
          break;
        case Constantes.TipoGCM.VIAJE_FINALIZADO:
          notificar("RapiTaxi", "El viaje ha finalizado.", SolicitarActivity.class);
          break;
        case Constantes.TipoGCM.SIN_CHOFER:
          notificar(
              "RapiTaxi",
              "No hay choferes para su viaje. Intentelo de nuevo.",
              SolicitarActivity.class);
          break;
      }
    }

    // Release the wake lock provided by the WakefulBroadcastReceiver.
    ReceptorLocal.completeWakefulIntent(intent);
  }
Ejemplo n.º 3
0
    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
      Util.logd("Facebook-WebView", "Redirect URL: " + url);
      if (url.startsWith(Facebook.REDIRECT_URI)) {
        Bundle values = Util.parseUrl(url);

        String error = values.getString("error");
        if (error == null) {
          error = values.getString("error_type");
        }

        if (error == null) {
          mListener.onComplete(values);
        } else if (error.equals("access_denied") || error.equals("OAuthAccessDeniedException")) {
          mListener.onCancel();
        } else {
          mListener.onFacebookError(new FacebookError(error));
        }

        FbDialog.this.dismiss();
        return true;
      } else if (url.startsWith(Facebook.CANCEL_URI)) {
        mListener.onCancel();
        FbDialog.this.dismiss();
        return true;
      } else if (url.contains(DISPLAY_STRING)) {
        return false;
      }
      // launch non-dialog URLs in a full browser
      getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
      return true;
    }
Ejemplo n.º 4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (isFinishing()) return;

    setContentView(R.layout.fingerprint_viewer);
    integrator = new IntentIntegrator(this);
    Intent intent = getIntent();
    account = getAccount(intent);
    user = getUser(intent);
    if (AccountManager.getInstance().getAccount(account) == null || user == null) {
      Application.getInstance().onError(R.string.ENTRY_IS_NOT_FOUND);
      finish();
      return;
    }
    if (savedInstanceState != null) {
      remoteFingerprint = savedInstanceState.getString(SAVED_REMOTE_FINGERPRINT);
      localFingerprint = savedInstanceState.getString(SAVED_LOCAL_FINGERPRINT);
    } else {
      remoteFingerprint = OTRManager.getInstance().getRemoteFingerprint(account, user);
      localFingerprint = OTRManager.getInstance().getLocalFingerprint(account);
    }
    verifiedView = (CheckBox) findViewById(R.id.verified);
    verifiedView.setOnCheckedChangeListener(this);
    scanView = findViewById(R.id.scan);
    scanView.setOnClickListener(this);
    showView = findViewById(R.id.show);
    showView.setOnClickListener(this);
    copyView = findViewById(R.id.copy);
    copyView.setOnClickListener(this);
    isUpdating = false;
  }
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    rootView = inflater.inflate(R.layout.user_profile_layout, container, false);

    /*
     * Get info from actvity
     */
    Bundle bundle = getActivity().getIntent().getBundleExtra(USER);

    // int numFollowers = bundle.getInt(FOLLOWERS_COUNT);

    if (bundle != null) {
      avatarUrl = bundle.getString(AVATAR_URL);
      fullNameString = bundle.getString(FULLNAME);
      numFollowers = bundle.getInt(FOLLOWERS_COUNT);
      configUserLayout(avatarUrl, fullNameString, numFollowers);

    } else {
      configUserLayout(null, null, -1);
    }

    configButton();

    return rootView;
  }
Ejemplo n.º 6
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_create_account);

    String email;
    if (savedInstanceState == null) {
      Bundle extras = getIntent().getExtras();
      email = extras == null ? "" : extras.getString(Constants.TAG_EMAIL);
    } else {
      email = savedInstanceState.getString(Constants.TAG_EMAIL);
    }

    edit_nome = (EditText) findViewById(R.id.edit_nome);
    edit_email = (EditText) findViewById(R.id.edit_email);
    edit_email.setText(email);
    edit_password = (EditText) findViewById(R.id.edit_password);
    txt_alreadyHave = (TextView) findViewById(R.id.txt_already_have);
    txt_alreadyHave.setOnClickListener(this);

    btn_registrar = (Button) findViewById(R.id.btn_register);
    btn_registrar.setOnClickListener(this);

    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
  }
Ejemplo n.º 7
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (data != null) {

      Bundle extras = data.getExtras();

      switch (requestCode) {
        case 0:
          final String returnText = extras.getString("commentText");

          if (!returnText.equals("CANCEL")) {
            final String postID = extras.getString("postID");
            final int commentID = extras.getInt("commentID");
            showDialog(ID_DIALOG_REPLYING);

            new Thread(
                    new Runnable() {
                      public void run() {
                        Looper.prepare();
                        pd = new ProgressDialog(CommentsActivity.this);
                        replyToComment(postID, commentID, returnText);
                      }
                    })
                .start();
          }

          break;
      }
    }
  }
Ejemplo n.º 8
0
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    Bundle bundle = null;
    if (data == null || (bundle = data.getExtras()) == null) return;

    if (requestCode == 200) {
      String path = bundle.getString("path");
      if (!path.equals("")) {
        SetBodyImagePath(path);
        show_body_image_path();
      }
    }

    if (requestCode == 201) {
      String path = bundle.getString("path");
      if (!path.equals("")) {
        SetAudioPath(path);
        show_audio_path();
      }
    }

    if (requestCode == 202 || requestCode == 203) {
      String path = bundle.getString("path");
      if (!path.equals("")) {
        SetDataPath(path, requestCode - 202); /* (path, 0 or 1) */
        show_data_path();
      }
    }
  }
  @Override
  public Loader<Cursor> onCreateLoader(int id, Bundle args) {

    switch (id) {
      case SEARCH_CURSOR_LOADER_ID:
        return new CursorLoader(
            getActivity(),
            PlaceProvider.SEARCH_URI,
            null,
            getString(R.string.mapa_google_api_browser_key),
            new String[] {args.getString("query")},
            null);
      case DETAILS_CURSOR_LOADER_ID:
        return new CursorLoader(
            getActivity(),
            PlaceProvider.DETAILS_URI,
            null,
            getString(R.string.mapa_google_api_browser_key),
            new String[] {args.getString("query")},
            null);

      default:
        return null;
    }
  }
Ejemplo n.º 10
0
  @Override
  public void onReceive(Context context, Intent arg1) {

    Bundle bundle = arg1.getExtras();
    switch (bundle.getString("NOTIFICATION_TYPE", "")) {
      case "newTemp":
        ((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE))
            .cancel(55); // Kills the notification

        Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
        TempBasal suggestedTemp =
            gson.fromJson(bundle.getString("SUGGESTED_BASAL", ""), TempBasal.class);
        pumpAction.setTempBasal(suggestedTemp); // Action the suggested Temp

        Notifications.clear("updateCard"); // Clears info card on current Basal
        break;
      case "setTemp":
        ((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE))
            .cancel(56); // Kills the notification
        break;
      case "NEW_INSULIN_UPDATE":
        Notifications.newInsulinUpdate();
        break;
      case "RUN_OPENAPS":
        Intent apsIntent = new Intent(MainApp.instance(), APSService.class);
        MainApp.instance().startService(apsIntent);
        break;
      case "CANCEL_TBR":
        pumpAction.cancelTempBasal();
        break;
    }
  }
  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
      // get the authentication flow settings
      mAuthClientId = extras.getString(KEY_AUTH_CLIENT_ID);
      mAuthDomain = extras.getString(KEY_AUTH_DOMAIN);
      try {
        mAuthMode = (AuthMode) extras.getSerializable(KEY_AUTH_MODE);
      } catch (ClassCastException e) {
        throw new IllegalArgumentException(
            "AuthMode must be one of the following: AuthMode.Social, AuthMode.Email, AuthMode.Both");
      }

      if (mAuthClientId == null || mAuthDomain == null || mAuthMode == null) {
        throw new IllegalArgumentException(
            "Missing some of these parameters: AuthClientID, AuthDomain, AuthMode");
      }

      // Valid params
      Log.d(TAG, String.format("Params: %s, %s, %s", mAuthClientId, mAuthDomain, mAuthMode));
      setContentView(R.layout.simpleauth_activity);
      setView();
    }
  }
Ejemplo n.º 12
0
  // [START receive_message]
  @Override
  public void onMessageReceived(String from, Bundle data) {
    String message = Html.fromHtml(data.getString("title")).toString();
    System.out.println(data.getString("title"));
    Log.d(TAG, "From: " + from);
    Log.d(TAG, "Message: " + message);

    if (from.startsWith("/topics/")) {
      // message received from some topic.
    } else {
      // normal downstream message.
    }

    // [START_EXCLUDE]
    /**
     * Production applications would usually process the message here. Eg: - Syncing with server. -
     * Store message in local database. - Update UI.
     */

    /**
     * In some cases it may be useful to show a notification indicating to the user that a message
     * was received.
     */
    if (getPushSettings(getString(R.string.switch_setting))) {
      sendNotification(message);
    }

    // [END_EXCLUDE]
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.product_gallery_activity);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.titlebar);

    options =
        new DisplayImageOptions.Builder()
            .cacheInMemory(false)
            .cacheOnDisc(false)
            .imageScaleType(ImageScaleType.EXACTLY)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();

    gallery = (Gallery) findViewById(R.id.gallery);

    Bundle bundle = getIntent().getExtras();
    title = bundle.getString("title");
    currentPath = bundle.getString("currentPath");
    httpHeader = bundle.getString("httpHeader");
    initUI(title);

    new GetProductTask().execute(currentPath, title, httpHeader);
  }
Ejemplo n.º 14
0
  public void createNotification(Context context, Bundle extras) {
    NotificationManager mNotificationManager =
        (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    String appName = getAppName(this);

    Intent notificationIntent = new Intent(this, PushHandlerActivity.class);
    notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
    notificationIntent.putExtra("pushBundle", extras);

    PendingIntent contentIntent =
        PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    NotificationCompat.Builder mBuilder =
        new NotificationCompat.Builder(context)
            .setDefaults(Notification.DEFAULT_ALL)
            .setSmallIcon(context.getApplicationInfo().icon)
            .setWhen(System.currentTimeMillis())
            .setContentTitle(extras.getString("title"))
            .setTicker(extras.getString("title"))
            .setContentIntent(contentIntent);

    String message = extras.getString("message");
    if (message != null) {
      mBuilder.setContentText(message);
    } else {
      mBuilder.setContentText("<missing message content>");
    }

    String msgcnt = extras.getString("msgcnt");
    if (msgcnt != null) {
      mBuilder.setNumber(Integer.parseInt(msgcnt));
    }

    mNotificationManager.notify((String) appName, NOTIFICATION_ID, mBuilder.build());
  }
  @SmallTest
  @MediumTest
  @LargeTest
  public void testMultipleCaches() {
    Bundle bundle1 = new Bundle(), bundle2 = new Bundle();

    bundle1.putInt(INT_KEY, 10);
    bundle1.putString(STRING_KEY, "ABC");
    bundle2.putInt(INT_KEY, 100);
    bundle2.putString(STRING_KEY, "xyz");

    ensureApplicationContext();

    SharedPreferencesTokenCachingStrategy cache1 =
        new SharedPreferencesTokenCachingStrategy(getContext());
    SharedPreferencesTokenCachingStrategy cache2 =
        new SharedPreferencesTokenCachingStrategy(getContext(), "CustomCache");

    cache1.save(bundle1);
    cache2.save(bundle2);

    // Get new references to make sure we are getting persisted data.
    // Reverse the cache references for fun.
    cache1 = new SharedPreferencesTokenCachingStrategy(getContext(), "CustomCache");
    cache2 = new SharedPreferencesTokenCachingStrategy(getContext());

    Bundle newBundle1 = cache1.load(), newBundle2 = cache2.load();

    Assert.assertEquals(bundle2.getInt(INT_KEY), newBundle1.getInt(INT_KEY));
    Assert.assertEquals(bundle2.getString(STRING_KEY), newBundle1.getString(STRING_KEY));
    Assert.assertEquals(bundle1.getInt(INT_KEY), newBundle2.getInt(INT_KEY));
    Assert.assertEquals(bundle1.getString(STRING_KEY), newBundle2.getString(STRING_KEY));
  }
  @Override
  public void onMessageReceived(String from, Bundle data) {
    String message = data.getString("message");
    String senderId = data.getString("senderId");
    String senderName = data.getString("senderName");
    String caseId = data.getString("caseId");
    caseId = "testCaseId";
    String messageId = data.getString("messageId");
    int typeOfMessage = data.getInt("typeOfMessage");
    new ChatsDb(this).insertChatMessage(caseId, senderId, typeOfMessage, message);

    if (UserChatRoom.broadcastReceiverIsSet
        && UserChatRoom.getChatRoomDetailsReturnContainerCache.caseId.equals(caseId)) {
      Intent intent = new Intent(MyGcmListenerService.MESSAGE_RESULT);
      if (message != null) {
        intent.putExtra(Constants.messageString, message);
        intent.putExtra(Constants.senderNameString, senderName);
        intent.putExtra(Constants.senderIdString, senderId);
        intent.putExtra(Constants.typeOfMessageString, typeOfMessage);
        intent.putExtra(Constants.caseIdString, caseId);
      }

      broadcaster.sendBroadcast(intent);
    } else {
      new AppIdentityDb(this).InsertUpdateResource(AppIdentityDb.newChatMessage + caseId, "1");
      sendNotification(message, senderName, caseId);
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {

    listaComments = new ArrayList<Comment>();
    preferences = getActivity().getSharedPreferences(Constantes.SP_FILE, Context.MODE_PRIVATE);
    commentsadapter =
        new ListaCommentsCustomAdapter(getActivity(), R.layout.linea_comments, listaComments);

    configurarToolbar();

    Bundle args = getArguments();
    if (args != null) {
      if (args.getParcelable("event")
          != null) { // this should happens when showing details of a event
        event = args.getParcelable("event");
        // new getImage().execute("cartel" + event.getId() + ".jpg");
      } else {
        if (args.getString("idevento")
            != null) { // si ha llegado una notificacion con la id del evento que hay que enseñar
          new CargarEvento().execute(args.getString("idevento"));
        }
      }

      new LoadComments().execute(Integer.toString(Constantes.NUMBER_MAX_COMMENTS_SHOW));
    }

    super.onCreate(savedInstanceState);
  }
  public View onCreateView(
      final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
    if (savedInstanceState != null) {
      final String loginTypeString = savedInstanceState.getString(LOGIN_TYPE_KEY);
      loginType = loginTypeString == null ? loginType : LoginType.valueOf(loginTypeString);
      progress = savedInstanceState.getInt(PROGRESS_KEY, progress);
      final String progressTypeString = savedInstanceState.getString(PROGRESS_TYPE_KEY);
      progressType =
          progressTypeString == null ? progressType : ProgressType.valueOf(progressTypeString);
    }

    View view = super.onCreateView(inflater, container, savedInstanceState);
    if (view == null) {
      final int layoutResourceId;
      switch (progressType) {
        case DOTS:
          layoutResourceId = R.layout.fragment_reverb_footer_dots;
          break;
        case BAR:
        default:
          layoutResourceId = R.layout.fragment_reverb_footer_bar;
          break;
      }
      view = inflater.inflate(layoutResourceId, container, false);
    }
    updateButtonText(view);
    updateProgress(view);
    updateSwitchLoginTypeListener(view);
    return view;
  }
  @SuppressLint("SetJavaScriptEnabled")
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getActionBar().setDisplayHomeAsUpEnabled(true);

    Bundle bundle = getIntent().getExtras();
    String url = bundle.getString("url");
    String title = bundle.getString("title");
    current_url = url;

    WebViewActivity.this.setTitle(title);

    final Context myApp = this;
    setContentView(R.layout.activity_webview);

    CookieSyncManager.createInstance(myApp);

    WebSettings settings = getWebView().getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setSupportZoom(true);
    settings.setBuiltInZoomControls(true);
    settings.setDisplayZoomControls(false);
    // settings.setLoadWithOverviewMode(true);
    settings.setUseWideViewPort(true);

    final WebView webview = (WebView) getWebView();
    webview.setWebViewClient(new MyWebViewClient());
    webview.setWebChromeClient(new MyWebChromeClient());

    webview.loadUrl(url);
  }
Ejemplo n.º 20
0
 public void requestBannerAd(
     Context context,
     MediationBannerListener mediationbannerlistener,
     Bundle bundle,
     AdSize adsize,
     MediationAdRequest mediationadrequest,
     Bundle bundle1) {
   zzJG = (CustomEventBanner) zzj(bundle.getString("class_name"));
   if (zzJG == null) {
     mediationbannerlistener.onAdFailedToLoad(this, 0);
     return;
   }
   if (bundle1 == null) {
     bundle1 = null;
   } else {
     bundle1 = bundle1.getBundle(bundle.getString("class_name"));
   }
   zzJG.requestBannerAd(
       context,
       new zza(this, mediationbannerlistener),
       bundle.getString("parameter"),
       adsize,
       mediationadrequest,
       bundle1);
 }
Ejemplo n.º 21
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_notification);
    setupViews();

    Bundle b = this.getIntent().getExtras();
    if (null != b) {
      final String sessionId = b.getString(HomeListenerService.KEY_SESSION_ID);
      LOGD(TAG, "Received session id in NotificationActivity: " + sessionId);
      final String sessionName = b.getString(HomeListenerService.KEY_SESSION_NAME);
      final String sessionRoom = b.getString(HomeListenerService.KEY_SESSION_ROOM);
      final String speakers = getIntent().getStringExtra(HomeListenerService.KEY_SPEAKER_NAME);
      final int notificationId =
          getIntent().getIntExtra(HomeListenerService.KEY_NOTIFICATION_ID, 0);
      mSession.setText(sessionName);
      mSpeaker.setText(speakers + " - " + sessionRoom);
      mContent.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              Intent feedbackIntent = new Intent(NotificationActivity.this, PagerActivity.class);
              feedbackIntent.putExtra(HomeListenerService.KEY_SESSION_ID, sessionId);
              feedbackIntent.putExtra(HomeListenerService.KEY_NOTIFICATION_ID, notificationId);
              feedbackIntent.setFlags(
                  Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
              startActivity(feedbackIntent);
            }
          });
    }
  }
Ejemplo n.º 22
0
        @Override
        public void handleMessage(Message msg) {
          Bundle data = msg.getData();

          String jobIdString = data.getString(SiteController.MESSAGE_KEY_JOB_ID);
          int jobId = (jobIdString != null) ? Integer.parseInt(jobIdString) : -1;
          Job job = (Job) (new JobTable()).get(mContext, jobId);

          int messageType = data.getInt(SiteController.MESSAGE_KEY_TYPE);
          switch (messageType) {
            case SiteController.MESSAGE_TYPE_SUCCESS:
              String result = data.getString(SiteController.MESSAGE_KEY_RESULT);
              jobSucceeded(result);
              break;
            case SiteController.MESSAGE_TYPE_FAILURE:
              int errorCode = data.getInt(SiteController.MESSAGE_KEY_CODE);
              String errorMessage = data.getString(SiteController.MESSAGE_KEY_MESSAGE);
              Exception exception =
                  (Exception) data.getSerializable(SiteController.MESSAGE_KEY_EXCEPTION);
              jobFailed(exception, errorCode, errorMessage);
              break;
            case SiteController.MESSAGE_TYPE_PROGRESS:
              String message = data.getString(SiteController.MESSAGE_KEY_MESSAGE);
              float progress = data.getFloat(SiteController.MESSAGE_KEY_PROGRESS);
              jobProgress(job, progress, message);
              break;
          }
        }
Ejemplo n.º 23
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   // TODO Auto-generated method stub
   super.onCreate(savedInstanceState);
   ViewUtils.inject(this);
   /*
    * 功能:获取前面activity传过来的uuid
    */
   Bundle bundle = getIntent().getExtras();
   uuid = bundle.getString("uuid");
   isOrigin = bundle.getBoolean("isOrigin");
   if (isOrigin) iv_inform_edit.setVisibility(View.VISIBLE);
   messageCount = bundle.getString("messageCount");
   volleyRequestQueue = Volley.newRequestQueue(this);
   context = InformActivity.this;
   loadingDialog = new LoadingDialog(context);
   loadingDialog.setLoadingString("请稍等");
   loadingDialog.showLoadingDialog();
   // 初始化
   init();
   /*
    * 功能:progress'判断网络状态的标志
    */
   //		progress = new ProgressDialog(InformActivity.this);
   //		progress.setMessage("请稍等");
   //		progress.setCanceledOnTouchOutside(false);
   //		progress.setCancelable(false);
   //		progress.show();
   // 获取后台数据
   NetConnect(uuid);
 }
Ejemplo n.º 24
0
  @Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.d(TAG, "onActivityResult");
    // This captures the return code sent by Login Activity, to know whether or not the user got the
    // authorization
    if (requestCode == Constants.AUTHORIZE_PUSH) {
      if (resultCode == Activity.RESULT_OK) {

        // Tell the activity NOT to reload on next resume since the push itself will do it
        ((DashboardActivity) getActivity()).setReloadOnResume(false);

        // In case authorization was ok, we launch push action
        Bundle extras = data.getExtras();
        int position = extras.getInt("Survey", 0);
        String user = extras.getString("User");
        String password = extras.getString("Password");
        final Survey survey = (Survey) adapter.getItem(position - 1);
        AsyncPush asyncPush = new AsyncPush(survey, user, password);
        asyncPush.execute((Void) null);
      } else {
        // Otherwise we notify and continue
        new AlertDialog.Builder(getActivity())
            .setTitle("Authorization failed")
            .setMessage("User or password introduced are wrong. Push aborted.")
            .setPositiveButton(android.R.string.ok, null)
            .setNegativeButton(android.R.string.no, null)
            .create()
            .show();
      }
    }
  }
Ejemplo n.º 25
0
  /** We have received a push notification from GCM, analyze the intents bundle for the payload. */
  @Override
  protected void onMessage(Context context, Intent intent) {

    Log.i(TAG, "Received message");
    displayMessage(context, "Message Received");
    String message = null;
    String title = null;
    String url = null;

    if (intent != null) {

      // Check the bundle for the pay load body and title
      Bundle bundle = intent.getExtras();
      if (bundle != null) {
        displayMessage(context, "Message bundle: " + bundle);

        Log.i(TAG, "Message bundle: " + bundle);
        message = bundle.getString("message");

        title = bundle.getString("title");

        url = bundle.getString("url");
      }
    }
    // If there was no body just use a standard message
    if (message == null) {
      message = getString(R.string.airbop_message);
    }

    generateNotification(context, title, message, url);
  }
Ejemplo n.º 26
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_item_display);
    if (savedInstanceState == null) {
      Bundle extras = getIntent().getExtras();
      if (extras == null) {
        itemId = null;
      } else {
        itemId = extras.getString("itemId");
      }
    } else {
      itemId = (String) savedInstanceState.getSerializable("itemId");
    }

    if (savedInstanceState == null) {
      Bundle extras = getIntent().getExtras();
      if (extras == null) {
        imageNum = 0;
      } else {
        imageNum = extras.getInt("imageNum");
      }
    } else {
      imageNum = (int) savedInstanceState.getSerializable("imageNum");
    }

    if (savedInstanceState == null) {
      Bundle extras = getIntent().getExtras();
      if (extras == null) {
        userId = null;
      } else {
        userId = extras.getString("userId");
      }
    } else {
      userId = (String) savedInstanceState.getSerializable("userId");
    }

    ParseQuery<ParseObject> query = ParseQuery.getQuery("Item");
    query.getInBackground(
        itemId,
        new GetCallback<ParseObject>() {
          public void done(ParseObject object, ParseException e) {
            if (e == null) {

              if (object.has("itemImage0")) {
                ImageView displayImage = (ImageView) findViewById(R.id.imageDisplay);
                ParseFile image = object.getParseFile("itemImage0");
                try {
                  byte[] imageData = image.getData();
                  Bitmap bitmap = BitmapFactory.decodeByteArray(imageData, 0, imageData.length);
                  displayImage.setImageBitmap(bitmap);
                } catch (ParseException e1) {
                  e1.printStackTrace();
                }
              }
            } else {
            }
          }
        });
  }
Ejemplo n.º 27
0
  // [START receive_message]
  @Override
  public void onMessageReceived(String from, Bundle data) {
    String message = data.getString("message");
    String extra = data.getString("extra");
    Log.d(TAG, "From: " + from);
    Log.d(TAG, "Message: " + message);

    if (from.startsWith("/topics/")) {
      // message received from some topic.
    } else {
      // normal downstream message.
    }

    // [START_EXCLUDE]
    /**
     * Production applications would usually process the message here. Eg: - Syncing with server. -
     * Store message in local database. - Update UI.
     */

    /**
     * In some cases it may be useful to show a notification indicating to the user that a message
     * was received.
     */
    sendNotification(message, extra);
    // [END_EXCLUDE]
  }
Ejemplo n.º 28
0
  /**
   * Authenticates this client as belonging to your application.
   *
   * <p>You must define {@code com.parse.APPLICATION_ID} and {@code com.parse.CLIENT_KEY} {@code
   * meta-data} in your {@code AndroidManifest.xml}:
   *
   * <pre>
   * &lt;manifest ...&gt;
   *
   * ...
   *
   *   &lt;application ...&gt;
   *     &lt;meta-data
   *       android:name="com.parse.APPLICATION_ID"
   *       android:value="@string/parse_app_id" /&gt;
   *     &lt;meta-data
   *       android:name="com.parse.CLIENT_KEY"
   *       android:value="@string/parse_client_key" /&gt;
   *
   *       ...
   *
   *   &lt;/application&gt;
   * &lt;/manifest&gt;
   * </pre>
   *
   * <p>This must be called before your application can use the Parse library. The recommended way
   * is to put a call to {@code Parse.initialize} in your {@code Application}'s {@code onCreate}
   * method:
   *
   * <p>
   *
   * <pre>
   * public class MyApplication extends Application {
   *   public void onCreate() {
   *     Parse.initialize(this);
   *   }
   * }
   * </pre>
   *
   * @param context The active {@link Context} for your application.
   */
  public static void initialize(Context context) {
    Context applicationContext = context.getApplicationContext();
    String applicationId;
    String clientKey;
    Bundle metaData = ManifestInfo.getApplicationMetadata(applicationContext);
    if (metaData != null) {
      applicationId = metaData.getString(PARSE_APPLICATION_ID);
      clientKey = metaData.getString(PARSE_CLIENT_KEY);

      if (applicationId == null) {
        throw new RuntimeException(
            "ApplicationId not defined. "
                + "You must provide ApplicationId in AndroidManifest.xml.\n"
                + "<meta-data\n"
                + "    android:name=\"com.parse.APPLICATION_ID\"\n"
                + "    android:value=\"<Your Application Id>\" />");
      }
      if (clientKey == null) {
        throw new RuntimeException(
            "ClientKey not defined. "
                + "You must provide ClientKey in AndroidManifest.xml.\n"
                + "<meta-data\n"
                + "    android:name=\"com.parse.CLIENT_KEY\"\n"
                + "    android:value=\"<Your Client Key>\" />");
      }
    } else {
      throw new RuntimeException("Can't get Application Metadata");
    }
    initialize(context, applicationId, clientKey);
  }
Ejemplo n.º 29
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle bundle = getIntent().getExtras();
    strdate = bundle.getString("strdate");
    enddate = bundle.getString("enddate");
    moneyType = bundle.getString("moneyType");
    initTitle(R.drawable.njzq_title_left_back, 0, "资金流水查询");

    String[] toolbarNames = {
      Global.TOOLBAR_DETAIL, Global.TOOLBAR_SHANGYE, Global.TOOLBAR_XIAYIYE, Global.TOOLBAR_REFRESH
    };
    initToolBar(toolbarNames, Global.BAR_TAG);
    super.enabledToolBarfalse();

    colsName = getResources().getStringArray(R.array.zr_trade_stock_query_zjls_name);
    colsIndex = getResources().getStringArray(R.array.zr_trade_stock_query_zjls_index);
    digitColsIndex = new HashSet<Integer>();
    digitColsIndex.add(3);
    digitColsIndex.add(4);

    handlerData();
    allRecords = new JSONArray();
  }
Ejemplo n.º 30
0
  /** 解析Intent */
  private void parseIntent(final Intent intent) {
    final Bundle arguments = intent.getExtras();
    if (arguments != null) {
      if (arguments.containsKey(EXTRA_DIRECTORY)) {
        String directory = arguments.getString(EXTRA_DIRECTORY);
        Logger.i("onStartCommand:" + directory);
        // 扫描文件夹
        if (!mScanMap.containsKey(directory)) mScanMap.put(directory, "");
      } else if (arguments.containsKey(EXTRA_FILE_PATH)) {
        // 单文件
        String filePath = arguments.getString(EXTRA_FILE_PATH);
        Logger.i("onStartCommand:" + filePath);
        if (!StringUtils.isEmpty(filePath)) {
          if (!mScanMap.containsKey(filePath))
            mScanMap.put(filePath, arguments.getString(EXTRA_MIME_TYPE));
          //					scanFile(filePath, arguments.getString(EXTRA_MIME_TYPE));
        }
      }
    }

    if (mServiceStatus == SCAN_STATUS_NORMAL || mServiceStatus == SCAN_STATUS_END) {
      new Thread(this).start();
      // scan();
    }
  }