use of android.support.v4.app.Fragment in project android-betterpickers by code-troopers.
the class TimePickerDialogFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.time_picker_dialog, container, false);
Button doneButton = (Button) view.findViewById(R.id.done_button);
Button cancelButton = (Button) view.findViewById(R.id.cancel_button);
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dismiss();
}
});
cancelButton.setTextColor(mTextColor);
doneButton.setTextColor(mTextColor);
doneButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
for (TimePickerDialogHandler handler : mTimePickerDialogHandlers) {
handler.onDialogTimeSet(mReference, mPicker.getHours(), mPicker.getMinutes());
}
final Activity activity = getActivity();
final Fragment fragment = getTargetFragment();
if (activity instanceof TimePickerDialogHandler) {
final TimePickerDialogHandler act = (TimePickerDialogHandler) activity;
act.onDialogTimeSet(mReference, mPicker.getHours(), mPicker.getMinutes());
} else if (fragment instanceof TimePickerDialogHandler) {
final TimePickerDialogHandler frag = (TimePickerDialogHandler) fragment;
frag.onDialogTimeSet(mReference, mPicker.getHours(), mPicker.getMinutes());
}
dismiss();
}
});
mPicker = (TimePicker) view.findViewById(R.id.time_picker);
mPicker.setSetButton(doneButton);
mPicker.setTheme(mTheme);
getDialog().getWindow().setBackgroundDrawableResource(mDialogBackgroundResId);
return view;
}
use of android.support.v4.app.Fragment in project android-betterpickers by code-troopers.
the class SampleHmsUsingFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.frame_layout);
Fragment fragment = new SampleHmsFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.frame, fragment);
transaction.commit();
}
use of android.support.v4.app.Fragment in project android-betterpickers by code-troopers.
the class TimePickerBuilder method show.
/**
* Instantiate and show the Picker
*/
public void show() {
if (manager == null || styleResId == null) {
Log.e("TimePickerBuilder", "setFragmentManager() and setStyleResId() must be called.");
return;
}
FragmentTransaction ft = manager.beginTransaction();
final Fragment prev = manager.findFragmentByTag("time_dialog");
if (prev != null) {
ft.remove(prev).commit();
ft = manager.beginTransaction();
}
ft.addToBackStack(null);
final TimePickerDialogFragment fragment = TimePickerDialogFragment.newInstance(mReference, styleResId);
if (targetFragment != null) {
fragment.setTargetFragment(targetFragment, 0);
}
fragment.setTimePickerDialogHandlers(mTimePickerDialogHandlers);
fragment.setOnDismissListener(mOnDismissListener);
fragment.show(ft, "time_dialog");
}
use of android.support.v4.app.Fragment in project android-betterpickers by code-troopers.
the class SampleDateUsingFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.frame_layout);
Fragment fragment = new SampleDateFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.frame, fragment);
transaction.commit();
}
use of android.support.v4.app.Fragment in project TakePhoto by crazycodeboy.
the class SimpleFragmentActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_fragment_layout);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.add(R.id.fragment1, fragment = new SimpleFragment(), "test");
transaction.commit();
}
Aggregations