Created
March 10, 2016 18:16
-
-
Save ClaudeHangui/39b9b0d9a44d7aecc20c to your computer and use it in GitHub Desktop.
Boite de dialogue pour l'information sur un projet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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