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);
   }
 }
  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);
            }
          }
        });
  }
  @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());
         }
       });
 }
Beispiel #5
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();
  }
 @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());
 }
Beispiel #7
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);
              }
            }
          });
    }
  }
Beispiel #8
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);
    }
  @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());
            }
          });
    }
Beispiel #11
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);
    //        }

  }
  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();
          }
        });
  }