Example #1
0
  private void setupNavigationView() {

    drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    NavigationView navigationView = (NavigationView) findViewById(R.id.navigation_view);
    if (navigationView != null) {
      setupDrawerContent(navigationView, this);
    }
    View header = findViewById(R.id.header);
    header.setClickable(true);
    final CircleImageView userPhoto = (CircleImageView) findViewById(R.id.user_photo);
    userPhoto.setClickable(true);
    userPhoto.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.d(TAG, MyUser.userId);
            if ("001".equals(MyUser.userId)) {
              drawerLayout.closeDrawers();
              showLoginDialog();
            } else {
              Intent intent = new Intent(MainActivity.this, UserAcitivity.class);
              intent.putExtra("userId", mUser.getUserId());
              startActivity(intent);
            }
          }
        });
  }
Example #2
0
  private void setUpLeftDrawable(boolean showingSearchSuggestions) {
    if (showingSearchSuggestions) {
      mLeftDrawableImageView.setImageDrawable(
          ContextCompat.getDrawable(getContext(), R.drawable.ic_arrow_back_black_24dp));
      mLeftDrawableRoundedImageView.setVisibility(View.GONE);
      mLeftDrawableImageView.setVisibility(View.VISIBLE);
    } else {
      switch (mLeftDrawableType) {
        case MENU:
          mLeftDrawableImageView.setImageDrawable(
              ContextCompat.getDrawable(getContext(), R.drawable.ic_menu_black_24dp));
          break;
        case BACK:
          mLeftDrawableImageView.setImageDrawable(
              ContextCompat.getDrawable(getContext(), R.drawable.ic_arrow_back_black_24dp));
          break;
        case SEARCH:
          mLeftDrawableImageView.setImageDrawable(
              ContextCompat.getDrawable(getContext(), R.drawable.ic_search_black_24dp));
          break;
        case AVATAR:
          break;
        default:
          break;
      }

      if (mLeftDrawableType == AVATAR) {
        mLeftDrawableImageView.setVisibility(View.GONE);
        mLeftDrawableRoundedImageView.setVisibility(View.VISIBLE);
      } else {
        mLeftDrawableRoundedImageView.setVisibility(View.GONE);
        mLeftDrawableImageView.setVisibility(View.VISIBLE);
      }
    }
  }
 public void addElementCircles() {
   CircleImageView civ;
   circle_holder.removeAllViewsInLayout();
   circleIndex.clear();
   QData qData;
   for (int i = 0; i < elements.size(); i++) {
     qData = elements.get(i);
     if (qData.isText()) {
       civ = new CircleImageView(this);
       civ.setImageDrawable(getResources().getDrawable(R.drawable.text));
       civ.setBorderColor(getResources().getColor(R.color.blue));
       civ.setBorderWidth(10);
       civ.setOnClickListener(circleClickListener);
       circle_holder.addView(civ, circle_params);
       circleIndex.add(civ);
     } else if (!qData.isText()) {
       civ = new CircleImageView(this);
       //                byte[] array = fragments.get(i).mData.getImage();
       civ.setImageBitmap(elements.get(i).getImageBitmap());
       civ.setBorderColor(getResources().getColor(R.color.blue));
       civ.setBorderWidth(10);
       civ.setOnClickListener(circleClickListener);
       circle_holder.addView(civ, circle_params);
       circleIndex.add(civ);
     }
     if (i == 0) circleIndex.get(i).setBorderColor(Color.WHITE);
   }
 }
  /**
   * 保存裁剪之后的图片数据
   *
   * @param picdata
   */
  private void setPicToView(Intent picdata) {
    Bundle extras = picdata.getExtras();
    if (extras != null) {
      // 取得SDCard图片路径做显示
      Bitmap avaterBitmap = extras.getParcelable("data");
      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      avaterBitmap.compress(Bitmap.CompressFormat.JPEG, 50, stream); // (0 - 100)压缩文件
      mImgUserAvatar.setImageBitmap(avaterBitmap);

      mAvaterUrl = FileUtil.saveFile(RegisterActivity.this, IMAGE_FILE_NAME, avaterBitmap);

      isTakeAvatar = true;

      // 压缩图片
      // BitmapFactory.Options option = new BitmapFactory.Options();
      // 压缩图片:表示缩略图大小为原始图片大小的几分之一,1为原图
      // option.inSampleSize = 2;
      // 根据图片的SDCard路径读出Bitmap
      // genderBitmap = BitmapFactory.decodeFile(avaterUrl, option);

      Toast.makeText(
              RegisterActivity.this,
              "头像保存在:" + mAvaterUrl.replaceAll(IMAGE_FILE_NAME, ""),
              Toast.LENGTH_LONG)
          .show();

      // 新线程后台上传服务端
      // new Thread(uploadImageRunnable).start();
    }
  }
Example #5
0
  private void saveNewUser() {
    parseUser = ParseUser.getCurrentUser();
    parseUser.setUsername(name);
    parseUser.setEmail(email);

    //        Saving profile photo as a ParseFile
    ByteArrayOutputStream stream = new ByteArrayOutputStream();
    Bitmap bitmap = ((BitmapDrawable) mProfileImage.getDrawable()).getBitmap();
    bitmap.compress(Bitmap.CompressFormat.JPEG, 70, stream);
    byte[] data = stream.toByteArray();
    String thumbName = parseUser.getUsername().replaceAll("\\s+", "");
    final ParseFile parseFile = new ParseFile(thumbName + "_thumb.jpg", data);

    parseFile.saveInBackground(
        new SaveCallback() {
          @Override
          public void done(ParseException e) {
            parseUser.put("profileThumb", parseFile);

            // Finally save all the user details
            parseUser.saveInBackground(
                new SaveCallback() {
                  @Override
                  public void done(ParseException e) {
                    Toast.makeText(
                            MainActivity.this,
                            "New user:"******" Signed up",
                            Toast.LENGTH_SHORT)
                        .show();
                  }
                });
          }
        });
  }
  private void responseUserHouse() {
    headImageView.setImageURL(Constants.HOST_IP + userDto.getLogoUrl());
    if (StringUtils.isBlank(userDto.getLogoUrl())) {
      headImageView.setBorderWidth(0);
    } else {
      headImageView.setBorderWidth(2);
    }

    double totalEarnings = Double.parseDouble(userDto.getHqMoney());
    // 只有当数字大于0.10的时候,才会有涨动的动画,而且,如果小于0.10,金额会显示为0.00,且界面卡动。
    if (totalEarnings >= 0.10) {
      totalMoneyTextView.setValue(totalEarnings);
      magicScrollView.AddListener(totalMoneyTextView);
      mHandler.sendEmptyMessageDelayed(0, 100);
    } else {
      totalMoneyTextView.setText(userDto.getHqMoney());
    }

    totalMoneyTextView.setText(userDto.getHqMoney());
    yesterdayEarningsTextView.setText("昨日收益:" + userDto.getHqYesterday());
    moneyTextView.setText(userDto.getSurplusMoney());
    hqStatusTextView.setText(userDto.isAutoPay() ? "已开启" : "未开启");
    if (userDto.getReserveCount() > 0) {
      countBadgeView.setText(userDto.getReserveCount() + "");
      countBadgeView.show(true);
    } else {
      countBadgeView.hide(false);
    }

    if (userDto.getHouses().isEmpty()) {
      noHouseImageView.setVisibility(View.VISIBLE);
    } else {
      noHouseImageView.setVisibility(View.GONE);
    }

    contentLayout.removeAllViews();
    for (UserHouseListAppDto dto : userDto.getHouses()) {
      TenantMeLayout layout = new TenantMeLayout(this);
      layout.setData(dto);

      LinearLayout.LayoutParams params =
          new LinearLayout.LayoutParams(
              LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
      params.setMargins(0, 0, 0, AdapterUtil.dip2px(this, 20));
      contentLayout.addView(layout, params);
    }
  }
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode != RESULT_OK) {
      return;
    }
    Bitmap bm = null;
    ContentResolver resolver = getContentResolver();
    if (requestCode == REQUEST_CODE_PICK_IMAGE) {
      try {
        bm = null;
        Uri originalUri = data.getData();
        bm = MediaStore.Images.Media.getBitmap(resolver, originalUri);
        String[] proj = {MediaStore.Images.Media.DATA};
        Cursor cursor = managedQuery(originalUri, proj, null, null, null);
        int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
        cursor.moveToFirst();
        String path = cursor.getString(column_index);
        Toast.makeText(getBaseContext(), "pick:" + path, Toast.LENGTH_SHORT).show();
        Bitmap bt = convertToBitmap(path, 100, 120);

        profile_circleimageview.setImageDrawable(new BitmapDrawable(bt));
        saveBitmap(bt);

      } catch (IOException e) {
      }
    } else if (requestCode == CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE) {
      //  Bitmap bt=convertToBitmap(path,100,120);
      bm = null;
      try {
        Uri originalUri = data.getData();
        bm = MediaStore.Images.Media.getBitmap(resolver, originalUri);
        String[] proj = {MediaStore.Images.Media.DATA};
        Cursor cursor = managedQuery(originalUri, proj, null, null, null);
        int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
        cursor.moveToFirst();
        String path = cursor.getString(column_index);
        Bitmap bt = convertToBitmap(path, 100, 120);
        // Toast.makeText(getBaseContext(),"take:"+path,Toast.LENGTH_SHORT).show();
        profile_circleimageview.setImageDrawable(new BitmapDrawable(bt));
        saveBitmap(bt);

      } catch (IOException e) {
        Toast.makeText(getBaseContext(), "Exception", Toast.LENGTH_SHORT).show();
      }
    }
  }
Example #8
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_profile);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    et_username = (TextView) findViewById(R.id.editUsername);

    et_email = (EditText) findViewById(R.id.editEmail);
    et_address = (EditText) findViewById(R.id.editAddress);
    et_password = (EditText) findViewById(R.id.editPassword);
    ib_avatar = (CircleImageView) findViewById(R.id.avatarEditProfile);
    ib_avatar.setImageDrawable(null);
    ib_avatar.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            showSelectImageDialog();
          }
        });
    client = new AsyncHttpClient();
    //        final ProgressGenerator progressGenerator = new ProgressGenerator(this);
    btnSave = (ActionProcessButton) findViewById(R.id.btnSave);
    btnSave.setMode(ActionProcessButton.Mode.ENDLESS);
    btnSave.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            if (checkingMissingInfo()) {
              Variables.refreshFlag = true;
              btnSave.setProgress(50);
              enableInput(false);
              if (avatarBitmap != null) {
                uploadImage(avatarBitmap);
              } else {
                saveChanges(originAvatarUrl);
              }
            }
          }
        });
    imageUploadClient = new AsyncHttpClient();
    imageUploadClient.addHeader("Authorization", "Client-ID 9806c7ef5d11150"); // TODO

    loadInfo();
    resetSaveButton();
    settingShowcase();
  }
Example #9
0
  private void initializeProfileInformation() {
    imgAvatar = (CircleImageView) findViewById(R.id.imgAvatar);
    imgAvatar.setOnClickListener(this);
    final TextView txtName = (TextView) findViewById(R.id.txtName);
    final TextView txtEmail = (TextView) findViewById(R.id.txtEmail);

    if (((GlobalApplication) getApplication()).getAvatar() != null) {
      imgAvatar.setImageBitmap(((GlobalApplication) getApplication()).getAvatar());
      txtName.setText(((GlobalApplication) getApplication()).getFullName());
      txtEmail.setText(((GlobalApplication) getApplication()).getEmail());
      Log.i(TAG, "Get Profile Information from GlobalApplication");
      return;
    }

    Log.i(TAG, "Get Profile Information from Server");
    ParseFile parseFile = (ParseFile) currentUser.get("avatar");
    if (parseFile != null) {
      parseFile.getDataInBackground(
          new GetDataCallback() {
            @Override
            public void done(byte[] bytes, ParseException e) {
              if (e == null) {
                String fullName = currentUser.getString("fullName");
                String email = currentUser.getEmail();

                userAvatar = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
                imgAvatar.setImageBitmap(userAvatar);
                txtName.setText(fullName);
                txtEmail.setText(email);

                ((GlobalApplication) getApplication()).setAvatar(userAvatar);
                ((GlobalApplication) getApplication()).setFullName(fullName);
                ((GlobalApplication) getApplication()).setPhoneNumber(currentUser.getUsername());
                ((GlobalApplication) getApplication()).setEmail(email);
              }
            }
          });
    }
  }
Example #10
0
 private void handleCrop(int resultCode, Intent result) {
   if (resultCode == RESULT_OK) {
     ib_avatar.setImageURI(Crop.getOutput(result));
     try {
       avatarBitmap =
           MediaStore.Images.Media.getBitmap(this.getContentResolver(), Crop.getOutput(result));
     } catch (IOException e) {
       e.printStackTrace();
     }
     btnSave.setProgress(0);
   } else if (resultCode == Crop.RESULT_ERROR) {
     Toast.makeText(this, Crop.getError(result).getMessage(), Toast.LENGTH_SHORT).show();
   }
 }
  @Override
  public void initView() {
    setContentView(R.layout.activity_register);

    mCoordinatorLayout = (CoordinatorLayout) findViewById(R.id.coordinatorLayout);
    mImgUserAvatar = (CircleImageView) findViewById(R.id.user_avatar);
    mEditUsername = (MaterialEditText) findViewById(R.id.username);
    mEditEmail = (MaterialEditText) findViewById(R.id.email);
    mEditPassword = (MaterialEditText) findViewById(R.id.password);
    mBtnRegister = (Button) findViewById(R.id.register);
    mImgUserAvatar.setOnClickListener(this);
    mBtnRegister.setOnClickListener(this);

    mAVService = AVService.getInstance();
  }
 public CommentViewHolder(View itemView) {
   super(itemView);
   ButterKnife.bind(this, itemView);
   user_photo.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           Intent intent = new Intent(activity, UserAcitivity.class);
           ActivityOptionsCompat options =
               ActivityOptionsCompat.makeSceneTransitionAnimation(
                   activity,
                   new Pair<View, String>(
                       v, activity.getResources().getString(R.string.transition_user_photo)));
           ActivityCompat.startActivity(activity, intent, options.toBundle());
         }
       });
 }
Example #13
0
  private void getUserDetailsFromParse() {
    parseUser = ParseUser.getCurrentUser();

    // Fetch profile photo
    try {
      ParseFile parseFile = parseUser.getParseFile("profileThumb");
      byte[] data = parseFile.getData();
      Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
      mProfileImage.setImageBitmap(bitmap);
    } catch (Exception e) {
      e.printStackTrace();
    }

    mEmailID.setText(parseUser.getEmail());
    mUsername.setText(parseUser.getUsername());

    Toast.makeText(
            MainActivity.this, "Welcome back " + mUsername.getText().toString(), Toast.LENGTH_SHORT)
        .show();
  }
 @SuppressLint("SetTextI18n")
 protected void setupLanguagesButton() {
   mPicasso
       .load(mPage.getLanguage().getIconPath())
       .placeholder(R.drawable.icon_language_loading)
       .error(R.drawable.icon_language_loading_error)
       .fit()
       .into(circleImageView);
   circleImageView.setOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View view) {
           if (!mPage.getAvailableLanguages().isEmpty()) {
             new MaterialDialog.Builder(BasePageWebViewLanguageActivity.this)
                 .title(R.string.dialog_choose_language_title)
                 .adapter(
                     new LanguageItemAdapter(
                         BasePageWebViewLanguageActivity.this,
                         mPage.getAvailableLanguages(),
                         false),
                     new MaterialDialog.ListCallback() {
                       @Override
                       public void onSelection(
                           MaterialDialog dialog, View itemView, int which, CharSequence text) {
                         loadLanguage(mPage.getAvailableLanguages().get(which));
                         Ln.d("Clicked item %d", which);
                         dialog.cancel();
                       }
                     })
                 .show();
           } else {
             Snackbar.make(
                     descriptionView,
                     R.string.no_other_languages_available_page,
                     Snackbar.LENGTH_SHORT)
                 .show();
           }
         }
       });
   otherLanguageCountTextView.setText("+" + mPage.getAvailableLanguages().size());
 }
Example #15
0
    public RVViewHolder(View itemView) {
      super(itemView);
      ivProfile = (CircleImageView) itemView.findViewById(R.id.profile_image);
      ivContent = (ImageView) itemView.findViewById(R.id.iv_content);
      userID = (TextView) itemView.findViewById(R.id.tv_user_id);
      date = (TextView) itemView.findViewById(R.id.tv_date);
      // textTitle = (TextView) itemView.findViewById(R.id.tv_text_title);
      textContent = (TextView) itemView.findViewById(R.id.tv_text_content);
      location = (TextView) itemView.findViewById(R.id.tv_location);
      ivShare = (ImageView) itemView.findViewById(R.id.share);
      ivRe = (ImageView) itemView.findViewById(R.id.iv_re);
      // like = (TextView) itemView.findViewById(R.id.tv_like);
      // btnLike = (ImageView) itemView.findViewById(R.id.btn_like);
      // btnRe = (ImageView)itemView.findViewById(R.id.btn_re);

      ivProfile.setOnClickListener(this);
      ivContent.setOnClickListener(this);
      ivShare.setOnClickListener(this);
      ivRe.setOnClickListener(this);
      // btnLike.setOnClickListener(this);
      // btnRe.setOnClickListener(this);
    }
Example #16
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_qabuilder2);

    rect = new RectShape();
    rectShapeDrawable = new ShapeDrawable(rect);

    paint = rectShapeDrawable.getPaint();
    paint.setColor(Color.WHITE);
    paint.setStyle(Paint.Style.STROKE);
    paint.setStrokeWidth(20);

    circleClickListener =
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            int index = circleIndex.indexOf((CircleImageView) v);
            scrollView.smoothScrollTo(0, questionDataLayout.getChildAt(index).getTop());

            // reset colors/boxes
            for (int i = 0; i < elements.size(); i++) {
              circleIndex.get(i).setBorderColor(getResources().getColor(R.color.blue));
              questionDataLayout.getChildAt(i).setBackground(null);
            }
            circleIndex.get(index).setBorderColor(Color.WHITE);
            // TODO: WORKAROUND FOR API 16 CALL BELOW
            questionDataLayout.getChildAt(index).setBackground(rectShapeDrawable);
            selectedIndex = index;
          }
        };

    questionItemClickListener =
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            int index = questionDataLayout.indexOfChild(v);

            // reset colors/boxes
            for (int i = 0; i < elements.size(); i++) {
              circleIndex.get(i).setBorderColor(getResources().getColor(R.color.blue));
              questionDataLayout.getChildAt(i).setBackground(null);
            }
            circleIndex.get(index).setBorderColor(Color.WHITE);
            // TODO: WORKAROUND FOR API 16 CALL BELOW
            v.setBackground(rectShapeDrawable);
            selectedIndex = index;
          }
        };

    questionItemLongClickListener =
        new View.OnLongClickListener() {
          @Override
          public boolean onLongClick(View v) {
            int index = questionDataLayout.indexOfChild(v);
            if (elements.get(index).isText()) {
              Toast.makeText(getApplicationContext(), "EDIT TEXT", Toast.LENGTH_SHORT).show();
            } else {
              Toast.makeText(getApplicationContext(), "EDIT IMAGE", Toast.LENGTH_SHORT).show();
            }
            return true;
          }
        };
    questionDataLayout = (LinearLayout) findViewById(R.id.question_data);

    elements = new ArrayList<QData>();

    scrollView = (ScrollView) findViewById(R.id.scrollview);

    circleIndex = new ArrayList<CircleImageView>();
    circle_holder = (LinearLayout) findViewById(R.id.circle_holder);
    circle_params = new LinearLayout.LayoutParams(140, ViewGroup.LayoutParams.MATCH_PARENT);

    elements.add(new QData("Hello"));
    elements.add(new QData("Goodbye"));
    elements.add(new QData(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher)));

    plusButton = (CircleImageView) findViewById(R.id.plus_button);
    plusButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            final ElementChooserView chooser = new ElementChooserView(getApplicationContext());
            //                selectedIndex = questionDataLayout.indexOfChild(chooser);
            chooser.addTextImg.setOnClickListener(
                new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                    int index = questionDataLayout.indexOfChild(chooser);
                    questionDataLayout.removeViewAt(index);
                    elements.add(index, new QData("New Text Item -- Long Click to Edit"));
                    addElementCircles();
                    createScrollView();
                  }
                });
            chooser.addCameraImg.setOnClickListener(
                new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                    // TODO: get camera stuff
                    chooserIndex = questionDataLayout.indexOfChild(chooser);
                    Intent i = new Intent(getApplicationContext(), CameraActivity.class);
                    startActivityForResult(i, 1);
                  }
                });
            chooser.addGalleryImg.setOnClickListener(
                new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                    chooserIndex = questionDataLayout.indexOfChild(chooser);
                    Intent i = new Intent(Intent.ACTION_PICK);
                    i.setType("image/*");
                    startActivityForResult(i, 2);
                  }
                });
            //                questionDataLayout.addView(chooser);
            questionDataLayout.addView(chooser, selectedIndex + 1);
            scrollView.smoothScrollTo(0, questionDataLayout.getChildAt(selectedIndex + 1).getTop());
          }
        });

    addElementCircles();
    createScrollView();
  }
    public AtyViewHolder(View itemView) {
      super(itemView);
      ButterKnife.bind(this, itemView);

      mjoinBtn.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              if ("加入".equals(mjoinBtn.getText().toString())) {
                mjoinBtn.setText("已加入");
                atyItem.setAtyJoined("true");
                atyItem.setAtyMembers(
                    String.valueOf(Integer.parseInt(atyItem.getAtyMembers()) + 1));
                mjoinBtn.setTextColor(activity.getResources().getColor(R.color.primary));
                notifyDataSetChanged();
              } else {
                mjoinBtn.setText("加入");
                atyItem.setAtyJoined("false");
                atyItem.setAtyMembers(
                    String.valueOf(Integer.parseInt(atyItem.getAtyMembers()) - 1));
                mjoinBtn.setTextColor(activity.getResources().getColor(R.color.black));
                notifyDataSetChanged();
              }
            }
          });

      share_fab.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              final String imgPath = null;
              Intent intent = new Intent(Intent.ACTION_SEND);
              intent.setType("text/plain");
              if (imgPath != null && !imgPath.equals("")) {
                File f = new File(imgPath);
                if (f != null && f.exists() && f.isFile()) {
                  intent.setType("image/*");
                  Uri u = Uri.fromFile(f);
                  intent.putExtra(Intent.EXTRA_STREAM, u);
                }
              }
              intent.putExtra(Intent.EXTRA_TITLE, "Title");
              intent.putExtra(Intent.EXTRA_SUBJECT, "Share");
              intent.putExtra(Intent.EXTRA_TEXT, "我要参加" + atyItem.getAtyName() + ",快来跟我一起吧!");
              intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
              activity.startActivity(Intent.createChooser(intent, "Share"));
            }
          });

      plus_fab.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              if (atyItem.getAtyPlused().equals("true")) {
                plus_fab.setBackgroundTintList(
                    ColorStateList.valueOf(activity.getResources().getColor(R.color.fab_gray)));
                plus_fab.setImageDrawable(
                    activity.getResources().getDrawable(R.drawable.ic_action_plus_one));
                atyItem.setAtyPlused("false");
                atyItem.setAtyPlus(String.valueOf(Integer.parseInt(atyItem.getAtyPlus()) - 1));
                notifyDataSetChanged();
                try {
                  totle_plus.setText(Integer.parseInt(totle_plus.getText().toString()) - 1);
                } catch (Exception e) {

                }

              } else {
                plus_fab.setBackgroundTintList(
                    ColorStateList.valueOf(activity.getResources().getColor(R.color.primary)));
                plus_fab.setImageDrawable(
                    activity.getResources().getDrawable(R.drawable.ic_action_plus_one_white));
                atyItem.setAtyPlused("true");
                atyItem.setAtyPlus(String.valueOf(Integer.parseInt(atyItem.getAtyPlus()) + 1));
                notifyDataSetChanged();
                try {
                  totle_plus.setText(Integer.parseInt(totle_plus.getText().toString()) + 1);
                } catch (Exception e) {

                }
              }
            }
          });

      user_photo.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              Intent intent = new Intent(activity, UserAcitivity.class);
              intent.putExtra("userId", userId);
              ActivityOptionsCompat options =
                  ActivityOptionsCompat.makeSceneTransitionAnimation(
                      activity,
                      new Pair<View, String>(
                          v, activity.getResources().getString(R.string.transition_user_photo)));
              ActivityCompat.startActivity(activity, intent, options.toBundle());
            }
          });
    }
  public void initView() {
    profile_circleimageview = (CircleImageView) findViewById(R.id.profile_image);
    person_sex = (EditText) findViewById(R.id.person_sex);
    person_work = (EditText) findViewById(R.id.person_work);
    person_phone = (EditText) findViewById(R.id.person_phone);
    person_email = (EditText) findViewById(R.id.person_email);
    person_weibo = (EditText) findViewById(R.id.person_weibo);

    person_sex.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {}
        });
    person_work.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {}
        });
    person_phone.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {}
        });
    person_email.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {}
        });
    person_weibo.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {}
        });

    profile_circleimageview.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            if (!popWindow.isShowing()) {
              popWindow.showAtLocation(view, Gravity.BOTTOM, 0, 0);
            }
          }
        });
    popwindowView = getLayoutInflater().inflate(R.layout.popup_choose_img, null, false);
    popWindow =
        new PopupWindow(
            popwindowView,
            ActionBar.LayoutParams.MATCH_PARENT,
            ActionBar.LayoutParams.WRAP_CONTENT);
    popwindowView.setBackgroundDrawable(new BitmapDrawable());
    popWindow.setOutsideTouchable(true);

    popWin_button_selected = (Button) popwindowView.findViewById(R.id.popwindow_changeimage);
    popWin_button_cancle = (Button) popwindowView.findViewById(R.id.popwindow_cancle);
    popWin_button_takephoto = (Button) popwindowView.findViewById(R.id.popwindow_takephoto);
    popWin_button_cancle.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            popWindow.dismiss();
          }
        });
    popWin_button_takephoto.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            popWindow.dismiss();
            getImageFromCamear();
          }
        });
    popWin_button_selected.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            popWindow.dismiss();
            getImageFromAlbum();
          }
        });
  }
  @Nullable
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    final View view = inflater.inflate(R.layout.second_login_view, null);

    email = (TextView) view.findViewById(R.id.email);
    name = (TextView) view.findViewById(R.id.name);
    editTextPassword = (EditText) view.findViewById(R.id.editTextPassword);
    profile_image = (CircleImageView) view.findViewById(R.id.profile_image);
    pass_forget = (Button) view.findViewById(R.id.pass_forget);
    pass_forget_description = (TextView) view.findViewById(R.id.pass_forget_description);
    progressBarSecond = (ProgressBar) view.findViewById(R.id.progressBarSecond);
    layoutSecond = (RevealLinearLayout) view.findViewById(R.id.layoutSecond);
    buttonLogin = (Button) view.findViewById(R.id.buttonLogin);

    progressBarSecond.setVisibility(View.GONE);

    if (mtsl != null) {
      email.setText(mtsl.getEmail());
      name.setText(mtsl.getName());
      profile_image.setImageBitmap(mtsl.getBitmap());

      if (mtsl.getButton_login_text_color() != 0)
        buttonLogin.setTextColor(mtsl.getButton_login_text_color());
      if (mtsl.getButton_login_background() != 0)
        buttonLogin.setBackgroundResource(mtsl.getButton_login_background());
      if (mtsl.getButton_login_text() != 0) buttonLogin.setText(mtsl.getButton_login_text());

      if (mtsl.getEdittext_password_background() != 0)
        editTextPassword.setBackgroundResource(mtsl.getEdittext_password_background());
      if (mtsl.getEdittext_password_text_color() != 0)
        editTextPassword.setTextColor(mtsl.getEdittext_password_text_color());

      if (mtsl.getName_text_color() != 0) name.setTextColor(mtsl.getName_text_color());

      if (mtsl.getButton_passforget_text_color() != 0)
        pass_forget.setTextColor(mtsl.getButton_passforget_text_color());
      if (mtsl.getButton_passforget_text() != 0)
        pass_forget.setText(mtsl.getButton_passforget_text());
      if (mtsl.getPassforget_description_text_color() != 0)
        pass_forget_description.setTextColor(mtsl.getPassforget_description_text_color());
      if (mtsl.getPassforget_description_text() != 0)
        pass_forget_description.setTextColor(mtsl.getPassforget_description_text());

      if (mtsl.getEmail_text_color() != 0) email.setTextColor(mtsl.getEmail_text_color());
    }

    buttonLogin.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            progressBarSecond.setVisibility(View.VISIBLE);
            layoutSecond.setVisibility(View.GONE);
            mListener.onLoginClicked(editTextPassword.getText().toString());
          }
        });

    pass_forget.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            mListener.onRecoverPasswordClicked();
          }
        });
    view.setBackgroundColor(mtsl.getSecond_step_background_color());

    return view;
  }
Example #20
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
    container.setAdapter(mSectionsPagerAdapter);
    tabs.setupWithViewPager(container);

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                .setAction("Action", null)
                .show();
          }
        });

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle =
        new ActionBarDrawerToggle(
            this,
            drawer,
            toolbar,
            R.string.navigation_drawer_open,
            R.string.navigation_drawer_close);
    drawer.setDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    //        View headerLayout = LayoutInflater.from(this).inflate(R.layout.nav_header_main, null);
    //        navigationView.addHeaderView(headerLayout);
    //        CircleImageView circleImageView = (CircleImageView)
    // headerLayout.findViewById(R.id.circleImageView);
    //        LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)
    // circleImageView.getLayoutParams();
    //        layoutParams.width = 250;
    //        layoutParams.height = 250;
    //        layoutParams.topMargin = 80;
    //        circleImageView.setLayoutParams(layoutParams);
    //        circleImageView.setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                LogUtil.d("头像点击。。。");
    //            }
    //        });
    View header = navigationView.getHeaderView(0);
    CircleImageView circleImageView = (CircleImageView) header.findViewById(R.id.circleImageView);
    circleImageView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            LogUtil.d("头像");
          }
        });

    // 模拟数据
    //        for (int i = 0; i < 20; i++) {
    //            Map<String, Object> listItem = new HashMap<>();
    //            listItem.put("img", R.mipmap.ic_launcher);
    //            listItem.put("text", "Item " + i);
    //            mData.add(listItem);
    //        }

  }
  @Override
  public boolean onDependentViewChanged(
      CoordinatorLayout parent, CircleImageView child, View dependency) {

    // Called once
    if (mStartYPosition == 0) mStartYPosition = (int) (child.getY() + (child.getHeight() / 2));

    if (mFinalYPosition == 0) mFinalYPosition = (dependency.getHeight() / 2);

    if (mStartHeight == 0) mStartHeight = child.getHeight();

    if (finalHeight == 0)
      finalHeight = mContext.getResources().getDimensionPixelOffset(R.dimen.image_final_width);

    if (mStartXPosition == 0) mStartXPosition = (int) (child.getX() + (child.getWidth() / 2));

    if (mFinalXPosition == 0)
      mFinalXPosition =
          mContext
                  .getResources()
                  .getDimensionPixelOffset(R.dimen.abc_action_bar_content_inset_material)
              + (finalHeight / 2);

    if (mStartToolbarPosition == 0)
      mStartToolbarPosition = dependency.getY() + (dependency.getHeight() / 2);

    final int maxScrollDistance = (int) (mStartToolbarPosition - getStatusBarHeight());
    float expandedPercentageFactor = dependency.getY() / maxScrollDistance;

    float distanceYToSubtract =
        ((mStartYPosition - mFinalYPosition) * (1f - expandedPercentageFactor))
            + (child.getHeight() / 2);

    float distanceXToSubtract =
        ((mStartXPosition - mFinalXPosition) * (1f - expandedPercentageFactor))
            + (child.getWidth() / 2);

    float heightToSubtract = ((mStartHeight - finalHeight) * (1f - expandedPercentageFactor));

    child.setY(mStartYPosition - distanceYToSubtract);
    child.setX(mStartXPosition - distanceXToSubtract);

    int proportionalAvatarSize = (int) (mAvatarMaxSize * (expandedPercentageFactor));

    CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
    lp.width = (int) (mStartHeight - heightToSubtract);
    lp.height = (int) (mStartHeight - heightToSubtract);
    child.setLayoutParams(lp);
    return true;
  }
Example #22
0
 private void beginCrop(Uri source) {
   ib_avatar.setImageDrawable(null);
   Uri destination = Uri.fromFile(new File(getCacheDir(), "cropped"));
   Crop.of(source, destination).asSquare().start(this);
 }
Example #23
0
  @SuppressLint("NewApi")
  public View getView(final JSONObject matchs) throws JSONException {
    View view = null;
    int viewType = getItemViewType(matchs);
    j_recordId = matchs.getString("record_id");

    if (TYPE_ONE == viewType) {
      view = inflater.inflate(R.layout.abc_match_board_item, null);
      TextView name = (TextView) view.findViewById(R.id.match_board_name);
      CircleImageView icon = (CircleImageView) view.findViewById(R.id.head_icon);
      TextView time = (TextView) view.findViewById(R.id.time);
      final TextView commentCount = (TextView) view.findViewById(R.id.zan_counts);
      TextView likeCount = (TextView) view.findViewById(R.id.enjoy_num);
      TextView tx_content = (TextView) view.findViewById(R.id.content);
      TextView recommend_msg = (TextView) view.findViewById(R.id.recommend_msg);
      LinearLayout ll_recomment = (LinearLayout) view.findViewById(R.id.ll_recomment);
      lay_zan = (LinearLayout) view.findViewById(R.id.lay_zan);
      ll_zan = (LinearLayout) view.findViewById(R.id.ll_zan);
      zan_count = (ImageView) view.findViewById(R.id.zan_count);
      View tx_yuan = (View) view.findViewById(R.id.yuan);
      LinearLayout ll_content = (LinearLayout) view.findViewById(R.id.ll_content);
      zan = (ImageView) view.findViewById(R.id.zan);
      LinearLayout ll_photo = (LinearLayout) view.findViewById(R.id.ll_photo);
      LinearLayout ll_grid1 = (LinearLayout) view.findViewById(R.id.ll_photo_grid1);
      LinearLayout ll_grid2 = (LinearLayout) view.findViewById(R.id.ll_photo_grid2);
      LinearLayout ll_grid3 = (LinearLayout) view.findViewById(R.id.ll_photo_grid3);

      try {
        Spannable span = SmileUtils.getSmiledText(context, matchs.getString("text"));
        tx_content.setText(span, BufferType.SPANNABLE);
        JSONObject content = (JSONObject) matchs.getJSONObject("content");

        if (content.getString("reason") != null && !content.getString("reason").equals("")) {
          ll_recomment.setVisibility(View.VISIBLE);
          recommend_msg.setText(content.get("reason").toString());
        } else {
          ll_recomment.setVisibility(View.GONE);
        }
        name.setText(content.getString("nickname"));
        time.setText(content.getString("time"));
        likeCount.setText(content.getString("comment_count"));
        like_state = content.getString("like_state");
        if (like_state.equals("0")) {
          zan.setImageResource(R.drawable.abc_match_heart);
        } else {
          zan.setImageResource(R.drawable.selectedlove);
        }
        like_users = content.getJSONArray("like_users");
        if (!content.getString("like_count").equals("0")) {
          commentCount.setText(content.getString("like_count"));
        }
        if (like_users != null) {
          if (Integer.parseInt(content.get("like_count").toString()) > 6) {
            zan_count.setVisibility(View.VISIBLE);
          } else {
            zan_count.setVisibility(View.GONE);
          }
          ll_zan.removeAllViews();
          for (int i = 0; i < like_users.length(); i++) {
            idUrl = like_users.getJSONObject(i).getString("id");
            if (i >= like_users.length() - 6) {
              CircleImageView header = new CircleImageView(context);
              header.setLayoutParams(new LayoutParams(60, 60));
              // new DownAndShowImageTask(like_users
              // .getJSONObject(i).getString("icon"), header)
              // .execute();
              loader.LoadImage(like_users.getJSONObject(i).getString("icon"), header);
              ll_zan.addView(header);
            }
          }
        }

        // new DownAndShowImageTask(content.getString("user_icon"),
        // icon)
        // .execute();
        loader.LoadImage(content.getString("user_icon"), icon);

        tx_yuan.setBackgroundResource(R.drawable.match_yuan);

        JSONArray imgs = (JSONArray) content.get("images");
        lay_zan.setOnClickListener(
            new OnClickListener() {

              @Override
              public void onClick(View v) {
                boolean flag = false;
                if (like_state.equals("0")) {
                  MobclickAgent.onEvent(context, "match_zan");
                  TCAgent.onEvent(context, "match_zan");
                  doPullDate(
                      flag,
                      "2007",
                      new MCHttpCallBack() {
                        @Override
                        public void onSuccess(MCHttpResp resp) {
                          super.onSuccess(resp);
                          try {
                            String resultCode = (String) resp.getJson().getString("result_code");
                            if ("0".equals(resultCode)) {

                              Toast.makeText(context, "点赞成功", Toast.LENGTH_SHORT).show();
                              // matchs.put("like_state", "1");
                              like_state = "1";
                              commentCount.setText(
                                  resp.getJson().getString("count_like").toString());
                              CircleImageView userIcon = new CircleImageView(context);
                              userIcon.setLayoutParams(new LayoutParams(60, 60));
                              loader.LoadImage(iconUrl, userIcon);
                              ll_zan.addView(userIcon, 0);
                              like_users.put(0, AppConfig.getInstance().getPlayerId());
                              zan.setImageResource(R.drawable.selectedlove);

                            } else {
                              Toast.makeText(context, "点赞失败", Toast.LENGTH_SHORT).show();
                            }
                          } catch (Exception e) {
                            e.printStackTrace();
                          }
                        }

                        @Override
                        public void onError(MCHttpResp resp) {
                          super.onError(resp);
                          CPorgressDialog.hideProgressDialog();
                          Toast.makeText(context, resp.getErrorMessage(), Toast.LENGTH_SHORT)
                              .show();
                        }
                      });
                } else {
                  doPullDate(
                      flag,
                      "2008",
                      new MCHttpCallBack() {
                        @Override
                        public void onSuccess(MCHttpResp resp) {
                          super.onSuccess(resp);
                          String resultCode;
                          try {
                            resultCode = (String) resp.getJson().getString("result_code");

                            if ("0".equals(resultCode)) {

                              Toast.makeText(context, "取消点赞成功", Toast.LENGTH_SHORT).show();
                              // matchs.put("like_state", "0");
                              like_state = "0";
                              for (int i = 0; i < like_users.length(); i++) {
                                idUrl = like_users.getJSONObject(i).getString("id");
                                if (idUrl.equals(AppConfig.getInstance().getPlayerId() + "")) {
                                  // like_users.remove(i);
                                  ll_zan.removeViewAt(i);
                                }
                              }
                              commentCount.setText(
                                  resp.getJson().getString("count_like").toString());
                              zan.setImageResource(R.drawable.abc_match_heart);

                            } else {
                              Toast.makeText(context, "取消点赞失败", Toast.LENGTH_SHORT).show();
                            }
                          } catch (Exception e) {
                            e.printStackTrace();
                          }
                        }

                        @Override
                        public void onError(MCHttpResp resp) {
                          super.onError(resp);
                          CPorgressDialog.hideProgressDialog();
                          Toast.makeText(context, resp.getErrorMessage(), Toast.LENGTH_SHORT)
                              .show();
                        }
                      });
                }
              }
            });

        ll_content.setOnClickListener(
            new OnClickListener() {

              @Override
              public void onClick(View view) {
                Intent intent = new Intent();
                intent.setClass(context, MatchCommentDetailActivity.class);
                intent.putExtra("commentid", j_recordId);
                context.startActivity(intent);
              }
            });
        if (imgs.length() < 1) {
          // oneHolder.photo.setVisibility(View.GONE);
          ll_photo.removeAllViews();
          ll_grid1.removeAllViews();
          ll_grid2.removeAllViews();
          ll_grid3.removeAllViews();
        } else if (imgs.length() == 1) {
          ll_photo.removeAllViews();
          ll_grid1.removeAllViews();
          ll_grid2.removeAllViews();
          ll_grid3.removeAllViews();
          ImageView photo = new ImageView(context);
          // 设置当前图像的图像(position为当前图像列表的位置)
          photo.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
          photo.setLayoutParams(
              new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
          // 设置Gallery组件的背景风格
          // oneHolder.photo.setVisibility(View.VISIBLE);
          StringBuffer s1 = new StringBuffer(imgs.getJSONObject(0).getString("url"));
          // new DownAndShowImageTask(s1.insert(s1.lastIndexOf("."),
          // "_M").toString(), photo).execute();
          loader.LoadImage(s1.insert(s1.lastIndexOf("."), "_M").toString(), photo);
          ll_photo.addView(photo);

        } else {
          if (imgs.length() < 4) {
            // 一行
            ll_grid1.removeAllViews();
            ll_grid2.removeAllViews();
            ll_grid3.removeAllViews();
            for (int i = 0; i < 3; i++) {
              addPhoto(i, ll_grid1, imgs);
            }
          } else if (imgs.length() > 3 && imgs.length() < 7) {
            // 两行
            ll_grid1.removeAllViews();
            ll_grid2.removeAllViews();
            ll_grid3.removeAllViews();
            for (int i = 0; i < 3; i++) {
              addPhoto(i, ll_grid1, imgs);
            }
            for (int i = 3; i < 6; i++) {
              addPhoto(i, ll_grid2, imgs);
            }
          } else if (imgs.length() > 6 && imgs.length() < 10) {
            // 三行
            ll_grid1.removeAllViews();
            ll_grid2.removeAllViews();
            ll_grid3.removeAllViews();
            for (int i = 0; i < 3; i++) {
              addPhoto(i, ll_grid1, imgs);
            }
            for (int i = 3; i < 6; i++) {
              addPhoto(i, ll_grid2, imgs);
            }
            for (int i = 6; i < 9; i++) {
              addPhoto(i, ll_grid3, imgs);
            }
          }
          // oneHolder.photo.setVisibility(View.GONE);
          // oneHolder.ll_content.removeView(oneHolder.photo);
          ll_photo.removeAllViews();
        }
      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }

    } else if (TYPE_TWO == viewType) {
      view = inflater.inflate(R.layout.abc_match_board_item_match, null);
      TextView name = (TextView) view.findViewById(R.id.match_match_name);
      View tx_yuan = (View) view.findViewById(R.id.yuan);

      Spannable span;
      try {
        span = SmileUtils.getSmiledText(context, matchs.getString("text"));
        name.setText(span, BufferType.SPANNABLE);
      } catch (Exception e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }

      tx_yuan.setBackgroundResource(R.drawable.match_yuan_);
    } else if (TYPE_THREE == viewType) {
      view = inflater.inflate(R.layout.abc_match_board_item_activity, null);
      TextView name = (TextView) view.findViewById(R.id.match_activity_name);
      LinearLayout ll_content = (LinearLayout) view.findViewById(R.id.ll_content);
      TextView type = (TextView) view.findViewById(R.id.type);
      TextView statue = (TextView) view.findViewById(R.id.status);
      // View arron = (View) view.findViewById(R.id.match_arron);
      View tx_yuan = (View) view.findViewById(R.id.yuan);
      TextView tx_counts = (TextView) view.findViewById(R.id.tx_counts);
      try {

        // activitys_id = activitys.getString("id");
        // Map<String, String> map = new HashMap<String, String>();
        // map.put("id", activitys_id);

        name.setText(matchs.getString("text"));
        final JSONObject activity = (JSONObject) matchs.get("activity");
        final String j_type = activity.getString("type");
        // final String j_recordId = matchs.getString("record_id");
        // tx_counts.setText(text)
        type.setText(j_type.equals("0") ? "" : "投票");
        type.setBackgroundResource(
            j_type.equals("0") ? R.drawable.img_quiz : R.drawable.abc_button_roundcorner_toupiao);
        statue.setText(getStatus(activity.getString("state")));
        tx_yuan.setBackgroundResource(R.drawable.match_yuan);
        tx_counts.setText("已有" + activity.getString("join_count").toString() + "人参与");
        ll_content.setOnClickListener(
            new OnClickListener() {

              public void onClick(View v) {
                if (j_type.equals("0")) {
                  Intent intent = new Intent();
                  intent.setClass(context, CathecticActivity.class);
                  intent.putExtra("id", j_recordId);
                  context.startActivity(intent);
                } else {
                  Intent intent = new Intent();
                  intent.setClass(context, VoteActivity.class);
                  intent.putExtra("id", j_recordId);
                  context.startActivity(intent);
                }
              }
            });

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

    return view;
  }