Added README.txt and GPL Header to Source Files
[DHBWCampusApp.git] / app / src / main / java / de / dhbwloe / campusapp / fragments / AppSearchDhbw.java
index 3159aca6cbcd56fe97a51e8d164f6622111e4595..a9bdc9c8f5a84bb1226614f1ab04680fcbf81354 100644 (file)
@@ -1,6 +1,19 @@
+/* AppSearchDhbw.java
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
 package de.dhbwloe.campusapp.fragments;
-
-
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
 import android.util.Log;
@@ -9,6 +22,7 @@ import android.view.View;
 import android.view.ViewGroup;
 import android.widget.AdapterView;
 import android.widget.ListView;
+import android.widget.ProgressBar;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -30,6 +44,7 @@ public class AppSearchDhbw extends CampusAppFragment implements AppSearchProvide
     private AppSearchListAdapter appSearchAdapter;
     private DhbwSearchHelper seachHelper;
     private ArrayList<AppSearchListItem> searchResultItems = new ArrayList<AppSearchListItem>();
+    private ProgressBar progressBar;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
@@ -96,6 +111,8 @@ public class AppSearchDhbw extends CampusAppFragment implements AppSearchProvide
         if(bQueryExecuted && !reset)
             return;
         bQueryExecuted = true;
+        progressBar = (ProgressBar) oFragmentView.findViewById(R.id.searchProgress);
+        progressBar.setVisibility(View.VISIBLE);
 
         searchResultItems.clear();
 
@@ -107,6 +124,7 @@ public class AppSearchDhbw extends CampusAppFragment implements AppSearchProvide
                 Log.i("SearchDhbw", "Success: "+results.size());
                 for(AppSearchListItem result : results)
                     searchResultItems.add(result);
+                progressBar.setVisibility(View.GONE);
                 if(appSearchAdapter != null)
                     appSearchAdapter.notifyDataSetChanged();
                 else
@@ -116,6 +134,7 @@ public class AppSearchDhbw extends CampusAppFragment implements AppSearchProvide
             @Override
             public void onSearchFailed(String error) {
                 Log.i("SearchDhbw", "Failed: " + error);
+                progressBar.setVisibility(View.GONE);
             }
         });
     }