Search in sources :

Example 1 with LocationsDBHelper

use of com.djalel.android.bilal.databases.LocationsDBHelper in project Bilal by cdjalel.

the class SearchCityActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_search_city);
    setTitle(getString(R.string.app_name));
    mDBHelper = new LocationsDBHelper(this);
    mDBHelper.openReadable();
    mLanguage = UserSettings.getLanguage(this).toUpperCase(Locale.ENGLISH);
    SearchView searchView = findViewById(R.id.search_city_box);
    searchView.setOnQueryTextListener(this);
    searchView.setIconified(false);
    // XML tag has a bug
    searchView.setQueryHint(getString(R.string.search_city));
    // Get the intent, verify the action and get the query
    Intent intent = getIntent();
    Timber.i("onCreate: intent.action = " + intent.getAction());
    handleIntent(getIntent());
}
Also used : SearchView(android.support.v7.widget.SearchView) LocationsDBHelper(com.djalel.android.bilal.databases.LocationsDBHelper) Intent(android.content.Intent)

Example 2 with LocationsDBHelper

use of com.djalel.android.bilal.databases.LocationsDBHelper in project Bilal by cdjalel.

the class UserSettings method updateCity.

private static City updateCity(Context context, String language) {
    City city = getCity(context);
    if (null != city) {
        LocationsDBHelper dbHelper = new LocationsDBHelper(context);
        dbHelper.openReadable();
        city = dbHelper.getCity(city.getId(), language.toUpperCase());
        dbHelper.close();
        if (null != city) {
            saveCity(context, city);
            return city;
        }
    }
    return null;
}
Also used : LocationsDBHelper(com.djalel.android.bilal.databases.LocationsDBHelper) City(com.djalel.android.bilal.datamodels.City)

Aggregations

LocationsDBHelper (com.djalel.android.bilal.databases.LocationsDBHelper)2 Intent (android.content.Intent)1 SearchView (android.support.v7.widget.SearchView)1 City (com.djalel.android.bilal.datamodels.City)1