Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ClaudeHangui/39b9b0d9a44d7aecc20c to your computer and use it in GitHub Desktop.
Save ClaudeHangui/39b9b0d9a44d7aecc20c to your computer and use it in GitHub Desktop.
Boite de dialogue pour l'information sur un projet
package fr.koonda.koonda.ui.fragments;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import fr.koonda.koonda.R;
/**
* Created by maroditv on 2/15/16.
*/
public class ProjectInformationDialogFragment extends DialogFragment
{
private RecyclerView recyclerView;
private LinearLayoutManager layoutManager;
public ProjectInformationDialogFragment() {
}
public static ProjectInformationDialogFragment newInstance(int position)
{
ProjectInformationDialogFragment informationDialogFragment = new ProjectInformationDialogFragment();
Bundle args = new Bundle();
args.putInt("POSITION", position);
informationDialogFragment.setArguments(args);
return informationDialogFragment;
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
return inflater.inflate(R.layout.project_information_dialog_layout, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState)
{
super.onViewCreated(view, savedInstanceState);
recyclerView = (RecyclerView)view.findViewById(R.id.recyle_view);
recyclerView.setHasFixedSize(true);
layoutManager = new LinearLayoutManager(view.getContext());
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(layoutManager);
}
@Override
public void onResume() {
// Get existing layout params for the window
ViewGroup.LayoutParams params = getDialog().getWindow().getAttributes();
// Assign window properties to fill the parent
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.height = WindowManager.LayoutParams.MATCH_PARENT;
getDialog().getWindow().setAttributes((WindowManager.LayoutParams) params);
super.onResume();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment