Back to project page android.app.niuz.io.
The source code is released under:
GNU General Public License
If you think the Android project android.app.niuz.io listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package io.niuz; /*from ww w . j ava 2s . c om*/ import io.niuz.model.APIRetrievalStatus; import io.niuz.services.CompaniesService; import io.niuz.services.PhoneService; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.ProgressBar; public class CompanyInformationLoadingActivity extends Activity { private ProgressBar cilaProgressBar; private Context context; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_company_information_loading); this.context = this; this.cilaProgressBar = (ProgressBar)findViewById(R.id.cilaProgressBar); this.cilaProgressBar.setVisibility(View.VISIBLE); } @Override protected void onResume() { super.onResume(); // Getting relevant companies toast("Initializing relevant companies..."); new GetRelevantCompaniesTask().execute(); } private void continueWithCompanyData() { startActivity(new Intent(this, NewsCompaniesSelectionActivity.class)); } private void toast(String message) { PhoneService.toast(message, this); } private class GetRelevantCompaniesTask extends AsyncTask<Object, Integer, APIRetrievalStatus> { @Override protected APIRetrievalStatus doInBackground(Object... params) { try { CompaniesService.initRelevantCompaniesForUsersIntro(context); return APIRetrievalStatus.SUCCESS; } catch (Exception e) { Log.w("Fatal", e); return APIRetrievalStatus.ERROR; } } @Override protected void onPostExecute(APIRetrievalStatus result) { switch (result) { case SUCCESS: continueWithCompanyData(); break; case ERROR: toast("Failed to initialize companies..."); } } } @Override public void onBackPressed() { startActivity(new Intent(context, PreMainActivity.class)); } }