public View getView(int position, View convertView, ViewGroup parent) { final View view = (convertView != null) ? convertView : LayoutInflater.from(parent.getContext()) .inflate(R.layout.bookmark_item, parent, false); final ImageView imageView = (ImageView) view.findViewById(R.id.bookmark_item_icon); final TextView textView = (TextView) view.findViewById(R.id.bookmark_item_text); final TextView bookTitleView = (TextView) view.findViewById(R.id.bookmark_item_booktitle); final Bookmark bookmark = getItem(position); if (bookmark == null) { imageView.setVisibility(View.VISIBLE); imageView.setImageResource(R.drawable.ic_list_plus); textView.setText(ZLResource.resource("bookmarksView").getResource("new").getValue()); bookTitleView.setVisibility(View.GONE); } else { imageView.setVisibility(View.GONE); textView.setText(bookmark.getText()); if (myCurrentBook) { bookTitleView.setVisibility(View.GONE); } else { bookTitleView.setVisibility(View.VISIBLE); bookTitleView.setText(bookmark.getBookTitle()); } } return view; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout containing a title and body text. ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.estadistica_view, container, false); int idEstadistica = this.mPageNumber; // Titulo y descripcion de estadistica TextView tituloEstadistica = (TextView) rootView.findViewById(R.id.TxtTituloEstadistica); TextView descEstadistica = (TextView) rootView.findViewById(R.id.TxtDescEstadistica); tituloEstadistica.setText(RelacionEstadisticas.getRelacion().get(idEstadistica).getTitulo()); descEstadistica.setText(RelacionEstadisticas.getRelacion().get(idEstadistica).getDescripcion()); rootView.addView( new EstadisticaViewLayout(Utilidades.getAppContext()) .getView(RelacionEstadisticas.getRelacion().get(idEstadistica))); // } // catch (Exception e) // { // Toast.makeText(Utilidades.getAppContext(), "error: " + e.getLocalizedMessage(), // Toast.LENGTH_LONG).show(); // Log.e("ERROR", e.getLocalizedMessage()); // } // Set the title view to show the page number. /*((TextView) rootView.findViewById(android.R.id.text1)).setText( getString(R.string.title_template_step, mPageNumber + 1));*/ return rootView; }
/** Clears the table, removes all values. */ public void ClearForm() { Utilities.LogDebug("GpsMainActivity.ClearForm"); TextView tvLatitude = (TextView) findViewById(R.id.txtLatitude); TextView tvLongitude = (TextView) findViewById(R.id.txtLongitude); TextView tvDateTime = (TextView) findViewById(R.id.txtDateTimeAndProvider); TextView tvAltitude = (TextView) findViewById(R.id.txtAltitude); TextView txtSpeed = (TextView) findViewById(R.id.txtSpeed); TextView txtSatellites = (TextView) findViewById(R.id.txtSatellites); TextView txtDirection = (TextView) findViewById(R.id.txtDirection); TextView txtAccuracy = (TextView) findViewById(R.id.txtAccuracy); tvLatitude.setText(""); tvLongitude.setText(""); tvDateTime.setText(""); tvAltitude.setText(""); txtSpeed.setText(""); txtSatellites.setText(""); txtDirection.setText(""); txtAccuracy.setText(""); }
public void onFileName(String newFileName) { if (newFileName == null || newFileName.length() <= 0) { return; } TextView txtFilename = (TextView) findViewById(R.id.txtFileName); if (AppSettings.shouldLogToGpx() || AppSettings.shouldLogToKml()) { txtFilename.setText( getString(R.string.summary_current_filename_format, Session.getCurrentFileName())); } else { txtFilename.setText(""); } }
/* Scan the files in the new directory, and store them in the filelist. * Update the UI by refreshing the list adapter. */ private void loadDirectory(String newdirectory) { if (newdirectory.equals("../")) { try { directory = new File(directory).getParent(); } catch (Exception e) { } } else { directory = newdirectory; } SharedPreferences.Editor editor = getPreferences(0).edit(); editor.putString("lastBrowsedDirectory", directory); editor.commit(); directoryView.setText(directory); filelist = new ArrayList<FileUri>(); ArrayList<FileUri> sortedDirs = new ArrayList<FileUri>(); ArrayList<FileUri> sortedFiles = new ArrayList<FileUri>(); if (!newdirectory.equals(rootdir)) { String parentDirectory = new File(directory).getParent() + "/"; Uri uri = Uri.parse("file://" + parentDirectory); sortedDirs.add(new FileUri(uri, parentDirectory)); } try { File dir = new File(directory); File[] files = dir.listFiles(); if (files != null) { for (File file : files) { if (file == null) { continue; } String filename = file.getName(); if (file.isDirectory()) { Uri uri = Uri.parse("file://" + file.getAbsolutePath() + "/"); FileUri fileuri = new FileUri(uri, uri.getPath()); sortedDirs.add(fileuri); } else if (filename.endsWith(".mid") || filename.endsWith(".MID") || filename.endsWith(".midi") || filename.endsWith(".MIDI")) { Uri uri = Uri.parse("file://" + file.getAbsolutePath()); FileUri fileuri = new FileUri(uri, uri.getLastPathSegment()); sortedFiles.add(fileuri); } } } } catch (Exception e) { } if (sortedDirs.size() > 0) { Collections.sort(sortedDirs, sortedDirs.get(0)); } if (sortedFiles.size() > 0) { Collections.sort(sortedFiles, sortedFiles.get(0)); } filelist.addAll(sortedDirs); filelist.addAll(sortedFiles); adapter = new IconArrayAdapter<FileUri>(this, android.R.layout.simple_list_item_1, filelist); this.setListAdapter(adapter); }
private void setPickerFragmentSettingsFromBundle(Bundle inState) { // We do this in a separate non-overridable method so it is safe to call from the constructor. if (inState != null) { showPictures = inState.getBoolean(SHOW_PICTURES_BUNDLE_KEY, showPictures); String extraFieldsString = inState.getString(EXTRA_FIELDS_BUNDLE_KEY); if (extraFieldsString != null) { String[] strings = extraFieldsString.split(","); setExtraFields(Arrays.asList(strings)); } showTitleBar = inState.getBoolean(SHOW_TITLE_BAR_BUNDLE_KEY, showTitleBar); String titleTextString = inState.getString(TITLE_TEXT_BUNDLE_KEY); if (titleTextString != null) { titleText = titleTextString; if (titleTextView != null) { titleTextView.setText(titleText); } } String doneButtonTextString = inState.getString(DONE_BUTTON_TEXT_BUNDLE_KEY); if (doneButtonTextString != null) { doneButtonText = doneButtonTextString; if (doneButton != null) { doneButton.setText(doneButtonText); } } } }
@Override public void onCreate(Bundle savedInstanceState) { c = this; preferences = PreferenceManager.getDefaultSharedPreferences(c); super.onCreate(savedInstanceState); setContentView(R.layout.gpu_sgx540); gpuCurrent = readFile(Constants.GPU_SGX540); seekGpu = (SeekBar) findViewById(R.id.seek_gpu); gpu = Arrays.asList(153, 307, 384); seekBar(gpu.size() - 1, gpu.indexOf(gpuCurrent)); /*else{ seekGpu.setEnabled(false); seekIva.setEnabled(false); TextView ns = (TextView)findViewById(R.id.not_supported); ns.setVisibility(View.VISIBLE); }*/ preferences = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); curGpuTxt = (TextView) findViewById(R.id.current_gpu); maxGpuTxt = (TextView) findViewById(R.id.max_gpu); minGpuTxt = (TextView) findViewById(R.id.min_gpu); mhz = getResources().getString(R.string.mhz); current = getResources().getString(R.string.current); max = getResources().getString(R.string._max); min = getResources().getString(R.string._min); curGpuTxt.setText(current + ": " + (gpuCurrent) + mhz); maxGpuTxt.setText(max + ": " + gpu.get(2) + mhz); minGpuTxt.setText(min + ": " + gpu.get(0) + mhz); Button cancel = (Button) findViewById(R.id.cancel); cancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { finish(); } }); }
private void updateLoader() { if (NavigineApp.Navigation == null) return; // Log.d(TAG, String.format(Locale.ENGLISH, "Update loader: %d", mLoader)); long timeNow = DateTimeUtils.currentTimeMillis(); if (mLoader < 0) return; int status = LocationLoader.checkLocationLoader(mLoader); if (status < 100) { if ((Math.abs(timeNow - mLoaderTime) > LOADER_TIMEOUT / 3 && status == 0) || (Math.abs(timeNow - mLoaderTime) > LOADER_TIMEOUT)) { mListView.setVisibility(View.GONE); mStatusLabel.setVisibility(View.VISIBLE); mStatusLabel.setText("Loading timeout!\nPlease, check your internet connection!"); Log.d(TAG, String.format(Locale.ENGLISH, "Load stopped on timeout!")); LocationLoader.stopLocationLoader(mLoader); mLoader = -1; } else { mListView.setVisibility(View.GONE); mStatusLabel.setVisibility(View.VISIBLE); mStatusLabel.setText(String.format(Locale.ENGLISH, "Loading content (%d%%)", status)); } } else { Log.d(TAG, String.format(Locale.ENGLISH, "Load finished with result: %d", status)); LocationLoader.stopLocationLoader(mLoader); mLoader = -1; if (status == 100) { parseMapsXml(); if (mInfoList.isEmpty()) { mListView.setVisibility(View.GONE); mStatusLabel.setVisibility(View.VISIBLE); mStatusLabel.setText("No locations available"); } else { mListView.setVisibility(View.VISIBLE); mStatusLabel.setVisibility(View.GONE); } } else { mListView.setVisibility(View.GONE); mStatusLabel.setVisibility(View.VISIBLE); mStatusLabel.setText("Error loading!\nPlease, check your ID!"); } } }
@Override public boolean onChildClick( ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { // TODO Auto-generated method stub String s = "選擇:群組" + groupPosition + ", 選項" + childPosition + ", ID" + id; mTxtResult.setText(s); return super.onChildClick(parent, v, groupPosition, childPosition, id); }
protected void populateGraphObjectView(View view, T graphObject) { String id = getIdOfGraphObject(graphObject); view.setTag(id); CharSequence title = getTitleOfGraphObject(graphObject); TextView titleView = (TextView) view.findViewById(R.id.com_facebook_picker_title); if (titleView != null) { titleView.setText(title, TextView.BufferType.SPANNABLE); } CharSequence subtitle = getSubTitleOfGraphObject(graphObject); TextView subtitleView = (TextView) view.findViewById(R.id.picker_subtitle); if (subtitleView != null) { if (subtitle != null) { subtitleView.setText(subtitle, TextView.BufferType.SPANNABLE); subtitleView.setVisibility(View.VISIBLE); } else { subtitleView.setVisibility(View.GONE); } } if (getShowCheckbox()) { CheckBox checkBox = (CheckBox) view.findViewById(R.id.com_facebook_picker_checkbox); updateCheckboxState(checkBox, isGraphObjectSelected(id)); } if (getShowPicture()) { URI pictureURI = getPictureUriOfGraphObject(graphObject); if (pictureURI != null) { ImageView profilePic = (ImageView) view.findViewById(R.id.com_facebook_picker_image); // See if we have already pre-fetched this; if not, download it. if (prefetchedPictureCache.containsKey(id)) { ImageResponse response = prefetchedPictureCache.get(id); profilePic.setImageBitmap(response.getBitmap()); profilePic.setTag(response.getRequest().getImageUri()); } else { downloadProfilePicture(id, pictureURI, profilePic); } } } }
@Override public void handleResponse(BackendlessCollection<SearchMatchesResult> response) { for (SearchMatchesResult geoPoint : response.getCurrentPage()) { if (geoPoint.getGeoPoint().equals(targetUserGeoPoint)) { travelMatchCount = geoPoint.getMatches(); if (travelMatchCount <= 1) travelMatchCount = travelMatchCount * 100; travelMatchValue.setText(String.valueOf(round(travelMatchCount, 2))); travelProgressBar.setProgress((int) round(travelMatchCount, 2)); travel = true; } } if (music == true && food == true && hobbies == true && travel == true) { summMatch = (foodMatchCount + musicMatchCount + hobbiesMatchCount + travelMatchCount) / 4; matchPercentField.setText(String.valueOf(round(summMatch, 2))); progressDialog.cancel(); } }
protected View getSectionHeaderView(String sectionHeader, View convertView, ViewGroup parent) { TextView result = (TextView) convertView; if (result == null) { result = (TextView) inflater.inflate(R.layout.com_facebook_picker_list_section_header, null); } result.setText(sectionHeader); return result; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { LayoutInflater vi = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); v = vi.inflate(R.layout.row, null); } Message m = items.get(position); // if (m != null) { m.createColorFromString(m.from); TextView tt = (TextView) v.findViewById(R.id.username); TextView bt = (TextView) v.findViewById(R.id.message); if (isMonospaced) { tt.setTypeface(Typeface.MONOSPACE); bt.setTypeface(Typeface.MONOSPACE); } tt.setText(m.getFrom()); tt.setTextColor(m.color); bt.setText(m.getMessage()); // } return v; }
@SuppressWarnings("deprecation") private void inflateTitleBar(ViewGroup view) { ViewStub stub = (ViewStub) view.findViewById(R.id.com_facebook_picker_title_bar_stub); if (stub != null) { View titleBar = stub.inflate(); final RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); layoutParams.addRule(RelativeLayout.BELOW, R.id.com_facebook_picker_title_bar); listView.setLayoutParams(layoutParams); if (titleBarBackground != null) { titleBar.setBackgroundDrawable(titleBarBackground); } doneButton = (Button) view.findViewById(R.id.com_facebook_picker_done_button); if (doneButton != null) { doneButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { logAppEvents(true); appEventsLogged = true; if (onDoneButtonClickedListener != null) { onDoneButtonClickedListener.onDoneButtonClicked(PickerFragment.this); } } }); if (getDoneButtonText() != null) { doneButton.setText(getDoneButtonText()); } if (doneButtonBackground != null) { doneButton.setBackgroundDrawable(doneButtonBackground); } } titleTextView = (TextView) view.findViewById(R.id.com_facebook_picker_title); if (titleTextView != null) { if (getTitleText() != null) { titleTextView.setText(getTitleText()); } } } }
@Override public View getView(final int position, View convertView, ViewGroup parent) { View view = convertView; if (view == null) { LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.content_list_item, null); } TextView titleTextView = (TextView) view.findViewById(R.id.list_item_title); TextView stateTextView = (TextView) view.findViewById(R.id.list_item_state); TextView downTextView = (TextView) view.findViewById(R.id.list_item_downbar); Button downloadButton = (Button) view.findViewById(R.id.list_item_download_button); Button uploadButton = (Button) view.findViewById(R.id.list_item_upload_button); LocationInfo info = mInfoList.get(position); String titleText = info.title; String stateText = ""; if (titleText.length() > 30) titleText = titleText.substring(0, 28) + "..."; synchronized (mLoaderMap) { if (mLoaderMap.containsKey(info.title)) { LoaderState loader = mLoaderMap.get(info.title); if (loader.state < 100) stateText = String.format(Locale.ENGLISH, "%d%%", loader.state); else if (loader.state == 100) stateText = String.format(Locale.ENGLISH, "Done!"); else stateText = String.format(Locale.ENGLISH, "Failed!"); } } if (info.localVersion < 0) titleText += " (?)"; else { if (info.localModified) titleText += String.format(Locale.ENGLISH, " (v. %d+)", info.localVersion); else titleText += String.format(Locale.ENGLISH, " (v. %d)", info.localVersion); } String mapFile = NavigineApp.Settings.getString("map_file", ""); if (mapFile.equals(info.archiveFile)) { titleTextView.setTypeface(null, Typeface.BOLD); view.setBackgroundColor(Color.parseColor("#590E0E")); } else { titleTextView.setTypeface(null, Typeface.NORMAL); view.setBackgroundColor(Color.BLACK); } titleTextView.setText(titleText); stateTextView.setText(stateText); if (info.localModified) { downloadButton.setVisibility(View.GONE); uploadButton.setVisibility(View.VISIBLE); downTextView.setText("Version is modified. Upload?"); } else if (info.serverVersion > info.localVersion) { downloadButton.setVisibility(View.VISIBLE); uploadButton.setVisibility(View.GONE); String downText = String.format(Locale.ENGLISH, "Version available: %d", info.serverVersion); downTextView.setText(downText); } else { downloadButton.setVisibility(View.INVISIBLE); uploadButton.setVisibility(View.GONE); downTextView.setText("Version is up to date"); } downloadButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { startDownload(position); } }); uploadButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { startUpload(position); } }); return view; }
/** * Given a location fix, processes it and displays it in the table on the form. * * @param loc Location information */ private void DisplayLocationInfo(Location loc) { Utilities.LogDebug("GpsMainActivity.DisplayLocationInfo"); try { if (loc == null) { return; } TextView tvLatitude = (TextView) findViewById(R.id.txtLatitude); TextView tvLongitude = (TextView) findViewById(R.id.txtLongitude); TextView tvDateTime = (TextView) findViewById(R.id.txtDateTimeAndProvider); TextView tvAltitude = (TextView) findViewById(R.id.txtAltitude); TextView txtSpeed = (TextView) findViewById(R.id.txtSpeed); TextView txtSatellites = (TextView) findViewById(R.id.txtSatellites); TextView txtDirection = (TextView) findViewById(R.id.txtDirection); TextView txtAccuracy = (TextView) findViewById(R.id.txtAccuracy); String providerName = loc.getProvider(); if (providerName.equalsIgnoreCase("gps")) { providerName = getString(R.string.providername_gps); } else { providerName = getString(R.string.providername_celltower); } tvDateTime.setText( new Date(Session.getLatestTimeStamp()).toLocaleString() + getString(R.string.providername_using, providerName)); tvLatitude.setText(String.valueOf(loc.getLatitude())); tvLongitude.setText(String.valueOf(loc.getLongitude())); if (loc.hasAltitude()) { double altitude = loc.getAltitude(); if (AppSettings.shouldUseImperial()) { tvAltitude.setText( String.valueOf(Utilities.MetersToFeet(altitude)) + getString(R.string.feet)); } else { tvAltitude.setText(String.valueOf(altitude) + getString(R.string.meters)); } } else { tvAltitude.setText(R.string.not_applicable); } if (loc.hasSpeed()) { float speed = loc.getSpeed(); String unit; if (AppSettings.shouldUseImperial()) { if (speed > 1.47) { speed = speed * 0.6818f; unit = getString(R.string.miles_per_hour); } else { speed = Utilities.MetersToFeet(speed); unit = getString(R.string.feet_per_second); } } else { if (speed > 0.277) { speed = speed * 3.6f; unit = getString(R.string.kilometers_per_hour); } else { unit = getString(R.string.meters_per_second); } } txtSpeed.setText(String.valueOf(speed) + unit); } else { txtSpeed.setText(R.string.not_applicable); } if (loc.hasBearing()) { float bearingDegrees = loc.getBearing(); String direction; direction = Utilities.GetBearingDescription(bearingDegrees, getApplicationContext()); txtDirection.setText( direction + "(" + String.valueOf(Math.round(bearingDegrees)) + getString(R.string.degree_symbol) + ")"); } else { txtDirection.setText(R.string.not_applicable); } if (!Session.isUsingGps()) { txtSatellites.setText(R.string.not_applicable); Session.setSatelliteCount(0); } if (loc.hasAccuracy()) { float accuracy = loc.getAccuracy(); if (AppSettings.shouldUseImperial()) { txtAccuracy.setText( getString( R.string.accuracy_within, String.valueOf(Utilities.MetersToFeet(accuracy)), getString(R.string.feet))); } else { txtAccuracy.setText( getString( R.string.accuracy_within, String.valueOf(accuracy), getString(R.string.meters))); } } else { txtAccuracy.setText(R.string.not_applicable); } } catch (Exception ex) { SetStatus(getString(R.string.error_displaying, ex.getMessage())); } }
/** * Sets the number of satellites in the satellite row in the table. * * @param number The number of satellites */ private void SetSatelliteInfo(int number) { Session.setSatelliteCount(number); TextView txtSatellites = (TextView) findViewById(R.id.txtSatellites); txtSatellites.setText(String.valueOf(number)); }
/** * Sets the message in the top status label. * * @param message The status message */ private void SetStatus(String message) { Utilities.LogDebug("GpsMainActivity.SetStatus: " + message); TextView tvStatus = (TextView) findViewById(R.id.textStatus); tvStatus.setText(message); Utilities.LogInfo(message); }
/** Displays a human readable summary of the preferences chosen by the user on the main form */ private void ShowPreferencesSummary() { Utilities.LogDebug("GpsMainActivity.ShowPreferencesSummary"); try { TextView txtLoggingTo = (TextView) findViewById(R.id.txtLoggingTo); TextView txtFrequency = (TextView) findViewById(R.id.txtFrequency); TextView txtDistance = (TextView) findViewById(R.id.txtDistance); TextView txtAutoEmail = (TextView) findViewById(R.id.txtAutoEmail); if (!AppSettings.shouldLogToKml() && !AppSettings.shouldLogToGpx()) { txtLoggingTo.setText(R.string.summary_loggingto_screen); } else if (AppSettings.shouldLogToGpx() && AppSettings.shouldLogToKml()) { txtLoggingTo.setText(R.string.summary_loggingto_both); } else { txtLoggingTo.setText((AppSettings.shouldLogToGpx() ? "GPX" : "KML")); } if (AppSettings.getMinimumSeconds() > 0) { String descriptiveTime = Utilities.GetDescriptiveTimeString( AppSettings.getMinimumSeconds(), getApplicationContext()); txtFrequency.setText(descriptiveTime); } else { txtFrequency.setText(R.string.summary_freq_max); } if (AppSettings.getMinimumDistanceInMeters() > 0) { if (AppSettings.shouldUseImperial()) { int minimumDistanceInFeet = Utilities.MetersToFeet(AppSettings.getMinimumDistanceInMeters()); txtDistance.setText( ((minimumDistanceInFeet == 1) ? getString(R.string.foot) : String.valueOf(minimumDistanceInFeet) + getString(R.string.feet))); } else { txtDistance.setText( ((AppSettings.getMinimumDistanceInMeters() == 1) ? getString(R.string.meter) : String.valueOf(AppSettings.getMinimumDistanceInMeters()) + getString(R.string.meters))); } } else { txtDistance.setText(R.string.summary_dist_regardless); } if (AppSettings.isAutoEmailEnabled()) { String autoEmailResx; if (AppSettings.getAutoEmailDelay() == 0) { autoEmailResx = "autoemail_frequency_whenistop"; } else { autoEmailResx = "autoemail_frequency_" + String.valueOf(AppSettings.getAutoEmailDelay()).replace(".", ""); } String autoEmailDesc = getString(getResources().getIdentifier(autoEmailResx, "string", getPackageName())); txtAutoEmail.setText(autoEmailDesc); } else { TableRow trAutoEmail = (TableRow) findViewById(R.id.trAutoEmail); trAutoEmail.setVisibility(View.INVISIBLE); } onFileName(Session.getCurrentFileName()); } catch (Exception ex) { Utilities.LogError("ShowPreferencesSummary", ex); } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.matchview); progressDialog = UIFactory.getDefaultProgressDialog(this); TextView nameField = (TextView) findViewById(R.id.nameField); TextView genderField = (TextView) findViewById(R.id.genderField); TextView ageField = (TextView) findViewById(R.id.ageField); ImageView avatarImage = (ImageView) findViewById(R.id.avatarImage); ImageView genderImage = (ImageView) findViewById(R.id.genderImage); matchPercentField = (TextView) findViewById(R.id.matchPercents); foodMatchValue = (TextView) findViewById(R.id.foodMatchValue); foodProgressBar = (ProgressBar) findViewById(R.id.foodProgressBar); musicMatchValue = (TextView) findViewById(R.id.musicMatchValue); musicProgressBar = (ProgressBar) findViewById(R.id.musicProgressBar); hobbiesMatchValue = (TextView) findViewById(R.id.hobbiesMatchValue); hobbiesProgressBar = (ProgressBar) findViewById(R.id.hobbiesProgressBar); travelMatchValue = (TextView) findViewById(R.id.travelMatchValue); travelProgressBar = (ProgressBar) findViewById(R.id.travelProgressBar); currentUserGeoPoint = (GeoPoint) getIntent().getSerializableExtra(Defaults.CURRENT_USER_GEO_POINT_BUNDLE_TAG); targetUserGeoPoint = (GeoPoint) getIntent().getSerializableExtra(Defaults.TARGET_USER_GEO_POINT_BUNDLE_TAG); triger = getIntent().getStringExtra(Defaults.TRIGER); String targetUserEmail = targetUserGeoPoint.getMetadata(BackendlessUser.EMAIL_KEY); targetUserName = targetUserGeoPoint.getMetadata(Defaults.NAME_PROPERTY); Gender targetUserGender = Gender.valueOf(targetUserGeoPoint.getMetadata(Defaults.GENDER_PROPERTY)); targetUserDeviceRegistrationId = targetUserGeoPoint.getMetadata(Defaults.DEVICE_REGISTRATION_ID_PROPERTY); Date userBirthDate; try { userBirthDate = Defaults.DEFAULT_DATE_FORMATTER.parse( targetUserGeoPoint.getMetadata(Defaults.BIRTH_DATE_PROPERTY)); } catch (ParseException e) { progressDialog.cancel(); Log.logLine(e); return; } Button actionButton = (Button) findViewById(R.id.actionButton); if (!targetUserGeoPoint .getMetadata() .containsKey(Backendless.UserService.CurrentUser().getEmail()) || !currentUserGeoPoint.getMetadata().containsKey(targetUserEmail)) { actionButton.setText(getResources().getText(R.string.button_match_ping)); actionButton.setOnClickListener(pingUserListener); } else { actionButton.setText(getResources().getText(R.string.button_sendmessage)); actionButton.setOnClickListener(sendMessageListener); } nameField.setText(targetUserName); genderField.setText(targetUserGender.name()); if (targetUserGender == Gender.male) { avatarImage.setImageDrawable(getResources().getDrawable(R.drawable.avatar_default_male)); genderImage.setImageDrawable(getResources().getDrawable(R.drawable.icon_male)); } else { avatarImage.setImageDrawable(getResources().getDrawable(R.drawable.avatar_default_female)); genderImage.setImageDrawable(getResources().getDrawable(R.drawable.icon_female)); } ageField.setText(String.valueOf(SimpleMath.getAgeFromDate(userBirthDate))); // Food Map<String, String> metaDataFood = new HashMap<String, String>(); metaDataFood.put("Asian", foodName); metaDataFood.put("Caribean", foodName); metaDataFood.put("Bar food", foodName); metaDataFood.put("French", foodName); metaDataFood.put("Mediterranean", foodName); metaDataFood.put("Greek", foodName); metaDataFood.put("Spanish", foodName); metaDataFood.put("Mexican", foodName); metaDataFood.put("Thai", foodName); int maxPoints = 10; BackendlessGeoQuery backendlessGeoQuery = new BackendlessGeoQuery(metaDataFood, maxPoints); backendlessGeoQuery.setPageSize(50); backendlessGeoQuery.setIncludeMeta(true); food = false; Backendless.Geo.relativeFind(backendlessGeoQuery, gotFoodCallback); // Music Map<String, String> metaDataMusic = new HashMap<String, String>(); metaDataMusic.put("Classical", musicName); metaDataMusic.put("Jazz", musicName); metaDataMusic.put("Hip-hop", musicName); metaDataMusic.put("Reggae", musicName); metaDataMusic.put("Blues", musicName); metaDataMusic.put("Trance", musicName); metaDataMusic.put("House", musicName); metaDataMusic.put("Rock", musicName); metaDataMusic.put("Folk", musicName); backendlessGeoQuery = new BackendlessGeoQuery(metaDataMusic, maxPoints); backendlessGeoQuery.setPageSize(50); backendlessGeoQuery.setIncludeMeta(true); music = false; Backendless.Geo.relativeFind(backendlessGeoQuery, gotMusicCallback); // Hobbies Map<String, String> metaDataHobbies = new HashMap<String, String>(); metaDataHobbies.put("Fishing", hobbiesName); metaDataHobbies.put("Diving", hobbiesName); metaDataHobbies.put("Rock climbing", hobbiesName); metaDataHobbies.put("Hiking", hobbiesName); metaDataHobbies.put("Reading", hobbiesName); metaDataHobbies.put("Dancing", hobbiesName); metaDataHobbies.put("Cooking", hobbiesName); metaDataHobbies.put("Surfing", hobbiesName); metaDataHobbies.put("Photography", hobbiesName); backendlessGeoQuery = new BackendlessGeoQuery(metaDataHobbies, maxPoints); backendlessGeoQuery.setPageSize(50); backendlessGeoQuery.setIncludeMeta(true); hobbies = false; Backendless.Geo.relativeFind(backendlessGeoQuery, gotHobbiesCallback); // Travel Map<String, String> metaDataTravel = new HashMap<String, String>(); metaDataTravel.put("Cruise", travelName); metaDataTravel.put("B&B", travelName); metaDataTravel.put("Europe", travelName); metaDataTravel.put("Asia", travelName); metaDataTravel.put("Caribean", travelName); metaDataTravel.put("Mountains", travelName); metaDataTravel.put("Whale watching", travelName); metaDataTravel.put("Active travel", travelName); metaDataTravel.put("Passive travel", travelName); backendlessGeoQuery = new BackendlessGeoQuery(metaDataTravel, maxPoints); backendlessGeoQuery.setPageSize(50); backendlessGeoQuery.setIncludeMeta(true); travel = false; Backendless.Geo.relativeFind(backendlessGeoQuery, gotTravelCallback); }