public kehu_gengxinshijianPopWindow(final Activity context) {
    this.context = context;
    LayoutInflater inflater =
        (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    conentView = inflater.inflate(R.layout.crm_kehu_gengxinshijian, null);
    int h = context.getWindowManager().getDefaultDisplay().getHeight();
    int w = context.getWindowManager().getDefaultDisplay().getWidth();
    // 设置SelectPicPopupWindow的View
    this.setContentView(conentView);
    // 设置SelectPicPopupWindow弹出窗体的宽
    // this.setWidth(w / 2 + 50);
    this.setWidth(w / 2);
    // 设置SelectPicPopupWindow弹出窗体的高
    this.setHeight(LayoutParams.WRAP_CONTENT);
    // 设置SelectPicPopupWindow弹出窗体可点击
    this.setFocusable(true);
    this.setOutsideTouchable(true);
    // 刷新状态
    this.update();
    // 实例化一个ColorDrawable颜色为半透明
    ColorDrawable dw = new ColorDrawable(0000000000);
    // 点back键和其他地方使其消失,设置了这个才能触发OnDismisslistener ,设置其他控件变化等操作
    this.setBackgroundDrawable(dw);
    // mPopupWindow.setAnimationStyle(android.R.style.Animation_Dialog);
    // 设置SelectPicPopupWindow弹出窗体动画效果

    // this.setAnimationStyle(R.style.AnimationPreview);
    l1 = (LinearLayout) conentView.findViewById(R.id.l1);
    l2 = (LinearLayout) conentView.findViewById(R.id.l2);
    l3 = (LinearLayout) conentView.findViewById(R.id.l3);
    l1.setOnTouchListener(this);
    l2.setOnTouchListener(this);
    l3.setOnTouchListener(this);
  }
Ejemplo n.º 2
0
  private LinearLayout getRowView(Item item) {
    LinearLayout wrapper = new LinearLayout(getContext());
    LinearLayout rowLayout = new LinearLayout(getContext());

    int textStyle = item.hasShortDesc() ? Typeface.BOLD : Typeface.NORMAL;
    TextView textView = util.createTamilTextView(0xFF000000, 18, textStyle);
    textView.setText(item.getText());
    textView.setLayoutParams(new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT, 1));
    rowLayout.addView(textView);

    if (!item.getChildren().isEmpty()) {
      TextView arrow = util.createTamilTextView(0xFF000000, 18, Typeface.NORMAL);
      arrow.setText(">");
      rowLayout.addView(arrow);
      wrapper.setOnClickListener(getClickListener());
      wrapper.setOnTouchListener(getHighlightListener());
    }

    wrapper.setOrientation(LinearLayout.VERTICAL);
    setRowStyle(wrapper);
    wrapper.setTag(item);
    wrapper.addView(rowLayout);

    if (item.hasShortDesc()) {
      TextView desc = util.createTamilTextView(0xFF000000, 14, Typeface.NORMAL);
      desc.setText(item.getShortDesc());
      wrapper.addView(desc);
    }

    return wrapper;
  }
  @Override
  protected void onStart() {
    super.onStart();

    // save 4MB of logcat to the SD card
    RobotLog.writeLogcatToDisk(this, 4 * 1024);

    Intent intent = new Intent(this, FtcRobotControllerService.class);
    bindService(intent, connection, Context.BIND_AUTO_CREATE);

    utility.updateHeader(
        Utility.NO_FILE,
        R.string.pref_hardware_config_filename,
        R.id.active_filename,
        R.id.included_header);

    callback.wifiDirectUpdate(WifiDirectAssistant.Event.DISCONNECTED);

    entireScreenLayout.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            dimmer.handleDimTimer();
            return false;
          }
        });

    wifiLock.acquire();
  }
Ejemplo n.º 4
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_content);
   layout = (LinearLayout) findViewById(R.id.content_activity_layout);
   layout.setOnTouchListener(this);
   initView();
 }
  public void updateList() {

    sideIndex.removeAllViews();
    indexListSize = alphabet.size();
    if (indexListSize < 1) {
      return;
    }

    int indexMaxSize = (int) Math.floor(sideIndex.getHeight() / 20);
    int tmpIndexListSize = indexListSize;
    while (tmpIndexListSize > indexMaxSize) {
      tmpIndexListSize = tmpIndexListSize / 2;
    }
    double delta;
    if (tmpIndexListSize > 0) {
      delta = indexListSize / tmpIndexListSize;
    } else {
      delta = 1;
    }

    TextView tmpTV;
    for (double i = 1; i <= indexListSize; i = i + delta) {
      Object[] tmpIndexItem = alphabet.get((int) i - 1);
      String tmpLetter = tmpIndexItem[0].toString();

      tmpTV = new TextView(contexto);
      tmpTV.setText(tmpLetter);
      tmpTV.setGravity(Gravity.CENTER);
      tmpTV.setTextSize(15);
      LinearLayout.LayoutParams params =
          new LinearLayout.LayoutParams(
              ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, 1);
      tmpTV.setLayoutParams(params);
      sideIndex.addView(tmpTV);
    }

    sideIndexHeight = sideIndex.getHeight();

    sideIndex.setOnTouchListener(
        new OnTouchListener() {
          @SuppressLint("ClickableViewAccessibility")
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            // now you know coordinates of touch
            sideIndexX = event.getX();
            sideIndexY = event.getY();

            // and can display a proper item it country list
            displayListItem();

            return false;
          }
        });
  }
  private void addGestureListener() {
    gestureDetector = new GestureDetector(this, new MyGestureDetector());

    LinearLayout centerpane = (LinearLayout) findViewById(R.id.center_pane);
    centerpane.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            return gestureDetector.onTouchEvent(event);
          }
        });
  }
  @Override
  public View onCreateView(
      @NotNull LayoutInflater inflater, ViewGroup container, @Nullable Bundle savedInstanceState) {
    Log.v(TAG, "onCreateView() this:" + this + " savedInstance:" + savedInstanceState);

    Bundle arguments = getArguments();
    actionbar = getActivity().getActionBar();
    Log.v(TAG, "Fragment bundle:" + this + " arguments:" + arguments);
    LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.other_filter, container, false);

    cbHideCompleted = (CheckBox) layout.findViewById(R.id.cb_show_completed);
    cbHideFuture = (CheckBox) layout.findViewById(R.id.cb_show_future);
    cbHideLists = (CheckBox) layout.findViewById(R.id.cb_show_lists);
    cbHideTags = (CheckBox) layout.findViewById(R.id.cb_show_tags);
    if (savedInstanceState != null) {
      cbHideCompleted.setChecked(
          !savedInstanceState.getBoolean(ActiveFilter.INTENT_HIDE_COMPLETED_FILTER, false));
      cbHideFuture.setChecked(
          !savedInstanceState.getBoolean(ActiveFilter.INTENT_HIDE_FUTURE_FILTER, false));
      cbHideLists.setChecked(
          !savedInstanceState.getBoolean(ActiveFilter.INTENT_HIDE_LISTS_FILTER, false));
      cbHideTags.setChecked(
          !savedInstanceState.getBoolean(ActiveFilter.INTENT_HIDE_TAGS_FILTER, false));
    } else {
      cbHideCompleted.setChecked(
          !arguments.getBoolean(ActiveFilter.INTENT_HIDE_COMPLETED_FILTER, false));
      cbHideFuture.setChecked(!arguments.getBoolean(ActiveFilter.INTENT_HIDE_FUTURE_FILTER, false));
      cbHideLists.setChecked(!arguments.getBoolean(ActiveFilter.INTENT_HIDE_LISTS_FILTER, false));
      cbHideTags.setChecked(!arguments.getBoolean(ActiveFilter.INTENT_HIDE_TAGS_FILTER, false));
    }

    gestureDetector =
        new GestureDetector(TodoApplication.getAppContext(), new FilterGestureDetector());
    OnTouchListener gestureListener =
        new OnTouchListener() {
          @Override
          public boolean onTouch(@NotNull View v, @NotNull MotionEvent event) {
            if (gestureDetector.onTouchEvent(event)) {
              MotionEvent cancelEvent = MotionEvent.obtain(event);
              cancelEvent.setAction(MotionEvent.ACTION_CANCEL);
              v.onTouchEvent(cancelEvent);
              return true;
            }
            return false;
          }
        };

    layout.setOnTouchListener(gestureListener);
    return layout;
  }
  private void onClick() {

    rootlayout.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            InputMethodManager in =
                (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);

            in.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
            return false;
          }
        });
  }
Ejemplo n.º 9
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.news);
    Log.e("LANG", Locale.getDefault().getDisplayLanguage());

    llbtnsched = (LinearLayout) findViewById(R.id.llbtnsched);
    llbtnnews = (LinearLayout) findViewById(R.id.llbtnnews);
    llbtnteams = (LinearLayout) findViewById(R.id.llbtnteams);
    llbtnsetting = (LinearLayout) findViewById(R.id.llbtnsetting);
    llbtnnews.setOnTouchListener(touch);
    llbtnsched.setOnTouchListener(touch);
    llbtnteams.setOnTouchListener(touch);
    llbtnsetting.setOnTouchListener(touch);

    btnSchedule = (Button) findViewById(R.id.btnSchedule);
    btnNews = (Button) findViewById(R.id.btnNews);
    btnTeams = (Button) findViewById(R.id.btnTeams);
    btnSetting = (Button) findViewById(R.id.btnSetting);
    btnlist = (Button) findViewById(R.id.btnlist);

    vfnew = (ViewFlipper) findViewById(R.id.vfnews);
    lvnew = (ListView) findViewById(R.id.lvnews);

    btnTeams.setOnClickListener(this);
    btnSetting.setOnClickListener(this);
    btnSchedule.setOnClickListener(this);
    handler = new Handler();

    btnlist.setOnClickListener(
        new OnClickListener() {
          public void onClick(View v) {
            showList();
          }
        });
    showList();
  }
Ejemplo n.º 10
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   // TODO Auto-generated method stub
   super.onCreate(savedInstanceState);
   this.requestWindowFeature(Window.FEATURE_NO_TITLE); // ШЁЯћБъЬт
   setContentView(R.layout.songschoice_layout);
   gridview1 = (GridView) findViewById(R.id.songfunction);
   quxiao = (LinearLayout) findViewById(R.id.quxiao);
   buttonquxiao = (Button) findViewById(R.id.cancel);
   hhh2 = new songuiadapter(new uiassit().tubiao(), this);
   gridview1.setAdapter(hhh2);
   quxiao.setOnTouchListener(this);
   gridview1.setOnItemClickListener(this);
   buttonquxiao.setOnClickListener(this);
 }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   requestWindowFeature(Window.FEATURE_NO_TITLE);
   final LinearLayout loginEntryView =
       (LinearLayout) getLayoutInflater().inflate(R.layout.renren_sdk_login_entry, null);
   loginEntryView.setOnClickListener(null);
   loginEntryView.setOnTouchListener(null);
   loginEntryView.setOnLongClickListener(null);
   loginEntryView.setOnKeyListener(null);
   ViewGroup.LayoutParams params =
       new ViewGroup.LayoutParams(
           ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
   addContentView(loginEntryView, params);
   initViews(loginEntryView);
 }
Ejemplo n.º 12
0
  private LinearLayout initLayout(Context context) {
    LinearLayout layout = new LinearLayout(context);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setFadingEdgeLength(0);
    layout.setGravity(Gravity.CENTER);

    layout.setOnTouchListener(
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN) {
              hide();
            }
            return false;
          }
        });

    return layout;
  }
Ejemplo n.º 13
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_layout);
    /** Layout init * */
    sliding_lyt = (LinearLayout) findViewById(R.id.sliding_lyt);
    sliding_lyt.setClickable(true);

    /** Animator create * */
    float start = -200 * Propose.getDensity(this);
    float end = 0;
    sliding_lyt.setX(start);
    ObjectAnimator rightAnimator =
        ObjectAnimator.ofFloat(sliding_lyt, View.TRANSLATION_X, start, end);
    rightAnimator.setDuration(500);
    /** "duration" use to onClick * */

    /** Propose create * */
    Propose propose = new Propose(this);
    propose.motionRight.play(rightAnimator);
    /** set right move Animator * */
    sliding_lyt.setOnTouchListener(propose);
    /** set touch listener * */
    propose.motionRight.setMotionDistance(-start);
    /** set Drag Distance * */

    /** set MotionListener for black Alpha* */
    propose.motionRight.setOnMotionListener(
        new MotionListener() {
          @Override
          public void onStart(boolean isForward) {}

          @Override
          public void onScroll(long currDuration, long totalDuration, boolean isForward) {
            float alpha = (float) currDuration / totalDuration / 2; // max 0.5
            findViewById(R.id.alpha_lyt).setAlpha(alpha);
          }

          @Override
          public void onEnd(boolean isForward) {}
        });
  }
  @Override
  public void onResume() {
    super.onResume();
    mDetector =
        new GestureDetector(
            this,
            new GestureDetector.SimpleOnGestureListener() {

              @Override
              public void onLongPress(MotionEvent e) {
                System.out.println("DETECTED LONG PRESS");
                recordButton.setVisibility(View.VISIBLE);
                //                youTubePlayer.pause();
              }

              @Override
              public boolean onSingleTapConfirmed(MotionEvent e) {
                System.out.println("DETECTED SINGLE TAP");
                if (!youTubePlayer.isPlaying()) {
                  System.out.println("Will play");
                  youTubePlayer.play();
                } else if (youTubePlayer.isPlaying()) {
                  System.out.println("Will pause");
                  youTubePlayer.pause();
                }
                return true;
              }
            });

    gestureListener =
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            System.out.println("ACK!!");
            mDetector.onTouchEvent(event);
            return true;
          }
        };
    gesturePane.setOnTouchListener(gestureListener);
  }
  @Override
  public View getCallout(
      final Context mContext, final ArrayList<? extends MapItem> mapItems, final int position) {

    LayoutInflater inflater =
        (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    LinearLayout calloutLayout = (LinearLayout) inflater.inflate(R.layout.map_item_callout, null);
    TextView calloutView = (TextView) inflater.inflate(R.layout.map_building_callout, null);
    calloutView.setText(this.getMapItemName());
    calloutLayout.addView(calloutView);
    calloutLayout.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            return false;
          }
        });

    calloutLayout.setOnClickListener(
        new View.OnClickListener() {

          @SuppressWarnings("unchecked")
          @Override
          public void onClick(View v) {
            Intent i = new Intent(mContext, MITMapDetailsSliderActivity.class);
            i.putParcelableArrayListExtra(
                MITMapView.MAP_ITEMS_KEY, (ArrayList<? extends Parcelable>) mapItems);
            i.putExtra(MITMapView.MAP_ITEM_INDEX_KEY, position);
            mContext.startActivity(i);
          }
        });

    return calloutLayout;
  }
Ejemplo n.º 16
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    animation_duration = getResources().getInteger(R.integer.animation_duration);

    /** Views * */
    /** Main Sections * */
    main_sections = (RelativeLayout) findViewById(R.id.main_sections);
    main_sections_bar = (LinearLayout) findViewById(R.id.main_sections_bar);

    /** On Touch Listeners * */
    main_sections_bar.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View view, MotionEvent motionEvent) {

            switch (motionEvent.getAction()) {
              case MotionEvent.ACTION_UP:
                Log.d(TAG, "ActionUp: " + motionEvent.toString());
                sectionsUp(motionEvent);
                break;
              case MotionEvent.ACTION_MOVE:
                sectionsMove(motionEvent);
                break;
              default:
                break;
            }

            return true;
          }
        });
  }
  @Override
  public View createView(Context context, LayoutInflater inflater) {
    searching = false;
    searchWas = false;

    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("Language", R.string.Language));

    actionBar.setActionBarMenuOnItemClick(
        new ActionBar.ActionBarMenuOnItemClick() {
          @Override
          public void onItemClick(int id) {
            if (id == -1) {
              finishFragment();
            }
          }
        });

    ActionBarMenu menu = actionBar.createMenu();
    ActionBarMenuItem item =
        menu.addItem(0, R.drawable.ic_ab_search)
            .setIsSearchField(true)
            .setActionBarMenuItemSearchListener(
                new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
                  @Override
                  public void onSearchExpand() {
                    searching = true;
                  }

                  @Override
                  public void onSearchCollapse() {
                    search(null);
                    searching = false;
                    searchWas = false;
                    if (listView != null) {
                      emptyTextView.setVisibility(View.GONE);
                      listView.setAdapter(listAdapter);
                    }
                  }

                  @Override
                  public void onTextChanged(EditText editText) {
                    String text = editText.getText().toString();
                    search(text);
                    if (text.length() != 0) {
                      searchWas = true;
                      if (listView != null) {
                        listView.setAdapter(searchListViewAdapter);
                      }
                    }
                  }
                });
    item.getSearchField().setHint(LocaleController.getString("Search", R.string.Search));

    listAdapter = new ListAdapter(context);
    searchListViewAdapter = new SearchAdapter(context);

    fragmentView = new FrameLayout(context);

    LinearLayout emptyTextLayout = new LinearLayout(context);
    emptyTextLayout.setVisibility(View.INVISIBLE);
    emptyTextLayout.setOrientation(LinearLayout.VERTICAL);
    ((FrameLayout) fragmentView).addView(emptyTextLayout);
    FrameLayout.LayoutParams layoutParams =
        (FrameLayout.LayoutParams) emptyTextLayout.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.gravity = Gravity.TOP;
    emptyTextLayout.setLayoutParams(layoutParams);
    emptyTextLayout.setOnTouchListener(
        new View.OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            return true;
          }
        });

    emptyTextView = new TextView(context);
    emptyTextView.setTextColor(0xff808080);
    emptyTextView.setTextSize(20);
    emptyTextView.setGravity(Gravity.CENTER);
    emptyTextView.setText(LocaleController.getString("NoResult", R.string.NoResult));
    emptyTextLayout.addView(emptyTextView);
    LinearLayout.LayoutParams layoutParams1 =
        (LinearLayout.LayoutParams) emptyTextView.getLayoutParams();
    layoutParams1.width = LayoutHelper.MATCH_PARENT;
    layoutParams1.height = LayoutHelper.MATCH_PARENT;
    layoutParams1.weight = 0.5f;
    emptyTextView.setLayoutParams(layoutParams1);

    FrameLayout frameLayout = new FrameLayout(context);
    emptyTextLayout.addView(frameLayout);
    layoutParams1 = (LinearLayout.LayoutParams) frameLayout.getLayoutParams();
    layoutParams1.width = LayoutHelper.MATCH_PARENT;
    layoutParams1.height = LayoutHelper.MATCH_PARENT;
    layoutParams1.weight = 0.5f;
    frameLayout.setLayoutParams(layoutParams1);

    listView = new ListView(context);
    listView.setEmptyView(emptyTextLayout);
    listView.setVerticalScrollBarEnabled(false);
    listView.setDivider(null);
    listView.setDividerHeight(0);
    listView.setAdapter(listAdapter);
    ((FrameLayout) fragmentView).addView(listView);
    layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    listView.setLayoutParams(layoutParams);

    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
            LocaleController.LocaleInfo localeInfo = null;
            if (searching && searchWas) {
              if (i >= 0 && i < searchResult.size()) {
                localeInfo = searchResult.get(i);
              }
            } else {
              if (i >= 0 && i < LocaleController.getInstance().sortedLanguages.size()) {
                localeInfo = LocaleController.getInstance().sortedLanguages.get(i);
              }
            }
            if (localeInfo != null) {
              LocaleController.getInstance().applyLanguage(localeInfo, true);
              parentLayout.rebuildAllFragmentViews(false);
            }
            finishFragment();
          }
        });

    listView.setOnItemLongClickListener(
        new AdapterView.OnItemLongClickListener() {
          @Override
          public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) {
            LocaleController.LocaleInfo localeInfo = null;
            if (searching && searchWas) {
              if (i >= 0 && i < searchResult.size()) {
                localeInfo = searchResult.get(i);
              }
            } else {
              if (i >= 0 && i < LocaleController.getInstance().sortedLanguages.size()) {
                localeInfo = LocaleController.getInstance().sortedLanguages.get(i);
              }
            }
            if (localeInfo == null
                || localeInfo.pathToFile == null
                || getParentActivity() == null) {
              return false;
            }
            final LocaleController.LocaleInfo finalLocaleInfo = localeInfo;
            AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
            builder.setMessage(
                LocaleController.getString("DeleteLocalization", R.string.DeleteLocalization));
            builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
            builder.setPositiveButton(
                LocaleController.getString("Delete", R.string.Delete),
                new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialogInterface, int i) {
                    if (LocaleController.getInstance().deleteLanguage(finalLocaleInfo)) {
                      if (searchResult != null) {
                        searchResult.remove(finalLocaleInfo);
                      }
                      if (listAdapter != null) {
                        listAdapter.notifyDataSetChanged();
                      }
                      if (searchListViewAdapter != null) {
                        searchListViewAdapter.notifyDataSetChanged();
                      }
                    }
                  }
                });
            builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
            showDialog(builder.create());
            return true;
          }
        });

    listView.setOnScrollListener(
        new AbsListView.OnScrollListener() {
          @Override
          public void onScrollStateChanged(AbsListView absListView, int i) {
            if (i == SCROLL_STATE_TOUCH_SCROLL && searching && searchWas) {
              AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus());
            }
          }

          @Override
          public void onScroll(
              AbsListView absListView,
              int firstVisibleItem,
              int visibleItemCount,
              int totalItemCount) {}
        });

    return fragmentView;
  }
Ejemplo n.º 18
0
  @Override
  public View createView(LayoutInflater inflater) {
    if (fragmentView == null) {
      searching = false;
      searchWas = false;

      actionBar.setBackButtonImage(R.drawable.ic_ab_back);
      actionBar.setAllowOverlayTitle(true);
      if (isAlwaysShare) {
        actionBar.setTitle(
            LocaleController.getString("AlwaysShareWithTitle", R.string.AlwaysShareWithTitle));
      } else if (isNeverShare) {
        actionBar.setTitle(
            LocaleController.getString("NeverShareWithTitle", R.string.NeverShareWithTitle));
      } else {
        actionBar.setTitle(
            isBroadcast
                ? LocaleController.getString("NewBroadcastList", R.string.NewBroadcastList)
                : LocaleController.getString("NewGroup", R.string.NewGroup));
        actionBar.setSubtitle(
            LocaleController.formatString(
                "MembersCount", R.string.MembersCount, selectedContacts.size(), maxCount));
      }

      actionBar.setActionBarMenuOnItemClick(
          new ActionBar.ActionBarMenuOnItemClick() {
            @Override
            public void onItemClick(int id) {
              if (id == -1) {
                finishFragment();
              } else if (id == done_button) {
                if (selectedContacts.isEmpty()) {
                  return;
                }
                ArrayList<Integer> result = new ArrayList<>();
                result.addAll(selectedContacts.keySet());
                if (isAlwaysShare || isNeverShare) {
                  if (delegate != null) {
                    delegate.didSelectUsers(result);
                  }
                  finishFragment();
                } else {
                  Bundle args = new Bundle();
                  args.putIntegerArrayList("result", result);
                  args.putBoolean("broadcast", isBroadcast);
                  presentFragment(new GroupCreateFinalActivity(args));
                }
              }
            }
          });
      ActionBarMenu menu = actionBar.createMenu();
      menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));

      searchListViewAdapter = new ContactsSearchAdapter(getParentActivity(), null, false);
      searchListViewAdapter.setCheckedMap(selectedContacts);
      searchListViewAdapter.setUseUserCell(true);
      listViewAdapter = new ContactsAdapter(getParentActivity(), true, false, null);
      listViewAdapter.setCheckedMap(selectedContacts);

      fragmentView = new LinearLayout(getParentActivity());
      LinearLayout linearLayout = (LinearLayout) fragmentView;
      linearLayout.setOrientation(LinearLayout.VERTICAL);

      FrameLayout frameLayout = new FrameLayout(getParentActivity());
      linearLayout.addView(frameLayout);
      LinearLayout.LayoutParams layoutParams =
          (LinearLayout.LayoutParams) frameLayout.getLayoutParams();
      layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
      layoutParams.height = LinearLayout.LayoutParams.WRAP_CONTENT;
      layoutParams.gravity = Gravity.TOP;
      frameLayout.setLayoutParams(layoutParams);

      userSelectEditText = new EditText(getParentActivity());
      userSelectEditText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
      userSelectEditText.setHintTextColor(0xff979797);
      userSelectEditText.setTextColor(0xff212121);
      userSelectEditText.setInputType(
          InputType.TYPE_TEXT_VARIATION_FILTER
              | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
              | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
      userSelectEditText.setMinimumHeight(AndroidUtilities.dp(54));
      userSelectEditText.setSingleLine(false);
      userSelectEditText.setLines(2);
      userSelectEditText.setMaxLines(2);
      userSelectEditText.setVerticalScrollBarEnabled(true);
      userSelectEditText.setHorizontalScrollBarEnabled(false);
      userSelectEditText.setPadding(0, 0, 0, 0);
      userSelectEditText.setImeOptions(
          EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
      userSelectEditText.setGravity(
          (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
      AndroidUtilities.clearCursorDrawable(userSelectEditText);
      frameLayout.addView(userSelectEditText);
      FrameLayout.LayoutParams layoutParams1 =
          (FrameLayout.LayoutParams) userSelectEditText.getLayoutParams();
      layoutParams1.width = FrameLayout.LayoutParams.MATCH_PARENT;
      layoutParams1.height = FrameLayout.LayoutParams.WRAP_CONTENT;
      layoutParams1.leftMargin = AndroidUtilities.dp(10);
      layoutParams1.rightMargin = AndroidUtilities.dp(10);
      layoutParams1.gravity = Gravity.TOP;
      userSelectEditText.setLayoutParams(layoutParams1);

      if (isAlwaysShare) {
        userSelectEditText.setHint(
            LocaleController.getString(
                "AlwaysShareWithPlaceholder", R.string.AlwaysShareWithPlaceholder));
      } else if (isNeverShare) {
        userSelectEditText.setHint(
            LocaleController.getString(
                "NeverShareWithPlaceholder", R.string.NeverShareWithPlaceholder));
      } else {
        userSelectEditText.setHint(
            LocaleController.getString("SendMessageTo", R.string.SendMessageTo));
      }
      if (Build.VERSION.SDK_INT >= 11) {
        userSelectEditText.setTextIsSelectable(false);
      }
      userSelectEditText.addTextChangedListener(
          new TextWatcher() {
            @Override
            public void beforeTextChanged(
                CharSequence charSequence, int start, int count, int after) {
              if (!ignoreChange) {
                beforeChangeIndex = userSelectEditText.getSelectionStart();
                changeString = new SpannableString(charSequence);
              }
            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {}

            @Override
            public void afterTextChanged(Editable editable) {
              if (!ignoreChange) {
                boolean search = false;
                int afterChangeIndex = userSelectEditText.getSelectionEnd();
                if (editable.toString().length() < changeString.toString().length()) {
                  String deletedString = "";
                  try {
                    deletedString =
                        changeString.toString().substring(afterChangeIndex, beforeChangeIndex);
                  } catch (Exception e) {
                    FileLog.e("tmessages", e);
                  }
                  if (deletedString.length() > 0) {
                    if (searching && searchWas) {
                      search = true;
                    }
                    Spannable span = userSelectEditText.getText();
                    for (int a = 0; a < allSpans.size(); a++) {
                      XImageSpan sp = allSpans.get(a);
                      if (span.getSpanStart(sp) == -1) {
                        allSpans.remove(sp);
                        selectedContacts.remove(sp.uid);
                      }
                    }
                    if (!isAlwaysShare && !isNeverShare) {
                      actionBar.setSubtitle(
                          LocaleController.formatString(
                              "MembersCount",
                              R.string.MembersCount,
                              selectedContacts.size(),
                              maxCount));
                    }
                    listView.invalidateViews();
                  } else {
                    search = true;
                  }
                } else {
                  search = true;
                }
                if (search) {
                  String text = userSelectEditText.getText().toString().replace("<", "");
                  if (text.length() != 0) {
                    searching = true;
                    searchWas = true;
                    if (listView != null) {
                      listView.setAdapter(searchListViewAdapter);
                      searchListViewAdapter.notifyDataSetChanged();
                      if (android.os.Build.VERSION.SDK_INT >= 11) {
                        listView.setFastScrollAlwaysVisible(false);
                      }
                      listView.setFastScrollEnabled(false);
                      listView.setVerticalScrollBarEnabled(true);
                    }
                    if (emptyTextView != null) {
                      emptyTextView.setText(
                          LocaleController.getString("NoResult", R.string.NoResult));
                    }
                    searchListViewAdapter.searchDialogs(text);
                  } else {
                    searchListViewAdapter.searchDialogs(null);
                    searching = false;
                    searchWas = false;
                    listView.setAdapter(listViewAdapter);
                    listViewAdapter.notifyDataSetChanged();
                    if (android.os.Build.VERSION.SDK_INT >= 11) {
                      listView.setFastScrollAlwaysVisible(true);
                    }
                    listView.setFastScrollEnabled(true);
                    listView.setVerticalScrollBarEnabled(false);
                    emptyTextView.setText(
                        LocaleController.getString("NoContacts", R.string.NoContacts));
                  }
                }
              }
            }
          });

      LinearLayout emptyTextLayout = new LinearLayout(getParentActivity());
      emptyTextLayout.setVisibility(View.INVISIBLE);
      emptyTextLayout.setOrientation(LinearLayout.VERTICAL);
      linearLayout.addView(emptyTextLayout);
      layoutParams = (LinearLayout.LayoutParams) emptyTextLayout.getLayoutParams();
      layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
      layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
      emptyTextLayout.setLayoutParams(layoutParams);
      emptyTextLayout.setOnTouchListener(
          new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
              return true;
            }
          });

      emptyTextView = new TextView(getParentActivity());
      emptyTextView.setTextColor(0xff808080);
      emptyTextView.setTextSize(20);
      emptyTextView.setGravity(Gravity.CENTER);
      emptyTextView.setText(LocaleController.getString("NoContacts", R.string.NoContacts));
      emptyTextLayout.addView(emptyTextView);
      layoutParams = (LinearLayout.LayoutParams) emptyTextView.getLayoutParams();
      layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
      layoutParams.height = LinearLayout.LayoutParams.MATCH_PARENT;
      layoutParams.weight = 0.5f;
      emptyTextView.setLayoutParams(layoutParams);

      FrameLayout frameLayout2 = new FrameLayout(getParentActivity());
      emptyTextLayout.addView(frameLayout2);
      layoutParams = (LinearLayout.LayoutParams) frameLayout2.getLayoutParams();
      layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
      layoutParams.height = LinearLayout.LayoutParams.MATCH_PARENT;
      layoutParams.weight = 0.5f;
      frameLayout2.setLayoutParams(layoutParams);

      listView = new LetterSectionsListView(getParentActivity());
      listView.setEmptyView(emptyTextLayout);
      listView.setVerticalScrollBarEnabled(false);
      listView.setDivider(null);
      listView.setDividerHeight(0);
      listView.setFastScrollEnabled(true);
      listView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
      listView.setAdapter(listViewAdapter);
      if (Build.VERSION.SDK_INT >= 11) {
        listView.setFastScrollAlwaysVisible(true);
        listView.setVerticalScrollbarPosition(
            LocaleController.isRTL
                ? ListView.SCROLLBAR_POSITION_LEFT
                : ListView.SCROLLBAR_POSITION_RIGHT);
      }
      linearLayout.addView(listView);
      layoutParams = (LinearLayout.LayoutParams) listView.getLayoutParams();
      layoutParams.width = LinearLayout.LayoutParams.MATCH_PARENT;
      layoutParams.height = LinearLayout.LayoutParams.MATCH_PARENT;
      listView.setLayoutParams(layoutParams);
      listView.setOnItemClickListener(
          new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
              TLRPC.User user = null;
              if (searching && searchWas) {
                user = searchListViewAdapter.getItem(i);
              } else {
                int section = listViewAdapter.getSectionForPosition(i);
                int row = listViewAdapter.getPositionInSectionForPosition(i);
                if (row < 0 || section < 0) {
                  return;
                }
                user = (TLRPC.User) listViewAdapter.getItem(section, row);
              }
              if (user == null) {
                return;
              }

              boolean check = true;
              if (selectedContacts.containsKey(user.id)) {
                check = false;
                try {
                  XImageSpan span = selectedContacts.get(user.id);
                  selectedContacts.remove(user.id);
                  SpannableStringBuilder text =
                      new SpannableStringBuilder(userSelectEditText.getText());
                  text.delete(text.getSpanStart(span), text.getSpanEnd(span));
                  allSpans.remove(span);
                  ignoreChange = true;
                  userSelectEditText.setText(text);
                  userSelectEditText.setSelection(text.length());
                  ignoreChange = false;
                } catch (Exception e) {
                  FileLog.e("tmessages", e);
                }
              } else {
                if (selectedContacts.size() == maxCount) {
                  return;
                }
                ignoreChange = true;
                XImageSpan span = createAndPutChipForUser(user);
                span.uid = user.id;
                ignoreChange = false;
              }
              if (!isAlwaysShare && !isNeverShare) {
                actionBar.setSubtitle(
                    LocaleController.formatString(
                        "MembersCount", R.string.MembersCount, selectedContacts.size(), maxCount));
              }
              if (searching || searchWas) {
                ignoreChange = true;
                SpannableStringBuilder ssb = new SpannableStringBuilder("");
                for (ImageSpan sp : allSpans) {
                  ssb.append("<<");
                  ssb.setSpan(
                      sp,
                      ssb.length() - 2,
                      ssb.length(),
                      SpannableStringBuilder.SPAN_EXCLUSIVE_EXCLUSIVE);
                }
                userSelectEditText.setText(ssb);
                userSelectEditText.setSelection(ssb.length());
                ignoreChange = false;

                searchListViewAdapter.searchDialogs(null);
                searching = false;
                searchWas = false;
                listView.setAdapter(listViewAdapter);
                listViewAdapter.notifyDataSetChanged();
                if (android.os.Build.VERSION.SDK_INT >= 11) {
                  listView.setFastScrollAlwaysVisible(true);
                }
                listView.setFastScrollEnabled(true);
                listView.setVerticalScrollBarEnabled(false);
                emptyTextView.setText(
                    LocaleController.getString("NoContacts", R.string.NoContacts));
              } else {
                if (view instanceof UserCell) {
                  ((UserCell) view).setChecked(check, true);
                }
              }
            }
          });
      listView.setOnScrollListener(
          new AbsListView.OnScrollListener() {
            @Override
            public void onScrollStateChanged(AbsListView absListView, int i) {
              if (i == SCROLL_STATE_TOUCH_SCROLL) {
                AndroidUtilities.hideKeyboard(userSelectEditText);
              }
              if (listViewAdapter != null) {
                listViewAdapter.setIsScrolling(i != SCROLL_STATE_IDLE);
              }
            }

            @Override
            public void onScroll(
                AbsListView absListView,
                int firstVisibleItem,
                int visibleItemCount,
                int totalItemCount) {
              if (absListView.isFastScrollEnabled()) {
                AndroidUtilities.clearDrawableAnimation(absListView);
              }
            }
          });
    } else {
      ViewGroup parent = (ViewGroup) fragmentView.getParent();
      if (parent != null) {
        parent.removeView(fragmentView);
      }
    }
    return fragmentView;
  }
Ejemplo n.º 19
0
  @SuppressLint({"ShowToast", "CutPasteId"})
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    getActionBar().setDisplayShowHomeEnabled(false);

    try {
      ViewConfiguration config = ViewConfiguration.get(this);
      Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
      if (menuKeyField != null) {
        menuKeyField.setAccessible(true);
        menuKeyField.setBoolean(config, false);
      }
    } catch (Exception ex) {
      // Ignore
    }

    SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    UserName = sharedPrefs.getString(UserName + "CurrentUser", null);
    if (sharedPrefs.getString(UserName + "gender", "").equals("Female")) {
      gender = "Female";
    }
    if (sharedPrefs.getString(UserName + "gender", "").equals("Male")) {
      gender = "Male";
    }

    setContentView(R.layout.closet_layout);
    Button btnWear = (Button) findViewById(R.id.btnWear);
    ImageView tops = (ImageView) findViewById(R.id.imgtops);
    ImageView bottoms = (ImageView) findViewById(R.id.imgbottoms);
    ImageView shoes = (ImageView) findViewById(R.id.imgshoes);
    LinearLayout l1 = (LinearLayout) findViewById(R.id.swipe);
    retrievePhotos();
    Bitmap b1 = BitmapFactory.decodeFile(topData.get(0));
    Bitmap b2 = BitmapFactory.decodeFile(bottomData.get(0));
    Bitmap b3 = BitmapFactory.decodeFile(shoeData.get(0));
    tops.setImageBitmap(b1);
    bottoms.setImageBitmap(b2);
    shoes.setImageBitmap(b3);

    try {
      File lastWeather =
          new File(
              Environment.getExternalStorageDirectory()
                  + "/OutfitSifter/"
                  + UserName
                  + "/lastWeather.txt");
      String[] textArray = new String[2];

      Scanner weather = new Scanner(lastWeather);

      int a = 0;
      while (weather.hasNextLine()) {
        textArray[a] = weather.nextLine();
        a++;
      }
      weather.close();

      if (textArray[1].contains("Rain") || textArray[1].contains("Storm")) {
        Toast.makeText(
                context,
                "There's a forcasted rain shower/storm, here's a few jackets to choose from!",
                Toast.LENGTH_SHORT)
            .show();
      }

    } catch (InputMismatchException e) {
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    int item = itemCount + 1;
    getActionBar().setTitle("Closet (" + item + "/" + topData.size() + ")");

    btnWear.setOnClickListener(
        new Button.OnClickListener() {
          @SuppressLint("SimpleDateFormat")
          public void onClick(View arg0) {
            File directory =
                new File(
                    Environment.getExternalStorageDirectory()
                        + "/OutfitSifter/"
                        + UserName
                        + "/Calendar");
            if (!directory.exists()) {
              directory.mkdir();
            }

            SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy");
            String currentDateandTime = sdf.format(new Date());
            final File date =
                new File(
                    Environment.getExternalStorageDirectory()
                        + "/OutfitSifter/"
                        + UserName
                        + "/Calendar/"
                        + currentDateandTime
                        + ".txt");
            if (date.exists() == false) {
              try {
                BufferedWriter out =
                    new BufferedWriter(
                        new OutputStreamWriter(new FileOutputStream(date), "US-ASCII"));
                out.write(topData.get(itemCount) + "");
                out.newLine();
                if (topData.get(itemCount).contains("onePiece")) {
                  out.write("null");
                } else {
                  out.write(bottomData.get(itemCount) + "");
                }
                out.newLine();
                out.write(shoeData.get(itemCount) + "");
                out.flush();
                out.close();
                Toast.makeText(context, "Updated!", Toast.LENGTH_SHORT).show();
              } catch (Exception e) {
              }
            } else {
              AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);
              // set title
              alertDialogBuilder.setTitle("Update your previously worn outfit today?");

              // set dialog message
              alertDialogBuilder
                  .setCancelable(false)
                  .setPositiveButton(
                      "Yes",
                      new DialogInterface.OnClickListener() {
                        @SuppressLint("InlinedApi")
                        public void onClick(DialogInterface dialog, int id) {
                          date.delete();
                          try {
                            BufferedWriter out =
                                new BufferedWriter(
                                    new OutputStreamWriter(new FileOutputStream(date), "US-ASCII"));
                            out.write(topData.get(itemCount) + "");
                            out.newLine();
                            if (topData.get(itemCount).contains("onePiece")) {
                              out.write("null");
                            } else {
                              out.write(bottomData.get(itemCount) + "");
                            }
                            out.newLine();
                            out.write(shoeData.get(itemCount) + "");
                            out.flush();
                            out.close();
                          } catch (Exception e) {
                          }
                          Toast.makeText(context, "Updated!", Toast.LENGTH_SHORT).show();
                        }
                      })
                  .setNegativeButton(
                      "No",
                      new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                          dialog.cancel();
                        }
                      });

              // create alert dialog
              AlertDialog alertDialog = alertDialogBuilder.create();

              // show it
              alertDialog.show();
            }
          }
        });

    l1.setOnTouchListener(
        new LinearLayout.OnTouchListener() {

          @SuppressWarnings("deprecation")
          public boolean onTouch(View v, MotionEvent event) {
            gestureDetector = new GestureDetector(new SwipeDetector());
            // Toast.makeText(context, "thump", Toast.LENGTH_SHORT).show();
            return false;
          }
        });

    tops.setOnTouchListener(
        new ImageView.OnTouchListener() {
          @SuppressWarnings("deprecation")
          public boolean onTouch(View v, MotionEvent event) {
            gestureDetector = new GestureDetector(new SwipeDetector());
            return false;
          }
        });

    bottoms.setOnTouchListener(
        new ImageView.OnTouchListener() {
          @SuppressWarnings("deprecation")
          public boolean onTouch(View v, MotionEvent event) {
            gestureDetector = new GestureDetector(new SwipeDetector());
            return false;
          }
        });

    shoes.setOnTouchListener(
        new ImageView.OnTouchListener() {
          @SuppressWarnings("deprecation")
          public boolean onTouch(View v, MotionEvent event) {
            gestureDetector = new GestureDetector(new SwipeDetector());
            return false;
          }
        });

    tops.setOnLongClickListener(
        new ImageView.OnLongClickListener() {

          public boolean onLongClick(View v) {
            longClick();
            return false;
          }
        });
    bottoms.setOnLongClickListener(
        new ImageView.OnLongClickListener() {

          public boolean onLongClick(View v) {
            longClick();
            return false;
          }
        });
    shoes.setOnLongClickListener(
        new ImageView.OnLongClickListener() {

          public boolean onLongClick(View v) {
            longClick();
            return false;
          }
        });

    setLayoutColor(topData, bottomData, shoeData, 0, 0, 0);
  }
  @Override
  public void onCreate() {
    super.onCreate();

    wm = (WindowManager) getSystemService(WINDOW_SERVICE);
    ll = (LinearLayout) View.inflate(this, R.layout.windowlayout, null);
    LinearLayout.LayoutParams llParameters =
        new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT);
    ll.setBackgroundColor(Color.argb(66, 255, 0, 0));
    ll.setLayoutParams(llParameters);
    ll.setOrientation(LinearLayout.HORIZONTAL);
    setPlayButton();
    setStartButton();
    setStopButton();
    setExitButton();
    stop.setEnabled(true);
    play.setEnabled(true);
    start.setEnabled(true);

    outputFile =
        Environment.getExternalStorageDirectory().getAbsolutePath()
            + "/myrecording"
            + recordCounter
            + ".3gp";
    myMediaRecorder = new MediaRecorder();
    myMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    myMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    myMediaRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
    myMediaRecorder.setOutputFile(outputFile);

    final WindowManager.LayoutParams parameters =
        new WindowManager.LayoutParams(
            500,
            150,
            WindowManager.LayoutParams.TYPE_PHONE,
            WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
            PixelFormat.TRANSLUCENT);

    ll.addView(start);
    ll.addView(stop);
    ll.addView(play);
    ll.addView(exit);
    parameters.x = 0;
    parameters.y = 0;
    parameters.gravity = Gravity.CENTER | Gravity.CENTER;
    wm.addView(ll, parameters);

    ll.setOnTouchListener(
        new View.OnTouchListener() {

          {
            updatedParameters = parameters;
          }

          int x, y;
          float touchedX, touchedY;

          @Override
          public boolean onTouch(View view, MotionEvent motionEvent) {
            switch (motionEvent.getAction()) {
              case MotionEvent.ACTION_DOWN:
                x = updatedParameters.x;
                y = updatedParameters.y;
                touchedX = motionEvent.getRawX();
                touchedY = motionEvent.getRawY();
                break;
              case MotionEvent.ACTION_MOVE:
                updatedParameters.x = (int) (x + (motionEvent.getRawX() - touchedX));
                updatedParameters.y = (int) (y + (motionEvent.getRawY() - touchedY));

                wm.updateViewLayout(ll, updatedParameters);
            }

            return false;
          }
        });
  }
Ejemplo n.º 21
0
  public void createFloatView() {
    Log.i(TAG, "Float View created");

    if (wmParams != null) return;

    wmParams = new WindowManager.LayoutParams();
    mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    wmParams.type = LayoutParams.TYPE_PHONE;
    wmParams.format = PixelFormat.RGBA_8888;
    wmParams.flags = LayoutParams.FLAG_NOT_FOCUSABLE;
    wmParams.gravity = Gravity.LEFT | Gravity.TOP;
    wmParams.x = wmParams.y = 0;
    wmParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
    wmParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
    LayoutInflater inflater = LayoutInflater.from(mContext);

    mFloatLayout = (LinearLayout) inflater.inflate(R.layout.float_layout, null);
    mFloatbarImage = (ImageView) mFloatLayout.findViewById(R.id.float_bar);
    mFloatRecordButton = (Button) mFloatLayout.findViewById(R.id.float_record_button);
    mFloatPlaybackButton = (Button) mFloatLayout.findViewById(R.id.float_playback_button);
    mFloatPickButton = (Button) mFloatLayout.findViewById(R.id.float_pick_button);
    mFloatDropButton = (Button) mFloatLayout.findViewById(R.id.float_drop_button);
    mFloatLayout.measure(
        View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
        View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));

    mFloatLayout.setOnTouchListener(
        new OnTouchListener() {
          int lastX, lastY;
          int paramX, paramY;

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            switch (event.getAction()) {
              case MotionEvent.ACTION_DOWN:
                lastX = (int) event.getRawX();
                lastY = (int) event.getRawY();
                paramX = wmParams.x;
                paramY = wmParams.y;
                break;
              case MotionEvent.ACTION_MOVE:
                int dx = (int) event.getRawX() - lastX;
                int dy = (int) event.getRawY() - lastY;
                wmParams.x = paramX + dx;
                wmParams.y = paramY + dy;
                mWindowManager.updateViewLayout(mFloatLayout, wmParams);
                break;
            }
            return false;
          }
        });

    mFloatRecordButton.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {

            switch (state) {
              case -1: // not start
                new EventRecordWatcher(new EventRecorder(5, scriptName)).start();
                state = 5;
                new Thread() {
                  public void run() {
                    int num = 5;
                    mHandler.post(
                        new Runnable() {

                          @Override
                          public void run() {
                            mFloatRecordButton.setText(Integer.toString(5));
                            mFloatRecordButton.setBackgroundColor(Color.BLACK);
                          }
                        });
                    while (num > 0) {
                      try {
                        sleep(1000);
                        final int a = --num;
                        mHandler.post(
                            new Runnable() {

                              @Override
                              public void run() {
                                mFloatRecordButton.setText(Integer.toString(a));
                              }
                            });

                      } catch (InterruptedException e) {
                        e.printStackTrace();
                      }
                    }
                    try {
                      sleep(1000);
                      state = -1; // tobe confirmed
                      mHandler.post(
                          new Runnable() {

                            @Override
                            public void run() {
                              mFloatRecordButton.setText("");
                              mFloatRecordButton.setBackgroundResource(
                                  android.R.drawable.ic_menu_add);
                              mFloatPickButton.setVisibility(View.VISIBLE);
                              mFloatPlaybackButton.setVisibility(View.VISIBLE);
                            }
                          });
                    } catch (InterruptedException e) {
                      e.printStackTrace();
                    }
                  }
                }.start();
                break;

              default:
                break;
            }
          }
        });

    mFloatPlaybackButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            new EventSenderForPlayback(scriptName).start();
          }
        });

    mFloatPickButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View arg0) {
            if (type == 1) {
              jumpBack("录制成功");
              return;
            }
            ActivityManager am =
                (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
            ComponentName cn = am.getRunningTasks(1).get(0).topActivity;
            final String name = cn.getClassName();
            mHandler.post(
                new Runnable() {

                  @Override
                  public void run() {
                    DolphinContext context = new DolphinContext(null, name, "still", 0l, 0l);
                    long id =
                        DaoManager.getDaoManager(mContext).addDolphinContext(context, pluginId);
                    if (id == 0) {
                      jumpBack("重复的插件环境");
                    } else {
                      jumpBack("插件环境选择成功");
                    }
                  }
                });
          }
        });

    mFloatDropButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            clean();
            jumpBack("放弃选取");
          }
        });
  }
Ejemplo n.º 22
0
  @SuppressWarnings("deprecation")
  @SuppressLint("NewApi")
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.mainlayout);
    m_context = MainActivity.this;

    parentView = (RelativeLayout) findViewById(R.id.layoutview);
    windowwidth = getWindowManager().getDefaultDisplay().getWidth();
    screenCenter = windowwidth / 2;
    int[] myImageList =
        new int[] {
          R.drawable.cats, R.drawable.baby1, R.drawable.sachin, R.drawable.cats, R.drawable.puppy
        };

    for (int i = 0; i < 5; i++) {
      LayoutInflater inflate =
          (LayoutInflater) m_context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

      final View m_view = inflate.inflate(R.layout.custom_layout, null);
      ImageView m_image = (ImageView) m_view.findViewById(R.id.sp_image);
      LinearLayout m_topLayout = (LinearLayout) m_view.findViewById(R.id.sp_color);
      LinearLayout m_bottomLayout = (LinearLayout) m_view.findViewById(R.id.sp_linh);
      // final RelativeLayout myRelView = new RelativeLayout(this);
      m_view.setLayoutParams(new LayoutParams((windowwidth - 80), 450));
      m_view.setX(40);
      m_view.setY(40);
      m_view.setTag(i);
      m_image.setBackgroundResource(myImageList[i]);

      /*
                  if (i == 0) {
                      m_view.setRotation(-1);
                  } else if (i == 1) {
                      m_view.setRotation(-5);

                  } else if (i == 2) {
                      m_view.setRotation(3);

                  } else if (i == 3) {
                      m_view.setRotation(7);

                  } else if (i == 4) {
                      m_view.setRotation(-2);

                  } else if (i == 5) {
                      m_view.setRotation(5);

                  }
      */

      // ADD dynamically like button on image.
      final Button imageLike = new Button(m_context);
      imageLike.setLayoutParams(new LayoutParams(100, 50));
      imageLike.setBackgroundDrawable(getResources().getDrawable(R.drawable.like));
      imageLike.setX(20);
      imageLike.setY(-250);
      imageLike.setAlpha(alphaValue);
      m_topLayout.addView(imageLike);

      // ADD dynamically dislike button on image.
      final Button imagePass = new Button(m_context);
      imagePass.setLayoutParams(new LayoutParams(100, 50));
      imagePass.setBackgroundDrawable(getResources().getDrawable(R.drawable.dislike));

      imagePass.setX(260);
      imagePass.setY(-300);
      imagePass.setAlpha(alphaValue);
      m_topLayout.addView(imagePass);

      // Click listener on the bottom layout to open the details of the
      // image.
      m_bottomLayout.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              startActivity(new Intent(m_context, DetailsActivity.class));
            }
          });

      // Touch listener on the image layout to swipe image right or left.
      m_topLayout.setOnTouchListener(
          new OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {
              x_cord = (int) event.getRawX();
              y_cord = (int) event.getRawY();

              m_view.setX(x_cord - screenCenter + 40);
              m_view.setY(y_cord - 150);
              switch (event.getAction()) {
                case MotionEvent.ACTION_DOWN:
                  x = (int) event.getX();
                  y = (int) event.getY();
                  Log.v("ACTION_DOWN : ", x + " " + y);
                  break;
                case MotionEvent.ACTION_MOVE:
                  x_cord = (int) event.getRawX(); // Updated for more
                  // smoother animation.
                  y_cord = (int) event.getRawY();
                  Log.v("ACTION_MOVE : ", x_cord + " " + y_cord);

                  m_view.setX(x_cord - x);
                  m_view.setY(y_cord - y);
                  // m_view.setY(y_cord-y);
                  // y_cord = (int) event.getRawY();
                  // m_view.setX(x_cord - screenCenter + 40);
                  // m_view.setY(y_cord - 150);
                  if (x_cord >= screenCenter) {
                    m_view.setRotation((float) ((x_cord - screenCenter) * (Math.PI / 32)));
                    if (x_cord > (screenCenter + (screenCenter / 2))) {
                      imageLike.setAlpha(1);
                      if (x_cord > (windowwidth - (screenCenter / 4))) {
                        Likes = 2;
                      } else {
                        Likes = 0;
                      }
                    } else {
                      Likes = 0;
                      imageLike.setAlpha(0);
                    }
                    imagePass.setAlpha(0);
                  } else {
                    // rotate
                    m_view.setRotation((float) ((x_cord - screenCenter) * (Math.PI / 32)));
                    if (x_cord < (screenCenter / 2)) {
                      imagePass.setAlpha(1);
                      if (x_cord < screenCenter / 4) {
                        Likes = 1;
                      } else {
                        Likes = 0;
                      }
                    } else {
                      Likes = 0;
                      imagePass.setAlpha(0);
                    }
                    imageLike.setAlpha(0);
                  }

                  break;
                case MotionEvent.ACTION_UP:
                  x_cord = (int) event.getRawX();
                  y_cord = (int) event.getRawY();

                  Log.e("ACTION_UP X Point", "" + x_cord + " , Y " + y_cord);
                  imagePass.setAlpha(0);
                  imageLike.setAlpha(0);

                  if (Likes == 0) {
                    Log.e("Event Status", "Nothing");
                    m_view.setX(40);
                    m_view.setY(40);
                    m_view.setRotation(0);
                  } else if (Likes == 1) {
                    Log.e("Event Status", "Passed");
                    parentView.removeView(m_view);
                  } else if (Likes == 2) {

                    Log.e("Event Status", "Liked");
                    parentView.removeView(m_view);
                  }
                  break;
                default:
                  break;
              }
              return true;
            }
          });

      parentView.addView(m_view);
    }
  }
Ejemplo n.º 23
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);

    swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.fragment_hmac_srl);
    llRoot = (LinearLayout) view.findViewById(R.id.fragment_hmac_ll_root);

    etInput = (EditText) view.findViewById(R.id.fragment_hmac_et_input);
    etPassword = (EditText) view.findViewById(R.id.fragment_hmac_et_password);

    etHmacMd5 = (EditText) view.findViewById(R.id.fragment_hmac_et_hmac_md5);
    etHmacSha1 = (EditText) view.findViewById(R.id.fragment_hmac_et_hmac_sha1);
    etHmacSha224 = (EditText) view.findViewById(R.id.fragment_hmac_et_hmac_sha224);
    etHmacSha256 = (EditText) view.findViewById(R.id.fragment_hmac_et_hmac_sha256);
    etHmacSha384 = (EditText) view.findViewById(R.id.fragment_hmac_et_hmac_sha384);
    etHmacSha512 = (EditText) view.findViewById(R.id.fragment_hmac_et_hmac_sha512);

    etHmacMd5.setInputType(InputType.TYPE_NULL);
    etHmacSha1.setInputType(InputType.TYPE_NULL);
    etHmacSha224.setInputType(InputType.TYPE_NULL);
    etHmacSha256.setInputType(InputType.TYPE_NULL);
    etHmacSha384.setInputType(InputType.TYPE_NULL);
    etHmacSha512.setInputType(InputType.TYPE_NULL);

    MyEditTextOnTouchListener editTextOnTouchListener = new MyEditTextOnTouchListener();

    etHmacMd5.setOnTouchListener(editTextOnTouchListener);
    etHmacSha1.setOnTouchListener(editTextOnTouchListener);
    etHmacSha224.setOnTouchListener(editTextOnTouchListener);
    etHmacSha256.setOnTouchListener(editTextOnTouchListener);
    etHmacSha384.setOnTouchListener(editTextOnTouchListener);
    etHmacSha512.setOnTouchListener(editTextOnTouchListener);
    llRoot.setOnTouchListener(editTextOnTouchListener);

    CommonTextWatcher textWatcher = new CommonTextWatcher();

    etInput.addTextChangedListener(textWatcher);
    etPassword.addTextChangedListener(textWatcher);

    swipeRefreshLayout.setOnRefreshListener(
        new SwipeRefreshLayout.OnRefreshListener() {
          @Override
          public void onRefresh() {
            if (!(TextUtils.isEmpty(etInput.getText())
                && TextUtils.isEmpty(etPassword.getText()))) {
              etInput.setText("");
              etPassword.setText("");
              etHmacMd5.setText("");
              etHmacSha1.setText("");
              etHmacSha224.setText("");
              etHmacSha256.setText("");
              etHmacSha384.setText("");
              etHmacSha512.setText("");
            }
            if (getActivity() != null) {
              getActivity().getCurrentFocus().clearFocus();
              swipeRefreshLayout.setRefreshing(false);
            }
          }
        });
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    isTraining = getIntent().getBooleanExtra("Training", true);
    setContentView(R.layout.face_detect_surface_view);

    screenWidth = MainPageActivity.getScreenHeight();
    screenHeight = MainPageActivity.getScreenWidth();

    mOpenCvCameraView = (CameraBridgeViewBase) findViewById(R.id.fd_activity_surface_view);
    mOpenCvCameraView.setCvCameraViewListener(this);

    captureButton = (ImageView) findViewById(R.id.capturebutton);
    captureText = (TextView) findViewById(R.id.capturetext);
    captureButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            closeSoftInput();
            if (capturingImage) {
              captureText.setText("Start Capturing");
              capturingImage = false;
              captureButton.setImageResource(R.drawable.capturestart);
            } else {
              captureText.setText("Stop Capturing");
              captureButton.setImageResource(R.drawable.capturestop);
              capturingImage = true;
            }
          }
        });

    backButton = (ImageView) findViewById(R.id.backbutton);
    backButton.setOnClickListener(
        new View.OnClickListener() {

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

    saveButton = (Button) findViewById(R.id.addtodbbutton);
    saveButton.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            closeSoftInput();
            if (isTraining) {
              insertToDatabase();
            } else {
              // deleteFromDatabase();
              updateThisPerson();
            }
          }
        });

    nameEdit = (EditText) findViewById(R.id.nameedit);
    nameEdit.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);

    deleteButton = (Button) findViewById(R.id.deletefromdbbutton);
    resetImagesForTraining();
    initOtherViews();
    if (!isTraining) {
      final int personIndex = getIntent().getIntExtra("personIndex", -1);
      new Thread(
              new Runnable() {

                @Override
                public void run() {
                  FaceDetectionUtils.faceDataSource.open();
                  persons = FaceDetectionUtils.faceDataSource.getAllPersons();
                  FaceDetectionUtils.faceDataSource.close();
                  thisPerson = persons.get(personIndex);
                  setImagesForDatabaseEdit();
                  FaceDetectionActivity.this.runOnUiThread(
                      new Runnable() {

                        @Override
                        public void run() {
                          nameEdit.setText(thisPerson.getName());
                          saveButton.setText("Update this person");
                        }
                      });
                }
              })
          .start();
      deleteButton.setVisibility(View.VISIBLE);
      deleteButton.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              closeSoftInput();
              deleteFromDatabase();
            }
          });
    }
    mOpenCvCameraView.enableView();
    bgLayout = (LinearLayout) findViewById(R.id.face_detect_layout);
    bgLayout.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            closeSoftInput();
            return false;
          }
        });
  }
Ejemplo n.º 25
0
  public View onCreateView(
      final LayoutInflater inflater, ViewGroup parent, Bundle saveInstanceState) {
    View view = inflater.inflate(R.layout.login_fragment, parent, false);

    // input fields' setting
    final EditText phoneInput = (EditText) view.findViewById(R.id.name_input);
    final EditText passwordInput = (EditText) view.findViewById(R.id.password_input);

    Button loginButton = (Button) view.findViewById(R.id.submit);
    loginButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(final View v) {
            String phone = phoneInput.getText().toString();
            String password = passwordInput.getText().toString();
            if (phone.length() != 0 && password.length() != 0) {
              /*LoadingWindow = new PopupWindow(inflater.inflate(R.layout.loading_window,null,false),
                      LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT,true);
              LoadingWindow.setAnimationStyle(R.style.PopupAnim);
              LoadingWindow.showAsDropDown(v);
              TimerTask temp = new TimerTask(){
                  public void run(){
                      LoadingWindow.dismiss();
                  }
              };
              Timer timer = new Timer(true);
              timer.schedule(temp, 2000);*/

              Log.d("LoginFragment", "submitbutton click");
              Intent intent = new Intent("MainService");
              HttpMsg loginRequest = new HttpMsg(HttpMsg.REQ_LOGIN, phone, password);
              intent.putExtra("HttpMsg", loginRequest);
              getActivity().sendBroadcast(intent);
              // getFragmentManager().beginTransaction().replace(R.id.maincontent, new
              // MainFragment()).commit();
            } else {
              Toast.makeText(getActivity(), "登录成功", Toast.LENGTH_SHORT).show();
            }
          }
        });
    Button signButton = (Button) view.findViewById(R.id.sign);
    signButton.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            getFragmentManager()
                .beginTransaction()
                .addToBackStack(null)
                .replace(R.id.maincontent, new SignFragment())
                .commit();
          }
        });

    final LinearLayout ll = (LinearLayout) view.findViewById(R.id.ll);
    ll.setOnTouchListener(
        new OnTouchListener() {

          @Override
          public boolean onTouch(View view, MotionEvent e) {
            ll.setFocusable(true);
            ll.setFocusableInTouchMode(true);
            ll.requestFocus();
            InputMethodManager in =
                (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
            in.hideSoftInputFromWindow(view.getWindowToken(), 0);
            return true;
          }
        });

    return view;
  }
  private void onClick() {

    WholeLayout.setOnTouchListener(
        new View.OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            InputMethodManager in =
                (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);

            in.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
            return false;
          }
        });

    logolayout.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            InputMethodManager in =
                (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);

            in.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);

            startActivity(
                new Intent(mContext, DashboardActivity.class).putExtra("TO_LAYOUT", "Dashboard"));

            ((Activity) mContext).finish();
          }
        });

    ReviewCancelbutton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            InputMethodManager in =
                (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);

            in.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);

            Fragment newFragment = new SummaryFragment(mContext);

            FragmentTransaction transaction =
                getActivity().getSupportFragmentManager().beginTransaction();

            transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

            // Replace whatever is in the fragment_container view with this fragment,
            // and add the transaction to the back stack if needed
            transaction.replace(R.id.rightFragment, newFragment);

            transaction.addToBackStack(FragmentNameConfig.SUMMARY_FRAGMENT);

            // Commit the transaction
            transaction.commit();
          }
        });

    ReviewNext.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            InputMethodManager in =
                (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);

            in.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);

            TaxPageFragment();
          }
        });

    errorlist.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {

            for (int i = 0; i < cautionList.getChildCount(); i++) {
              View v = cautionList.getChildAt(i);
              v.getTag();
            }

            TextView fix_me = (TextView) view.findViewById(R.id.fix_me);

            fix_me.setOnClickListener(
                new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {

                    if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("Create")) {

                      Fragment newFragment = new AddExemptOrganization(mContext, true, true);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.wholevertical, newFragment);

                      transaction.addToBackStack(FragmentNameConfig.ORG_DETAIL_FRAGMENT);

                      // Commit the transaction
                      transaction.commit();

                    } else if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("IRSPayment")) {

                      Fragment newFragment = new IRSPayment(mContext);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.rightFragment, newFragment);

                      transaction.addToBackStack(FragmentNameConfig.IRS_PAYMENT_FRAGMENT);

                      // Commit the transaction
                      transaction.commit();

                    } else if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("Step1")) {

                      Fragment newFragment = new NewTaxYearFragment(mContext, 0);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.rightFragment, newFragment);

                      // transaction.addToBackStack(FragmentNameConfig.FORM_TAX_SELECTION_FRAGMENT);
                      // Commit the transaction
                      transaction.commit();

                    } else if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("Step2")) {
                      Fragment newFragment = new NewTaxYearFragment(mContext, 0);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.rightFragment, newFragment);

                      // transaction.addToBackStack(FragmentNameConfig.FORM_TAX_SELECTION_FRAGMENT);
                      // Commit the transaction
                      transaction.commit();

                    } else if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("Step3")) {

                      Fragment newFragment = new NewTaxYearFragment(mContext, 0);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.rightFragment, newFragment);

                      // transaction.addToBackStack(FragmentNameConfig.FORM_TAX_SELECTION_FRAGMENT);
                      // Commit the transaction
                      transaction.commit();

                    } else if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("BookInCareOf")) {

                      Fragment newFragment = new BooksInCareOf(mContext, true);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.rightFragment, newFragment);

                      transaction.addToBackStack(FragmentNameConfig.BOOKS_IN_CARE_OF_FRAGMENT);

                      // Commit the transaction
                      transaction.commit(); // TODO: 11/26/2015

                    } else if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("PrimaryExemptPurpose")) {

                      Fragment newFragment = new BooksInCareOf(mContext, true);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.rightFragment, newFragment);

                      transaction.addToBackStack(FragmentNameConfig.BOOKS_IN_CARE_OF_FRAGMENT);

                      // Commit the transaction
                      transaction.commit(); // TODO: 11/26/2015

                    } else if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("ProgramServiceAccomplishment")) {

                      Fragment newFragment = new BooksInCareOf(mContext, true);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.rightFragment, newFragment);

                      transaction.addToBackStack(FragmentNameConfig.BOOKS_IN_CARE_OF_FRAGMENT);

                      // Commit the transaction
                      transaction.commit(); // TODO: 11/26/2015

                    } else {

                      Fragment newFragment = new AddExemptOrganization(mContext, true, true);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.wholevertical, newFragment);

                      transaction.addToBackStack(FragmentNameConfig.ORG_DETAIL_FRAGMENT);

                      // Commit the transaction
                      transaction.commit();
                    }
                  }
                });
          }
        });

    cautionList.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {

            TextView fix_me = (TextView) view.findViewById(R.id.fix_me);

            fix_me.setOnClickListener(
                new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {

                    if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("Create")) {

                      Fragment newFragment = new AddExemptOrganization(mContext, true, true);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.wholevertical, newFragment);

                      transaction.addToBackStack(FragmentNameConfig.ORG_DETAIL_FRAGMENT);

                      // Commit the transaction
                      transaction.commit();

                    } else if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("IRSPayment")) {

                      Fragment newFragment = new IRSPayment(mContext);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.rightFragment, newFragment);

                      transaction.addToBackStack(FragmentNameConfig.IRS_PAYMENT_FRAGMENT);

                      // Commit the transaction
                      transaction.commit();

                    } else if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("Step1")) {

                      Fragment newFragment = new NewTaxYearFragment(mContext, 0);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.rightFragment, newFragment);

                      // transaction.addToBackStack(FragmentNameConfig.FORM_TAX_SELECTION_FRAGMENT);
                      // Commit the transaction
                      transaction.commit();

                    } else if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("Step2")) {
                      Fragment newFragment = new NewTaxYearFragment(mContext, 0);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.rightFragment, newFragment);

                      // transaction.addToBackStack(FragmentNameConfig.FORM_TAX_SELECTION_FRAGMENT);
                      // Commit the transaction
                      transaction.commit();

                    } else if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("Step3")) {

                      Fragment newFragment = new NewTaxYearFragment(mContext, 0);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.rightFragment, newFragment);

                      // transaction.addToBackStack(FragmentNameConfig.FORM_TAX_SELECTION_FRAGMENT);
                      // Commit the transaction
                      transaction.commit();

                    } else if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("BookInCareOf")) {

                      Fragment newFragment = new BooksInCareOf(mContext, true);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.rightFragment, newFragment);

                      transaction.addToBackStack(FragmentNameConfig.BOOKS_IN_CARE_OF_FRAGMENT);

                      // Commit the transaction
                      transaction.commit(); // TODO: 11/26/2015

                    } else if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("PrimaryExemptPurpose")) {

                      Fragment newFragment = new BooksInCareOf(mContext, true);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.rightFragment, newFragment);

                      transaction.addToBackStack(FragmentNameConfig.BOOKS_IN_CARE_OF_FRAGMENT);

                      // Commit the transaction
                      transaction.commit(); // TODO: 11/26/2015

                    } else if (getAuditResponse.getErrorList().get(position).getACT() != null
                        && getAuditResponse
                            .getErrorList()
                            .get(position)
                            .getACT()
                            .equalsIgnoreCase("ProgramServiceAccomplishment")) {

                      Fragment newFragment = new BooksInCareOf(mContext, true);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.rightFragment, newFragment);

                      transaction.addToBackStack(FragmentNameConfig.BOOKS_IN_CARE_OF_FRAGMENT);

                      // Commit the transaction
                      transaction.commit(); // TODO: 11/26/2015

                    } else {

                      Fragment newFragment = new AddExemptOrganization(mContext, true, true);

                      FragmentTransaction transaction =
                          getActivity().getSupportFragmentManager().beginTransaction();

                      transaction.setCustomAnimations(R.anim.slidein, R.anim.slideout);

                      // Replace whatever is in the fragment_container view with this fragment,
                      // and add the transaction to the back stack if needed
                      transaction.replace(R.id.wholevertical, newFragment);

                      transaction.addToBackStack(FragmentNameConfig.ORG_DETAIL_FRAGMENT);

                      // Commit the transaction
                      transaction.commit();
                    }
                  }
                });
          }
        });
  }