-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInfinityFragment.java
More file actions
54 lines (47 loc) · 1.93 KB
/
InfinityFragment.java
File metadata and controls
54 lines (47 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.example.android.dept;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class InfinityFragment extends BaseFragment {
Class fragmentClass;
Fragment fragment;
public InfinityFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
ViewGroup rootview=(ViewGroup)inflater.inflate(R.layout.fragment_infinity, container, false);
((AppCompatActivity) getActivity()).getSupportActionBar().hide();
new Handler().postDelayed(new Runnable() {
public void run() {
getActivity().startActivity(new Intent(getActivity(), InfinityActivity.class));
getActivity().finish();
}
}, 1000);
return rootview;
}
@Override
public boolean onBackPressed() {
Bundle bundle = new Bundle();
bundle.putInt("position",3);
ScreenSlidePagerActivity home = new ScreenSlidePagerActivity();
home.setArguments(bundle);
fragmentClass = ScreenSlidePagerActivity.class;
try {
fragment = (Fragment) fragmentClass.newInstance();
}catch (Exception e){}
FragmentTransaction fragmentTransaction = getActivity().getSupportFragmentManager().beginTransaction();
fragmentTransaction.setCustomAnimations(android.R.anim.fade_in,
android.R.anim.fade_out);
fragmentTransaction.replace(R.id.layout_for_fragment,home).commit();
return true;
}
}