private void initView() {
    View.inflate(getContext(), R.layout.ec_call_control_layout, this);
    // 来电显示界面
    mIncomingCallLayout = (LinearLayout) findViewById(R.id.incoming_call_bottom_show);
    mCallCancel = (ImageButton) findViewById(R.id.layout_call_cancel);
    mCallAccept = (ImageButton) findViewById(R.id.layout_call_accept);
    mCallAccept.setOnClickListener(this);
    mCallCancel.setOnClickListener(this);

    // 通话进行过程中显示
    mCallingshowPanel = (LinearLayout) findViewById(R.id.calling_bottom_show);
    // 通话控制按钮区域
    mCallSetupLayout = (RelativeLayout) findViewById(R.id.call_mute_container);
    mCallMute = (ImageView) findViewById(R.id.layout_call_mute);
    mCallHandFree = (ImageView) findViewById(R.id.layout_call_handfree);

    mCallHandFree.setClickable(true);
    mCallMute.setClickable(true);
    mCallHandFree.setOnClickListener(l);
    mCallMute.setOnClickListener(l);

    mCallTransfer = (ImageView) findViewById(R.id.layout_call_transfer);

    // 挂断电话按钮
    mCallRelease = (ImageButton) findViewById(R.id.layout_call_release);
    mCallRelease.setOnClickListener(this);
  }
  /** Config UI just one time */
  private void configUI() {
    setOrientation(LinearLayout.VERTICAL);
    setPadding(8, 8, 8, 8);

    TextView titleView = new TextView(ctx);
    titleView.setText(TEXT_TITLE);
    titleView.setTextColor(Color.LTGRAY);
    addView(titleView);

    LinearLayout subLayout = new LinearLayout(ctx);
    subLayout.setOrientation(LinearLayout.HORIZONTAL);
    LinearLayout.LayoutParams subLayoutParams =
        new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

    // configuring the iconView
    iconView.setImageDrawable(icon);
    LayoutParams icParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    icParams.gravity = Gravity.CENTER_VERTICAL;

    // configuring the msgView
    msgView.setText(msg);
    msgView.setPadding(10, 0, 0, 0);
    msgView.setTextSize(20);
    msgView.setTextColor(Color.WHITE);
    msgView.setGravity(Gravity.CENTER_VERTICAL);
    msgView.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    msgView.setMaxLines(1);
    LayoutParams tvParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

    subLayout.addView(iconView, icParams);
    subLayout.addView(msgView, tvParams);

    addView(subLayout, subLayoutParams);

    actionBtn.setText(TEXT_DELETE);
    actionBtn.setTextColor(Color.WHITE);
    addView(actionBtn, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

    undoRedoLayout.setOrientation(LinearLayout.HORIZONTAL);
    undoView = new ImageView(ctx);
    redoView = new ImageView(ctx);
    undoView.setImageDrawable(DrawableFactory.build(ctx, DrawableFactory.ICON_UNDO));
    redoView.setImageDrawable(DrawableFactory.build(ctx, DrawableFactory.ICON_REDO));
    undoView.setClickable(true);
    redoView.setClickable(true);
    LayoutParams undoRedoParams =
        new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    undoRedoParams.weight = 1;
    undoRedoLayout.addView(undoView, undoRedoParams);
    undoRedoLayout.addView(redoView, undoRedoParams);
    addView(undoRedoLayout);
  }
예제 #3
0
 @Override
 public void onTextChanged(CharSequence s, int start, int before, int count) {
   mAdapter.getFilter().filter(s);
   ImageView imgView = (ImageView) findViewById(R.id.search_icon);
   if (s.length() > 0) {
     imgView.setImageResource(R.drawable.ic_action_navigation_close);
     imgView.setOnClickListener(this);
     imgView.setClickable(true);
   } else {
     imgView.setClickable(false);
     imgView.setImageResource(R.drawable.ic_action_search);
     imgView.setOnClickListener(null);
   }
 }
 @Override
 public void handleMessage(android.os.Message msg) {
   switch (msg.what) {
     case 0:
       String result = (String) msg.obj;
       int update_Info = JsonUtil.getUpdate_Info(result);
       if (update_Info == 0) {
         Toast.makeText(getApplicationContext(), "修改密码成功", 0).show();
         // 修改登录状态
         getSharedPreferences("Login_UserInfo", Context.MODE_PRIVATE)
             .edit()
             .putBoolean("login_type", false)
             .commit();
         Intent intent = new Intent(MineFragment_Update_Pwd.this, MineFragment_Login.class);
         startActivity(intent);
         manager.killActivity(MineFragment_Update_Pwd.this);
       } else if (update_Info == -1) {
         Toast.makeText(getApplicationContext(), "修改密码失败", 0).show();
       } else if (update_Info == -2) {
         Toast.makeText(getApplicationContext(), "用户不存在", 0).show();
       } else if (update_Info == -3) {
         Toast.makeText(getApplicationContext(), "原密码不正确", 0).show();
       }
       pb_update.setVisibility(View.INVISIBLE);
       next_ok.setClickable(true);
       break;
     default:
       break;
   }
 };
  public void clickView(
      final ImageView imageView,
      final String imageUrl,
      final String videoUrl,
      final boolean videoFlag,
      final boolean intentFlag,
      final int sId) {
    imageView.setClickable(true);
    imageView.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            // imageInDialog.setBackgroundResource(image);
            if (intentFlag) {
              Intent intent = new Intent("com.arctech.DIALOGACTIVITY");
              intent.putExtra("imageUrl", imageUrl);
              intent.putExtra("videoUrl", videoUrl);
              intent.putExtra("videoFlag", videoFlag);
              startActivity(intent);

            } else {
              skillId = sId;
              imageClickFlag = true;
              new regTask().execute("Photos");
            }
          }
        });
  }
예제 #6
0
  public TouchImageView(Context context, AttributeSet attrs) {
    super(context, attrs);
    super.setClickable(true);
    this.mContext = context;

    init();
  }
예제 #7
0
  public TouchImageView(Context context) {
    super(context);
    super.setClickable(true);
    this.mContext = context;

    init();
  }
예제 #8
0
  public void setColorPreview(LinearLayout colorPreview, Integer selectedColor) {
    if (colorPreview == null) return;
    this.colorPreview = colorPreview;
    if (selectedColor == null) selectedColor = 0;
    int children = colorPreview.getChildCount();
    if (children == 0 || colorPreview.getVisibility() != View.VISIBLE) return;

    for (int i = 0; i < children; i++) {
      View childView = colorPreview.getChildAt(i);
      if (!(childView instanceof LinearLayout)) continue;
      LinearLayout childLayout = (LinearLayout) childView;
      if (i == selectedColor) {
        childLayout.setBackgroundColor(Color.WHITE);
      }
      ImageView childImage = (ImageView) childLayout.findViewById(R.id.image_preview);
      childImage.setClickable(true);
      childImage.setTag(i);
      childImage.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              if (v == null) return;
              Object tag = v.getTag();
              if (tag == null || !(tag instanceof Integer)) return;
              setSelectedColor((int) tag);
            }
          });
    }
  }
예제 #9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.animations_main_screen);

    mPhotosList = (ListView) findViewById(android.R.id.list);
    mImageView = (ImageView) findViewById(R.id.picture);
    mContainer = (ViewGroup) findViewById(R.id.container);

    // Prepare the ListView
    final ArrayAdapter<String> adapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, PHOTOS_NAMES);

    mPhotosList.setAdapter(adapter);
    mPhotosList.setOnItemClickListener(this);

    // Prepare the ImageView
    mImageView.setClickable(true);
    mImageView.setFocusable(true);
    mImageView.setOnClickListener(this);

    // Since we are caching large views, we want to keep their cache
    // between each animation
    mContainer.setPersistentDrawingCache(ViewGroup.PERSISTENT_ANIMATION_CACHE);
  }
예제 #10
0
  /** 消失 */
  protected void dismiss() {
    if (getStatus() == SweetSheet.Status.DISMISS) {
      return;
    }
    mBg.setClickable(false);
    dismissShowdown();

    ObjectAnimator translationOut =
        ObjectAnimator.ofFloat(mRootView, "translationY", 0, mRootView.getHeight());
    translationOut.setDuration(600);
    translationOut.setInterpolator(new DecelerateInterpolator());
    translationOut.addListener(
        new SimpleAnimationListener() {
          @Override
          public void onAnimationStart(Animator animation) {
            mStatus = SweetSheet.Status.DISMISSING;
          }

          @Override
          public void onAnimationEnd(Animator animation) {
            mStatus = SweetSheet.Status.DISMISS;
            mParentVG.removeView(mRootView);
          }
        });
    translationOut.start();
  }
예제 #11
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {

    final Image image = getItem(position);

    if (convertView == null) {
      convertView =
          LayoutInflater.from(getContext()).inflate(R.layout.gallery_image_layout, parent, false);
    }

    ImageLoader imageLoader = ImageLoader.getInstance();

    ImageView IVGalleryImage = (ImageView) convertView.findViewById(R.id.IVGalleryImage);
    imageLoader.displayImage(image.getThumbURL(), IVGalleryImage);

    IVGalleryImage.setClickable(true);
    IVGalleryImage.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            State.setImage(image);
            Intent intent = new Intent(context, ImageActivity.class);
            context.startActivity(intent);
          }
        });

    return convertView;
  }
예제 #12
0
  protected void show() {

    if (getStatus() != SweetSheet.Status.DISMISS) {
      return;
    }
    mBg.setClickable(mIsBgClickEnable);
    showShowdown();
  }
 @Override
 public void onReceive(Context context, Intent intent) {
   if (intent.getAction().equals(Intent.ACTION_MEDIA_EJECT)
       || intent.getAction().equals(Intent.ACTION_MEDIA_REMOVED)
       || intent.getAction().equals(Intent.ACTION_MEDIA_BAD_REMOVAL)) {
     // SD卡移除,设置列表为空
     mView_MoreFunctions.setClickable(false);
     mView_Title.setText("");
     mAdapter.setData(null);
     // 提示SD卡不可用
     Toast.makeText(getActivity(), R.string.sdcard_cannot_use, Toast.LENGTH_SHORT).show();
   } else if (intent.getAction().equals(Intent.ACTION_MEDIA_MOUNTED)) {
     // TODO SD卡正常挂载,重新加载数据
     mView_MoreFunctions.setClickable(true);
     getLoaderManager()
         .restartLoader(FOLDER_RETRIEVE_LOADER, null, FolderBrowserFragment.this);
   }
 }
예제 #14
0
  protected void onPostExecute(Bitmap image) {
    if (image != null) {
      iv.setImageBitmap(image);
      ImageCache.getInstance().put(thumbnailPath, image);
      iv.setClickable(true);
      iv.setTag(thumbnailPath);
      iv.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              if (thumbnailPath != null) {

                Intent intent = new Intent(activity, ShowBigImage.class);
                File file = new File(localFullSizePath);
                if (file.exists()) {
                  Uri uri = Uri.fromFile(file);
                  intent.putExtra("uri", uri);
                } else {
                  // The local full size pic does not exist yet. ShowBigImage needs to download it
                  // from the server first
                  intent.putExtra("remotepath", remotePath);
                }
                if (message.getChatType() != ChatType.Chat) {
                  // delete the image from server after download
                }
                if (message != null
                    && message.direct == EMMessage.Direct.RECEIVE
                    && !message.isAcked) {
                  message.isAcked = true;
                  try {
                    // 看了大图后发个已读回执给对方
                    EMChatManager.getInstance()
                        .ackMessageRead(message.getFrom(), message.getMsgId());
                  } catch (Exception e) {
                    e.printStackTrace();
                  }
                }
                activity.startActivity(intent);
              }
            }
          });
    } else {
      if (message.status == EMMessage.Status.FAIL) {
        if (CommonUtils.isNetWorkConnected(activity)) {
          new Thread(
                  new Runnable() {

                    @Override
                    public void run() {
                      EMChatManager.getInstance().asyncFetchMessage(message);
                    }
                  })
              .start();
        }
      }
    }
  }
예제 #15
0
  @Override
  protected void onPostExecute(Bitmap result) {
    super.onPostExecute(result);
    if (result != null) {
      iv.setImageBitmap(result);
      ImageCache.getInstance().put(thumbnailPath, result);
      iv.setClickable(true);
      iv.setTag(thumbnailPath);
      iv.setOnClickListener(
          new View.OnClickListener() {

            @Override
            public void onClick(View v) {
              if (thumbnailPath != null) {
                VideoMessageBody videoBody = (VideoMessageBody) message.getBody();
                Intent intent = new Intent(activity, ShowVideoActivity.class);
                intent.putExtra("localpath", videoBody.getLocalUrl());
                intent.putExtra("secret", videoBody.getSecret());
                intent.putExtra("remotepath", videoBody.getRemoteUrl());
                if (message != null
                    && message.direct == EMMessage.Direct.RECEIVE
                    && !message.isAcked) {
                  message.isAcked = true;
                  try {
                    EMChatManager.getInstance()
                        .ackMessageRead(message.getFrom(), message.getMsgId());
                  } catch (Exception e) {
                    e.printStackTrace();
                  }
                }
                activity.startActivity(intent);
              }
            }
          });

    } else {
      if (message.status == EMMessage.Status.FAIL || message.direct == EMMessage.Direct.RECEIVE) {
        if (CommonUtils.isNetWorkConnected(activity)) {
          new AsyncTask<Void, Void, Void>() {

            @Override
            protected Void doInBackground(Void... params) {
              EMChatManager.getInstance().asyncFetchMessage(message);
              return null;
            }

            @Override
            protected void onPostExecute(Void result) {
              adapter.notifyDataSetChanged();
            };
          }.execute();
        }
      }
    }
  }
예제 #16
0
  private void sharedConstructing(Context context) {
    super.setClickable(true);
    this.context = context;
    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    matrix = new Matrix();
    m = new float[9];
    setImageMatrix(matrix);
    setScaleType(ScaleType.MATRIX);

    setOnTouchListener(
        new OnTouchListener() {

          @Override
          public boolean onTouch(View v, MotionEvent event) {
            mScaleDetector.onTouchEvent(event);
            PointF curr = new PointF(event.getX(), event.getY());

            switch (event.getAction()) {
              case MotionEvent.ACTION_DOWN:
                last.set(curr);
                start.set(last);
                mode = DRAG;
                break;

              case MotionEvent.ACTION_MOVE:
                if (mode == DRAG) {
                  float deltaX = curr.x - last.x;
                  float deltaY = curr.y - last.y;
                  float fixTransX = getFixDragTrans(deltaX, viewWidth, origWidth * saveScale);
                  float fixTransY = getFixDragTrans(deltaY, viewHeight, origHeight * saveScale);
                  matrix.postTranslate(fixTransX, fixTransY);
                  fixTrans();
                  last.set(curr.x, curr.y);
                }
                break;

              case MotionEvent.ACTION_UP:
                mode = NONE;
                int xDiff = (int) Math.abs(curr.x - start.x);
                int yDiff = (int) Math.abs(curr.y - start.y);
                if (xDiff < CLICK && yDiff < CLICK) performClick();
                break;

              case MotionEvent.ACTION_POINTER_UP:
                mode = NONE;
                break;
            }

            setImageMatrix(matrix);
            invalidate();
            return true; // indicate event was handled
          }
        });
  }
 private void createPlaceholderView() {
   if (mImageView == null) {
     mImageView = new ImageView(getContext());
     mImageView.setClickable(false);
     mImageView.setScaleType(ScaleType.CENTER_CROP);
     mImageView.setLayoutParams(
         new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
   }
   mImageView.setImageResource(R.drawable.img_placeholder);
   this.addView(mImageView);
 }
예제 #18
0
  /**
   * Initialize the buttons declared in the xml. In this case just the MAIN button. Main button: add
   * a touch listener, when clicked should take you back to the main conversation
   */
  public void initializeButtons() {
    // set listener to main button
    // Button mainButton = (Button) findViewById(R.id.main_button);
    /*
     * mainButton.setOnTouchListener(new View.OnTouchListener() {
     *
     * @Override public boolean onTouch(View view, MotionEvent evt) { switch
     * (evt.getAction()) { case MotionEvent.ACTION_DOWN: break; case
     * MotionEvent.ACTION_MOVE: break; case MotionEvent.ACTION_UP:
     * if(!(screen.getSpace()==Space.getMainSpace())){
     * MainApplication.screen
     * .getSpaceViewController().changeSpace(Space.getMainSpace()); } break;
     * } return false; } });
     */
    try {
      // sidechat 1
      // Log.v("C", "Problem on adding space");
      Space newSpace = SpaceController.addSpace(Space.getMainSpace().getContext());

      side1 = new PrivateSpaceIconView(Space.getMainSpace().getContext(), newSpace);
      newSpace.getSpaceController().setPSIV(side1);
      // main chat
      PrivateSpaceIconView main =
          new PrivateSpaceIconView(Space.getMainSpace().getContext(), Space.getMainSpace());
      Space.getMainSpace().getSpaceController().setPSIV(main);
      // sidechat 2
      Space newSpace2 = SpaceController.addSpace(Space.getMainSpace().getContext());
      side2 = new PrivateSpaceIconView(Space.getMainSpace().getContext(), newSpace2);
      newSpace2.getSpaceController().setPSIV(side2);
    } catch (XMPPException e) {
      // TODO Auto-generated catch block

      e.printStackTrace();
    }

    TextView logo = (TextView) findViewById(R.id.logo);
    logo.setClickable(true);
    logo.setOnClickListener(this.logoOnClickListener());

    // ImageView soundButton = (ImageView) findViewById(R.id.sound_button);
    // soundButton.setClickable(true);
    // soundButton.setOnClickListener(this.getSoundButtonOnClickListener());
    /*
     * Log.v(TAG, "Clicked on MENU key"); LayoutInflater inflater =
     * (LayoutInflater) MainApplication.this
     * .getSystemService(Context.LAYOUT_INFLATER_SERVICE); MenuView menuView
     * = new MenuView(inflater); menuView.launch();
     */

    ImageView spatializationButton = (ImageView) findViewById(R.id.auto_spatialization);
    spatializationButton.setClickable(true);
    spatializationButton.setOnClickListener(this.getSpatializationListener());
  }
  public void sellProfileClick(final ImageView imageView, final String stkid) {
    imageView.setClickable(true);
    imageView.setOnClickListener(
        new View.OnClickListener() {

          @Override
          public void onClick(View v) {
            profileFlag = true;
            sellerStkid = stkid;
            new regTask().execute("SellerMarket profile");
          }
        });
  }
예제 #20
0
  private void searchCity() {
    final String city = mEditCityName.getText().toString().trim();
    if (!TextUtils.isEmpty(city) && !Utils.isTaskRunning(mCityTask)) {

      mButtonSearch.setClickable(false);
      mEditCityName.setEnabled(false);
      mSearching.setVisibility(View.VISIBLE);
      mListView.setVisibility(View.INVISIBLE);
      mImm.hideSoftInputFromWindow(mEditCityName.getWindowToken(), 0);
      mCityTask = new CityTask();
      mCityTask.execute(city);
    }
  }
    public ViewHolder(View itemView) {

      super(itemView);
      mTextView_headlines =
          (TextView) itemView.findViewById(R.id.savedNewsFeedItem_headlines_textView);
      mTextView_trailText =
          (TextView) itemView.findViewById(R.id.savedNewsFeedItem_trailText_textView);
      mImageView_deleteButton =
          (ImageView) itemView.findViewById(R.id.savedNewsFeedItem_deleteButton);
      mCardView = (CardView) itemView.findViewById(R.id.savedNewsFeed_cardView);
      mImageView_shareButton =
          (ImageView) itemView.findViewById(R.id.savedNewsFeedItem_shareButton);
      mTextView_author = (TextView) itemView.findViewById(R.id.savedNewsFeedItem_author);
      mTextView_sectionID = (TextView) itemView.findViewById(R.id.savedNewsFeedItem_sectionID);

      mTextView_headlines.setClickable(true);
      mTextView_headlines.setOnClickListener(this);
      mTextView_trailText.setClickable(true);
      mTextView_trailText.setOnClickListener(this);
      mImageView_deleteButton.setClickable(true);
      mImageView_deleteButton.setOnClickListener(this);
      mImageView_shareButton.setClickable(true);
      mImageView_shareButton.setOnClickListener(this);
    }
 private void addFavorite(Place place) {
   int reulst =
       FavoriteMission.getInstance()
           .addFavoritePlace(UserManager.getInstance().getUserId(this), place);
   Toast toast;
   toast = Toast.makeText(this, "收藏成功", Toast.LENGTH_SHORT);
   if (reulst == 0) {
     collect.setText(R.string.collected);
     collectBtn.setClickable(false);
     getPlaceFavoriteCount();
   } else {
     toast = Toast.makeText(this, "收藏失败", Toast.LENGTH_SHORT);
   }
   toast.show();
 }
예제 #23
0
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.fragment_video3, container, false);

    // set the path where we want to save the file
    File SDCardRoot = Environment.getExternalStorageDirectory();
    // create a new file, to save the downloaded file
    // recupero il percorso del file
    file = new File(SDCardRoot + "/PersonalTrainer/", "slanci_posteriori.mp4");
    video = (VideoView) v.findViewById(R.id.videoView1);

    getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    image = (ImageView) v.findViewById(R.id.imageView1);
    image.setClickable(true);

    return v;
  }
예제 #24
0
 private void sharedConstructing(Context context) {
   super.setClickable(true);
   this.context = context;
   mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
   mGestureDetector = new GestureDetector(context, new GestureListener());
   matrix = new Matrix();
   prevMatrix = new Matrix();
   m = new float[9];
   normalizedScale = 1;
   if (mScaleType == null) {
     mScaleType = ScaleType.FIT_CENTER;
   }
   minScale = 1;
   maxScale = 3;
   superMinScale = SUPER_MIN_MULTIPLIER * minScale;
   superMaxScale = SUPER_MAX_MULTIPLIER * maxScale;
   setImageMatrix(matrix);
   setScaleType(ScaleType.MATRIX);
   setState(State.NONE);
   onDrawReady = false;
   super.setOnTouchListener(new PrivateOnTouchListener());
 }
예제 #25
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_layout, container, false);
    final ImageFragment imageFragment =
        (ImageFragment) getFragmentManager().findFragmentById(R.id.fragment_Image);

    image = (ImageView) view.findViewById(R.id.imageView_Fragment_Pic);
    image.setClickable(true);
    image.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            FragmentTransaction fr = getFragmentManager().beginTransaction();
            fr.hide(imageFragment);
            fr.commit();
          }
        });

    return view;
  }
예제 #26
0
    public void update(final VideoModel baseItemModel, final int positon) {
      model = baseItemModel;
      title.setText(model.getTitle());
      text.setText(
          changeMB(model.getDownloadedSize())
              + "/"
              + changeMB(model.getVideoSize())
              + "  ("
              + model.getDownloadPercent()
              + "%)");
      TouchUtil.createTouchDelegate(delete, 50);
      TouchUtil.createTouchDelegate(studyRecordBtn, 30);
      if (type == DISMISS_DELETE) {
        studyRecordBtn.setVisibility(View.VISIBLE);
        studyRecordBtn.setClickable(true);
        delete.setVisibility(View.GONE);
        deleteLayout.setVisibility(View.GONE);
        delete.setClickable(false);
        deleteLayout.setClickable(false);
        TouchUtil.createTouchDelegate(delete, 50);
        TouchUtil.createTouchDelegate(studyRecordBtn, 30);
        if (context.type == StudyRecordActivity.ALREADOVER_TYEP) {
          studyRecordBtn.setVisibility(View.GONE);
        } else {
          studyRecordBtn.setVisibility(View.VISIBLE);
          String currentVideoId = DownloadTaskManager.getInstance(context).downloadingId();
          if (currentVideoId != null && currentVideoId.equals(model.getId())) {
            studyRecordBtn.setText(context.getResources().getString(R.string.pause));
            studyRecordBtn.setOnClickListener(
                new OnClickListener() {

                  @Override
                  public void onClick(View v) {
                    // 暂停一个下载,并移除当前下载队列中。
                    DownloadTaskManager.getInstance(context).stopOneTask(model);
                  }
                });
          } else if (set.contains(model)) {
            studyRecordBtn.setText(context.getResources().getString(R.string.wait));
            studyRecordBtn.setOnClickListener(
                new OnClickListener() {

                  @Override
                  public void onClick(View v) {
                    // TODO
                  }
                });
          } else {
            studyRecordBtn.setText(context.getResources().getString(R.string.downlaod));
            studyRecordBtn.setOnClickListener(
                new OnClickListener() {

                  @Override
                  public void onClick(View v) {
                    // 将一个下载加载到下载队列中。
                    startTask(baseItemModel);
                  }
                });
          }
        }
      } else {
        studyRecordBtn.setVisibility(View.GONE);
        studyRecordBtn.setClickable(false);
        delete.setVisibility(View.VISIBLE);
        deleteLayout.setVisibility(View.VISIBLE);
        delete.setClickable(true);
        deleteLayout.setClickable(true);
        TouchUtil.createTouchDelegate(delete, 50);
        TouchUtil.createTouchDelegate(studyRecordBtn, 30);
      }
      deleteLayout.setOnClickListener(
          new View.OnClickListener() {

            @Override
            public void onClick(View v) {
              deleteDialog(baseItemModel);
            }
          });
      delete.setOnClickListener(
          new View.OnClickListener() {

            @Override
            public void onClick(View v) {
              deleteDialog(baseItemModel);
            }
          });
      if (positon == getCount() - 1) {
        line.setVisibility(View.INVISIBLE);
      } else {
        line.setVisibility(View.VISIBLE);
      }
    }
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    if (values.get(position).isSection()) {
      ImageView view = new ImageView(context);
      if (m.theme1 == 0) view.setImageResource(R.color.divider);
      else view.setImageResource(R.color.divider_dark);
      view.setClickable(false);
      view.setFocusable(false);
      if (m.theme1 == 0) view.setBackgroundColor(Color.WHITE);
      else view.setBackgroundResource(R.color.background_material_dark);
      view.setLayoutParams(
          new AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, m.dpToPx(17)));
      view.setPadding(0, m.dpToPx(8), 0, m.dpToPx(8));
      return view;
    } else {
      View view = inflater.inflate(R.layout.drawerrow, parent, false);
      final TextView txtTitle = (TextView) view.findViewById(R.id.firstline);
      final ImageView imageView = (ImageView) view.findViewById(R.id.icon);
      if (m.theme1 == 0) {
        view.setBackgroundResource(R.drawable.safr_ripple_white);
      } else {
        view.setBackgroundResource(R.drawable.safr_ripple_black);
      }
      view.setOnClickListener(
          new View.OnClickListener() {

            public void onClick(View p1) {
              m.selectItem(position);
            }
            // TODO: Implement this method

          });
      view.setOnLongClickListener(
          new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {
              if (!getItem(position).isSection())
                // not to remove the first bookmark (storage) and permanent bookmarks
                if (position > m.storage_count && position < values.size() - 7) {
                  EntryItem item = (EntryItem) getItem(position);
                  String path = (item).getPath();
                  if (m.mainActivityHelper.contains(path, m.books) != -1) {
                    m.renameBookmark(((EntryItem) getItem(position)).getTitle(), path);
                  } else if (path.startsWith("smb:/")) {
                    m.showSMBDialog(item.getTitle(), path, true);
                  }
                } else if (position < m.storage_count) {
                  String path = ((EntryItem) getItem(position)).getPath();
                  if (!path.equals("/"))
                    new Futils()
                        .showProps(RootHelper.generateBaseFile(new File(path), true), m, m.theme1);
                }

              // return true to denote no further processing
              return true;
            }
          });

      txtTitle.setText(((EntryItem) (values.get(position))).getTitle());
      imageView.setImageDrawable(getDrawable(position));
      imageView.clearColorFilter();
      if (myChecked.get(position)) {
        if (m.theme1 == 0) view.setBackgroundColor(Color.parseColor("#ffeeeeee"));
        else view.setBackgroundColor(Color.parseColor("#ff424242"));
        imageView.setColorFilter(fabskin);
        txtTitle.setTextColor(Color.parseColor(m.fabskin));
      } else {
        if (m.theme1 == 0) {
          imageView.setColorFilter(Color.parseColor("#666666"));
          txtTitle.setTextColor(m.getResources().getColor(android.R.color.black));
        } else {
          imageView.setColorFilter(Color.WHITE);
          txtTitle.setTextColor(m.getResources().getColor(android.R.color.white));
        }
      }

      return view;
    }
  }
예제 #28
0
  private void init() {
    if (initialized) {
      return;
    }

    initialized = true;

    Settings.setLanguage(Settings.isUseEnglish());

    findOnMap.setClickable(true);
    findOnMap.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(final View v) {
            cgeoFindOnMap(v);
          }
        });

    findByOffline.setClickable(true);
    findByOffline.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(final View v) {
            cgeoFindByOffline(v);
          }
        });
    findByOffline.setOnLongClickListener(
        new View.OnLongClickListener() {

          @Override
          public boolean onLongClick(final View v) {
            new StoredList.UserInterface(MainActivity.this)
                .promptForListSelection(
                    R.string.list_title,
                    new Action1<Integer>() {

                      @Override
                      public void call(final Integer selectedListId) {
                        Settings.saveLastList(selectedListId);
                        CacheListActivity.startActivityOffline(MainActivity.this);
                      }
                    },
                    false,
                    PseudoList.HISTORY_LIST.id);
            return true;
          }
        });
    findByOffline.setLongClickable(true);

    advanced.setClickable(true);
    advanced.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(final View v) {
            cgeoSearch(v);
          }
        });

    any.setClickable(true);
    any.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(final View v) {
            cgeoPoint(v);
          }
        });

    filter.setClickable(true);
    filter.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(final View v) {
            selectGlobalTypeFilter();
          }
        });
    filter.setOnLongClickListener(
        new View.OnLongClickListener() {

          @Override
          public boolean onLongClick(final View v) {
            Settings.setCacheType(CacheType.ALL);
            setFilterTitle();
            return true;
          }
        });

    updateCacheCounter();

    setFilterTitle();
    checkRestore();
    (new CleanDatabaseThread()).start();
  }
예제 #29
0
  private void init() {
    super.setClickable(true);
    this.context = context;

    matrix.setTranslate(1f, 1f);
    setImageMatrix(matrix);
    setScaleType(ScaleType.MATRIX);

    setOnTouchListener(
        new OnTouchListener() {

          public boolean onTouch(View v, MotionEvent rawEvent) {
            WrapMotionEvent event = WrapMotionEvent.wrap(rawEvent);

            // Handle touch events here...
            switch (event.getAction() & MotionEvent.ACTION_MASK) {
              case MotionEvent.ACTION_DOWN:
                savedMatrix.set(matrix);
                start.set(event.getX(), event.getY());
                Log.d(TAG, "mode=DRAG");
                mode = DRAG;
                break;
              case MotionEvent.ACTION_POINTER_DOWN:
                oldDist = spacing(event);
                Log.d(TAG, "oldDist=" + oldDist);
                if (oldDist > 10f) {
                  savedMatrix.set(matrix);
                  midPoint(mid, event);
                  mode = ZOOM;
                  Log.d(TAG, "mode=ZOOM");
                }
                break;
              case MotionEvent.ACTION_UP:
                int xDiff = (int) Math.abs(event.getX() - start.x);
                int yDiff = (int) Math.abs(event.getY() - start.y);
                if (xDiff < 8 && yDiff < 8) {
                  performClick();
                }
              case MotionEvent.ACTION_POINTER_UP:
                mode = NONE;
                Log.d(TAG, "mode=NONE");
                break;
              case MotionEvent.ACTION_MOVE:
                if (mode == DRAG) {
                  // ...
                  matrix.set(savedMatrix);
                  matrix.postTranslate(event.getX() - start.x, event.getY() - start.y);
                } else if (mode == ZOOM) {
                  float newDist = spacing(event);
                  Log.d(TAG, "newDist=" + newDist);
                  if (newDist > 10f) {
                    matrix.set(savedMatrix);
                    float scale = newDist / oldDist;
                    matrix.postScale(scale, scale, mid.x, mid.y);
                  }
                }
                break;
            }

            setImageMatrix(matrix);
            return true; // indicate event was handled
          }
        });
  }
예제 #30
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_profile);

    Bundle extras = getIntent() != null ? getIntent().getExtras() : new Bundle();
    final Person person = extras.getParcelable("person");
    final Activity currentActivity = this;
    final ActionBar bar = getActionBar();
    View viewActionBar = getLayoutInflater().inflate(R.layout.layout_action_bar, null);

    ImageView backView = (ImageView) viewActionBar.findViewById(R.id.actionbar_left);
    backView.setImageResource(R.drawable.arrow_left);
    backView.setVisibility(View.VISIBLE);
    backView.setClickable(true);
    backView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            currentActivity.finish();
          }
        });

    ActionBar.LayoutParams params =
        new ActionBar.LayoutParams(
            ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.MATCH_PARENT);
    bar.setCustomView(viewActionBar, params);
    bar.setDisplayShowCustomEnabled(true);
    bar.setDisplayShowTitleEnabled(false);
    bar.setIcon(new ColorDrawable(Color.TRANSPARENT));
    bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#F15153")));

    TextView attendeeNameView = (TextView) findViewById(R.id.attendeeName);
    attendeeNameView.setText(person.getFirstName() + " " + person.getLastName());

    final ImageView attendeeImageView = (ImageView) findViewById(R.id.attendeeImage);
    final TextView attendeeHeadlineView = (TextView) findViewById(R.id.attendeeHeadline);
    final TextView attendeeLocationView = (TextView) findViewById(R.id.attendeeLocation);

    boolean isAccessTokenValid =
        LISessionManager.getInstance(currentActivity).getSession().isValid();
    if (isAccessTokenValid) {
      String url =
          Constants.personByIdBaseUrl + person.getLinkedinId() + Constants.personProjection;
      APIHelper.getInstance(currentActivity)
          .getRequest(
              currentActivity,
              url,
              new ApiListener() {
                @Override
                public void onApiSuccess(ApiResponse apiResponse) {
                  try {
                    JSONObject s = apiResponse.getResponseDataAsJson();
                    String headline = s.has("headline") ? s.getString("headline") : "";
                    String pictureUrl = s.has("pictureUrl") ? s.getString("pictureUrl") : null;
                    JSONObject location = s.getJSONObject("location");
                    String locationName =
                        location != null && location.has("name") ? location.getString("name") : "";

                    attendeeHeadlineView.setText(headline);
                    attendeeLocationView.setText(locationName);
                    if (pictureUrl != null) {
                      new FetchImageTask(attendeeImageView).execute(pictureUrl);
                    } else {
                      attendeeImageView.setImageResource(R.drawable.ghost_person);
                    }
                  } catch (JSONException e) {

                  }
                }

                @Override
                public void onApiError(LIApiError apiError) {}
              });

      ViewStub viewOnLIStub = (ViewStub) findViewById(R.id.viewOnLIStub);
      View viewOnLI = viewOnLIStub.inflate();
      Button viewOnLIButton = (Button) viewOnLI.findViewById(R.id.viewOnLinkedInButton);
      viewOnLIButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              DeepLinkHelper.getInstance()
                  .openOtherProfile(
                      currentActivity,
                      person.getLinkedinId(),
                      new DeepLinkListener() {
                        @Override
                        public void onDeepLinkSuccess() {}

                        @Override
                        public void onDeepLinkError(LIDeepLinkError error) {}
                      });
            }
          });
    } else {
      attendeeImageView.setImageResource(R.drawable.ghost_person);
    }
  }