@Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.activity_uploadaprescription, container, false);

    init(view);

    editTextDoctorAdd.setAdapter(new PlacesAutoCompleteAdapter1(getActivity(), R.layout.list_item));
    editTextDoctorAdd.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          @Override
          public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

            String strLocations = (String) adapterView.getItemAtPosition(i);
            editTextDoctorAdd.setText(strLocations);

            String s = strLocations;
            if (s.contains(",")) {
              String parts[] = s.split("\\,");
              System.out.print(parts[0]);
              String s1 = parts[0];
            }
          }
        });

    return view;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search_stops_nearby);

    mAppPrefs = new HelperSharedPreferences(getApplicationContext());

    mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);

    mapFragment.getMapAsync(this);

    mLocationProvider = new LocationProviderActivity(this, this);

    // Retrieve the AutoCompleteTextView that will display Place suggestions.
    mAutocompleteView = (AutoCompleteTextView) findViewById(R.id.autocomplete_places2);
    // Register a listener that receives callbacks when a suggestion has been selected
    mAutocompleteView.setOnItemClickListener(mAutocompleteClickListener);
    // Retrieve the TextViews that will display details and attributions of the selected place.

    mGoogleApiClient = mLocationProvider.mGoogleApiClient;

    // Set up the adapter that will retrieve suggestions from the Places Geo Data API that cover
    // the entire world.
    mAdapter =
        new PlaceAutocompleteAdapter(
            this, android.R.layout.simple_list_item_1, mGoogleApiClient, BOUNDS_CAMPUS, null);
    mAutocompleteView.setAdapter(mAdapter);
  }
Example #3
0
  /** Initialize the views. */
  private void initializeUI() {
    setCustomContentView(R.layout.activity_add_city, R.string.screen_name_city_select);
    btnBack = (Button) findViewById(R.id.nav_back_button);
    btnLoaction = (Button) findViewById(R.id.nav_location_button);
    btnBack.setVisibility(View.VISIBLE);
    btnLoaction.setVisibility(View.VISIBLE);

    hotCityListGridView = (GridView) findViewById(R.id.hot_city_list_grid_view);
    searchCityEditText = (AutoCompleteTextView) findViewById(R.id.search_name_edit_text);

    defaultHotCityList = getResources().getStringArray(R.array.hot_city_list);
    hotCityListGridView.setAdapter(new CityAdapter());
    hotCityListGridView.setOnItemClickListener(onItemClickListener);
    searchCityEditText.addTextChangedListener(searchWatcher);

    adapter =
        new ArrayAdapter<String>(
            AddCitiyActivity.this, // 定义匹配源的adapter
            android.R.layout.simple_dropdown_item_1line,
            seachResultCityArrayList);
    searchCityEditText.setAdapter(adapter);
    searchCityEditText.setOnItemSelectedListener(onItemSelectedListener);

    btnBack.setOnClickListener(onClickListener);
  }
  /**
   * Attempts to sign in or register the account specified by the login form. If there are form
   * errors (invalid email, missing fields, etc.), the errors are presented and no actual login
   * attempt is made.
   */
  private void attemptLogin() {
    if (mAuthTask != null) {
      return;
    }

    // Reset errors.
    mNameView.setError(null);
    mZipCodeView.setError(null);

    // Store values at the time of the login attempt.
    String name = mNameView.getText().toString();
    String phone = mPhoneView.getText().toString();
    String bloodgroup = adapter.getItem(mBloodGroupsView.getSelectedItemPosition()).toString();
    String zipcode = mZipCodeView.getText().toString();

    boolean cancel = false;
    View focusView = null;

    // Check for a valid password, if the user entered one.
    if (TextUtils.isEmpty(zipcode) || !isZipCodeValid(zipcode)) {
      mZipCodeView.setError("Invalid Zip Code");
      focusView = mZipCodeView;
      cancel = true;
    }

    // Check for a valid email address.
    if (TextUtils.isEmpty(name)) {
      mNameView.setError(getString(R.string.error_field_required));
      focusView = mNameView;
      cancel = true;
    } else if (isEmailValid(name)) {
      mNameView.setError("Invalid Name");
      focusView = mNameView;
      cancel = true;
    }
    if (TextUtils.isEmpty(phone)) {
      mPhoneView.setError("This field is required");
      focusView = mPhoneView;
      cancel = true;
    }

    if (mBloodGroupsView.getSelectedItemPosition() < 1) {
      Snackbar.make(mBloodGroupsView, "Choose your Blood Group", Snackbar.LENGTH_SHORT).show();
      focusView = mBloodGroupsView;
      cancel = true;
    }

    if (cancel) {
      // There was an error; don't attempt login and focus the first
      // form field with an error.
      focusView.requestFocus();
    } else {
      // Show a progress spinner, and kick off a background task to
      // perform the user login attempt.
      showProgress(true);
      mAuthTask = new UserLoginTask(name, phone, bloodgroup, zipcode);
      // showProgress(true);
      mAuthTask.execute((Void) null);
    }
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_event);

    // get edit texts
    event_name = (EditText) findViewById(R.id.event_name);
    location = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextLocation);
    Start_Date = (EditText) findViewById(R.id.Start_Date);
    Start_Time = (EditText) findViewById(R.id.Start_Time);
    End_Date = (EditText) findViewById(R.id.End_Date);
    End_Time = (EditText) findViewById(R.id.End_Time);
    description = (EditText) findViewById(R.id.description);

    // AutoComplete TextView
    AutoCompleteTextView autoCompleteTextViewLocation =
        (AutoCompleteTextView) findViewById(R.id.autoCompleteTextLocation);
    autoCompleteTextViewLocation.setAdapter(
        new GooglePlacesAutocompleteAdapter(this, R.layout.activity_add_event_location_list));
    autoCompleteTextViewLocation.setOnItemClickListener(this);

    // spinnerCategory
    spinnerCategory = (Spinner) findViewById(R.id.category);
    spinnerCategory.setSelection(0);
    arrayAdapterCategory =
        ArrayAdapter.createFromResource(this, R.array.category_names, R.layout.spinner_item);
    spinnerCategory.setAdapter(arrayAdapterCategory);
    // spinnerType
    spinnerType = (Spinner) findViewById(R.id.type);
    spinnerType.setSelection(0);
    arrayAdapterType =
        ArrayAdapter.createFromResource(this, R.array.type_names, R.layout.spinner_item);
    spinnerType.setAdapter(arrayAdapterType);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.create_account, container, false);
    username = (EditText) v.findViewById(R.id.create_account_username);
    username.addTextChangedListener(mTextWatcher);
    password = (EditText) v.findViewById(R.id.create_account_password);
    password.addTextChangedListener(mTextWatcher);
    confirmPassword = (EditText) v.findViewById(R.id.create_account_confirm_password);
    confirmPassword.addTextChangedListener(mTextWatcher);
    errorText = (TextView) v.findViewById(R.id.error_label);
    mSettingsWarningLabel = (TextView) v.findViewById(R.id.settings_warn_label);
    createButton = (Button) v.findViewById(R.id.next);
    createButton.setOnClickListener(this);
    serverEdit = (AutoCompleteTextView) v.findViewById(R.id.xmpp_server);
    ArrayAdapter<CharSequence> completeAdapter =
        ArrayAdapter.createFromResource(
            getActivity(), R.array.xmpp_server_list, R.layout.simple_combobox_item);

    serverEdit.setAdapter(completeAdapter);
    serverEdit.addTextChangedListener(mTextWatcher);
    // show the list on second click on the text view
    serverEdit.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            serverEdit.showDropDown();
          }
        });
    return v;
  }
 @Override
 public void onClick(View v) {
   if (v == createButton) {
     boolean create = true;
     if (!checkUserName()) {
       username.setError(getString(R.string.create_account_err_username));
       create = false;
     }
     if (TextUtils.isEmpty(serverEdit.getText())) {
       serverEdit.setError("Choose a server");
       create = false;
     }
     if (!checkPasswords()) {
       password.setError(getString(R.string.create_account_err_passwords));
       confirmPassword.setError(getString(R.string.create_account_err_passwords));
       create = false;
     }
     if (create) {
       String jid = String.format("%s@%s", username.getText(), serverEdit.getText());
       jid = StringUtils.parseBareAddress(jid);
       String pass = password.getText().toString();
       task = new CreateAccountTask();
       task.execute(jid, pass);
     }
   }
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTheme();
    setContentView(R.layout.waypoint_new);
    setTitle("waypoint");

    if (geo == null) {
      geo = app.startGeo(geoUpdate);
    }

    // get parameters
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
      geocode = extras.getString("geocode");
      wpCount = extras.getInt("count", 0);
      id = extras.getInt("waypoint");
    }

    if (StringUtils.isBlank(geocode) && id <= 0) {
      showToast(res.getString(R.string.err_waypoint_cache_unknown));

      finish();
      return;
    }

    if (id <= 0) {
      setTitle(res.getString(R.string.waypoint_add_title));
    } else {
      setTitle(res.getString(R.string.waypoint_edit_title));
    }

    if (geocode != null) {
      app.setAction(geocode);
    }

    Button buttonLat = (Button) findViewById(R.id.buttonLatitude);
    buttonLat.setOnClickListener(new coordDialogListener());
    Button buttonLon = (Button) findViewById(R.id.buttonLongitude);
    buttonLon.setOnClickListener(new coordDialogListener());

    Button addWaypoint = (Button) findViewById(R.id.add_waypoint);
    addWaypoint.setOnClickListener(new coordsListener());

    List<String> wayPointNames = new ArrayList<String>(cgBase.waypointTypes.values());
    AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.name);
    ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, wayPointNames);
    textView.setAdapter(adapter);

    if (id > 0) {
      waitDialog = ProgressDialog.show(this, null, res.getString(R.string.waypoint_loading), true);
      waitDialog.setCancelable(true);

      (new loadWaypoint()).start();
    }

    disableSuggestions((EditText) findViewById(R.id.distance));
  }
  // Check whether all information needed for offering a ride
  // has been typed in by user
  public boolean inputValid() {
    boolean checkBelong = false, checkStart = false, checkEnd = false;
    if (isGroup || isEvent) {
      checkBelong = true;
    } else {
      System.out.println("Have not choose any group or event!!");
      Toast.makeText(
              getApplicationContext(), "Must select a group or an event!", Toast.LENGTH_SHORT)
          .show();
    }
    if (!EditStart.getText().toString().isEmpty()
        || isFromEvent
        || FromCurrentLocation.isChecked()) {
      checkStart = true;
    } else {
      System.out.println("Have not input start point!!");
      Toast.makeText(getApplicationContext(), "Must set start point!", Toast.LENGTH_SHORT).show();
    }
    if (!EditEnd.getText().toString().isEmpty() || isToEvent || ToCurrentLocation.isChecked()) {
      checkEnd = true;
    } else {
      System.out.println("Have not input end point!!");
      Toast.makeText(getApplicationContext(), "Must set end point!", Toast.LENGTH_SHORT).show();
    }

    return !((!checkBelong)
        || displayDate.getText().toString().isEmpty()
        || (displayStartTime.getText().toString().isEmpty() && !isFind)
        || displayArrivalTime.getText().toString().isEmpty()
        || (!checkStart)
        || (!checkEnd));
  }
Example #10
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);

    Window window = this.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    window.setStatusBarColor(this.getResources().getColor(R.color.colorPrimaryDark));

    SharedPreferences prefs = this.getSharedPreferences("server", Context.MODE_PRIVATE);

    String server = prefs.getString("server", "");

    if (server.length() > 1) {
      TextView textView = (TextView) findViewById(R.id.text_Server);
      textView.setText(server);
    }

    AutoCompleteTextView textView2 = (AutoCompleteTextView) findViewById(R.id.text_Server);

    String[] servers = getResources().getStringArray(R.array.server_array);

    ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, servers);
    textView2.setAdapter(adapter);

    activityName = getResources().getString(R.string.title_activity_settings);
  }
Example #11
0
  private void sendMessage() {
    AutoCompleteTextView gPerson = (AutoCompleteTextView) findViewById(R.id.contactPerson);
    String person = gPerson.getText().toString();

    Cursor cur =
        managedQuery(
            android.provider.Contacts.People.CONTENT_URI,
            null,
            android.provider.Contacts.PeopleColumns.NAME + "='" + person + "'",
            null);

    while (cur.next()) {
      String phone =
          cur.getString(cur.getColumnIndex(android.provider.Contacts.PhonesColumns.NUMBER));
      person = phone;
    }

    cur.close();

    EditText gMessage = (EditText) findViewById(R.id.textMessage);
    String message = gMessage.getText().toString();

    SmsManager manager = SmsManager.getDefault();
    manager.sendTextMessage(person, null, message, null, null, null);

    // save the sent message for the conversation.
    MessagesDbAdapter gDbAdapter = new MessagesDbAdapter(this);
    gDbAdapter.open();

    gDbAdapter.createMessage(person, message, 1, 1, System.currentTimeMillis());
    gDbAdapter.close();

    Toast.makeText(this, "Text message has been sent.", Toast.LENGTH_LONG).show();
    finish();
  }
Example #12
0
  private void initTitleButton() {
    search_title_search = (ImageButton) findViewById(R.id.search_title_search_id);
    search_title_textview = (AutoCompleteTextView) findViewById(R.id.search_title_textview_id);
    search_title_return = (ImageButton) findViewById(R.id.search_title_return_id);

    // 返回按钮响应

    // 文本框响应
    search_title_textview.addTextChangedListener(this);
    search_title_textview.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            if (position >= 0) {
              try {
                LatLng latlng =
                    new LatLng(
                        latLonPointList.get(position).getLatitude(),
                        latLonPointList.get(position).getLongitude());
                getAddress(latlng);
              } catch (NullPointerException e) {
                e.printStackTrace(System.out);
              }
            }
          }
        });

    // 搜索按钮响应
  }
Example #13
0
 /**
  * 初始化AutoCompleteTextView,最多显示5项提示,使 AutoCompleteTextView在一开始获得焦点时自动提示
  *
  * @param field 保存在sharedPreference中的字段名
  * @param auto 要操作的AutoCompleteTextView
  */
 private void initAutoComplete(String field, AutoCompleteTextView auto) {
   String[] hisArrays = getFieldHistInputData(field);
   if (hisArrays != null) {
     ArrayAdapter<String> adapter =
         new ArrayAdapter<String>(
             getActivity(), android.R.layout.simple_dropdown_item_1line, hisArrays);
     // 只保留最近的50条的记录
     if (hisArrays.length > 100) {
       String[] newArrays = new String[100];
       System.arraycopy(hisArrays, 0, newArrays, 0, 100);
       adapter =
           new ArrayAdapter<String>(
               getActivity(), android.R.layout.simple_dropdown_item_1line, newArrays);
     }
     auto.setAdapter(adapter);
     // auto.setDropDownHeight(350);
     auto.setThreshold(1);
     auto.setCompletionHint("历史记录");
     auto.setOnFocusChangeListener(
         new OnFocusChangeListener() {
           @Override
           public void onFocusChange(View v, boolean hasFocus) {
             AutoCompleteTextView view = (AutoCompleteTextView) v;
             if (hasFocus) {
               view.showDropDown();
             }
           }
         });
   }
 }
 private void setUpLayout() {
   edittext1 = (EditText) findViewById(R.id.edittext1);
   edittext2 = (EditText) findViewById(R.id.edittext2);
   edittext3 = (EditText) findViewById(R.id.edittext3);
   edittext4 = (EditText) findViewById(R.id.edittext4);
   edittext5 = (EditText) findViewById(R.id.edittext5);
   edittext6 = (EditText) findViewById(R.id.edittext6);
   edittext7 = (EditText) findViewById(R.id.edittext7);
   edittext8 = (EditText) findViewById(R.id.edittext8);
   edittext9 = (EditText) findViewById(R.id.edittext9);
   edittext10 = (EditText) findViewById(R.id.edittext10);
   radiobuttongroup1 = (RadioGroup) findViewById(R.id.radiogroup1);
   radiobutton1 = (RadioButton) findViewById(R.id.radiobutton1);
   radiobutton2 = (RadioButton) findViewById(R.id.radiobutton2);
   radiobuttongroup2 = (RadioGroup) findViewById(R.id.radiogroup2);
   radiobutton3 = (RadioButton) findViewById(R.id.radiobutton3);
   radiobutton4 = (RadioButton) findViewById(R.id.radiobutton4);
   radiobuttongroup3 = (RadioGroup) findViewById(R.id.radiogroup3);
   radiobutton5 = (RadioButton) findViewById(R.id.radiobutton5);
   radiobutton6 = (RadioButton) findViewById(R.id.radiobutton6);
   displayDateDialog();
   displayTimeDialog();
   autocompletetextview1 = (AutoCompleteTextView) findViewById(R.id.autocompletetextview1);
   autocompletetextview2 = (AutoCompleteTextView) findViewById(R.id.autocompletetextview2);
   DatabaseHandler obj = new DatabaseHandler(this);
   List<String> employeeList = obj.getAllEmployeeNames();
   ArrayAdapter<String> adapter =
       new ArrayAdapter<String>(this, R.layout.employee_list_item, employeeList);
   autocompletetextview1.setAdapter(adapter);
   List<String> productList = obj.getAllProducts();
   ArrayAdapter<String> adapter1 =
       new ArrayAdapter<String>(this, R.layout.product_list_item_1, productList);
   autocompletetextview2.setAdapter(adapter1);
 }
Example #15
0
 public void startDownloadListFaculties(ArrayAdapter<String> arrayAdapter) {
   if (!m_activeApp) {
     StaticStorage.m_listFaculties.clear();
     Thread thread;
     m_activeApp = true;
     m_download_finished = false;
     textView.setCompletionHint(getActivity().getString(R.string.placeholder_downloading));
     ServerGetFaculties serverGetFaclts =
         new ServerGetFaculties((ArrayAdapter<String>) textView.getAdapter());
     serverGetFaclts.execute();
     m_activeApp = true;
     thread =
         new Thread() {
           public void run() {
             try {
               while (!m_download_finished) {
                 Thread.sleep(200);
                 if (!textView.getAdapter().isEmpty()) {
                   textView.setCompletionHint("");
                   m_download_finished = true;
                 }
               } // while
             } catch (Exception ex) {
             }
           }
         };
     thread.start();
   }
 }
Example #16
0
 @Override
 public void onClick(View v) {
   textView.showDropDown();
   if (!((MainNavigationDrawer) getActivity()).isOnline())
     ((MainNavigationDrawer) getActivity()).askForInternet();
   else startDownloadListFaculties((ArrayAdapter<String>) textView.getAdapter());
 }
  /** 判断当前位置位于哪个校区 */
  private void judge_position() {
    if (mLocation.getLatitude() < 36.648152
        && mLocation.getLongitude() > 117.068195
        && mLocation.getLatitude() > 36.642666
        && mLocation.getLongitude() < 117.080217) {

      flag = 2; // 燕山校区
    } else if (mLocation.getLatitude() < 36.66187
        && mLocation.getLongitude() > 117.501132
        && mLocation.getLatitude() > 36.651857
        && mLocation.getLongitude() < 117.520319) {
      flag = 0; // 明水校区
    } else if (mLocation.getLatitude() < 36.674867
        && mLocation.getLongitude() > 117.370944
        && mLocation.getLatitude() > 36.665148
        && mLocation.getLongitude() < 117.380147) {
      flag = 1; // 圣井校区
    } else if (mLocation.getLatitude() < 36.631209
        && mLocation.getLongitude() > 117.019616
        && mLocation.getLatitude() > 36.619802
        && mLocation.getLongitude() < 117.026629) {
      flag = 3; // 舜耕校区
    }
    mMap.clear();
    this.flipper.setDisplayedChild(flag);
    mMap.animateCamera(
        CameraUpdateFactory.newLatLngZoom(position_schoolLatLngs[flag], zoom_current));
    startTextView.setText(null);
    endTextView.setText(null);
    isClickStart = true;
    isClickTarget = false;
    loadMap(flag + 2, true);
  }
  public void attemptSearch() {

    category = spinner.getSelectedItem().toString();
    title = searchtitle.getText().toString();
    autoOne = autoComplete1.getText().toString();
    autoTwo = autoComplete2.getText().toString();
    autoThree = autoComplete3.getText().toString();
    time = seekbar.getProgress();

    for (IngredientType i : ingredientsList) {
      if (i.getName().equals(autoOne)) {
        idOne = i.getID();
      }
      if (i.getName().equals(autoTwo)) {
        idTwo = i.getID();
      }
      if (i.getName().equals(autoThree)) {
        idThree = i.getID();
      }
    }

    mSearchStatusMessageView.setText(R.string.search_progress_signing_in);

    showProgress(true);

    mUserRecipesSearch = new UserRecipesSearch();
    mUserRecipesSearch.execute();
  }
  @UiThread
  void updateUiAdapter(Address address) {
    if (map == null) {
      return;
    }
    try {
      ignoreUpdate = true;
      CameraPosition position =
          new CameraPosition.Builder()
              .target(new LatLng(address.getLatitude(), address.getLongitude()))
              .zoom(currentZoom)
              .build();
      CameraUpdate update = CameraUpdateFactory.newCameraPosition(position);
      map.animateCamera(update);

      autocompleteEndereco.setAdapter(null);
      autocompleteEndereco.setText(street);
      autocompleteEndereco.setAdapter(
          new PlacesAutoCompleteAdapter(
              getActivity(), R.layout.autocomplete_list_item, ExploreFragment.class));
      tvNumero.setText(number);
    } catch (Exception e) {
      Log.e("ZUP", e.getMessage(), e);
      Crashlytics.logException(e);
    }
  }
Example #20
0
 /**
  * 初始化AutoCompleteTextView,最多显示5项提示,使 AutoCompleteTextView在一开始获得焦点时自动提示
  *
  * @param field 保存在sharedPreference中的字段名
  * @param autoCompleteTextView 要操作的AutoCompleteTextView
  */
 private void initAutoComplete(String field, AutoCompleteTextView autoCompleteTextView) {
   SharedPreferences sp = getSharedPreferences("network_url", 0);
   String longhistory = sp.getString("history", "");
   String[] histories = longhistory.split(",");
   ArrayAdapter<String> adapter =
       new ArrayAdapter<String>(context, android.R.layout.simple_dropdown_item_1line, histories);
   // 只保留最近的50条的记录
   if (histories.length > 50) {
     String[] newHistories = new String[50];
     System.arraycopy(histories, 0, newHistories, 0, 50);
     adapter =
         new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, newHistories);
   }
   autoCompleteTextView.setAdapter(adapter);
   autoCompleteTextView.setOnFocusChangeListener(
       new OnFocusChangeListener() {
         @Override
         public void onFocusChange(View v, boolean hasFocus) {
           AutoCompleteTextView view = (AutoCompleteTextView) v;
           if (hasFocus) {
             view.showDropDown();
           }
         }
       });
 }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    // set displayed values
    if (getArguments() != null) {
      if (getArguments().containsKey(ARG_QUERY)) {
        String query = getArguments().getString(ARG_QUERY);
        mQueryEditText.setText(query, TextView.BufferType.EDITABLE);

        Log.d(Constants.TAG, "query: " + query);
      }

      if (getArguments().containsKey(ARG_KEYSERVER)) {
        String keyserver = getArguments().getString(ARG_KEYSERVER);
        int keyserverPos = mServerAdapter.getPosition(keyserver);
        mServerSpinner.setSelection(keyserverPos);

        Log.d(Constants.TAG, "keyserver: " + keyserver);
      }

      if (getArguments().getBoolean(ARG_DISABLE_QUERY_EDIT, false)) {
        mQueryEditText.setEnabled(false);
      }
    }
  }
Example #22
0
  /**
   * 发起路线规划搜索示例
   *
   * @param v
   */
  void SearchButtonProcess(View v) {
    // 重置浏览节点的路线数据
    route = null;
    routeOverlay = null;
    transitOverlay = null;
    mBtnPre.setVisibility(View.INVISIBLE);
    mBtnNext.setVisibility(View.INVISIBLE);

    // 对起点终点的name进行赋值,也可以直接对坐标赋值,赋值坐标则将根据坐标进行搜索
    MKPlanNode stNode = new MKPlanNode();
    stNode.name = editSt.getText().toString();
    if (ptStart != null) {
      stNode.pt = ptStart;
    }

    MKPlanNode enNode = new MKPlanNode();
    enNode.name = editEn.getText().toString();
    if (ptEnd != null) {
      enNode.pt = ptEnd;
    }
    pb.show();
    // 实际使用中请对起点终点城市进行正确的设定
    if (mBtnDrive.equals(v)) {
      mSearch.drivingSearch("上海", stNode, "上海", enNode);
    } else if (mBtnTransit.equals(v)) {
      mSearch.transitSearch("上海", stNode, enNode);
    } else if (mBtnWalk.equals(v)) {
      mSearch.walkingSearch("上海", stNode, "上海", enNode);
    }
    ptEnd = null;
    ptStart = null;
  }
Example #23
0
  public void onClick(View v) {

    user_screen = username.getText().toString();
    switch (v.getId()) {
      case R.id.send:
        try {
          twitter.sendDirectMessage(user_screen, textMessage.getText().toString());

          Toast.makeText(
                  v.getContext(), "Direct Message sent to " + user_screen, Toast.LENGTH_SHORT)
              .show();
          textMessage.setText("");

          finish();

        } catch (TwitterException e) {
          Log.e("SEND_DM", "gagal ngirim DM: " + e.getMessage());

          if (user_screen.trim().equals("")) {
            username.setError("Username cannot be blank.");
          }

          if (textMessage.getText().toString().trim().equals("")) {
            textMessage.setError("Text Message cannot blank");
          }
        }

        break;
    }
  }
  private void init() {
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.advice);
    preferences = getSharedPreferences("image", MODE_PRIVATE);
    back = (ImageView) this.findViewById(R.id.back_advice);
    userName = (EditText) this.findViewById(R.id.user_name);
    userEmail = (AutoCompleteTextView) this.findViewById(R.id.user_email);
    /*emailPass = (EditText)this.findViewById(R.id.user_email_pass);*/
    adapter = new AutoTextViewAdapter(this);
    userEmail.setAdapter(adapter);
    userEmail.setThreshold(1); // 输入1个字符时就开始检测,默认为2个
    userEmail.addTextChangedListener(this); // 监听autoview的变化
    adviceInfo = (EditText) this.findViewById(R.id.advice_info);
    submit = (Button) this.findViewById(R.id.submit);
    submit.setOnClickListener(new SubmitListener());
    back.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            finish();
            overridePendingTransition(R.anim.push_below_in, R.anim.push_below_out);
          }
        });
    setBackground();
  }
  public void updateType(Amenity amenity) {
    poiTypeEditText.setText(amenity.getSubType());
    poiTypeTextInputLayout.setHint(amenity.getType().getTranslation());
    setAdapterForPoiTypeEditText();
    poiTypeEditText.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(final View v, MotionEvent event) {
            final EditText editText = (EditText) v;
            final int DRAWABLE_RIGHT = 2;
            if (event.getAction() == MotionEvent.ACTION_UP) {
              if (event.getX()
                  >= (editText.getRight()
                      - editText.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width()
                      - editText.getPaddingRight())) {
                if (editPoiData.amenity.getType() != null) {
                  DialogFragment dialogFragment =
                      PoiSubTypeDialogFragment.createInstance(editPoiData.amenity);
                  dialogFragment.show(getChildFragmentManager(), "PoiSubTypeDialogFragment");
                }

                return true;
              }
            }
            return false;
          }
        });
  }
  private void save() {
    if (TextUtils.isEmpty(poiTypeEditText.getText())) {
      poiTypeEditText.setError(getResources().getString(R.string.please_specify_poi_type));
      return;
    }
    OsmPoint.Action action = node.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY;
    for (Map.Entry<String, String> tag : editPoiData.getTagValues().entrySet()) {
      if (tag.getKey().equals(EditPoiData.POI_TYPE_TAG)) {
        final PoiType poiType = allTranslatedSubTypes.get(tag.getValue().trim().toLowerCase());
        if (poiType != null) {
          node.putTag(poiType.getOsmTag(), poiType.getOsmValue());
          if (poiType.getOsmTag2() != null) {
            node.putTag(poiType.getOsmTag2(), poiType.getOsmValue2());
          }
        } else {
          node.putTag(editPoiData.amenity.getType().getDefaultTag(), tag.getValue());
        }
        //					} else if (tag.tag.equals(OSMSettings.OSMTagKey.DESCRIPTION.getValue())) {
        //						description = tag.value;
      } else {
        if (tag.getKey().length() > 0) {
          node.putTag(tag.getKey(), tag.getValue());
        } else {
          node.removeTag(tag.getKey());
        }
      }
    }
    commitNode(
        action,
        node,
        mOpenstreetmapUtil.getEntityInfo(),
        "",
        false, // closeChange.isSelected(),
        new Runnable() {
          @Override
          public void run() {
            OsmEditingPlugin plugin = OsmandPlugin.getPlugin(OsmEditingPlugin.class);
            if (plugin != null) {
              List<OpenstreetmapPoint> points = plugin.getDBPOI().getOpenstreetmapPoints();
              OsmPoint point = points.get(points.size() - 1);
              if (getActivity() instanceof MapActivity) {
                MapActivity mapActivity = (MapActivity) getActivity();
                mapActivity
                    .getContextMenu()
                    .showOrUpdate(
                        new LatLon(point.getLatitude(), point.getLongitude()),
                        plugin.getOsmEditsLayer(mapActivity).getObjectName(point),
                        point);
              }
            }

            if (getActivity() instanceof MapActivity) {
              ((MapActivity) getActivity()).getMapView().refreshMap(true);
            }
            dismiss();
          }
        },
        getActivity(),
        mOpenstreetmapUtil);
  }
Example #27
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setHasOptionsMenu(true);

    View v = inflater.inflate(R.layout.fragment_vendorgrid, null);

    mGvVendors = (GridView) v.findViewById(R.id.gv_vendorlist);
    mActvSearch = (AutoCompleteTextView) v.findViewById(R.id.actv_search);

    mSearchAdapter = new SearchGridAdapter();
    mVendorAdapter = new VendorGridAdapter();
    mGvVendors.setAdapter(mVendorAdapter);
    mGvVendors.setOnItemClickListener(mOnVendorClickListener);

    mActvSearch.addTextChangedListener(mOnSearchTextWatcher);
    if (!mSearchWasVisible) {
      mActvSearch.setVisibility(View.GONE);
    }
    getActivity().setTitle(R.string.app_name);

    if (getActivity() instanceof ActivityMain) {
      ((ActivityMain) getActivity()).setOnBackKeyListener(this);
    }

    return v;
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (!isGooglePlayServicesAvailable()) {
      finish();
    }

    // Create view
    setContentView(R.layout.activity_home_page);

    // Spinner
    spinner = (ProgressBar) findViewById(R.id.progressBar);
    spinner.bringToFront();
    spinner.setVisibility(View.GONE);

    // Add Maps
    mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
    mapsActivity = new MapsActivity(getBaseContext(), mapFragment, this);

    // Get Autocomplete textview
    autoCompView = (AutoCompleteTextView) findViewById(R.id.destination);
    autoCompView.setAdapter(new GooglePlacesAutocompleteAdapter(this, R.layout.list_item));
    autoCompView.setOnItemClickListener(this);

    // Add background to Done button
    submitUpdate = (Button) findViewById(R.id.submitUpdate);
    submitUpdate.getBackground().setColorFilter(0xFF000000, PorterDuff.Mode.MULTIPLY);

    // Set Date TimePicker
    setDateTimePicker();
    // Call the method to call the Maps activity
    // Set the drawer
    setupDrawer();
    addDrawerItems();
    // Get hidden Panel
    hiddenPanel = findViewById(R.id.hidden_panel);

    // Call to get API esults
    apiResults = new GetAPIResults(getBaseContext(), mapFragment, this);

    // Check if there is a savedInstance
    if (savedInstanceState != null && savedInstanceState.getString("parking_listings") != null) {
      saved = true;
      JSONArray parking_listings_array = null;

      try {
        latitude = savedInstanceState.getDouble("lat");
        longitude = savedInstanceState.getDouble("lng");
        parking_listings = savedInstanceState.getString("parking_listings");
        parking_listings_array = new JSONArray(parking_listings);
        mapsActivity.addMapsOnMarker(parking_listings_array, latitude, longitude);
      } catch (JSONException e) {
        e.printStackTrace();
      }
    } else {
      mMap = mapFragment.getMap();
      getCurrentLocationOfUser();
    }
  }
 private void findViews() {
   profileImageView = (ImageView) _view.findViewById(R.id.imv_photo);
   profileImageView.setImageBitmap(mProfile.getPhoto());
   usernameTextView = (AutoCompleteTextView) _view.findViewById(R.id.txv_username);
   usernameTextView.setText(mProfile.getUserName());
   messageTextView = (AutoCompleteTextView) _view.findViewById(R.id.txv_message);
   messageTextView.setText(mProfile.getMessage());
 }
 private void loadStates() {
   Country country = Countries.getCountryForName(countryField.getText().toString());
   if (country != null) {
     List<String> states = country.getStates();
     stateField.setAdapter(
         new ArrayAdapter<>(getActivity(), android.R.layout.simple_dropdown_item_1line, states));
   }
 }