├── .gitignore ├── LICENSE ├── README.md ├── Xamarin Azure Search Tutorial.pptx ├── demo1.png ├── demo2.png ├── demo3.png ├── demo4.png ├── demo5.png ├── lesson02 ├── RealEstateXamarinAndroidDemo.sln └── RealEstateXamarinAndroidDemo │ ├── AzureSearchHelper.cs │ ├── ListingsAdapter.cs │ ├── MainActivity.cs │ ├── Model.cs │ ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs │ ├── RealEstateXamarinAndroidDemo.csproj │ ├── Resources │ ├── AboutResources.txt │ ├── Resource.Designer.cs │ ├── drawable │ │ ├── Icon.png │ │ ├── img_loading.gif │ │ └── main_background.png │ ├── layout │ │ ├── Details.axml │ │ ├── Filter.axml │ │ ├── Listings.axml │ │ ├── Main.axml │ │ └── list_item.axml │ └── values │ │ └── Strings.xml │ ├── libs │ └── AndroidQuery.dll │ └── packages.config ├── lesson03 ├── RealEstateXamarinAndroidDemo.sln └── RealEstateXamarinAndroidDemo │ ├── AzureSearchHelper.cs │ ├── ListingsAdapter.cs │ ├── MainActivity.cs │ ├── Model.cs │ ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs │ ├── RealEstateXamarinAndroidDemo.csproj │ ├── Resources │ ├── AboutResources.txt │ ├── Resource.Designer.cs │ ├── drawable │ │ ├── Icon.png │ │ ├── img_loading.gif │ │ └── main_background.png │ ├── layout │ │ ├── Details.axml │ │ ├── Filter.axml │ │ ├── Listings.axml │ │ ├── Main.axml │ │ └── list_item.axml │ └── values │ │ └── Strings.xml │ ├── libs │ └── AndroidQuery.dll │ └── packages.config ├── lesson04 ├── RealEstateXamarinAndroidDemo.sln └── RealEstateXamarinAndroidDemo │ ├── AzureSearchHelper.cs │ ├── ListingsAdapter.cs │ ├── MainActivity.cs │ ├── Model.cs │ ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs │ ├── RealEstateXamarinAndroidDemo.csproj │ ├── Resources │ ├── AboutResources.txt │ ├── Resource.Designer.cs │ ├── drawable │ │ ├── Icon.png │ │ ├── img_loading.gif │ │ └── main_background.png │ ├── layout │ │ ├── Details.axml │ │ ├── Filter.axml │ │ ├── Listings.axml │ │ ├── Main.axml │ │ └── list_item.axml │ └── values │ │ └── Strings.xml │ ├── libs │ └── AndroidQuery.dll │ └── packages.config ├── lesson05 ├── RealEstateXamarinAndroidDemo.sln └── RealEstateXamarinAndroidDemo │ ├── AzureSearchHelper.cs │ ├── ListingsAdapter.cs │ ├── MainActivity.cs │ ├── Model.cs │ ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs │ ├── RealEstateXamarinAndroidDemo.csproj │ ├── Resources │ ├── AboutResources.txt │ ├── Resource.Designer.cs │ ├── drawable │ │ ├── Icon.png │ │ ├── img_loading.gif │ │ └── main_background.png │ ├── layout │ │ ├── Details.axml │ │ ├── Filter.axml │ │ ├── Listings.axml │ │ ├── Main.axml │ │ └── list_item.axml │ └── values │ │ └── Strings.xml │ ├── libs │ └── AndroidQuery.dll │ └── packages.config ├── lesson06 ├── RealEstateXamarinAndroidDemo.sln └── RealEstateXamarinAndroidDemo │ ├── AzureSearchHelper.cs │ ├── ListingsAdapter.cs │ ├── MainActivity.cs │ ├── Model.cs │ ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs │ ├── RealEstateXamarinAndroidDemo.csproj │ ├── Resources │ ├── AboutResources.txt │ ├── Resource.Designer.cs │ ├── drawable │ │ ├── Icon.png │ │ ├── img_loading.gif │ │ └── main_background.png │ ├── layout │ │ ├── Details.axml │ │ ├── Filter.axml │ │ ├── Listings.axml │ │ ├── Main.axml │ │ └── list_item.axml │ └── values │ │ └── Strings.xml │ ├── libs │ └── AndroidQuery.dll │ └── packages.config ├── lesson07 ├── RealEstateXamarinAndroidDemo.sln └── RealEstateXamarinAndroidDemo │ ├── AzureSearchHelper.cs │ ├── ListingsAdapter.cs │ ├── MainActivity.cs │ ├── Model.cs │ ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs │ ├── RealEstateXamarinAndroidDemo.csproj │ ├── Resources │ ├── AboutResources.txt │ ├── Resource.Designer.cs │ ├── drawable │ │ ├── Icon.png │ │ ├── img_loading.gif │ │ └── main_background.png │ ├── layout │ │ ├── Details.axml │ │ ├── Filter.axml │ │ ├── Listings.axml │ │ ├── Main.axml │ │ └── list_item.axml │ └── values │ │ └── Strings.xml │ ├── libs │ └── AndroidQuery.dll │ └── packages.config └── src ├── RealEstateXamarinAndroidDemo.sln └── RealEstateXamarinAndroidDemo ├── AzureSearchHelper.cs ├── GettingStarted.Xamarin ├── ListingsAdapter.cs ├── MainActivity.cs ├── MainApplication.cs ├── Model.cs ├── Properties ├── AndroidManifest.xml └── AssemblyInfo.cs ├── RealEstateXamarinAndroidDemo.csproj ├── Resources ├── AboutResources.txt ├── Resource.Designer.cs ├── drawable │ ├── Icon.png │ ├── img_loading.gif │ └── main_background.png ├── layout │ ├── Details.axml │ ├── Filter.axml │ ├── Listings.axml │ ├── Main.axml │ └── list_item.axml └── values │ └── Strings.xml ├── libs └── AndroidQuery.dll └── packages.config /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opendb 80 | *.opensdf 81 | *.sdf 82 | *.cachefile 83 | *.VC.db 84 | *.VC.VC.opendb 85 | 86 | # Visual Studio profiler 87 | *.psess 88 | *.vsp 89 | *.vspx 90 | *.sap 91 | 92 | # TFS 2012 Local Workspace 93 | $tf/ 94 | 95 | # Guidance Automation Toolkit 96 | *.gpState 97 | 98 | # ReSharper is a .NET coding add-in 99 | _ReSharper*/ 100 | *.[Rr]e[Ss]harper 101 | *.DotSettings.user 102 | 103 | # JustCode is a .NET coding add-in 104 | .JustCode 105 | 106 | # TeamCity is a build add-in 107 | _TeamCity* 108 | 109 | # DotCover is a Code Coverage Tool 110 | *.dotCover 111 | 112 | # NCrunch 113 | _NCrunch_* 114 | .*crunch*.local.xml 115 | nCrunchTemp_* 116 | 117 | # MightyMoose 118 | *.mm.* 119 | AutoTest.Net/ 120 | 121 | # Web workbench (sass) 122 | .sass-cache/ 123 | 124 | # Installshield output folder 125 | [Ee]xpress/ 126 | 127 | # DocProject is a documentation generator add-in 128 | DocProject/buildhelp/ 129 | DocProject/Help/*.HxT 130 | DocProject/Help/*.HxC 131 | DocProject/Help/*.hhc 132 | DocProject/Help/*.hhk 133 | DocProject/Help/*.hhp 134 | DocProject/Help/Html2 135 | DocProject/Help/html 136 | 137 | # Click-Once directory 138 | publish/ 139 | 140 | # Publish Web Output 141 | *.[Pp]ublish.xml 142 | *.azurePubxml 143 | # TODO: Comment the next line if you want to checkin your web deploy settings 144 | # but database connection strings (with potential passwords) will be unencrypted 145 | *.pubxml 146 | *.publishproj 147 | 148 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 149 | # checkin your Azure Web App publish settings, but sensitive information contained 150 | # in these scripts will be unencrypted 151 | PublishScripts/ 152 | 153 | # NuGet Packages 154 | *.nupkg 155 | # The packages folder can be ignored because of Package Restore 156 | **/packages/* 157 | # except build/, which is used as an MSBuild target. 158 | !**/packages/build/ 159 | # Uncomment if necessary however generally it will be regenerated when needed 160 | #!**/packages/repositories.config 161 | # NuGet v3's project.json files produces more ignoreable files 162 | *.nuget.props 163 | *.nuget.targets 164 | 165 | # Microsoft Azure Build Output 166 | csx/ 167 | *.build.csdef 168 | 169 | # Microsoft Azure Emulator 170 | ecf/ 171 | rcf/ 172 | 173 | # Windows Store app package directories and files 174 | AppPackages/ 175 | BundleArtifacts/ 176 | Package.StoreAssociation.xml 177 | _pkginfo.txt 178 | 179 | # Visual Studio cache files 180 | # files ending in .cache can be ignored 181 | *.[Cc]ache 182 | # but keep track of directories ending in .cache 183 | !*.[Cc]ache/ 184 | 185 | # Others 186 | ClientBin/ 187 | ~$* 188 | *~ 189 | *.dbmdl 190 | *.dbproj.schemaview 191 | *.pfx 192 | *.publishsettings 193 | node_modules/ 194 | orleans.codegen.cs 195 | 196 | # Since there are multiple workflows, uncomment next line to ignore bower_components 197 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 198 | #bower_components/ 199 | 200 | # RIA/Silverlight projects 201 | Generated_Code/ 202 | 203 | # Backup & report files from converting an old project file 204 | # to a newer Visual Studio version. Backup files are not needed, 205 | # because we have git ;-) 206 | _UpgradeReport_Files/ 207 | Backup*/ 208 | UpgradeLog*.XML 209 | UpgradeLog*.htm 210 | 211 | # SQL Server files 212 | *.mdf 213 | *.ldf 214 | 215 | # Business Intelligence projects 216 | *.rdl.data 217 | *.bim.layout 218 | *.bim_*.settings 219 | 220 | # Microsoft Fakes 221 | FakesAssemblies/ 222 | 223 | # GhostDoc plugin setting file 224 | *.GhostDoc.xml 225 | 226 | # Node.js Tools for Visual Studio 227 | .ntvs_analysis.dat 228 | 229 | # Visual Studio 6 build log 230 | *.plg 231 | 232 | # Visual Studio 6 workspace options file 233 | *.opt 234 | 235 | # Visual Studio LightSwitch build output 236 | **/*.HTMLClient/GeneratedArtifacts 237 | **/*.DesktopClient/GeneratedArtifacts 238 | **/*.DesktopClient/ModelManifest.xml 239 | **/*.Server/GeneratedArtifacts 240 | **/*.Server/ModelManifest.xml 241 | _Pvt_Extensions 242 | 243 | # Paket dependency manager 244 | .paket/paket.exe 245 | paket-files/ 246 | 247 | # FAKE - F# Make 248 | .fake/ 249 | 250 | # JetBrains Rider 251 | .idea/ 252 | *.sln.iml 253 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Liam Cavanagh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Real Estate Xamarin Android Demo 2 | 3 | This is a sample application written using Xamarin for Android that demonstrates how to build a mobile applications that leverages Azure Search to perform full text search. 4 | 5 | Some of the concepts covered in this application include: 6 | - Type Ahead (or Suggestions) 7 | - Full Text Search 8 | - Paging 9 | - Filtering & Faceting 10 | - Recommendations by finding real estate listings that are similar to the one you are currently viewing 11 | 12 | ## Screen Shots 13 | ![Demo Screen Shot - Type Ahead](https://raw.githubusercontent.com/liamca/RealEstateXamarinAndroidDemo/master/demo1.png) 14 | 15 | ![Demo Screen Shot - Search & Paging of Results](https://raw.githubusercontent.com/liamca/RealEstateXamarinAndroidDemo/master/demo2.png) 16 | 17 | ![Demo Screen Shot - Filtering & Count](https://raw.githubusercontent.com/liamca/RealEstateXamarinAndroidDemo/master/demo3.png) 18 | 19 | ![Demo Screen Shot - Details](https://raw.githubusercontent.com/liamca/RealEstateXamarinAndroidDemo/master/demo4.png) 20 | 21 | ![Demo Screen Shot - Recommendations](https://raw.githubusercontent.com/liamca/RealEstateXamarinAndroidDemo/master/demo5.png) 22 | 23 | ## Course Videos 24 | 25 | Download Lesson 1 - What is a Search Enabled Application and intro to Azure Search?
26 | Download Lesson 2 - Type Ahead Search Suggestions
27 | Download Lesson 3 - Full Text Search and Paging
28 | Download Lesson 4 - Filtering Search Results
29 | Download Lesson 5 - Document Lookup
30 | Download Lesson 6 - Adding Intelligence using More Like This
31 | Download Lesson 7 - Scoring and Tuning
32 | Download Lesson 8 - Analytics
33 | -------------------------------------------------------------------------------- /Xamarin Azure Search Tutorial.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liamca/RealEstateXamarinAndroidDemo/945109a14bf594efa6086d707e5bff335ed7703a/Xamarin Azure Search Tutorial.pptx -------------------------------------------------------------------------------- /demo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liamca/RealEstateXamarinAndroidDemo/945109a14bf594efa6086d707e5bff335ed7703a/demo1.png -------------------------------------------------------------------------------- /demo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liamca/RealEstateXamarinAndroidDemo/945109a14bf594efa6086d707e5bff335ed7703a/demo2.png -------------------------------------------------------------------------------- /demo3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liamca/RealEstateXamarinAndroidDemo/945109a14bf594efa6086d707e5bff335ed7703a/demo3.png -------------------------------------------------------------------------------- /demo4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liamca/RealEstateXamarinAndroidDemo/945109a14bf594efa6086d707e5bff335ed7703a/demo4.png -------------------------------------------------------------------------------- /demo5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liamca/RealEstateXamarinAndroidDemo/945109a14bf594efa6086d707e5bff335ed7703a/demo5.png -------------------------------------------------------------------------------- /lesson02/RealEstateXamarinAndroidDemo.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RealEstateXamarinAndroidDemo", "RealEstateXamarinAndroidDemo\RealEstateXamarinAndroidDemo.csproj", "{35453B5B-85BD-4A71-AFFA-6905064AD96F}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {35453B5B-85BD-4A71-AFFA-6905064AD96F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {35453B5B-85BD-4A71-AFFA-6905064AD96F}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {35453B5B-85BD-4A71-AFFA-6905064AD96F}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 17 | {35453B5B-85BD-4A71-AFFA-6905064AD96F}.Release|Any CPU.ActiveCfg = Release|Any CPU 18 | {35453B5B-85BD-4A71-AFFA-6905064AD96F}.Release|Any CPU.Build.0 = Release|Any CPU 19 | {35453B5B-85BD-4A71-AFFA-6905064AD96F}.Release|Any CPU.Deploy.0 = Release|Any CPU 20 | EndGlobalSection 21 | GlobalSection(SolutionProperties) = preSolution 22 | HideSolutionNode = FALSE 23 | EndGlobalSection 24 | EndGlobal 25 | -------------------------------------------------------------------------------- /lesson02/RealEstateXamarinAndroidDemo/AzureSearchHelper.cs: -------------------------------------------------------------------------------- 1 | //Copyright 2014 Microsoft 2 | //Licensed under the MIT License 3 | 4 | //Based on sample code provided at https://github.com/twitter/typeahead.js 5 | //Data and Images provided by Wikipedia - http://en.wikipedia.org/wiki/List_of_vegetables 6 | 7 | using Newtonsoft.Json; 8 | using Newtonsoft.Json.Converters; 9 | using Newtonsoft.Json.Serialization; 10 | using System; 11 | using System.Net.Http; 12 | using System.Text; 13 | 14 | 15 | namespace RealEstateXamarinAndroidDemo 16 | { 17 | public class AzureSearchHelper 18 | { 19 | // This sample uses the prototype API. Please review the documenation for details on this API version - http://msdn.microsoft.com/en-us/library/azure/dn864560.aspx 20 | public const string ApiVersionString = "api-version=2015-02-28-Preview"; 21 | 22 | private static readonly JsonSerializerSettings _jsonSettings; 23 | 24 | static AzureSearchHelper() 25 | { 26 | _jsonSettings = new JsonSerializerSettings 27 | { 28 | Formatting = Formatting.Indented, // for readability, change to None for compactness 29 | ContractResolver = new CamelCasePropertyNamesContractResolver(), 30 | DateTimeZoneHandling = DateTimeZoneHandling.Utc 31 | }; 32 | 33 | _jsonSettings.Converters.Add(new StringEnumConverter()); 34 | } 35 | 36 | public static string SerializeJson(object value) 37 | { 38 | return JsonConvert.SerializeObject(value, _jsonSettings); 39 | } 40 | 41 | public static T DeserializeJson(string json) 42 | { 43 | return JsonConvert.DeserializeObject(json, _jsonSettings); 44 | } 45 | 46 | public static HttpResponseMessage SendSearchRequest(HttpClient client, HttpMethod method, Uri uri, string json = null) 47 | { 48 | UriBuilder builder = new UriBuilder(uri); 49 | string separator = string.IsNullOrWhiteSpace(builder.Query) ? string.Empty : "&"; 50 | builder.Query = builder.Query.TrimStart('?') + separator + ApiVersionString; 51 | 52 | var request = new HttpRequestMessage(method, builder.Uri); 53 | 54 | if (json != null) 55 | { 56 | request.Content = new StringContent(json, Encoding.UTF8, "application/json"); 57 | } 58 | 59 | return client.SendAsync(request).Result; 60 | } 61 | 62 | public static void EnsureSuccessfulSearchResponse(HttpResponseMessage response) 63 | { 64 | if (!response.IsSuccessStatusCode) 65 | { 66 | string error = response.Content == null ? null : response.Content.ReadAsStringAsync().Result; 67 | throw new Exception("Search request failed: " + error); 68 | } 69 | } 70 | } 71 | } -------------------------------------------------------------------------------- /lesson02/RealEstateXamarinAndroidDemo/ListingsAdapter.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.Graphics; 3 | using Android.Views; 4 | using Android.Widget; 5 | using Com.Androidquery; 6 | using Com.Androidquery.Callback; 7 | using System; 8 | using System.Collections.Generic; 9 | using System.Linq; 10 | using System.Text; 11 | 12 | namespace RealEstateXamarinAndroidDemo 13 | { 14 | public class LoadListings : BaseAdapter 15 | { 16 | Activity _activity; 17 | List _listings; 18 | 19 | public LoadListings(Activity activity, List listings) 20 | { 21 | _activity = activity; 22 | _listings = listings; 23 | } 24 | 25 | public override int Count 26 | { 27 | get { return _listings.Count; } 28 | } 29 | 30 | public override Java.Lang.Object GetItem(int position) 31 | { 32 | return position; 33 | } 34 | 35 | public override long GetItemId(int position) 36 | { 37 | return position; 38 | } 39 | 40 | public override Android.Views.View GetView(int position, Android.Views.View convertView, Android.Views.ViewGroup parent) 41 | { 42 | if (convertView == null) 43 | { 44 | convertView = _activity.LayoutInflater.Inflate(Resource.Layout.list_item, parent, false); 45 | } 46 | 47 | ListListing listing = _listings[position]; 48 | 49 | AQuery aq = new AQuery(convertView); 50 | 51 | TextView txtProductName = convertView.FindViewById(Resource.Id.txtProductName); 52 | txtProductName.Text = listing.MainText; 53 | 54 | TextView txtSubText = convertView.FindViewById(Resource.Id.txtSubText); 55 | txtSubText.Text = listing.SubText; 56 | 57 | 58 | Bitmap imgLoading = aq.GetCachedImage(Resource.Drawable.img_loading); 59 | 60 | if (aq.ShouldDelay(position, convertView, parent, listing.ImageUrl)) 61 | { 62 | ((AQuery)aq.Id(Resource.Id.imgProduct)).Image(imgLoading, 0.75f); 63 | } 64 | else 65 | { 66 | ((AQuery)aq.Id(Resource.Id.imgProduct)).Image(listing.ImageUrl, true, true, 0, 0, imgLoading, 0, 0.75f); 67 | } 68 | 69 | return convertView; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /lesson02/RealEstateXamarinAndroidDemo/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.App; 3 | using Android.Content; 4 | using Android.Runtime; 5 | using Android.Views; 6 | using Android.Widget; 7 | using Android.OS; 8 | using System.Threading.Tasks; 9 | using Newtonsoft.Json.Linq; 10 | using System.Collections.Generic; 11 | using System.Linq; 12 | using Android.Graphics; 13 | using System.Net; 14 | 15 | namespace RealEstateXamarinAndroidDemo 16 | { 17 | [Activity(Label = "RealEstateXamarinAndroidDemo", MainLauncher = true, Icon = "@drawable/icon")] 18 | public class MainActivity : Activity 19 | { 20 | 21 | protected override void OnCreate(Bundle bundle) 22 | { 23 | base.OnCreate(bundle); 24 | ConfigureMainLayout(); 25 | } 26 | 27 | private async void ConfigureMainLayout() 28 | { 29 | // Set our view from the "main" layout resource 30 | SetContentView(Resource.Layout.Main); 31 | FindViewById