-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathfragment_example.java
More file actions
137 lines (111 loc) · 3.83 KB
/
fragment_example.java
File metadata and controls
137 lines (111 loc) · 3.83 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package com.example.app_example;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class ActionItemsFragment extends Fragment {
public ActionItemsFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i("FRAGMENT_LIFE_CICLE", "onCreate");
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Log.i("FRAGMENT_LIFE_CICLE", "onCreateView");
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_action_items, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
Log.i("FRAGMENT_LIFE_CICLE", "onViewCreated");
Activity activity = getActivity();
if(activity instanceof MainActivity){
view.findViewById(R.id.imageViewBack).setVisibility(View.INVISIBLE);//INVISIBLE=4
}
View v=view.findViewById(R.id.configurationIconFrag);
if(v!=null) {
v.setOnClickListener(
new View.OnClickListener() {
public void onClick(View v) {
Intent myIntent = new Intent(getActivity().getBaseContext(), InputsExample.class);
startActivity(myIntent);
}
}
);
}else{
Log.e("View not found:", String.valueOf(R.id.configurationButton));
}
v=view.findViewById(R.id.informationIcon);
if(v!=null) {
v.setOnClickListener(
new View.OnClickListener() {
public void onClick(View v) {
final String URI = "https://developer.android.com?p1=1";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(URI));
startActivity(intent);
Log.i("Opening browser:", URI);
}
}
);
}else{
Log.e("View not found:", String.valueOf(R.id.informationIcon));
}
view.findViewById(R.id.imageViewBack).setOnClickListener(
new View.OnClickListener() {
public void onClick(View v) {
Intent myIntent = new Intent(getActivity().getBaseContext(), MainActivity.class);
startActivity(myIntent);
}
}
);
}
@Override
public void onStart() {
super.onStart();
Log.i("FRAGMENT_LIFE_CICLE", "onStart");
}
@Override
public void onPause() {
super.onPause();
Log.i("FRAGMENT_LIFE_CICLE", "onPause");
}
@Override
public void onResume() {
super.onResume();
Log.i("FRAGMENT_LIFE_CICLE", "onResume");
}
@Override
public void onDestroy() {
super.onDestroy();
Log.i("FRAGMENT_LIFE_CICLE", "onDestroy");
}
@Override
public void onStop() {
super.onStop();
Log.i("FRAGMENT_LIFE_CICLE", "onPause");
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
Log.i("FRAGMENT_LIFE_CICLE", "onAttach");
}
@Override
public void onDetach() {
super.onDetach();
Log.i("FRAGMENT_LIFE_CICLE", "onDetach");
}
@Override
public void onDestroyView() {
super.onDestroyView();
Log.i("FRAGMENT_LIFE_CICLE", "onDestroyView");
}
}