@@ -88,9 +88,9 @@ public View getView(int i, View view, ViewGroup viewGroup) {
88
88
if (view == null ) {
89
89
view = LayoutInflater .from (getContext ()).inflate (R .layout .layout_upload_item , viewGroup , false );
90
90
holder = new UploadHolderView ();
91
- holder .image = ( SimpleDraweeView ) view .findViewById (R .id .uploadImage );
92
- holder .title = ( TextView ) view .findViewById (R .id .uploadTitle );
93
- holder .overlay = ( RelativeLayout ) view .findViewById (R .id .uploadOverlay );
91
+ holder .image = view .findViewById (R .id .uploadImage );
92
+ holder .title = view .findViewById (R .id .uploadTitle );
93
+ holder .overlay = view .findViewById (R .id .uploadOverlay );
94
94
95
95
holder .image .setLayoutParams (new FrameLayout .LayoutParams (ViewGroup .LayoutParams .MATCH_PARENT , photoSize .y ));
96
96
holder .image .setHierarchy (GenericDraweeHierarchyBuilder
@@ -128,11 +128,8 @@ public void onStop() {
128
128
super .onStop ();
129
129
130
130
// FIXME: Stops the keyboard from being shown 'stale' while moving out of this fragment into the next
131
- View target = getView ().findFocus ();
132
- if (target != null ) {
133
- InputMethodManager imm = (InputMethodManager ) target .getContext ().getSystemService (Context .INPUT_METHOD_SERVICE );
134
- imm .hideSoftInputFromWindow (target .getWindowToken (), 0 );
135
- }
131
+ View target = getActivity ().getCurrentFocus ();
132
+ hideKeyboard (target );
136
133
}
137
134
138
135
// FIXME: Wrong result type
@@ -168,8 +165,8 @@ public void setImageOnlyMode(boolean mode) {
168
165
@ Override
169
166
public View onCreateView (LayoutInflater inflater , ViewGroup container , Bundle savedInstanceState ) {
170
167
View view = inflater .inflate (R .layout .fragment_multiple_uploads_list , container , false );
171
- photosGrid = ( GridView ) view .findViewById (R .id .multipleShareBackground );
172
- baseTitle = ( EditText ) view .findViewById (R .id .multipleBaseTitle );
168
+ photosGrid = view .findViewById (R .id .multipleShareBackground );
169
+ baseTitle = view .findViewById (R .id .multipleBaseTitle );
173
170
174
171
photosAdapter = new PhotoDisplayAdapter ();
175
172
photosGrid .setAdapter (photosAdapter );
@@ -189,8 +186,12 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
189
186
}
190
187
191
188
public void hideKeyboard (View view ) {
192
- InputMethodManager inputMethodManager =(InputMethodManager )getActivity ().getSystemService (Activity .INPUT_METHOD_SERVICE );
193
- inputMethodManager .hideSoftInputFromWindow (view .getWindowToken (), 0 );
189
+ if (view != null ) {
190
+ InputMethodManager inputMethodManager = (InputMethodManager ) getActivity ().getSystemService (Activity .INPUT_METHOD_SERVICE );
191
+ if (inputMethodManager != null ) {
192
+ inputMethodManager .hideSoftInputFromWindow (view .getWindowToken (), 0 );
193
+ }
194
+ }
194
195
}
195
196
196
197
@ Override
0 commit comments