Example #1
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_start);

    search = Search.getInstance();

    status = (TextView) findViewById(R.id.statusTextView);
    progressBar = (ProgressBar) findViewById(R.id.connectingProgressBar);
    reconnectButton = (Button) findViewById(R.id.reconnectButton);
  }
Example #2
0
 @Override
 protected Void doInBackground(Void... params) {
   SearchParser parser = null;
   try {
     Log.i("AsyncTask", "Task:" + this.hashCode() + ", Activity:" + activity.hashCode());
     try {
       parser = SearchParser.parse();
     } catch (IOException e) {
       e.printStackTrace();
     }
     search.setAllIngredients(parser.getIngredientsCategories());
     search.setAllTags(parser.getTagsCategories());
     Intent intent = new Intent(activity, MainActivity.class);
     activity.startActivity(intent);
   } catch (Exception e) {
     Log.e(activity.TAG, e.getStackTrace().toString());
     failed = true;
   }
   ;
   return null;
 }
 @Override
 public View getChildView(
     int groupPosition,
     int childPosition,
     boolean isLastChild,
     View convertView,
     ViewGroup parent) {
   if (convertView == null) {
     convertView = layoutInflater.inflate(R.layout.item_expandble_list, parent, false);
   }
   TagsCategory category = (TagsCategory) getGroup(groupPosition);
   TextView tagName = (TextView) convertView.findViewById(R.id.elementsItemName);
   Tag tag = category.get(childPosition);
   tagName.setText(tag.getName());
   if (search.isChosen(tag)) {
     convertView.setBackgroundColor(Color.GRAY);
   } else {
     convertView.setBackgroundColor(Color.LTGRAY);
   }
   return convertView;
 }
 public void changeData(Search search) {
   categories = search.getAllTags();
   this.search = search;
 }