public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.twitter_web_login);

    mInstance = this;
    WebView webView = (WebView) findViewById(R.id.webView);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.addJavascriptInterface(new JavaScriptInterface(), "PINCODE");

    webView.setWebViewClient(
        new WebViewClient() {
          public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            Log.v("ifoodtv", ">>>> url = " + url.toString());

            view.loadUrl(
                "javascript:window.PINCODE.getPinCode(document.getElementById('oauth_pin').innerHTML);");

            if (url != null && url.equals("http://mobile.twitter.com/")) {
              finish();
            }
          }
        });

    mIntent = getIntent();
    String url1 = mIntent.getStringExtra("auth_url");
    mAction = mIntent.getStringExtra("action");
    Log.v("ifoodtv", ">>> url1 = " + url1);
    webView.loadUrl(url1);
  }
 @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;
   }
 }
  /**
   * Called when the BroadcastReceiver receives an Intent broadcast. Checks to see whether the
   * intent's action is _listClickAction. If it is, the app widget displays a Toast message for the
   * current item.
   */
  @Override
  public void onReceive(Context context, Intent intent) {
    if (intent.getAction().equals(_listClickAction)) {
      // ---Launch video search in the browser---
      String searchText = intent.getStringExtra("search_text");
      String linkScheme1 = intent.getStringExtra("scheme1");
      String linkScheme2 = intent.getStringExtra("scheme2");
      Intent browserIntent = null; // new Intent(_listClickAction);
      try {
        browserIntent =
            new Intent(
                Intent.ACTION_VIEW,
                Uri.parse(linkScheme1 + URLEncoder.encode(searchText, "UTF-8") + linkScheme2));
      } catch (UnsupportedEncodingException e) {
        BugSenseHandler.sendExceptionMessage("Widget4x4Provider", "onReceive", e);
        Crashlytics.setString("Widget4x4Provider", "onReceive");
        Crashlytics.logException(e);

        if (ApplicationContext.DEBUG_MODE) e.printStackTrace();
      }

      browserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      browserIntent.putExtra(Browser.EXTRA_APPLICATION_ID, context.getPackageName());
      context.startActivity(browserIntent);
    } else if (intent.getAction().equals("android.appwidget.action.APPWIDGET_UPDATE")) {
      // ---Update the widget with latest search---
      final AppWidgetManager mgr = AppWidgetManager.getInstance(context);
      onUpdate(context, mgr, appWidgetIds);
    }
    super.onReceive(context, intent);
  }
 private void handleSendDirectMessageIntent(final Intent intent) {
   final long accountId = intent.getLongExtra(EXTRA_ACCOUNT_ID, -1);
   final long recipientId = intent.getLongExtra(EXTRA_RECIPIENT_ID, -1);
   final String imageUri = intent.getStringExtra(EXTRA_IMAGE_URI);
   final String text = intent.getStringExtra(EXTRA_TEXT);
   sendMessage(accountId, recipientId, text, imageUri);
 }
Ejemplo n.º 5
1
 @Override
 public void onReceive(Context context, Intent intent) {
   String action = intent.getAction();
   if (Intent.ACTION_BATTERY_CHANGED.equals(action)) {
     mBatteryLevel.setSummary(Utils.getBatteryPercentage(intent));
     mBatteryStatus.setSummary(Utils.getBatteryStatus(getResources(), intent));
   } else if (SPN_STRINGS_UPDATED_ACTION.equals(action)) {
     String operatorName = null;
     String plmn = null;
     String spn = null;
     if (intent.getBooleanExtra(EXTRA_SHOW_PLMN, false)) {
       plmn = intent.getStringExtra(EXTRA_PLMN);
       if (plmn != null) {
         operatorName = plmn;
       }
     }
     if (intent.getBooleanExtra(EXTRA_SHOW_SPN, false)) {
       spn = intent.getStringExtra(EXTRA_SPN);
       if (spn != null) {
         operatorName = spn;
       }
     }
     Preference p = findPreference(KEY_OPERATOR_NAME);
     if (p != null) {
       mExt.updateOpNameFromRec(p, operatorName);
     }
   }
 }
Ejemplo n.º 6
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    textView = (TextView) findViewById(R.id.textView);

    Intent intent = getIntent();
    String name = "";
    String age = "";
    if (intent != null) {
      /** ************通过intent启动****************** */
      name = intent.getStringExtra("name");
      age = intent.getStringExtra("age");
      String action = intent.getAction();

      /** ************通过scheme 启动****************** */
      if (Intent.ACTION_VIEW.equals(action)) {
        Uri uri = intent.getData();
        if (uri != null) {
          name = uri.getQueryParameter("name");
          age = uri.getQueryParameter("age");
        }
      }
      textView.setText(name + "\n" + age);
    }
  }
Ejemplo n.º 7
0
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   switch (requestCode) {
     case (Constants.LOGIN_RESULTCODE):
       {
         if (resultCode == Activity.RESULT_OK) {
           String verifier = data.getStringExtra(Constants.LOGIN_VERIFIER);
           helper.setVerifier(verifier);
           // TODO Switch tabs using the index.
         }
         break;
       }
     case (Constants.CATEGORY_RESULTCODE):
       {
         String currentCategory = data.getStringExtra(Constants.CATEGORY_RESULT);
         currentCategoryNumber = data.getStringExtra(Constants.CATEGORYNUMBER_RESULT);
         Toast.makeText(
                 this.getApplicationContext(),
                 "You selected: " + currentCategory,
                 Toast.LENGTH_LONG)
             .show();
         break;
       }
   }
 }
  @Override
  public void onReceive(Context context, Intent intent) {
    PendingIntent pendingIntent =
        PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), 0);

    String text =
        intent.getStringExtra(StatusContract.Columns.USER)
            + ": "
            + intent.getStringExtra(StatusContract.Columns.TEXT);

    // Create the notification object
    Notification.Builder builder = new Notification.Builder(context);
    builder
        .setContentTitle("New Status!")
        .setContentText(text)
        .setAutoCancel(true)
        .setSmallIcon(android.R.drawable.stat_notify_more)
        .setWhen(System.currentTimeMillis())
        .setContentIntent(pendingIntent);
    Notification notification = builder.getNotification();

    // Post the notification
    NotificationManager nm =
        (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    nm.notify(0, notification);

    Log.d("NewStatusReceiver", "onReceive with text: " + text);
  }
Ejemplo n.º 9
0
  public void onCreate(final Bundle savedInstanceState) {

    PrefsUtility.applyTheme(this);

    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    super.onCreate(savedInstanceState);

    final Intent intent = getIntent();

    final String html = intent.getStringExtra("html");
    final String title = intent.getStringExtra("title");
    setTitle(title);

    if (html == null) {
      BugReportActivity.handleGlobalError(this, "No HTML");
    }

    webView = WebViewFragment.newInstanceHtml(html);

    setContentView(View.inflate(this, R.layout.main_single, null));

    getSupportFragmentManager().beginTransaction().add(R.id.main_single_frame, webView).commit();
  }
Ejemplo n.º 10
0
  private void finishLogin(Intent intent) {
    Log.d(TAG, "finishLogin");

    String accountName = intent.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
    String accountPassword = intent.getStringExtra(PARAM_USER_PASS);
    final Account account =
        new Account(accountName, intent.getStringExtra(AccountManager.KEY_ACCOUNT_TYPE));

    if (getIntent().getBooleanExtra(ARG_IS_ADDING_NEW_ACCOUNT, false)) {
      Log.d(TAG, "finishLogin > addAccountExplicitly");
      String authtoken = intent.getStringExtra(AccountManager.KEY_AUTHTOKEN);
      String authtokenType = mAuthTokenType;

      // Creating the account on the device and setting the auth token we got
      // (Not setting the auth token will cause another call to the server to authenticate the
      // user)
      mAccountManager.addAccountExplicitly(account, accountPassword, null);
      mAccountManager.setAuthToken(account, authtokenType, authtoken);
    } else {
      Log.d(TAG, "finishLogin > setPassword");
      mAccountManager.setPassword(account, accountPassword);
    }

    setAccountAuthenticatorResult(intent.getExtras());
    setResult(RESULT_OK, intent);
    finish();
  }
 public void handleIntent(Intent intent) {
   if (intent == null) {
     return;
   }
   try {
     Intent firstIntent = getIntent();
     int type = intent.getIntExtra("ntype", 0);
     ;
     switch (type) {
       case ENotification.F_TYPE_PUSH:
         if (null != mBrowser) {
           String data = intent.getStringExtra("data");
           String pushMessage = intent.getStringExtra("message");
           SharedPreferences sp =
               getSharedPreferences(PushReportConstants.PUSH_DATA_SHAREPRE, Context.MODE_PRIVATE);
           Editor editor = sp.edit();
           editor.putString(PushReportConstants.PUSH_DATA_SHAREPRE_DATA, data);
           editor.putString(PushReportConstants.PUSH_DATA_SHAREPRE_MESSAGE, pushMessage);
           editor.commit();
           mBrowser.pushNotify();
         }
         break;
       case ENotification.F_TYPE_USER:
         break;
       case ENotification.F_TYPE_SYS:
         break;
       default:
         getIntentData(intent);
         firstIntent.putExtras(intent);
         break;
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
Ejemplo n.º 12
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    Intent invokingIntent = getIntent();
    mAddingNewAccount = invokingIntent.getStringExtra(ARG_IS_ADDING_NEW_ACCOUNT).equals("true");
    mEmail = invokingIntent.getStringExtra(ARG_ACCOUNT_NAME);
    mLoginLayout = new LoginLayout(mEmail, mAddingNewAccount, this);

    // initialize the authenticator response intent
    mAccountAuthenticatorResponse =
        getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE);

    if (mAccountAuthenticatorResponse != null) {
      mAccountAuthenticatorResponse.onRequestContinued();
    }

    // depending on whether the activity was started in response to an authentication error, we want
    // to
    // start it with a proper layout
    final HttpLoginMessage.EError serverResponseCode =
        (HttpLoginMessage.EError) invokingIntent.getSerializableExtra(ARG_SERVER_RESPONSE_CODE);
    if (serverResponseCode == null) {
      setLayout(mLoginLayout);
    } else {
      processServerResponse(serverResponseCode);
    }
  }
Ejemplo n.º 13
0
        @SuppressWarnings("nls")
        @Override
        public void onReceive(Context context, Intent intent) {
          System.err.println("TVA thug hustlin - ");

          if (!intent.hasExtra("tag_id")) return;
          System.err.println(
              Long.toString(tagData.getValue(TagData.REMOTE_ID))
                  + " VS "
                  + intent.getStringExtra("tag_id"));
          if (!Long.toString(tagData.getValue(TagData.REMOTE_ID))
              .equals(intent.getStringExtra("tag_id"))) return;

          runOnUiThread(
              new Runnable() {
                @Override
                public void run() {
                  System.err.println("REFRESH updates list pa-pa-pa");
                  refreshUpdatesList();
                }
              });
          refreshData(false, true);

          NotificationManager nm = new AndroidNotificationManager(ContextManager.getContext());
          nm.cancel(tagData.getValue(TagData.REMOTE_ID).intValue());
        }
Ejemplo n.º 14
0
  @Override
  protected void onHandleIntent(Intent intent) {
    String vrijemeOd = intent.getStringExtra("vrijemeOd");
    String vrijemeDo = intent.getStringExtra("vrijemeDo");
    String broj = intent.getStringExtra("broj");
    int userId = intent.getIntExtra("userId", 0);

    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost =
        new HttpPost("http://104.236.71.177//rasus_backend//korisnik/koristenje/" + userId);

    try {
      // Add your data
      // JSONObject c = jsonArray.getJSONObject(0);
      List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
      nameValuePairs.add(new BasicNameValuePair("vrijemeOd", vrijemeOd));
      nameValuePairs.add(new BasicNameValuePair("vrijemeDo", vrijemeDo));
      nameValuePairs.add(new BasicNameValuePair("broj", broj));
      httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

      // Execute HTTP Post Request
      HttpResponse response = httpclient.execute(httppost);
      statusLine = response.getStatusLine();
      Intent i = new Intent("newReservation");
      sendLocationBroadcast(i);
    } catch (ClientProtocolException e) {
      // TODO Auto-generated catch block
    } catch (IOException e) {
      // TODO Auto-generated catch block
    }
  }
Ejemplo n.º 15
0
 protected void onNewIntent(Intent intent) {
   super.onNewIntent(intent);
   this.f4685D = UiMode.m7254a(intent.getStringExtra("extra_ui_mode"));
   this.f4686E = EndMode.m7253a(intent.getStringExtra("extra_end_mode"));
   this.f4687F = intent.getBooleanExtra("extra_call_out", false);
   m7136q();
 }
Ejemplo n.º 16
0
  private void onConfirmed() {
    setResult(Activity.RESULT_OK);
    Intent intent = getIntent();
    String isFromLauncher = intent.getStringExtra("UlockApp");
    String isSwitchParent = intent.getStringExtra("switchParent");
    if (isSwitchParent == null) isSwitchParent = "false";

    if (isFromLauncher != null) {
      if (isFromLauncher.equals("true")) {
        G.Watchdog.isAppRuned = 2;

        Permisions.setDisablePermisions(getApplicationContext());
        getApplicationContext()
            .stopService(new Intent(getApplicationContext(), Service_Launcher.class));

        if ("true".equals(isSwitchParent)) {
          Intent intent_parent = new Intent(this, Activity_Parent.class);
          intent_parent.putExtra("switchParent", "true");
          startActivity(intent_parent);
        }

        finish();
        Permisions.setDisablePermisions(getApplicationContext());
        //                            finish();
        /* new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                finish();
            }
        }, 1000);*/
      }
    } else {
      finish();
    }
  }
  /** 获取上个页面传递过来的数据 */
  private void getIntentData(Intent intent) {

    if (intent != null) {

      HotNewsInfo hotNewsInfo = (HotNewsInfo) intent.getSerializableExtra("data");

      title = hotNewsInfo.getTitle();
      view_count = hotNewsInfo.getView_count();
      tvTitle.setText(title);
      tvViewCount.setText(view_count + "万次播放");
      tvTags.setText("标签:" + hotNewsInfo.getTag());
      tvLink.setText(hotNewsInfo.getLink());
      tIBtnUP.setText(hotNewsInfo.getUp_count() + "万");
      tIBtnDown.setText(hotNewsInfo.getDown_count());
      tvCategory.setText("类型:" + hotNewsInfo.getCategory());
      tvPublished.setText(hotNewsInfo.getPublished());
      // 判断是不是本地视频
      isFromLocal = intent.getBooleanExtra("isFromLocal", false);

      if (isFromLocal) { // 播放本地视频
        local_vid = intent.getStringExtra("video_id");
      } else { // 在线播放
        id = intent.getStringExtra("vid");
      }
    }
  }
Ejemplo n.º 18
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_voo);

    Controle controle = new Controle();
    // capturando a msg do intent

    Intent intent = getIntent();
    String destino = intent.getStringExtra(MainActivity.DESTINO);
    String origem = intent.getStringExtra(MainActivity.ORIGEM);

    TreeSet<Voo> lista = controle.listarVoos(origem, destino);

    // texto da View
    TextView textView = (TextView) findViewById(R.id.txt_lista_voo);
    String message = "";

    for (Voo voo : lista) {
      message += voo.getNome() + "" + voo.getSituacao() + "\n";
    }

    if (message.length() == 0) {

      message = "Voo não encontrado";

      textView.setLines(3);
    } else {
      textView.setLines(lista.size());
    }

    textView.setText(message);
  }
Ejemplo n.º 19
0
  private void initView() {
    sub = (TextView) findViewById(R.id.detail_subject);
    body = (TextView) findViewById(R.id.detail_bodytext);

    body.setAutoLinkMask(0x0f);
    // body.setEms();
    // body.setMovementMethod(ScrollingMovementMethod.getInstance());
    body.setMovementMethod(LinkMovementMethod.getInstance());

    times = (TextView) findViewById(R.id.detail_time);
    froms = (TextView) findViewById(R.id.detail_from);
    img_reply = (ImageView) findViewById(R.id.mail_img_reply);
    ed_reply = (EditText) findViewById(R.id.mail_ed_reply);
    Intent it = getIntent();
    subject = it.getStringExtra("SUBJECT");
    bodytext = it.getStringExtra("BODYTEXT");
    time = it.getStringExtra("TIME");
    from = it.getStringExtra("FROM");

    sub.setText(subject);
    String str = cutString(bodytext);
    body.setText(Html.fromHtml(str, imgGetter, null));
    times.setText(time);
    froms.setText(from);

    img_reply.setOnClickListener(this);
  }
  @Override
  protected void onHandleIntent(Intent intent) {
    File output =
        new File(
            this.defaultLocation,
            new SimpleDateFormat("'Document 'yyyy-MM-dd' 'HHmmss'.'").format(new Date())
                + intent.getStringExtra(EXTRA_OUTPUT_FILE_EXTENSION));

    getNotificationManager()
        .notify(
            ConversionService.class.getName(),
            1,
            new NotificationCompat.Builder(this)
                .setContentTitle("Converting documents")
                .setContentText(defaultLocation.toString())
                .setSmallIcon(R.drawable.ic_launcher)
                .setOngoing(true)
                .build());

    InputStream is = null;
    try {
      is = getContentResolver().openInputStream(intent.getData());
      Document doc = new Document(is);
      App.closeStream(is);
      doc.save(output.toString(), intent.getIntExtra(EXTRA_SAVE_FORMAT, -1));

      getNotificationManager()
          .notify(
              ConversionService.class.getName(),
              2,
              new NotificationCompat.Builder(this)
                  .setContentTitle("Document converted")
                  .setContentText(output.toString())
                  .setSmallIcon(R.drawable.ic_launcher)
                  .setContentIntent(
                      PendingIntent.getActivity(
                          ConversionService.this,
                          0,
                          new Intent(Intent.ACTION_VIEW)
                              .setDataAndType(
                                  Uri.fromFile(output), intent.getStringExtra(EXTRA_OUTPUT_MIME)),
                          PendingIntent.FLAG_CANCEL_CURRENT))
                  .build());

    } catch (Exception x) {
      getNotificationManager()
          .notify(
              ConversionService.class.getName(),
              3,
              new NotificationCompat.Builder(this)
                  .setContentTitle("Document conversion failed")
                  .setContentText(x.getMessage())
                  .setSmallIcon(R.drawable.ic_launcher)
                  .build());
    } finally {
      App.closeStream(is);
    }

    getNotificationManager().cancel(ConversionService.class.getName(), 1);
  }
  @Override
  /** * Results for SHARE intent with return */
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    switch (resultCode) {
      case PrintingSample.LICENSE_ACTIVATION_SUCCESS:
        Log.d(
            TAG,
            getString(R.string.message_license_activation_success) + "; resultCode " + resultCode);
        break;
      case PrintingSample.LICENSE_ACTIVATION_ERROR:
        Log.d(
            TAG,
            getString(R.string.message_license_activation_error) + "; resultCode " + resultCode);
        break;
      default:
        Log.d(TAG, "resultCode " + resultCode);
        break;
    }

    if (data != null) {
      Log.d(TAG, "result " + data.getStringExtra("result"));
      Log.d(TAG, "resultString " + data.getStringExtra("resultString"));
      Log.d(TAG, "resultType " + data.getStringExtra("resultType"));
      Log.d(TAG, "resultTypeString " + data.getStringExtra("resultTypeString"));
      Log.d(TAG, "result message " + data.getStringExtra("resultMessage"));
    }
  }
  @Override
  protected void onMessage(Context context, Intent intent) {
    try {
      r = new Random();
      prefs = new PrefsManager(context);
      int num;
      Intent i;
      PendingIntent pendingIntent;

      i = new Intent(context, FeedActivity.class);

      i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

      num = r.nextInt(10000);

      pendingIntent = PendingIntent.getActivity(context, num, i, 0);

      sendBlankNotification(
          context,
          intent.getStringExtra("title"),
          intent.getStringExtra("msg"),
          pendingIntent,
          num);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Ejemplo n.º 23
0
  @Override
  public void onReceive(Context context, Intent intent) {

    if (intent
        .getStringExtra(TelephonyManager.EXTRA_STATE)
        .equals(TelephonyManager.EXTRA_STATE_RINGING)) {

      // Phone number
      String incomingNumber = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);

      // Ringing state
      // This code will execute when the phone has an incoming call
    } else if (intent
            .getStringExtra(TelephonyManager.EXTRA_STATE)
            .equals(TelephonyManager.EXTRA_STATE_IDLE)
        || intent
            .getStringExtra(TelephonyManager.EXTRA_STATE)
            .equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) {

      // This code will execute when the call is answered or disconnected
      Intent updateWidget = new Intent(context, WidgetProvider4x1.class);
      updateWidget.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
      // Use an array and EXTRA_APPWIDGET_IDS instead of AppWidgetManager.EXTRA_APPWIDGET_ID,
      // since it seems the onUpdate() is only fired on that:
      int[] ids =
          AppWidgetManager.getInstance(context)
              .getAppWidgetIds(new ComponentName(context, WidgetProvider4x1.class));
      updateWidget.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids);
      context.sendBroadcast(updateWidget);

      Toast.makeText(context, "CALL ENDED YAY!", Toast.LENGTH_LONG).show();
    }
  }
Ejemplo n.º 24
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate fragment_place_map view
    View rootView = inflater.inflate(R.layout.fragment_place_map, container, false);

    // Set views
    txtPlaceName = (TextView) rootView.findViewById(R.id.txtPlaceName);
    txtPlaceAddress = (TextView) rootView.findViewById(R.id.txtPlaceAddress);
    txtPlacePhone = (TextView) rootView.findViewById(R.id.txtPlacePhone);
    txtPlaceWeb = (TextView) rootView.findViewById(R.id.txtPlaceWeb);
    btnWaze = (Button) rootView.findViewById(R.id.btnWaze);

    // Get Intent and get place data from intent
    intent = getActivity().getIntent();
    double lat = intent.getDoubleExtra("lat", -1);
    double lon = intent.getDoubleExtra("lon", -1);
    String name = intent.getStringExtra("name");
    String web = intent.getStringExtra("web");
    String phone = intent.getStringExtra("phone");
    String address = intent.getStringExtra("address");
    place = new Place(name, address, lat, lon, web, phone);

    return rootView;
  }
  @Override
  public void onReceive(Context context, Intent intent) {
    if (Params.TAG_FG_DEBUG && fgDebugLocal) {
      Log.i(Params.TAG_GEN, TAG_LOCAL + "notificationCatcherReceiver - Received message");
    }
    ;
    if (Params.TAG_FG_DEBUG && fgDebugLocal) {
      Log.i(
          Params.TAG_GEN,
          TAG_LOCAL + "notificationCatcherReceiver - intent.getAction() :: " + intent.getAction());
    }
    ;
    if (Params.TAG_FG_DEBUG && fgDebugLocal) {
      Log.i(
          Params.TAG_GEN,
          TAG_LOCAL
              + "notificationCatcherReceiver - EXTRA_PACKAGE) :: "
              + intent.getStringExtra(SendNotificationService.EXTRA_PACKAGE));
    }
    ;
    if (Params.TAG_FG_DEBUG && fgDebugLocal) {
      Log.i(
          Params.TAG_GEN,
          TAG_LOCAL
              + "notificationCatcherReceiver - EXTRA_MESSAGE) :: "
              + intent.getStringExtra(SendNotificationService.EXTRA_MESSAGE));
    }
    ;

    intent = new Intent(context, SendNotification.class);
    intent.putExtra("notification", message);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);
  }
Ejemplo n.º 26
0
 @Override
 protected void onHandleIntent(Intent intent) {
   String url = null;
   String userName = intent.getStringExtra(PROVIDED_USER_NAME);
   String instrumentName = intent.getStringExtra(PROVIDED_INSTRUMENT);
   try {
     url = URLDecoder.decode(getString(R.string.poll_post_url, instrumentName, userName), "UTF-8");
   } catch (UnsupportedEncodingException e) {
     e.printStackTrace();
   }
   if (url == null) return;
   RequestFuture<String> future = RequestFuture.newFuture();
   StringRequest request = new StringRequest(Request.Method.POST, url, future, future);
   Volley.newRequestQueue(getApplicationContext()).add(request);
   try {
     String response = future.get(30, TimeUnit.SECONDS);
     PostPollDto dto = new Gson().fromJson(response, PostPollDto.class);
     if (dto.getStatus().toLowerCase().equalsIgnoreCase("ok")) {
       PreferencesUtil.savePollInstrument(getApplicationContext(), instrumentName);
       PreferencesUtil.saveUserName(getApplicationContext(), userName);
       EventBus.getDefault().post(new PollPostEvent());
     } else {
       EventBus.getDefault().post(new PollPostEvent(dto.getMsg()));
     }
   } catch (InterruptedException | ExecutionException | TimeoutException e) {
     EventBus.getDefault().post(new PollPostEvent(e.getLocalizedMessage()));
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gplus);

    Intent i = getIntent();
    name = i.getStringExtra("name");
    phone = i.getStringExtra("phone");
    vehicle = i.getStringExtra("vehicle");
    regId = i.getStringExtra("regId");
    lati = ((Variables) this.getApplication()).getamb_lati();
    longi = ((Variables) this.getApplication()).getamb_longi();

    btnSignIn = (SignInButton) findViewById(R.id.btn_sign_in);

    // Button click listeners
    btnSignIn.setOnClickListener(this);

    mGoogleApiClient =
        new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(Plus.API)
            .addScope(Plus.SCOPE_PLUS_LOGIN)
            .build();
  }
Ejemplo n.º 28
0
  @Override
  public void setView() {
    setContentView(R.layout.act_accountcenter);

    sp_opengesture = getSharedPreferences("OPENGESTURE", 0);
    Intent in = getIntent();
    userAccountType = in.getStringExtra("userAccountType");
    cardType = in.getStringExtra("cardType");
    loginname = in.getStringExtra("username");
    megTotal = in.getIntExtra("megTotal", 0);
    _userInfoService = new UserInfoService(ActAccountCenter.this);
    mHandler =
        new Handler() {
          @Override
          public void handleMessage(Message msg) {
            switch (msg.what) {
              case -1:
                break;
              case 0:
                new SweetAlertDialog(ActAccountCenter.this, SweetAlertDialog.SUCCESS_TYPE)
                    .setContentText("手势密码设置成功!")
                    .show();
                break;
              case 3:
                break;
              case 2:
                break;
              default:
                break;
            }
          };
        };

    _handler =
        new Handler() {
          @Override
          public void handleMessage(Message msg) {
            switch (msg.what) {
              case -1:
                break;
              case 0:
                break;
              case 1:
                break;
              default:
                break;
            }
            if (dialog != null && dialog.isShowing()) {
              dialog.dismiss();
            }
          };
        };

    try {
      getAccountCenter();
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
Ejemplo n.º 29
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);
    getSupportActionBar().setBackgroundDrawable(new ColorDrawable(0xff359AC4));

    TextView textView_id = (TextView) findViewById(R.id.profile_id);
    TextView textView_pw = (TextView) findViewById(R.id.profile_pw);

    Intent intent_main = getIntent();

    String id = intent_main.getStringExtra("id");
    String pw = intent_main.getStringExtra("password");

    textView_id.setText(String.valueOf(id));
    textView_pw.setText(String.valueOf(pw));

    mNavigationDrawerFragment =
        (NavigationDrawerFragment)
            getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
    mTitle = getTitle();

    // Set up the drawer.
    mNavigationDrawerFragment.setUp(
        R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout));
  }
Ejemplo n.º 30
0
 @Override
 public void onReceive(Context context, Intent intent) {
   if (intent.getStringExtra(MESSAGE_KEY) != null) {
     Toast.makeText(MainActivity.this, intent.getStringExtra(MESSAGE_KEY), Toast.LENGTH_LONG)
         .show();
   }
 }