Beispiel #1
0
        public void handleMessage(android.os.Message msg) {
          switch (msg.what) {
            case MSG_INIT_OK:
              ArrayAdapter<LogItem> adapter = (ArrayAdapter<LogItem>) getListView().getAdapter();

              adapter.setNotifyOnChange(false);

              adapter.clear();

              ArrayList<LogItem> data = (ArrayList<LogItem>) msg.obj;

              if (data != null) {
                for (int i = 0, size = data.size(); i < size; i++) {
                  adapter.add(data.get(i));
                }
              }

              adapter.notifyDataSetChanged();

              sendEmptyMessage(MSG_DISMISS_PROGRESS);

              if (adapter.getCount() == 0) {
                Util.shortToast(LogViewer.this, R.string.no_log_info);
              } else {
                getListView().setSelection(adapter.getCount() - 1);
              }

              break;
            case MSG_CONTENT_READY:
              sendEmptyMessage(MSG_DISMISS_PROGRESS);

              Util.handleMsgSendContentReady(
                  (String) msg.obj,
                  "Android Device Log - ", //$NON-NLS-1$
                  LogViewer.this,
                  msg.arg2 == 1);

              break;
            case MSG_CHECK_FORCE_COMPRESSION:
              sendEmptyMessage(MSG_DISMISS_PROGRESS);

              Util.checkForceCompression(
                  this, LogViewer.this, (String) msg.obj, msg.arg1, "android_log"); // $NON-NLS-1$

              break;
            case MSG_DISMISS_PROGRESS:
              if (progress != null) {
                progress.dismiss();
                progress = null;
              }
              break;
            case MSG_TOAST:
              Util.shortToast(LogViewer.this, (String) msg.obj);
              break;
          }
        };
Beispiel #2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    rooms.add(ROOM_CREATE_TAG);
    roomIds.add(-1);
    adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, rooms);
    adapter.setNotifyOnChange(false);
    this.getListView()
        .setOnItemClickListener(
            new OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Log.i(this.getClass().getName(), "Clicked " + rooms.get(position));
                if (position == 0) {
                  assert rooms.get(position).equals(ROOM_CREATE_TAG);
                  Map<String, Object> properties = new HashMap<String, Object>();
                  // properties.put("password", "123");
                  Time current = new Time();
                  current.setToNow();
                  ServerConnection.mClient.createRoom(
                      "created@" + current.format("%H%M%S"), 2, properties);
                } else {
                  ServerConnection.mClient.joinRoom(roomIds.get(position));
                }
              }
            });
    setListAdapter(adapter);

    final SmartFoxClient sfs = ServerConnection.mClient;
    sfs.addEventListener(SFSEvent.onConnection, this);
    sfs.addEventListener(SFSEvent.onConnectionLost, this);
    sfs.addEventListener(SFSEvent.onLogin, this);
    sfs.addEventListener(SFSEvent.onRoomListUpdate, this);
    sfs.addEventListener(SFSEvent.onJoinRoom, this);
    sfs.addEventListener(SFSEvent.onRoomAdded, this);
    sfs.addEventListener(SFSEvent.onRoomDeleted, this);
    sfs.addEventListener(SFSEvent.onPublicMessage, this);

    new Thread() {
      @Override
      public void run() {
        // TODO: get it?
        sfs.connect("10.0.2.2", 9339);
      }
    }.start();
  }
Beispiel #3
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    Log.d(TAG, "onCreate");
    super.onCreate(savedInstanceState);
    Thread.currentThread().setUncaughtExceptionHandler(this);
    setContentView(R.layout.main);

    inputView = (EditText) findViewById(R.id.input_view);
    inputView.setOnEditorActionListener(this);

    listAdapter = new ArrayAdapter<String>(this, R.layout.row);
    listAdapter.setNotifyOnChange(true);

    resultsView = (ListView) this.findViewById(R.id.results_view);
    resultsView.setAdapter(listAdapter);
    resultsView.setOnItemClickListener(this);
  }
  protected void a(String s, int i) {
    if (!g.equals(s)) {
      return;
    }
    j();
    if (i == 403) {
      List list = oq.a(a).b(g);
      c = pi.a(a, list);
      StringBuilder stringbuilder = (new StringBuilder()).append("Data size = ");
      int j;
      if (c == null) {
        j = 0;
      } else {
        j = c.size();
      }
      nz.b("ToolboxListActivity", stringbuilder.append(j).toString());
      b.setNotifyOnChange(false);
      b.clear();
      ou ou1;
      for (Iterator iterator = list.iterator(); iterator.hasNext(); b.add(ou1)) {
        ou1 = (ou) iterator.next();
      }

      b.notifyDataSetChanged();
      if (!f) {
        if (c.size() == 0) {
          b(ok.toolbox_no_apps_des_toolbox_empty_a);
          return;
        } else {
          a(c, true);
          return;
        }
      } else {
        h = false;
        return;
      }
    } else {
      b(ok.toolbox_no_apps_des_network_error_b);
      return;
    }
  }
Beispiel #5
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // show instructions
    showInfoDialog(TAG, INSTRUCTIONS);
    btLedEmotionStart = (Button) findViewById(R.id.btLedEmotionStart);
    // set event click for button start led emotion
    btLedEmotionStart.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            startEmotion();
          }
        });

    btLedEmotionStop = (Button) findViewById(R.id.btLedEmotionStop);
    // set event click for button stop led emotion
    btLedEmotionStop.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            stopEmotion();
          }
        });

    spLedEmotionList = (Spinner) findViewById(R.id.spLedEmotionList);
    ledEmotionListAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item);
    ledEmotionListAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    ledEmotionListAdapter.setNotifyOnChange(true);
    for (int i = 0; i < emotionList.length; i++) {
      ledEmotionListAdapter.add(emotionList[i]);
    }
    // set list predefined emotions to adapter
    spLedEmotionList.setAdapter(ledEmotionListAdapter);
  }
  public void showSetBetDialog() {
    AlertDialog.Builder builder = new Builder(this);
    LayoutInflater infalInflater =
        (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    FrameLayout layout = (FrameLayout) infalInflater.inflate(R.layout.bet, null);

    final AutoCompleteTextView input =
        (AutoCompleteTextView) layout.findViewById(R.id.tv_bet_input);
    input.setInputType(InputType.TYPE_CLASS_NUMBER);

    LengthFilter filter = new LengthFilter(5);
    input.setFilters(new InputFilter[] {filter});
    input.setSelectAllOnFocus(true);
    input.setTextColor(Color.BLACK);
    input.setText("" + this.number);

    String[] betSuggestion = getResources().getStringArray(R.array.bet_suggestion);
    final ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(this, R.layout.item_list_s, betSuggestion);
    adapter.setNotifyOnChange(true);
    input.setAdapter(adapter);
    input.setThreshold(1);
    input.setOnFocusChangeListener(
        new OnFocusChangeListener() {

          @Override
          public void onFocusChange(View v, boolean hasFocus) {
            if (input.isFocused()) {
              input.showDropDown();
            }
          }
        });

    input.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            if (input.isFocused()) {
              input.showDropDown();
            }
          }
        });

    builder.setView(layout);
    builder.setPositiveButton(
        getResources().getString(R.string.confirm_ok),
        new DialogInterface.OnClickListener() {
          public void onClick(DialogInterface dialog, int whichButton) {
            int number = PasswordGeneratorActivity.this.number;
            try {
              number = Integer.parseInt(input.getText().toString());
            } catch (Exception e) {
              // TODO: handle exception
            }
            if (number < 4) number = 4;
            else if (number > 21) number = 21;
            setTextNumberCharacter(number);
          }
        });
    builder.setNegativeButton(getResources().getString(R.string.confirm_cancel), null);
    builder.setIcon(R.drawable.ic_launcher);
    builder.create().show();
  }
Beispiel #7
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the help for this fragment
    //        if(view == null)
    Log.d("init", "search fragment onCreateView");
    if (true) view = inflater.inflate(R.layout.fragment_search, container, false);
    if (true) {
      textView = (AutoCompleteTextView) view.findViewById(R.id.autocomplete_search);
      textView.setThreshold(1);

      if (mType == t_type.GROUP) {
        textView.setOnClickListener(this);
        textView.setOnItemClickListener(this);

        textView.setHint(R.string.group_search_placeholder);

        adapter =
            new ArrayAdapter<String>(
                getActivity(), R.layout.text_layout, StaticStorage.m_listGroupsName);
        textView.setAdapter(adapter);
        adapter.setNotifyOnChange(true);

        ListView list = (ListView) view.findViewById(R.id.recentList);
        final ArrayAdapter recent_adapter =
            new ArrayAdapter(
                inflater.getContext(),
                R.layout.detailed_item_list_item,
                new ArrayList(StaticStorage.m_recentGroups.values())) {
              @Override
              public View getView(int position, View convertView, ViewGroup parent) {
                View holder;
                Group group = (Group) getItem(position);
                if (convertView == null) {
                  // You should fetch the LayoutInflater once in your constructor
                  holder =
                      LayoutInflater.from(parent.getContext())
                          .inflate(R.layout.detailed_item_list_item, parent, false);
                } else {
                  holder = convertView;
                }

                TextView v = (TextView) holder.findViewById(R.id.detailed_item_list_item_text1);
                v.setText(group.m_info.m_name);
                v = (TextView) holder.findViewById(R.id.detailed_item_list_item_text2);
                v.setText(group.m_info.m_faculty.m_abbr);
                v = (TextView) holder.findViewById(R.id.detailed_item_list_item_text3);
                v.setText(group.m_info.m_spec);
                return holder;
              }
            };
        list.setAdapter(recent_adapter);
        // ListView Item Click Listener
        list.setOnItemClickListener(
            new AdapterView.OnItemClickListener() {

              @Override
              public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Group group = (Group) recent_adapter.getItem(position);

                Log.d("init", group.toString());
                if (((NavigationView) getActivity().findViewById(R.id.nav_view))
                    .getMenu()
                    .getItem(0)
                    .isChecked()) {
                  ((MainNavigationDrawer) getActivity()).createTree(group);
                  //                            new CreateFiles(getActivity(), group).execute();
                } else {
                  ((MainNavigationDrawer) getActivity())
                      .switchContent(TimeTableFragment.newInstance(group));
                  StaticStorage.m_recentGroups.put(group.m_info.m_id, group);
                }
              }
            });

        Button btn = (Button) view.findViewById(R.id.primat_list);
        btn.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                if (!((MainNavigationDrawer) getActivity()).isOnline()) {
                  ((MainNavigationDrawer) getActivity()).askForInternet();
                  return;
                }
                if (StaticStorage.m_primatGroupsName.isEmpty()) {
                  new AlertDialog.Builder(getActivity())
                      .setTitle(getResources().getString(R.string.error))
                      .setMessage(getResources().getString(R.string.not_loaded))
                      .setPositiveButton(android.R.string.ok, null) // dismisses by default
                      .create()
                      .show();
                  return;
                }

                AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                builder.setTitle(getResources().getString(R.string.str_depth));
                builder.setIcon(R.drawable.logo_amd_mod);
                //                        ListView modeList = new ListView(getActivity());
                final ArrayAdapter<String> modeAdapter =
                    new ArrayAdapter<String>(
                        getActivity(),
                        android.R.layout.simple_list_item_1,
                        android.R.id.text1,
                        StaticStorage.m_primatGroupsName);
                builder.setAdapter(
                    modeAdapter,
                    new DialogInterface.OnClickListener() {
                      @Override
                      public void onClick(DialogInterface dialog, int which) {
                        GroupInfo tmpGroup = StaticStorage.m_primatGroups.get(which);
                        new ServerGetTable(tmpGroup, getActivity()).execute();
                      }
                    });
                final Dialog dialog = builder.create();
                dialog.show();
              }
            });
        if (StaticStorage.m_listGroupsName.isEmpty()) {
          if (!((MainNavigationDrawer) getActivity()).isOnline())
            ((MainNavigationDrawer) getActivity()).askForInternet();
          else startDownloadListFaculties((ArrayAdapter<String>) textView.getAdapter());
        }

      } else {
        if (!((MainNavigationDrawer) getActivity()).isOnline())
          ((MainNavigationDrawer) getActivity()).askForInternet();
        textView.setOnItemClickListener(this);
        textView.setHint(R.string.lecturer_search_placeholder);
        adapter =
            new ArrayAdapter<String>(
                getActivity(), R.layout.text_layout, StaticStorage.m_listLecturerName);
        adapter.setNotifyOnChange(true);
        textView.setAdapter(adapter);
        textView.addTextChangedListener(this);

        ListView list = (ListView) view.findViewById(R.id.recentList);
        final ArrayAdapter recent_adapter =
            new ArrayAdapter(
                inflater.getContext(),
                R.layout.detailed_item_list_item,
                new ArrayList(StaticStorage.m_recentLecturers.values())) {
              @Override
              public View getView(int position, View convertView, ViewGroup parent) {
                View holder;
                Lecturer group = (Lecturer) getItem(position);
                if (convertView == null) {
                  // You should fetch the LayoutInflater once in your constructor
                  holder =
                      LayoutInflater.from(parent.getContext())
                          .inflate(R.layout.detailed_item_list_item, parent, false);
                } else {
                  holder = convertView;
                }

                TextView v = (TextView) holder.findViewById(R.id.detailed_item_list_item_text1);
                v.setText(group.m_info.m_fio);
                v = (TextView) holder.findViewById(R.id.detailed_item_list_item_text2);
                v.setText("");
                v = (TextView) holder.findViewById(R.id.detailed_item_list_item_text3);
                v.setText(group.m_info.m_chair);
                return holder;
              }
            };
        list.setAdapter(recent_adapter);
        // ListView Item Click Listener
        list.setOnItemClickListener(
            new AdapterView.OnItemClickListener() {

              @Override
              public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Lecturer lect = (Lecturer) recent_adapter.getItem(position);

                Log.d("init", lect.toString());
                if (((NavigationView) getActivity().findViewById(R.id.nav_view))
                    .getMenu()
                    .getItem(0)
                    .isChecked()) {
                  ((MainNavigationDrawer) getActivity()).createTree(lect);
                  //                            new CreateFiles(getActivity(), lect).execute();
                } else {
                  ((MainNavigationDrawer) getActivity())
                      .switchContent(TimeTableFragment.newInstance(lect));
                  StaticStorage.m_recentLecturers.put(lect.m_info.m_id, lect);
                }
              }
            });
        /*
        Button btn = (Button) view.findViewById(R.id.primat_list);
        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
                builder.setTitle(getResources().getString(R.string.str_depth));

                ListView modeList = new ListView(getActivity());
                ArrayAdapter<String> modeAdapter = new ArrayAdapter<String>(getActivity(),
                        android.R.help.simple_list_item_1, android.R.id.text1,
                        StaticStorage.m_primatLecturerName);
                modeList.setAdapter(modeAdapter);

                builder.setView(modeList);
                final Dialog dialog = builder.create();

                dialog.show();
            }
        });
        */
        Button btn = (Button) view.findViewById(R.id.primat_list);
        btn.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                if (!((MainNavigationDrawer) getActivity()).isOnline())
                  ((MainNavigationDrawer) getActivity()).askForInternet();
                else new ServerGetPrimatLecturers(getActivity(), true).execute();
              }
            });
      }
    }

    //
    // ((CollapsingToolbarLayout)getActivity().findViewById(R.id.collapsing_toolbar_layout)).setTitle(getResources().getString(R.string.search));
    //
    // ((Toolbar)getActivity().findViewById(R.id.toolbar)).setTitle(getResources().getString(R.string.search));

    if (((NavigationView) getActivity().findViewById(R.id.nav_view))
        .getMenu()
        .getItem(0)
        .isChecked()) {
      if (mType == t_type.GROUP) {
        ((AppCompatActivity) getActivity())
            .getSupportActionBar()
            .setTitle(getResources().getString(R.string.choose_group));
      } else {
        ((AppCompatActivity) getActivity())
            .getSupportActionBar()
            .setTitle(getResources().getString(R.string.choose_lectname));
      }
    } else {
      ((AppCompatActivity) getActivity())
          .getSupportActionBar()
          .setTitle(getResources().getString(R.string.search));
    }

    return view;
  }
Beispiel #8
0
  /** Popup Window For Select Area */
  public void openAreaListOfCityPopupWindow(
      final String purpose, final EditText editText, Map<String, Integer> areaMap) {
    try {
      LayoutInflater inflater =
          (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View layout =
          inflater.inflate(
              R.layout.activity_area_list_popup_window, (ViewGroup) findViewById(R.id.popupWindow));

      pwindo = new PopupWindow(layout, LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT, true);
      pwindo.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.WHITE));
      pwindo.showAtLocation(layout, Gravity.CENTER, 0, 0);

      // pwindo.setOutsideTouchable(true);

      search = (EditText) layout.findViewById(R.id.search);
      scroll = (ScrollView) layout.findViewById(R.id.selectedList);
      searchListView = (ListView) layout.findViewById(R.id.searchList);
      selectedItemLayout = (LinearLayout) layout.findViewById(R.id.selectitem);
      selectedItemLayout.setOrientation(LinearLayout.VERTICAL);
      selectedItemList.clear();
      notSelectedItemList.clear();
      masterList.clear();
      selectedItemLayout.removeAllViews();

      if (purpose.equalsIgnoreCase("areaMap")) {
        notSelectedItemList = new ArrayList<String>(areaMap.keySet());
        masterList = new ArrayList<String>(areaMap.keySet());
      }

      Collections.sort(notSelectedItemList);
      Collections.sort(masterList);
      String purposeText = "";

      if (purpose.equalsIgnoreCase("areaMap")) purposeText = editText.getText().toString();

      if (purposeText != null && purposeText.length() > 0) {
        ArrayList<TextView> getAllTextViewbyLanguageText = new ArrayList<TextView>();
        selectedItemList = new ArrayList<String>(Arrays.asList(purposeText.split(" - ")));
        final ArrayList<TextView> getLanguageTextView =
            getAllLanguageTextViewbyLanguageText(
                purposeText, getAllTextViewbyLanguageText, selectedItemList);
        notSelectedItemList.removeAll(selectedItemList);
        counter = getLanguageTextView.size();
        for (int i = 0; i < getLanguageTextView.size(); i++) {
          addTextViewINLinearLayout(selectedItemLayout, getLanguageTextView.get(i), getActivity());
        }
      } else {
        counter = 0;
      }

      adapter =
          new ArrayAdapter<String>(getActivity(), R.layout.demo, R.id.listTV, notSelectedItemList);
      adapter.setNotifyOnChange(true);
      searchListView.setAdapter(adapter);

      // on click of done button fill the selected item into edit box
      done = (Button) layout.findViewById(R.id.doneButton);
      done.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              ArrayList<TextView> allTextView = new ArrayList<TextView>();
              pwindo.dismiss();
              allTextView = getAllTextViewbyParentLinearLayout(selectedItemLayout, allTextView);

              String getAllTextViewString = getAlltextViewString(allTextView);

              if (purpose.equalsIgnoreCase("areaMap"))
                editText.setText(getAllTextViewString, TextView.BufferType.EDITABLE);
            }
          });

      // close the screen
      cancel = (Button) layout.findViewById(R.id.cancelPopupButton);
      cancel.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              pwindo.dismiss();
              counter = 0;
            }
          });

      search.addTextChangedListener(
          new TextWatcher() {
            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {}

            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

            @Override
            public void afterTextChanged(Editable s) {
              int length = search.getText().length();
              if (search.getText().length() > 0) {
                @SuppressWarnings("unchecked")
                List<String> searchItemList =
                    (List<String>)
                        CollectionUtils.select(
                            masterList,
                            new Predicate() {
                              @Override
                              public boolean evaluate(Object item) {
                                String text = search.getText().toString().toLowerCase();
                                return !selectedItemList.contains(item)
                                    && String.valueOf(item).toLowerCase().startsWith(text);
                              }
                            });

                Collections.sort(searchItemList);
                notSelectedItemList.clear();
                notSelectedItemList.addAll(searchItemList);
                adapter.notifyDataSetChanged();
              } else {
                notSelectedItemList.clear();
                notSelectedItemList.addAll(masterList);
                notSelectedItemList.removeAll(selectedItemList);
                Collections.sort(notSelectedItemList);
                adapter.notifyDataSetChanged();
              }
            }
          });

      searchListView.setOnItemClickListener(
          new OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> adapterView, View v, int position, long id) {

              String item = (String) searchListView.getItemAtPosition(position);

              final TextView tv = new TextView(getActivity());

              tv.setText(item);

              tv.setId((int) id);

              LinearLayout.LayoutParams llp =
                  new LinearLayout.LayoutParams(
                      LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

              llp.setMargins(12, 8, 0, 0); // llp.setMargins(left,
              // top,right, bottom);

              tv.setLayoutParams(llp);

              tv.setCompoundDrawablesWithIntrinsicBounds(R.drawable.imageclose, 0, 0, 0);

              tv.setOnClickListener(
                  new OnClickListener() {

                    @Override
                    public void onClick(View v) {

                      clickOnTextView(tv);
                    }
                  });

              // set condition to select maximum 10 area
              if (counter < 10) {

                counter++;

                addTextViewINLinearLayout(selectedItemLayout, tv, getActivity());

                selectedItemList.add(notSelectedItemList.get(position));

                notSelectedItemList.remove(position);

                adapter.notifyDataSetChanged();
              }

              // scroll view down at bottom wheen add item
              scroll.post(
                  new Runnable() {
                    @Override
                    public void run() {

                      scroll.fullScroll(View.FOCUS_DOWN);
                    }
                  });
            }
          });

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.item_choose_list);

    // Intent intent = getIntent();
    opr = this.getIntent().getIntExtra("opr", 0);
    userType = this.getIntent().getIntExtra("user_type", 0);
    _id = this.getIntent().getIntExtra("_id", 0);
    _name = this.getIntent().getStringExtra("_name");
    _address = this.getIntent().getStringExtra("_address");
    userId = getIntent().getStringExtra("userId");

    newBtn = (Button) findViewById(R.id.createNewBtn);
    TextView keyView = (TextView) findViewById(R.id.item_chose_text_edit);

    if (opr == DbAdapter.PRACTICE) {
      setTitle(getString(R.string.app_name) + " - Choose your Practice");
      newBtn.setVisibility(View.GONE);
    } else if (opr == DbAdapter.HOSPITAL) {
      setTitle(getString(R.string.app_name) + " - Choose your Hospital");
      newBtn.setVisibility(View.GONE);
    } else if (opr == DbAdapter.SPECIALTY) {
      setTitle(getString(R.string.app_name) + " - Choose your Specialty");
      newBtn.setVisibility(View.GONE);
    } else if (opr == DbAdapter.DOCTOR) {
      setTitle("Choose your Name");
      newBtn.setVisibility(View.VISIBLE);
      keyView.setHint("Enter your last name");
      newBtn.setText("Click, if you do not find your name");
    }

    // dba = new DbAdapter(this);
    // dba.open();
    itemListView = (ListView) findViewById(R.id.itemChoseList);

    if (opr == DbAdapter.DOCTOR) {
      simpleAdapter =
          new SimpleAdapter(
              this,
              docList,
              R.layout.doctor_row_lite,
              new String[] {"docTitile1", "docTitile2"},
              new int[] {R.id.doc_lite_title1, R.id.doc_lite_title2});
      simpleAdapter.notifyDataSetChanged();
      // simpleAdapter.setNotifyOnChange(true); // This is so I don't have to manually sync whenever
      // changed
      itemListView.setAdapter(simpleAdapter);
    } else {
      autoCompleteAdapter =
          new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line);
      autoCompleteAdapter.setNotifyOnChange(
          true); // This is so I don't have to manually sync whenever changed
      itemListView.setAdapter(autoCompleteAdapter);
    }
    textView = (TextView) findViewById(R.id.item_chose_text_edit);
    // footerView = (TextView)findViewById(R.id.item_chose_footer);

    final TextWatcher textChecker =
        new TextWatcher() {

          public void afterTextChanged(Editable s) {
            // textView.setEnabled(true);
          }

          public void beforeTextChanged(CharSequence s, int start, int count, int after) {
            // textView.setEnabled(false);
          }

          public void onTextChanged(CharSequence s, int start, int before, int count) {

            searchText = s.toString();
            systemtaskHandler.removeCallbacks(systemTaskRunner);
            systemtaskHandler.postDelayed(systemTaskRunner, 1500);
            //

          }
        };
    textView.addTextChangedListener(textChecker);

    itemListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {

          public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
            selectedItemIdx = position;
            if (opr == DbAdapter.PRACTICE) {
              Intent intent = new Intent(ItemChooseActivity.this, ItemChooseActivity.class);
              intent.putExtra("opr", DbAdapter.SPECIALTY);
              intent.putExtra("user_type", 1);
              intent.putExtra("_id", Integer.parseInt((String) idArr[selectedItemIdx]));
              intent.putExtra("_name", (String) nameArr[selectedItemIdx]);
              intent.putExtra("_address", (String) addArr[selectedItemIdx]);
              System.out.println("SMM::PRAC_ID::" + (String) idArr[selectedItemIdx]);
              startActivityForResult(intent, 1100);
            } else if (opr == DbAdapter.HOSPITAL) {
              Intent intent = new Intent(ItemChooseActivity.this, ItemChooseActivity.class);
              intent.putExtra("opr", DbAdapter.SPECIALTY);
              intent.putExtra("user_type", 2);
              intent.putExtra("_id", Integer.parseInt((String) idArr[selectedItemIdx]));
              intent.putExtra("_name", (String) nameArr[selectedItemIdx]);
              intent.putExtra("_address", (String) addArr[selectedItemIdx]);
              System.out.println("SMM::PRAC_ID::" + (String) idArr[selectedItemIdx]);
              startActivityForResult(intent, 1100);
              // Intent intent = new Intent(ItemChooseActivity.this, RegFormActivity.class);
              // intent.putExtra("prac_id", Integer.parseInt((String)idArr[selectedItemIdx+1]));
              // intent.putExtra("prac_name", (String)nameArr[selectedItemIdx+1]);
              // intent.putExtra("prac_address", (String)addArr[selectedItemIdx+1]);
              // System.out.println("SMM::HOSP_ID::"+(String)idArr[selectedItemIdx]);
              // startActivityForResult(intent, 1100);
            } else if (opr == DbAdapter.SPECIALTY) {
              Intent intent = new Intent(ItemChooseActivity.this, PCPRegFormActivity.class);
              intent.putExtra("user_type", userType);
              intent.putExtra("prac_id", _id);
              intent.putExtra("prac_name", _name);
              intent.putExtra("prac_address", _address);
              intent.putExtra("spec_id", Integer.parseInt((String) idArr[selectedItemIdx]));
              intent.putExtra("spec_name", (String) nameArr[selectedItemIdx]);
              System.out.println("SMM::SPEC_ID::" + (String) idArr[selectedItemIdx]);
              startActivityForResult(intent, 1100);
            } else if (opr == DbAdapter.DOCTOR) {
              Intent intent = new Intent(ItemChooseActivity.this, PCPRegFormActivity.class);
              try {
                JSONObject obj = (JSONObject) docList2.get(selectedItemIdx);
                intent.putExtra("user_type", userType);
                intent.putExtra("doc_id", obj.getInt("id"));
                intent.putExtra("prac_id", obj.getInt("prac_id"));
                // System.out.println("SMM::PRAC_ID="+obj.getInt("prac_id"));
                intent.putExtra("prac_name", obj.getString("prac_name"));
                intent.putExtra("prac_address", obj.getString("add_line_1"));
              } catch (Exception ex) {
                System.out.println("SMM::ERROR::" + ex);
              }
              intent.putExtra("doc_id", Integer.parseInt((String) idArr[selectedItemIdx]));
              System.out.println("SMM::DOC_ID::" + (String) idArr[selectedItemIdx]);
              startActivityForResult(intent, 1100);
            }
          }
        });

    newBtn.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            Intent intent = new Intent(ItemChooseActivity.this, ItemChooseActivity.class);
            if (userType == 1) intent.putExtra("opr", DbAdapter.PRACTICE);
            if (userType == 2) intent.putExtra("opr", DbAdapter.HOSPITAL);
            // intent.putExtra("_id", _id);
            // intent.putExtra("_name", _name);
            // intent.putExtra("_address", _address);
            startActivityForResult(intent, 1100);
            /*
            Intent intent = new Intent(ItemChooseActivity.this, PCPRegFormActivity.class);
            intent.putExtra("prac_id", _id);
            intent.putExtra("prac_name", _name);
            intent.putExtra("prac_address", _address);
            startActivityForResult(intent, 1100);
            */
          }
        });

    searchText = "";
    systemtaskHandler.removeCallbacks(systemTaskRunner);
    systemtaskHandler.postDelayed(systemTaskRunner, 1500);
  }