Esempio n. 1
0
  public void tellJoke(View view) {
    MainActivityFragment fragment =
        (MainActivityFragment) getSupportFragmentManager().findFragmentByTag(MAIN_FRAGMENT);
    fragment.enableProgressBar();

    new JokeApiEndpointAsyncTask().execute(this);
  }
Esempio n. 2
0
  @Override
  protected void onRestart() {
    super.onRestart();

    MainActivityFragment fragment =
        (MainActivityFragment) getSupportFragmentManager().findFragmentByTag(MAIN_FRAGMENT);
    fragment.disableProgressBar();
  }
Esempio n. 3
0
 public void tellJoke(View view) {
   progressBar.setVisibility(View.VISIBLE);
   jokesAsyncTask = new JokesAsyncTask(this);
   jokesAsyncTask.execute();
   if (fragment != null) {
     fragment.onCallFragment();
   }
 }
Esempio n. 4
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_main);
   progressBar = (ProgressBar) findViewById(R.id.progressBar);
   fragment = (MainActivityFragment) getSupportFragmentManager().findFragmentById(R.id.fragment);
   fragment.setListener(this);
 }
 public void tellJoke(View view) {
   MainActivityFragment fragment =
       (MainActivityFragment) getSupportFragmentManager().findFragmentById(R.id.fragment);
   fragment.showInterstitialAd();
 }
Esempio n. 6
0
 @Override
 public void onResult(String joke) {
   this.joke = joke;
   fragment.onForceFinish();
 }