@Override protected void onResume() { super.onResume(); // refreshing = true; boolean isFromBooking = false; boolean isFromPrefernece = true; new GetCompanyListTask(this, null, isFromBooking, isFromPrefernece, city, province, country) .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); if (canOpenTutorial(CompanyPreferenceActivity.class.getSimpleName())) { showToolTip( getString(R.string.tooltip_preference), CompanyPreferenceActivity.class.getSimpleName()); } DaoManager daoManager = DaoManager.getInstance(this); preferenceDao = daoManager.getDBPreferenceDao(DaoManager.TYPE_WRITE); loadSavedAttrList(); companyArr = new CompanyItem[0]; boolean isFromPreference = true; cp_adapter = new CompanyListAdapter(this, companyArr, isFromPreference); lv_company.setAdapter(cp_adapter); /* int usedMegs = (int)(Debug.getNativeHeapAllocatedSize() / 1048576L); String usedMegsString = String.format(" - Memory Used: %d MB", usedMegs); Logger.e(TAG, usedMegsString); */ }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_company_preference); _context = this; city = getIntent().getExtras().getString(MBDefinition.EXTRA_CITY); province = getIntent().getExtras().getString(MBDefinition.EXTRA_PROVINCE); country = getIntent().getExtras().getString(MBDefinition.EXTRA_COUNTRY); setToolBar(); lv_company = (ListView) findViewById(R.id.lv_company); lv_company.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, final int position, long id) { AlertDialog.Builder builder = new AlertDialog.Builder(_context); builder.setMessage( _context.getString(R.string.save_preference_confirmation) + " " + city + "?"); builder.setPositiveButton( R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // delete previous preferred company deletePreferedByCity(); // add preferred company with empty attrList addPreference(cp_adapter.getCompanyItem(position)); finish(); } }); builder.setNegativeButton( R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); builder.show(); } }); Typeface OpenSansBold = FontCache.getFont(this, "fonts/OpenSansBold.ttf"); Typeface OpenSansRegular = FontCache.getFont(this, "fonts/OpenSansRegular.ttf"); TextView textView1 = (TextView) findViewById(R.id.textView1); TextView textView2 = (TextView) findViewById(R.id.textView2); tv_company404_text = (TextView) findViewById(R.id.tv_company404_text); line = findViewById(R.id.line); textView1.setTypeface(OpenSansBold); textView2.setTypeface(OpenSansBold); tv_company404_text.setTypeface(OpenSansRegular); }
@Override protected void onDestroy() { Logger.d(TAG, "onDestroy"); super.onDestroy(); // TL-369 if (findViewById(R.id.RootView) != null) { unbindDrawables(findViewById(R.id.RootView)); System.gc(); } }