├── .gitignore ├── LICENSE.txt ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── takeoffandroid │ │ └── materialdialogsearchview │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── takeoffandroid │ │ └── materialdialogsearchview │ │ ├── MainActivity.java │ │ ├── SearchAdapter.java │ │ ├── SharedPreference.java │ │ └── Utils.java │ └── res │ ├── drawable-hdpi │ ├── ic_arrow_left_grey600_24dp.png │ ├── ic_backup_restore_grey600_24dp.png │ ├── ic_close_grey600_24dp.png │ ├── ic_magnify_grey600_24dp.png │ ├── ic_microphone_grey600_24dp.png │ └── ic_search_white_24dp.png │ ├── drawable-mdpi │ ├── ic_arrow_left_grey600_24dp.png │ ├── ic_backup_restore_grey600_24dp.png │ ├── ic_close_grey600_24dp.png │ ├── ic_magnify_grey600_24dp.png │ ├── ic_microphone_grey600_24dp.png │ └── ic_search_white_24dp.png │ ├── drawable-xhdpi │ ├── ic_arrow_left_grey600_24dp.png │ ├── ic_backup_restore_grey600_24dp.png │ ├── ic_close_grey600_24dp.png │ ├── ic_magnify_grey600_24dp.png │ ├── ic_microphone_grey600_24dp.png │ └── ic_search_white_24dp.png │ ├── drawable-xxhdpi │ ├── ic_arrow_left_grey600_24dp.png │ ├── ic_backup_restore_grey600_24dp.png │ ├── ic_close_grey600_24dp.png │ ├── ic_magnify_grey600_24dp.png │ ├── ic_microphone_grey600_24dp.png │ └── ic_search_white_24dp.png │ ├── drawable-xxxhdpi │ ├── ic_arrow_left_grey600_24dp.png │ ├── ic_backup_restore_grey600_24dp.png │ ├── ic_close_grey600_24dp.png │ ├── ic_magnify_grey600_24dp.png │ ├── ic_microphone_grey600_24dp.png │ └── ic_search_white_24dp.png │ ├── layout │ ├── activity_main.xml │ ├── include_toolbar.xml │ ├── include_toolbar_search.xml │ ├── list_item_search.xml │ └── view_toolbar_search.xml │ ├── menu │ └── menu_search.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── color.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/android,osx,windows,linux,intellij,java 2 | 3 | ### Android ### 4 | # Built application files 5 | *.apk 6 | *.ap_ 7 | 8 | # Files for the Dalvik VM 9 | *.dex 10 | 11 | # Java class files 12 | *.class 13 | 14 | # Generated files 15 | bin/ 16 | gen/ 17 | 18 | # Gradle files 19 | .gradle/ 20 | build/ 21 | 22 | # Local configuration file (sdk path, etc) 23 | local.properties 24 | 25 | # Proguard folder generated by Eclipse 26 | proguard/ 27 | 28 | # Log Files 29 | *.log 30 | 31 | # Android Studio Navigation editor temp files 32 | .navigation/ 33 | 34 | ### Android Patch ### 35 | gen-external-apklibs 36 | 37 | 38 | ### OSX ### 39 | .DS_Store 40 | .AppleDouble 41 | .LSOverride 42 | 43 | # Icon must end with two \r 44 | Icon 45 | 46 | 47 | # Thumbnails 48 | ._* 49 | 50 | # Files that might appear in the root of a volume 51 | .DocumentRevisions-V100 52 | .fseventsd 53 | .Spotlight-V100 54 | .TemporaryItems 55 | .Trashes 56 | .VolumeIcon.icns 57 | 58 | # Directories potentially created on remote AFP share 59 | .AppleDB 60 | .AppleDesktop 61 | Network Trash Folder 62 | Temporary Items 63 | .apdisk 64 | 65 | 66 | ### Windows ### 67 | # Windows image file caches 68 | Thumbs.db 69 | ehthumbs.db 70 | 71 | # Folder config file 72 | Desktop.ini 73 | 74 | # Recycle Bin used on file shares 75 | $RECYCLE.BIN/ 76 | 77 | # Windows Installer files 78 | *.cab 79 | *.msi 80 | *.msm 81 | *.msp 82 | 83 | # Windows shortcuts 84 | *.lnk 85 | 86 | 87 | ### Linux ### 88 | *~ 89 | 90 | # KDE directory preferences 91 | .directory 92 | 93 | # Linux trash folder which might appear on any partition or disk 94 | .Trash-* 95 | 96 | 97 | ### Intellij ### 98 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio 99 | 100 | *.iml 101 | 102 | ## Directory-based project format: 103 | .idea/ 104 | # if you remove the above rule, at least ignore the following: 105 | 106 | # User-specific stuff: 107 | # .idea/workspace.xml 108 | # .idea/tasks.xml 109 | # .idea/dictionaries 110 | 111 | # Sensitive or high-churn files: 112 | # .idea/dataSources.ids 113 | # .idea/dataSources.xml 114 | # .idea/sqlDataSources.xml 115 | # .idea/dynamic.xml 116 | # .idea/uiDesigner.xml 117 | 118 | # Gradle: 119 | # .idea/gradle.xml 120 | # .idea/libraries 121 | 122 | # Mongo Explorer plugin: 123 | # .idea/mongoSettings.xml 124 | 125 | ## File-based project format: 126 | *.ipr 127 | *.iws 128 | 129 | ## Plugin-specific files: 130 | 131 | # IntelliJ 132 | /out/ 133 | 134 | # mpeltonen/sbt-idea plugin 135 | .idea_modules/ 136 | 137 | # JIRA plugin 138 | atlassian-ide-plugin.xml 139 | 140 | # Crashlytics plugin (for Android Studio and IntelliJ) 141 | com_crashlytics_export_strings.xml 142 | crashlytics.properties 143 | crashlytics-build.properties 144 | 145 | 146 | ### Java ### 147 | *.class 148 | 149 | # Mobile Tools for Java (J2ME) 150 | .mtj.tmp/ 151 | 152 | # Package Files # 153 | *.jar 154 | *.war 155 | *.ear 156 | 157 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 158 | hs_err_pid* 159 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Chandrasekar K 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so without any conditions and terms. 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-MaterialDialogSearchView-green.svg?style=flat)](https://android-arsenal.com/details/1/2589) 2 | 3 | Buy Me a Coffee at ko-fi.com 4 | 5 | # MaterialDialogSearchView 6 | 7 | MaterialDialogSearchView is a custom implementation of a Toolbar SearchView in a material design. 8 | It is an alternate approach using Material dialogs as SearchView similar to the applications seen on nowadays with this type of SearchView's in the apps 9 | like Google play, Google card's,etc. 10 | 11 | #### **What made me to do this repo?** 12 | 13 | This repo is truely made on the inspiration of Google play's SearchView and StackOverflow question of mine 14 | http://stackoverflow.com/questions/30521615/implementing-google-play-and-maps-like-search-bar-android 15 | 16 | 17 | 18 | 19 | #### **How to use?** 20 | 21 | Regarding the usage, it is simple to go without using any third party libraries. The class files used in this repo is limited to 22 | 23 | #### **MainActivity.java** 24 | 25 | This is the main class and it comprises of Custom dialog and then several logics to filter out the users suggestion in EditText. 26 | 27 | #### **SearchAdapter.java** 28 | 29 | It is nothing but a adapter class extends BaseAdapter which in turn used to display the list items (i.e Country's Text and icon used in this repo) in a ListView. 30 | 31 | #### **Utils.java** 32 | 33 | It is an Utility class which is used to adjust the height of ListView based on the count of child items. 34 | 35 | #### **SharedPreference.java** 36 | 37 | SharedPrefernce class is used to store and retrieve recently searched values (i.e selected or clicked values from the suggestions list.) 38 | 39 | > **Note:** 40 | 41 | 1. This is completely a custom implementation of mine. Though this solution may be simple, but very effective implementing MaterialSearchView's and it will not affect any part of the coding cycle. You can use this view in activity, fragment or wherever you want. Happy coding! 42 | 2. Voice search will not work. It is just displayed for the UI purpose. EditText data will be cleared once if you click mic icon. 43 | 44 | #### **Licensing** 45 | 46 | About licensing it is free to go. You can do whatever you want with this code. I really appreciate all of your feedbacks and pull requests to improve this repo. 47 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.0" 6 | 7 | defaultConfig { 8 | applicationId "com.takeoffandroid.materialdialogsearchview" 9 | minSdkVersion 11 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:appcompat-v7:23.0.1' 25 | compile 'com.android.support:recyclerview-v7:23.0.1' 26 | compile 'org.immutables:gson:2.1.0.alpha' 27 | 28 | } 29 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/Chandru-MacBook/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/takeoffandroid/materialdialogsearchview/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.takeoffandroid.materialdialogsearchview; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/takeoffandroid/materialdialogsearchview/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.takeoffandroid.materialdialogsearchview; 2 | 3 | import android.app.Dialog; 4 | import android.os.Bundle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.widget.Toolbar; 7 | import android.text.Editable; 8 | import android.text.TextWatcher; 9 | import android.view.Gravity; 10 | import android.view.Menu; 11 | import android.view.MenuItem; 12 | import android.view.View; 13 | import android.view.WindowManager; 14 | import android.widget.AdapterView; 15 | import android.widget.EditText; 16 | import android.widget.ImageView; 17 | import android.widget.LinearLayout; 18 | import android.widget.ListView; 19 | import android.widget.TextView; 20 | 21 | import java.util.ArrayList; 22 | import java.util.Arrays; 23 | 24 | 25 | public class MainActivity extends AppCompatActivity { 26 | Toolbar toolbar; 27 | private ArrayList mCountries; 28 | 29 | 30 | @Override 31 | protected void onCreate(Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | setContentView(R.layout.activity_main); 34 | toolBarData(); 35 | 36 | } 37 | 38 | @Override 39 | protected void onStart() { 40 | super.onStart(); 41 | } 42 | 43 | @Override 44 | protected void onStop() { 45 | super.onStop(); 46 | } 47 | 48 | @Override 49 | public boolean onCreateOptionsMenu(Menu menu) { 50 | getMenuInflater().inflate(R.menu.menu_search, menu); 51 | 52 | 53 | return true; 54 | } 55 | 56 | 57 | @Override 58 | public boolean onOptionsItemSelected(MenuItem item) { 59 | 60 | int id = item.getItemId(); 61 | switch (id) { 62 | 63 | case android.R.id.home: 64 | finish(); 65 | break; 66 | 67 | case R.id.action_search: 68 | loadToolBarSearch(); 69 | break; 70 | } 71 | 72 | return super.onOptionsItemSelected(item); 73 | } 74 | 75 | private void toolBarData() { 76 | toolbar = (Toolbar) findViewById(R.id.toolbar); 77 | toolbar.setTitle("MaterialDialogSearchView"); 78 | toolbar.setTitleTextColor(getResources().getColor(R.color.white)); 79 | setSupportActionBar(toolbar); 80 | } 81 | 82 | public void loadToolBarSearch() { 83 | 84 | 85 | ArrayList countryStored = SharedPreference.loadList(MainActivity.this, Utils.PREFS_NAME, Utils.KEY_COUNTRIES); 86 | 87 | View view = MainActivity.this.getLayoutInflater().inflate(R.layout.view_toolbar_search, null); 88 | LinearLayout parentToolbarSearch = (LinearLayout) view.findViewById(R.id.parent_toolbar_search); 89 | ImageView imgToolBack = (ImageView) view.findViewById(R.id.img_tool_back); 90 | final EditText edtToolSearch = (EditText) view.findViewById(R.id.edt_tool_search); 91 | ImageView imgToolMic = (ImageView) view.findViewById(R.id.img_tool_mic); 92 | final ListView listSearch = (ListView) view.findViewById(R.id.list_search); 93 | final TextView txtEmpty = (TextView) view.findViewById(R.id.txt_empty); 94 | 95 | Utils.setListViewHeightBasedOnChildren(listSearch); 96 | 97 | edtToolSearch.setHint("Search your country"); 98 | 99 | final Dialog toolbarSearchDialog = new Dialog(MainActivity.this, R.style.MaterialSearch); 100 | toolbarSearchDialog.setContentView(view); 101 | toolbarSearchDialog.setCancelable(false); 102 | toolbarSearchDialog.getWindow().setLayout(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT); 103 | toolbarSearchDialog.getWindow().setGravity(Gravity.BOTTOM); 104 | toolbarSearchDialog.show(); 105 | 106 | toolbarSearchDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); 107 | 108 | countryStored = (countryStored != null && countryStored.size() > 0) ? countryStored : new ArrayList(); 109 | final SearchAdapter searchAdapter = new SearchAdapter(MainActivity.this, countryStored, false); 110 | 111 | listSearch.setVisibility(View.VISIBLE); 112 | listSearch.setAdapter(searchAdapter); 113 | 114 | 115 | listSearch.setOnItemClickListener(new AdapterView.OnItemClickListener() { 116 | @Override 117 | public void onItemClick(AdapterView adapterView, View view, int position, long l) { 118 | 119 | String country = String.valueOf(adapterView.getItemAtPosition(position)); 120 | SharedPreference.addList(MainActivity.this, Utils.PREFS_NAME, Utils.KEY_COUNTRIES, country); 121 | edtToolSearch.setText(country); 122 | listSearch.setVisibility(View.GONE); 123 | 124 | 125 | } 126 | }); 127 | edtToolSearch.addTextChangedListener(new TextWatcher() { 128 | @Override 129 | public void beforeTextChanged(CharSequence s, int start, int count, int after) { 130 | 131 | String[] country = MainActivity.this.getResources().getStringArray(R.array.countries_array); 132 | mCountries = new ArrayList(Arrays.asList(country)); 133 | listSearch.setVisibility(View.VISIBLE); 134 | searchAdapter.updateList(mCountries, true); 135 | 136 | 137 | } 138 | 139 | @Override 140 | public void onTextChanged(CharSequence s, int start, int before, int count) { 141 | ArrayList filterList = new ArrayList(); 142 | boolean isNodata = false; 143 | if (s.length() > 0) { 144 | for (int i = 0; i < mCountries.size(); i++) { 145 | 146 | 147 | if (mCountries.get(i).toLowerCase().startsWith(s.toString().trim().toLowerCase())) { 148 | 149 | filterList.add(mCountries.get(i)); 150 | 151 | listSearch.setVisibility(View.VISIBLE); 152 | searchAdapter.updateList(filterList, true); 153 | isNodata = true; 154 | } 155 | } 156 | if (!isNodata) { 157 | listSearch.setVisibility(View.GONE); 158 | txtEmpty.setVisibility(View.VISIBLE); 159 | txtEmpty.setText("No data found"); 160 | } 161 | } else { 162 | listSearch.setVisibility(View.GONE); 163 | txtEmpty.setVisibility(View.GONE); 164 | } 165 | 166 | } 167 | 168 | @Override 169 | public void afterTextChanged(Editable s) { 170 | 171 | } 172 | }); 173 | 174 | imgToolBack.setOnClickListener(new View.OnClickListener() { 175 | @Override 176 | public void onClick(View view) { 177 | toolbarSearchDialog.dismiss(); 178 | } 179 | }); 180 | 181 | imgToolMic.setOnClickListener(new View.OnClickListener() { 182 | @Override 183 | public void onClick(View view) { 184 | 185 | edtToolSearch.setText(""); 186 | 187 | } 188 | }); 189 | 190 | 191 | } 192 | 193 | 194 | 195 | 196 | } 197 | -------------------------------------------------------------------------------- /app/src/main/java/com/takeoffandroid/materialdialogsearchview/SearchAdapter.java: -------------------------------------------------------------------------------- 1 | package com.takeoffandroid.materialdialogsearchview; 2 | 3 | import android.content.Context; 4 | import android.graphics.drawable.Drawable; 5 | import android.os.Build; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.BaseAdapter; 10 | import android.widget.TextView; 11 | 12 | import java.util.ArrayList; 13 | 14 | public class SearchAdapter extends BaseAdapter { 15 | 16 | private Context mContext; 17 | private ArrayList mCountries; 18 | private LayoutInflater mLayoutInflater; 19 | private boolean mIsFilterList; 20 | 21 | public SearchAdapter(Context context, ArrayList countries, boolean isFilterList) { 22 | this.mContext = context; 23 | this.mCountries =countries; 24 | this.mIsFilterList = isFilterList; 25 | } 26 | 27 | 28 | public void updateList(ArrayList filterList, boolean isFilterList) { 29 | this.mCountries = filterList; 30 | this.mIsFilterList = isFilterList; 31 | notifyDataSetChanged (); 32 | } 33 | 34 | @Override 35 | public int getCount() { 36 | return mCountries.size(); 37 | } 38 | 39 | @Override 40 | public String getItem(int position) { 41 | return mCountries.get(position); 42 | } 43 | 44 | @Override 45 | public long getItemId(int i) { 46 | return 0; 47 | } 48 | 49 | @Override 50 | public View getView(int position, View convertView, ViewGroup parent) { 51 | View v = convertView; 52 | ViewHolder holder = null; 53 | if(v==null){ 54 | 55 | holder = new ViewHolder(); 56 | 57 | mLayoutInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 58 | 59 | v = mLayoutInflater.inflate(R.layout.list_item_search, parent, false); 60 | holder.txtCountry = (TextView)v.findViewById(R.id.txt_country); 61 | v.setTag(holder); 62 | } else{ 63 | 64 | holder = (ViewHolder) v.getTag(); 65 | } 66 | 67 | holder.txtCountry.setText(mCountries.get(position)); 68 | 69 | Drawable searchDrawable,recentDrawable; 70 | 71 | if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ 72 | searchDrawable = mContext.getResources().getDrawable(R.drawable.ic_magnify_grey600_24dp, null); 73 | recentDrawable = mContext.getResources().getDrawable(R.drawable.ic_backup_restore_grey600_24dp, null); 74 | 75 | } else { 76 | searchDrawable = mContext.getResources().getDrawable(R.drawable.ic_magnify_grey600_24dp); 77 | recentDrawable = mContext.getResources().getDrawable(R.drawable.ic_backup_restore_grey600_24dp); 78 | } 79 | if(mIsFilterList) { 80 | holder.txtCountry.setCompoundDrawablesWithIntrinsicBounds(searchDrawable, null, null, null); 81 | }else { 82 | holder.txtCountry.setCompoundDrawablesWithIntrinsicBounds(recentDrawable, null, null, null); 83 | 84 | } 85 | return v; 86 | } 87 | 88 | } 89 | 90 | class ViewHolder{ 91 | TextView txtCountry; 92 | } 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /app/src/main/java/com/takeoffandroid/materialdialogsearchview/SharedPreference.java: -------------------------------------------------------------------------------- 1 | package com.takeoffandroid.materialdialogsearchview; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | 6 | import com.google.gson.Gson; 7 | 8 | import java.util.ArrayList; 9 | import java.util.Arrays; 10 | import java.util.List; 11 | 12 | public class SharedPreference { 13 | 14 | // Avoid magic numbers. 15 | private static final int MAX_SIZE = 3; 16 | 17 | 18 | public SharedPreference() { 19 | super(); 20 | } 21 | 22 | 23 | public static void storeList(Context context,String pref_name, String key, List countries) { 24 | 25 | SharedPreferences settings; 26 | SharedPreferences.Editor editor; 27 | settings = context.getSharedPreferences(pref_name, Context.MODE_PRIVATE); 28 | editor = settings.edit(); 29 | Gson gson = new Gson(); 30 | String jsonFavorites = gson.toJson(countries); 31 | editor.putString(key, jsonFavorites); 32 | editor.apply(); 33 | } 34 | 35 | public static ArrayList loadList(Context context,String pref_name, String key) { 36 | 37 | SharedPreferences settings; 38 | List favorites; 39 | settings = context.getSharedPreferences(pref_name, Context.MODE_PRIVATE); 40 | if (settings.contains(key)) { 41 | String jsonFavorites = settings.getString(key, null); 42 | Gson gson = new Gson(); 43 | String[] favoriteItems = gson.fromJson(jsonFavorites, String[].class); 44 | favorites = Arrays.asList(favoriteItems); 45 | favorites = new ArrayList<>(favorites); 46 | } else 47 | return null; 48 | return (ArrayList) favorites; 49 | } 50 | 51 | public static void addList(Context context, String pref_name, String key,String country) { 52 | List favorites = loadList(context, pref_name, key); 53 | if (favorites == null) 54 | favorites = new ArrayList<>(); 55 | 56 | if(favorites.size() > MAX_SIZE) { 57 | favorites.clear(); 58 | deleteList(context, pref_name); 59 | } 60 | 61 | if(favorites.contains(country)){ 62 | 63 | favorites.remove(country); 64 | 65 | } 66 | favorites.add(country); 67 | 68 | storeList(context, pref_name, key, favorites); 69 | 70 | } 71 | 72 | // public static void removeList(Context context,String pref_name, String key, String country) { 73 | // ArrayList favorites = loadList(context, pref_name,key); 74 | // if (favorites != null) { 75 | // favorites.remove(country); 76 | // storeList(context, pref_name, key, favorites); 77 | // } 78 | // } 79 | 80 | 81 | public static void deleteList(Context context, String pref_name){ 82 | 83 | SharedPreferences myPrefs = context.getSharedPreferences(pref_name, 84 | Context.MODE_PRIVATE); 85 | SharedPreferences.Editor editor = myPrefs.edit(); 86 | editor.clear(); 87 | editor.apply(); 88 | } 89 | } -------------------------------------------------------------------------------- /app/src/main/java/com/takeoffandroid/materialdialogsearchview/Utils.java: -------------------------------------------------------------------------------- 1 | package com.takeoffandroid.materialdialogsearchview; 2 | 3 | import android.content.Context; 4 | import android.net.ConnectivityManager; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.ListAdapter; 8 | import android.widget.ListView; 9 | 10 | public class Utils { 11 | 12 | public static final String PREFS_NAME = "TAKEOFFANDROID"; 13 | 14 | public static final String KEY_COUNTRIES = "Countries"; 15 | 16 | public static final int REQUEST_CODE = 1234; 17 | 18 | public static void setListViewHeightBasedOnChildren(ListView listView) { 19 | ListAdapter listAdapter = listView.getAdapter(); 20 | if (listAdapter == null) { 21 | // pre-condition 22 | return; 23 | } 24 | 25 | int totalHeight = 0; 26 | for (int i = 0; i < listAdapter.getCount(); i++) { 27 | View listItem = listAdapter.getView(i, null, listView); 28 | listItem.measure(0, 0); 29 | totalHeight += listItem.getMeasuredHeight(); 30 | } 31 | 32 | ViewGroup.LayoutParams params = listView.getLayoutParams(); 33 | params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1)); 34 | listView.setLayoutParams(params); 35 | listView.requestLayout(); 36 | } 37 | 38 | 39 | public static boolean isConnectedNetwork (Context context) { 40 | 41 | ConnectivityManager cm = (ConnectivityManager) context.getSystemService (Context.CONNECTIVITY_SERVICE); 42 | return cm.getActiveNetworkInfo () != null && cm.getActiveNetworkInfo ().isConnectedOrConnecting (); 43 | 44 | } 45 | 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_arrow_left_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-hdpi/ic_arrow_left_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_backup_restore_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-hdpi/ic_backup_restore_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_close_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-hdpi/ic_close_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_magnify_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-hdpi/ic_magnify_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_microphone_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-hdpi/ic_microphone_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-hdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_arrow_left_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-mdpi/ic_arrow_left_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_backup_restore_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-mdpi/ic_backup_restore_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_close_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-mdpi/ic_close_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_magnify_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-mdpi/ic_magnify_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_microphone_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-mdpi/ic_microphone_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-mdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_arrow_left_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xhdpi/ic_arrow_left_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_backup_restore_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xhdpi/ic_backup_restore_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_close_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xhdpi/ic_close_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_magnify_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xhdpi/ic_magnify_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_microphone_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xhdpi/ic_microphone_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xhdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_arrow_left_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xxhdpi/ic_arrow_left_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_backup_restore_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xxhdpi/ic_backup_restore_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_close_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xxhdpi/ic_close_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_magnify_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xxhdpi/ic_magnify_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_microphone_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xxhdpi/ic_microphone_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xxhdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_arrow_left_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xxxhdpi/ic_arrow_left_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_backup_restore_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xxxhdpi/ic_backup_restore_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_close_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xxxhdpi/ic_close_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_magnify_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xxxhdpi/ic_magnify_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_microphone_grey600_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xxxhdpi/ic_microphone_grey600_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_search_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/drawable-xxxhdpi/ic_search_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/include_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/include_toolbar_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 18 | 19 | 24 | 25 | 38 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/res/layout/list_item_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_toolbar_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 16 | 17 | 18 | 26 | 27 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | #212121 8 | #727272 9 | #B3727272 10 | 11 | #B6B6B6 12 | #FFFFFF 13 | #000000 14 | #F2F2F2 15 | 16 | 17 | #F44336 18 | #FF4081 19 | #9C27B0 20 | #7C4DFF 21 | #3F51B5 22 | #448AFF 23 | #03A9F4 24 | #00BCD4 25 | #009688 26 | #4CAF50 27 | #8BC34A 28 | #CDDC39 29 | #FFEB3B 30 | #FFC107 31 | #FF9800 32 | #FF5722 33 | #795548 34 | #9E9E9E 35 | #607D8B 36 | 37 | #BF000000 38 | 39 | #80000000 40 | 41 | #40000000 42 | 43 | #017C67 44 | #00715C 45 | #AF3F3F 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | MaterialDialogSearchView 3 | 4 | Hello world! 5 | Settings 6 | 7 | 8 | 9 | 10 | None 11 | Afghanistan 12 | Albania 13 | Algeria 14 | American Samoa 15 | Andorra 16 | Angola 17 | Anguilla 18 | Antarctica 19 | Antigua and Barbuda 20 | Argentina 21 | Armenia 22 | Aruba 23 | Australia 24 | Austria 25 | Azerbaijan 26 | Bahrain 27 | Bangladesh 28 | Barbados 29 | Belarus 30 | Belgium 31 | Belize 32 | Benin 33 | Bermuda 34 | Bhutan 35 | Bolivia 36 | Bosnia and Herzegovina 37 | Botswana 38 | Bouvet Island 39 | Brazil 40 | British Indian Ocean Territory 41 | British Virgin Islands 42 | Brunei 43 | Bulgaria 44 | Burkina Faso 45 | Burundi 46 | Cote d\'Ivoire 47 | Cambodia 48 | Cameroon 49 | Canada 50 | Cape Verde 51 | Cayman Islands 52 | Central African Republic 53 | Chad 54 | Chile 55 | China 56 | Christmas Island 57 | Cocos (Keeling) Islands 58 | Colombia 59 | Comoros 60 | Congo 61 | Cook Islands 62 | Costa Rica 63 | Croatia 64 | Cuba 65 | Cyprus 66 | Czech Republic 67 | Democratic Republic of the Congo 68 | Denmark 69 | Djibouti 70 | Dominica 71 | Dominican Republic 72 | East Timor 73 | Ecuador 74 | Egypt 75 | El Salvador 76 | Equatorial Guinea 77 | Eritrea 78 | Estonia 79 | Ethiopia 80 | Faeroe Islands 81 | Falkland Islands 82 | Fiji 83 | Finland 84 | Former Yugoslav Republic of Macedonia 85 | France 86 | French Guiana 87 | French Polynesia 88 | French Southern Territories 89 | Gabon 90 | Georgia 91 | Germany 92 | Ghana 93 | Gibraltar 94 | Greece 95 | Greenland 96 | Grenada 97 | Guadeloupe 98 | Guam 99 | Guatemala 100 | Guinea 101 | Guinea-Bissau 102 | Guyana 103 | Haiti 104 | Heard Island and McDonald Islands 105 | Honduras 106 | Hong Kong 107 | Hungary 108 | Iceland 109 | India 110 | Indonesia 111 | Iran 112 | Iraq 113 | Ireland 114 | Israel 115 | Italy 116 | Jamaica 117 | Japan 118 | Jordan 119 | Kazakhstan 120 | Kenya 121 | Kiribati 122 | Kuwait 123 | Kyrgyzstan 124 | Laos 125 | Latvia 126 | Lebanon 127 | Lesotho 128 | Liberia 129 | Libya 130 | Liechtenstein 131 | Lithuania 132 | Luxembourg 133 | Macau 134 | Madagascar 135 | Malawi 136 | Malaysia 137 | Maldives 138 | Mali 139 | Malta 140 | Marshall Islands 141 | Martinique 142 | Mauritania 143 | Mauritius 144 | Mayotte 145 | Mexico 146 | Micronesia 147 | Moldova 148 | Monaco 149 | Mongolia 150 | Montserrat 151 | Morocco 152 | Mozambique 153 | Myanmar 154 | Namibia 155 | Nauru 156 | Nepal 157 | Netherlands 158 | Netherlands Antilles 159 | New Caledonia 160 | New Zealand 161 | Nicaragua 162 | Niger 163 | Nigeria 164 | Niue 165 | Norfolk Island 166 | North Korea 167 | Northern Marianas 168 | Norway 169 | Oman 170 | Pakistan 171 | Palau 172 | Panama 173 | Papua New Guinea 174 | Paraguay 175 | Peru 176 | Philippines 177 | Pitcairn Islands 178 | Poland 179 | Portugal 180 | Puerto Rico 181 | Qatar 182 | Reunion 183 | Romania 184 | Russia 185 | Rwanda 186 | Sqo Tome and Principe 187 | Saint Helena 188 | Saint Kitts and Nevis 189 | Saint Lucia 190 | Saint Pierre and Miquelon 191 | Saint Vincent and the Grenadines 192 | Samoa 193 | San Marino 194 | Saudi Arabia 195 | Senegal 196 | Seychelles 197 | Sierra Leone 198 | Singapore 199 | Slovakia 200 | Slovenia 201 | Solomon Islands 202 | Somalia 203 | South Africa 204 | South Georgia and the South Sandwich Islands 205 | South Korea 206 | Spain 207 | Sri Lanka 208 | Sudan 209 | Suriname 210 | Svalbard and Jan Mayen 211 | Swaziland 212 | Sweden 213 | Switzerland 214 | Syria 215 | Taiwan 216 | Tajikistan 217 | Tanzania 218 | Thailand 219 | The Bahamas 220 | The Gambia 221 | Togo 222 | Tokelau 223 | Tonga 224 | Trinidad and Tobago 225 | Tunisia 226 | Turkey 227 | Turkmenistan 228 | Turks and Caicos Islands 229 | Tuvalu 230 | Uganda 231 | Ukraine 232 | United Arab Emirates 233 | United Kingdom 234 | United States 235 | United States Minor Outlying Islands 236 | Uruguay 237 | Uzbekistan 238 | Vanuatu 239 | Vatican City 240 | Venezuela 241 | Vietnam 242 | Virgin Islands 243 | Wallis and Futuna 244 | Western Sahara 245 | Yemen 246 | Yugoslavia 247 | Zambia 248 | Zimbabwe 249 | 250 | 251 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 20 | 21 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.3.0' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ckdevrel/MaterialDialogSearchView/b78aa768b8b45635660081e5a1ff999dfc2f08de/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Oct 01 23:21:44 GMT+05:30 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------