Eu não faço ideia do porquê mas quando eu chamo meu DialogFragment, logo em seguida o sistema chama outro, como se eu tivesse dado duas chamadas no show().
Coloquei a maior (e mais interessante no contexto) parte da activity e do fragment aqui abaixo pra vcs darem uma olhada.
Desde ja eu agradeço bastante qualquer ajuda.
-- Coloquei a maior (e mais interessante no contexto) parte da activity e do fragment aqui abaixo pra vcs darem uma olhada.
Desde ja eu agradeço bastante qualquer ajuda.
//////////////// ACTIVITYpublic class OfertasActivity extends AppCompatActivity implements View.OnClickListener {
private RecyclerView mRecyclerView; private RecyclerView.LayoutManager mLayoutManager; private ArrayList<Oferta> mListaOfertas; private Toolbar mToolbar; public ButtonFloat mFAB;
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_main_activity);
mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar);
mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
mFAB = (ButtonFloat) findViewById(R.id.buttonFloat); mFAB.setOnClickListener(this);
// use a linear layout manager mLayoutManager = new LinearLayoutManager(this); mRecyclerView.setLayoutManager(mLayoutManager);
mListaOfertas = new ArrayList<>();
mRecyclerView.setAdapter(new OfertasRecyclerAdapter(this, mListaOfertas));
}
@Override protected void onResume() { super.onResume();
if (mRecyclerView.getAdapter().getItemCount() == 0) {
showAddFragment();
} }
private void showAddFragment() {
AddFragment fragment = AddFragment.newInstance(); fragment.show(getSupportFragmentManager(), "addFragment");
new Handler().postDelayed(new Runnable() { @Override public void run() { mFAB.hide(); }
}, 1000);
}
@Override public void onClick(View v) {
showAddFragment();
}
//////////////// FRAGMENTpublic class AddFragment extends DialogFragment implements View.OnClickListener {
public static AddFragment newInstance() { return new AddFragment(); }
@Override public void onResume() { super.onResume();
ISRESUMED = true;
}
@Override public void onPause() { super.onPause();
ISRESUMED = false;
}
@Override public void onDismiss(DialogInterface dialog) { super.onDismiss(dialog);
((OfertasActivity) getActivity()).mFAB.show();
}}
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
0 comentários:
Postar um comentário