Search in sources :

Example 16 with CircleImageView

use of de.hdodenhof.circleimageview.CircleImageView in project ride-read-android by Ride-Read.

the class MineEditMessageActivity method initView.

private void initView() {
    birthDate = (TextView) findViewById(R.id.mine_editmsg_tv_birthdate);
    TextView save = (TextView) findViewById(R.id.right_title);
    civ = (CircleImageView) findViewById(R.id.mine_editmsg_iv_head);
    edtDistrict = (TextView) findViewById(R.id.mine_editmsg_et_locale);
    ImageView back = (ImageView) findViewById(R.id.left_setting_icon);
    editmsgSex = (TextView) findViewById(R.id.mine_editmsg_et_sex);
    realname = (TextView) findViewById(R.id.mine_editmsg_et_name);
    phonenum = (EditText) findViewById(R.id.mine_editmsg_et_phone);
    signtureedt = (TextView) findViewById(R.id.mine_editmsg_et_signture);
    schooledt = (TextView) findViewById(R.id.mine_editmsg_et_school);
    jobedt = (EditText) findViewById(R.id.mine_editmsg_et_job);
    hometownedt = (EditText) findViewById(R.id.mine_editmsg_et_hometown);
    setData(data);
    save.setOnClickListener(this);
    civ.setOnClickListener(this);
    ((LinearLayout) findViewById(R.id.mine_change_headimg)).setOnClickListener(this);
    back.setOnClickListener(this);
}
Also used : TextView(android.widget.TextView) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) LinearLayout(android.widget.LinearLayout)

Example 17 with CircleImageView

use of de.hdodenhof.circleimageview.CircleImageView in project curb by irijwj.

the class HomePageActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home_page);
    ButterKnife.bind(this);
    setSupportActionBar(toolbar);
    ActionBar ab = getSupportActionBar();
    if (ab != null) {
        ab.setDisplayShowTitleEnabled(false);
        ab.setHomeAsUpIndicator(R.drawable.ic_ab_home);
        ab.setDisplayHomeAsUpEnabled(true);
    }
    Intent lc_intent = getIntent();
    // initFragment();//初始化其它fragments
    ActivityUtil.setContainerView(R.id.content_frame);
    ActivityUtil.setFragmentManagerInHome(getSupportFragmentManager());
    /*InformationFragment informationFragment = InformationFragment.newInstance();
        ActivityUtil.addFragmentInHomePage(R.id.nav_info, informationFragment);
        informationPresenter = new InformationPresenter(InformationRepository.
                getInstance(InformationLocalDataSource.getInstance(HomePageActivity.this),
                        InformationRemoteDataSource.getInstance(), this), informationFragment, this);*/
    int itemToShow = R.id.nav_info;
    String title = getString(R.string.information);
    if (lc_intent.getStringExtra("FcmDataTarget") != null && !lc_intent.getStringExtra("FcmDataTarget").isEmpty()) {
        String[] target = lc_intent.getStringExtra("FcmDataTarget").split("-");
        if (target[1].equals("nav_scholat")) {
            itemToShow = R.id.nav_scholat;
        }
    } else {
        // 判断Intent中是否存在intemToShow这一项
        int itemTemp = lc_intent.getIntExtra(ITEM_TO_SHOW, 0);
        if (itemTemp != 0) {
            itemToShow = itemTemp;
        }
    }
    navView.setCheckedItem(itemToShow);
    if (itemToShow == R.id.nav_scholat)
        title = getString(R.string.scholat);
    toolbarTitle.setText(title);
    FragmentFactory.getInstance().showFragmentInHomePage(this, m_ContentFrame.getId(), itemToShow);
    // ActivityUtil.setCurrentFragment(itemToShow);
    navView.setNavigationItemSelectedListener(this);
    // 设置NavigationView中头像的点击事件
    LinearLayout lc_linearLayout = (LinearLayout) navView.getHeaderView(0);
    for (int i = 0; i < lc_linearLayout.getChildCount(); i++) {
        View lc_view = lc_linearLayout.getChildAt(i);
        if (lc_view.getId() == R.id.nav_header_imageView) {
            m_avatar = (CircleImageView) lc_view;
            if (!XmlDataStorage.isSharedHelperSet()) {
                XmlDataStorage.setM_sharedHelper(SharedHelper.getInstance(HomePageActivity.this));
            }
            String path = XmlDataStorage.getAvatarPath();
            if (!path.equals("")) {
                Bitmap lc_bitmap = BitmapFactory.decodeFile(path);
                m_avatar.setImageBitmap(lc_bitmap);
            }
            lc_view.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    Intent lc_intent = new Intent(HomePageActivity.this, UserProfileActivity.class);
                    HomePageActivity.this.startActivity(lc_intent);
                }
            });
        } else {
            if (lc_view.getId() == R.id.nav_header_account) {
                TextView lc_account = (TextView) lc_view;
                Map userInfo = XmlDataStorage.getUserInfo();
                lc_account.setText((String) userInfo.get(XmlDataStorage.USER_ACCOUNT));
            }
        }
    }
}
Also used : Intent(android.content.Intent) NavigationView(android.support.design.widget.NavigationView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) BindView(butterknife.BindView) View(android.view.View) TextView(android.widget.TextView) Bitmap(android.graphics.Bitmap) TextView(android.widget.TextView) UserProfileActivity(jxpl.scnu.curb.userProfile.UserProfileActivity) Map(java.util.Map) ActionBar(android.support.v7.app.ActionBar) LinearLayout(android.widget.LinearLayout)

Example 18 with CircleImageView

use of de.hdodenhof.circleimageview.CircleImageView in project CoCoin by Nightonke.

the class AccountBookListViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_account_book_list_view);
    mContext = this;
    userName = (TextView) findViewById(R.id.user_name);
    userEmail = (TextView) findViewById(R.id.user_email);
    userName.setTypeface(CoCoinUtil.typefaceLatoRegular);
    userEmail.setTypeface(CoCoinUtil.typefaceLatoLight);
    User user = BmobUser.getCurrentUser(CoCoinApplication.getAppContext(), User.class);
    if (user != null) {
        userName.setText(user.getUsername());
        userEmail.setText(user.getEmail());
    }
    int size = RecordManager.getInstance(CoCoinApplication.getAppContext()).RECORDS.size();
    if (RecordManager.getInstance(CoCoinApplication.getAppContext()).SELECTED_RECORDS == null) {
        RecordManager.getInstance(CoCoinApplication.getAppContext()).SELECTED_RECORDS = new LinkedList<>();
    }
    RecordManager.getInstance(CoCoinApplication.getAppContext()).SELECTED_RECORDS.clear();
    for (int i = 0; i < size; i++) {
        CoCoinRecord record = new CoCoinRecord();
        record.set(RecordManager.RECORDS.get(i));
        RecordManager.getInstance(CoCoinApplication.getAppContext()).SELECTED_RECORDS.add(record);
    }
    RecordManager.getInstance(CoCoinApplication.getAppContext()).SELECTED_SUM = Double.valueOf(RecordManager.getInstance(CoCoinApplication.getAppContext()).SUM);
    originalSum = RecordManager.getInstance(CoCoinApplication.getAppContext()).SELECTED_SUM;
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    setTitle("");
    mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    int currentapiVersion = android.os.Build.VERSION.SDK_INT;
    if (currentapiVersion >= Build.VERSION_CODES.LOLLIPOP) {
        // Do something for lollipop and above versions
        Window window = this.getWindow();
        window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
        window.setStatusBarColor(ContextCompat.getColor(mContext, R.color.statusBarColor));
    } else {
        // do something for phones running an SDK before lollipop
        View statusBarView = (View) findViewById(R.id.status_bar_view);
        statusBarView.getLayoutParams().height = CoCoinUtil.getStatusBarHeight();
    }
    if (toolbar != null) {
        setSupportActionBar(toolbar);
        final ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setDisplayShowHomeEnabled(true);
            actionBar.setDisplayShowTitleEnabled(true);
            actionBar.setDisplayUseLogoEnabled(false);
            actionBar.setHomeButtonEnabled(true);
        }
    }
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawer, 0, 0);
    mDrawer.setDrawerListener(mDrawerToggle);
    searchView = (MaterialSearchView) findViewById(R.id.search_view);
    searchView.setVoiceSearch(false);
    searchView.setHint(mContext.getResources().getString(R.string.input_remark_to_search));
    searchView.setOnQueryTextListener(new MaterialSearchView.OnQueryTextListener() {

        @Override
        public boolean onQueryTextSubmit(String query) {
            progressDialog = new MaterialDialog.Builder(mContext).title(R.string.selecting_title).content(R.string.selecting_content).cancelable(false).progress(true, 0).show();
            new SelectRecordsByRemark(query).execute();
            return false;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return false;
        }
    });
    searchView.setOnSearchViewListener(new MaterialSearchView.SearchViewListener() {

        @Override
        public void onSearchViewShown() {
            //Do some magic
            Log.d("Saver", "onSearchViewShown");
        }

        @Override
        public void onSearchViewClosed() {
            //Do some magic
            Log.d("Saver", "onSearchViewClosed");
        }
    });
    emptyTip = (TextView) findViewById(R.id.empty_tip);
    emptyTip.setTypeface(CoCoinUtil.GetTypeface());
    recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
    layoutManager = new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false);
    recyclerViewTouchActionGuardManager = new RecyclerViewTouchActionGuardManager();
    recyclerViewTouchActionGuardManager.setInterceptVerticalScrollingWhileAnimationRunning(true);
    recyclerViewTouchActionGuardManager.setEnabled(true);
    recyclerViewSwipeManager = new RecyclerViewSwipeManager();
    mAdapter = new MySwipeableItemAdapter(mContext, RecordManager.SELECTED_RECORDS, this, this);
    mAdapter.setEventListener(new MySwipeableItemAdapter.EventListener() {

        @Override
        public void onItemRemoved(int position) {
            activityOnItemRemoved(position);
        }

        @Override
        public void onItemPinned(int position) {
            activityOnItemPinned(position);
        }

        @Override
        public void onItemViewClicked(View v, boolean pinned) {
            int position = recyclerView.getChildAdapterPosition(v);
            if (position != RecyclerView.NO_POSITION) {
                activityOnItemClicked(position);
            }
        }
    });
    adapter = mAdapter;
    wrappedAdapter = recyclerViewSwipeManager.createWrappedAdapter(mAdapter);
    final GeneralItemAnimator animator = new SwipeDismissItemAnimator();
    animator.setSupportsChangeAnimations(false);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(wrappedAdapter);
    recyclerView.setItemAnimator(animator);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    // Lollipop or later has native drop shadow feature. ItemShadowDecorator is not required.
    } else {
        recyclerView.addItemDecoration(new ItemShadowDecorator((NinePatchDrawable) ContextCompat.getDrawable(mContext, R.drawable.material_shadow_z1)));
    }
    recyclerView.addItemDecoration(new SimpleListDividerDecorator(ContextCompat.getDrawable(mContext, R.drawable.list_divider_h), true));
    // NOTE:
    // The initialization order is very important! This order determines the priority of touch event handling.
    //
    // priority: TouchActionGuard > Swipe > DragAndDrop
    recyclerViewTouchActionGuardManager.attachRecyclerView(recyclerView);
    recyclerViewSwipeManager.attachRecyclerView(recyclerView);
    verticalRecyclerViewFastScroller = (VerticalRecyclerViewFastScroller) findViewById(R.id.fast_scroller);
    // Connect the recycler to the scroller (to let the scroller scroll the list)
    verticalRecyclerViewFastScroller.setRecyclerView(recyclerView);
    // Connect the scroller to the recycler (to let the recycler scroll the scroller's handle)
    recyclerView.setOnScrollListener(verticalRecyclerViewFastScroller.getOnScrollListener());
    CoCoinUtil.backupCoCoinRecord = null;
    if (RecordManager.SELECTED_RECORDS.size() == 0) {
        emptyTip.setVisibility(View.VISIBLE);
        verticalRecyclerViewFastScroller.setVisibility(View.INVISIBLE);
    } else {
        emptyTip.setVisibility(View.GONE);
        verticalRecyclerViewFastScroller.setVisibility(View.VISIBLE);
    }
    infoLayout = (FrameLayout) mDrawer.findViewById(R.id.info_layout);
    LinearLayout.LayoutParams infoLayoutParams = new LinearLayout.LayoutParams(infoLayout.getLayoutParams());
    infoLayoutParams.setMargins(0, CoCoinUtil.getStatusBarHeight() - CoCoinUtil.dpToPx(30), 0, 0);
    infoLayout.setLayoutParams(infoLayoutParams);
    profileImage = (CircleImageView) mDrawer.findViewById(R.id.profile_image);
    profileImage.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (SettingManager.getInstance().getLoggenOn()) {
                CoCoinUtil.showToast(mContext, R.string.change_logo_tip);
            } else {
                CoCoinUtil.showToast(mContext, R.string.login_tip);
            }
        }
    });
    mDemoSlider = (SliderLayout) findViewById(R.id.slider);
    HashMap<String, Integer> urls = CoCoinUtil.GetDrawerTopUrl();
    for (String name : urls.keySet()) {
        CustomSliderView customSliderView = new CustomSliderView(this);
        // initialize a SliderLayout
        customSliderView.image(urls.get(name)).setScaleType(BaseSliderView.ScaleType.Fit);
        mDemoSlider.addSlider(customSliderView);
    }
    mDemoSlider.setPresetTransformer(SliderLayout.Transformer.ZoomOut);
    mDemoSlider.setCustomAnimation(new DescriptionAnimation());
    mDemoSlider.setDuration(4000);
    mDemoSlider.setCustomIndicator((PagerIndicator) findViewById(R.id.custom_indicator));
    titleExpense = (TextView) findViewById(R.id.title_expense);
    titleExpense.setTypeface(CoCoinUtil.typefaceLatoLight);
    titleExpense.setText(CoCoinUtil.GetInMoney((int) (double) RecordManager.getInstance(mContext).SELECTED_SUM));
    titleSum = (TextView) findViewById(R.id.title_sum);
    titleSum.setTypeface(CoCoinUtil.typefaceLatoLight);
    titleSum.setText(RecordManager.getInstance(mContext).SELECTED_RECORDS.size() + "'s");
    //        titleSlider = (SliderLayout)findViewById(R.id.title_slider);
    //        titleSlider.getLayoutParams().height = 48;
    //        titleSlider.getLayoutParams().width = 400 - CoCoinUtil.dpToPx(60 * 2);
    //
    //        HashMap<String, Integer> urls2 = CoCoinUtil.getTransparentUrls();
    //
    //        CustomTitleSliderView customTitleSliderView = new CustomTitleSliderView(0 + "'s", CoCoinFragmentManager.NUMBER_SLIDER);
    //        customTitleSliderView
    //                .image(urls2.get("0"))
    //                .setScaleType(BaseSliderView.ScaleType.Fit);
    //        titleSlider.addSlider(customTitleSliderView);
    //
    //        customTitleSliderView = new CustomTitleSliderView(CoCoinUtil.GetInMoney(0), CoCoinFragmentManager.EXPENSE_SLIDER);
    //        customTitleSliderView
    //                .image(urls2.get("1"))
    //                .setScaleType(BaseSliderView.ScaleType.Fit);
    //        titleSlider.addSlider(customTitleSliderView);
    //
    //        titleSlider.setPresetTransformer(SliderLayout.Transformer.ZoomOut);
    //        titleSlider.setCustomAnimation(new DescriptionAnimation());
    //        titleSlider.setDuration(3000);
    //        titleSlider.setCustomIndicator((PagerIndicator) findViewById(R.id.custom_indicator));
    ((TextView) findViewById(R.id.tag_title)).setTypeface(CoCoinUtil.GetTypeface());
    ((TextView) findViewById(R.id.tag_title_expense)).setTypeface(CoCoinUtil.GetTypeface());
    ((TextView) findViewById(R.id.tag_title_time)).setTypeface(CoCoinUtil.GetTypeface());
    ((TextView) findViewById(R.id.tag_title_tag)).setTypeface(CoCoinUtil.GetTypeface());
    setMoney = (TextView) findViewById(R.id.select_expense);
    setMoney.setTypeface(CoCoinUtil.GetTypeface());
    setMoney.setOnClickListener(this);
    noMoney = (TextView) findViewById(R.id.no_expense);
    noMoney.setTypeface(CoCoinUtil.GetTypeface());
    noMoney.setOnClickListener(this);
    setTime = (TextView) findViewById(R.id.select_time);
    setTime.setTypeface(CoCoinUtil.GetTypeface());
    setTime.setOnClickListener(this);
    noTime = (TextView) findViewById(R.id.no_time);
    noTime.setTypeface(CoCoinUtil.GetTypeface());
    noTime.setOnClickListener(this);
    setTag = (TextView) findViewById(R.id.select_tag);
    setTag.setTypeface(CoCoinUtil.GetTypeface());
    setTag.setOnClickListener(this);
    noTag = (TextView) findViewById(R.id.no_tag);
    noTag.setTypeface(CoCoinUtil.GetTypeface());
    noTag.setOnClickListener(this);
    select = (TextView) findViewById(R.id.select);
    select.setTypeface(CoCoinUtil.GetTypeface());
    select.setOnClickListener(this);
    leftExpense = (TextView) findViewById(R.id.left_expense);
    leftExpense.setTypeface(CoCoinUtil.GetTypeface());
    rightExpense = (TextView) findViewById(R.id.right_expense);
    rightExpense.setTypeface(CoCoinUtil.GetTypeface());
    leftTime = (TextView) findViewById(R.id.left_time);
    leftTime.setTypeface(CoCoinUtil.GetTypeface());
    rightTime = (TextView) findViewById(R.id.right_time);
    rightTime.setTypeface(CoCoinUtil.GetTypeface());
    tagImage = (ImageView) findViewById(R.id.tag_image);
    tagName = (TextView) findViewById(R.id.tag_name);
    tagName.setTypeface(CoCoinUtil.GetTypeface());
    setConditions();
    loadLogo();
}
Also used : BmobUser(cn.bmob.v3.BmobUser) User(com.nightonke.saver.model.User) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) CustomSliderView(com.nightonke.saver.ui.CustomSliderView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeDismissItemAnimator(com.h6ah4i.android.widget.advrecyclerview.animator.SwipeDismissItemAnimator) RecyclerViewTouchActionGuardManager(com.h6ah4i.android.widget.advrecyclerview.touchguard.RecyclerViewTouchActionGuardManager) ItemShadowDecorator(com.h6ah4i.android.widget.advrecyclerview.decoration.ItemShadowDecorator) TextView(android.widget.TextView) SimpleListDividerDecorator(com.h6ah4i.android.widget.advrecyclerview.decoration.SimpleListDividerDecorator) ActionBar(android.support.v7.app.ActionBar) NinePatchDrawable(android.graphics.drawable.NinePatchDrawable) Window(android.view.Window) RecyclerViewSwipeManager(com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager) MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) MaterialSearchView(com.miguelcatalan.materialsearchview.MaterialSearchView) ImageView(android.widget.ImageView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) MyGridView(com.nightonke.saver.ui.MyGridView) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) BaseSliderView(com.daimajia.slider.library.SliderTypes.BaseSliderView) CustomSliderView(com.nightonke.saver.ui.CustomSliderView) RecyclerView(android.support.v7.widget.RecyclerView) CoCoinRecord(com.nightonke.saver.model.CoCoinRecord) DescriptionAnimation(com.daimajia.slider.library.Animations.DescriptionAnimation) MaterialSearchView(com.miguelcatalan.materialsearchview.MaterialSearchView) MySwipeableItemAdapter(com.nightonke.saver.adapter.MySwipeableItemAdapter) GeneralItemAnimator(com.h6ah4i.android.widget.advrecyclerview.animator.GeneralItemAnimator) LinearLayout(android.widget.LinearLayout)

Example 19 with CircleImageView

use of de.hdodenhof.circleimageview.CircleImageView in project CoCoin by Nightonke.

the class AccountBookTagViewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    setContentView(R.layout.activity_account_book_tag_view);
    mViewPager = (MaterialViewPager) findViewById(R.id.materialViewPager);
    View view = mViewPager.getRootView();
    TextView title = (TextView) view.findViewById(R.id.logo_white);
    title.setTypeface(CoCoinUtil.typefaceLatoLight);
    title.setText(SettingManager.getInstance().getAccountBookName());
    mViewPager.getPagerTitleStrip().setTypeface(CoCoinUtil.typefaceLatoLight, Typeface.NORMAL);
    setTitle("");
    toolbar = mViewPager.getToolbar();
    mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    userName = (TextView) findViewById(R.id.user_name);
    userEmail = (TextView) findViewById(R.id.user_email);
    userName.setTypeface(CoCoinUtil.typefaceLatoRegular);
    userEmail.setTypeface(CoCoinUtil.typefaceLatoLight);
    User user = BmobUser.getCurrentUser(CoCoinApplication.getAppContext(), User.class);
    if (user != null) {
        userName.setText(user.getUsername());
        userEmail.setText(user.getEmail());
    }
    if (toolbar != null) {
        setSupportActionBar(toolbar);
        final ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setDisplayHomeAsUpEnabled(true);
            actionBar.setDisplayShowHomeEnabled(true);
            actionBar.setDisplayShowTitleEnabled(true);
            actionBar.setDisplayUseLogoEnabled(false);
            actionBar.setHomeButtonEnabled(true);
        }
    }
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawer, 0, 0);
    mDrawer.setDrawerListener(mDrawerToggle);
    View logo = findViewById(R.id.logo_white);
    if (logo != null) {
        logo.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                mViewPager.notifyHeaderChanged();
            }
        });
    }
    tagModeAdapter = new TagViewFragmentAdapter(getSupportFragmentManager());
    mViewPager.getViewPager().setOffscreenPageLimit(tagModeAdapter.getCount());
    mViewPager.getViewPager().setAdapter(tagModeAdapter);
    mViewPager.getPagerTitleStrip().setViewPager(mViewPager.getViewPager());
    mViewPager.clearAnimation();
    if (SettingManager.getInstance().getShowPicture()) {
        mViewPager.setMaterialViewPagerListener(new MaterialViewPager.Listener() {

            @Override
            public HeaderDesign getHeaderDesign(int page) {
                return HeaderDesign.fromColorAndUrl(CoCoinUtil.GetTagColor(RecordManager.TAGS.get(page).getId()), CoCoinUtil.GetTagUrl(RecordManager.TAGS.get(page).getId()));
            }
        });
    } else {
        mViewPager.setMaterialViewPagerListener(new MaterialViewPager.Listener() {

            @Override
            public HeaderDesign getHeaderDesign(int page) {
                return HeaderDesign.fromColorAndDrawable(CoCoinUtil.GetTagColor(RecordManager.TAGS.get(page).getId()), CoCoinUtil.GetTagDrawable(-3));
            }
        });
    }
    myGridView = (MyGridView) mDrawer.findViewById(R.id.grid_view);
    drawerTagChooseAdapter = new DrawerTagChooseGridViewAdapter(mContext);
    myGridView.setAdapter(drawerTagChooseAdapter);
    myGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
            YoYo.with(Techniques.Bounce).delay(0).duration(700).playOn(view);
            mViewPager.getViewPager().setCurrentItem(position);
            final Handler handler = new Handler();
            handler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    mDrawer.closeDrawers();
                }
            }, 700);
        }
    });
    profileImage = (CircleImageView) mDrawer.findViewById(R.id.profile_image);
    profileImage.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (SettingManager.getInstance().getLoggenOn()) {
                CoCoinUtil.showToast(mContext, R.string.change_logo_tip);
            } else {
                CoCoinUtil.showToast(mContext, R.string.login_tip);
            }
        }
    });
    mDemoSlider = (SliderLayout) findViewById(R.id.slider);
    HashMap<String, Integer> urls = CoCoinUtil.GetDrawerTopUrl();
    for (String name : urls.keySet()) {
        CustomSliderView customSliderView = new CustomSliderView(this);
        // initialize a SliderLayout
        customSliderView.image(urls.get(name)).setScaleType(BaseSliderView.ScaleType.Fit);
        mDemoSlider.addSlider(customSliderView);
    }
    mDemoSlider.setPresetTransformer(SliderLayout.Transformer.ZoomOut);
    mDemoSlider.setCustomAnimation(new DescriptionAnimation());
    mDemoSlider.setDuration(4000);
    mDemoSlider.setCustomIndicator((PagerIndicator) findViewById(R.id.custom_indicator));
    loadLogo();
}
Also used : MaterialViewPager(com.github.florent37.materialviewpager.MaterialViewPager) BmobUser(cn.bmob.v3.BmobUser) User(com.nightonke.saver.model.User) HeaderDesign(com.github.florent37.materialviewpager.header.HeaderDesign) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) TagViewFragmentAdapter(com.nightonke.saver.adapter.TagViewFragmentAdapter) Handler(android.os.Handler) CustomSliderView(com.nightonke.saver.ui.CustomSliderView) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) View(android.view.View) MyGridView(com.nightonke.saver.ui.MyGridView) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) BaseSliderView(com.daimajia.slider.library.SliderTypes.BaseSliderView) CustomSliderView(com.nightonke.saver.ui.CustomSliderView) DescriptionAnimation(com.daimajia.slider.library.Animations.DescriptionAnimation) TextView(android.widget.TextView) AdapterView(android.widget.AdapterView) DrawerTagChooseGridViewAdapter(com.nightonke.saver.adapter.DrawerTagChooseGridViewAdapter) ActionBar(android.support.v7.app.ActionBar)

Example 20 with CircleImageView

use of de.hdodenhof.circleimageview.CircleImageView in project CoCoin by Nightonke.

the class AccountBookSettingActivity method init.

// Init the setting activity////////////////////////////////////////////////////////////////////////
private void init() {
    back = (MaterialIconView) findViewById(R.id.icon_left);
    back.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();
        }
    });
    logo = (CircleImageView) findViewById(R.id.profile_image);
    logo.setOnClickListener(this);
    profileLayout = (MaterialRippleLayout) findViewById(R.id.profile_layout);
    userNameIcon = (MaterialIconView) findViewById(R.id.user_name_icon);
    userEmailIcon = (MaterialIconView) findViewById(R.id.user_email_icon);
    userName = (TextView) findViewById(R.id.user_name);
    userName.setTypeface(CoCoinUtil.typefaceLatoLight);
    userEmail = (TextView) findViewById(R.id.user_email);
    userEmail.setTypeface(CoCoinUtil.typefaceLatoLight);
    loginButton = (TextView) findViewById(R.id.login_button);
    loginButton.setTypeface(CoCoinUtil.typefaceLatoLight);
    loginButton.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            userOperator();
        }
    });
    expense = (RiseNumberTextView) findViewById(R.id.expense);
    expense.setTypeface(CoCoinUtil.typefaceLatoLight);
    records = (RiseNumberTextView) findViewById(R.id.records);
    records.setTypeface(CoCoinUtil.typefaceLatoLight);
    expenseTV = (TextView) findViewById(R.id.expense_text);
    expenseTV.setTypeface(CoCoinUtil.GetTypeface());
    recordsTV = (TextView) findViewById(R.id.records_text);
    recordsTV.setTypeface(CoCoinUtil.GetTypeface());
    expense.withNumber(RecordManager.SUM).setDuration(1500).start();
    records.withNumber(RecordManager.RECORDS.size()).setDuration(1500).start();
    monthLayout = (MaterialRippleLayout) findViewById(R.id.month_layout);
    monthIcon = (MaterialIconView) findViewById(R.id.month_limit_icon);
    monthMaxExpenseIcon = (MaterialIconView) findViewById(R.id.month_expense_icon);
    monthColorRemindIcon = (MaterialIconView) findViewById(R.id.month_color_icon);
    monthWarningIcon = (MaterialIconView) findViewById(R.id.warning_expense_icon);
    monthColorRemindTypeIcon = (MaterialIconView) findViewById(R.id.month_color_type_icon);
    monthColorRemindSelect = (MaterialIconView) findViewById(R.id.month_color_type);
    monthColorRemindSelect.setColor(SettingManager.getInstance().getRemindColor());
    monthForbiddenIcon = (MaterialIconView) findViewById(R.id.month_forbidden_icon);
    monthSB = (Switch) findViewById(R.id.month_limit_enable_button);
    monthSB.setOnCheckedChangeListener(this);
    monthColorRemindSB = (Switch) findViewById(R.id.month_color_remind_button);
    monthColorRemindSB.setOnCheckedChangeListener(this);
    monthForbiddenSB = (Switch) findViewById(R.id.month_forbidden_button);
    monthForbiddenSB.setOnCheckedChangeListener(this);
    monthMaxExpense = (RiseNumberTextView) findViewById(R.id.month_expense);
    if (SettingManager.getInstance().getIsMonthLimit())
        monthMaxExpense.withNumber(SettingManager.getInstance().getMonthLimit()).setDuration(1000).start();
    // change the month limit///////////////////////////////////////////////////////////////////////////
    monthMaxExpense.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (SettingManager.getInstance().getIsMonthLimit()) {
                new MaterialDialog.Builder(mContext).theme(Theme.LIGHT).typeface(CoCoinUtil.GetTypeface(), CoCoinUtil.GetTypeface()).title(R.string.set_month_expense_dialog_title).inputType(InputType.TYPE_CLASS_NUMBER).positiveText(R.string.submit).inputRange(3, 5).input(SettingManager.getInstance().getMonthLimit().toString(), null, new MaterialDialog.InputCallback() {

                    @Override
                    public void onInput(MaterialDialog dialog, CharSequence input) {
                        int newExpense = SettingManager.getInstance().getMonthLimit();
                        if (input.length() != 0) {
                            newExpense = Integer.parseInt(input.toString());
                        }
                        // the month limit must be smaller than the month warning
                        if (newExpense < SettingManager.getInstance().getMonthWarning()) {
                            SettingManager.getInstance().setMonthWarning(((int) (newExpense * 0.8) / 100 * 100));
                            if (SettingManager.getInstance().getMonthWarning() < 100) {
                                SettingManager.getInstance().setMonthWarning(100);
                            }
                            updateSettingsToServer(UPDATE_MONTH_WARNING);
                            SettingManager.getInstance().setMainViewRemindColorShouldChange(true);
                            monthWarning.setText(SettingManager.getInstance().getMonthWarning().toString());
                        }
                        SettingManager.getInstance().setMonthLimit(newExpense);
                        updateSettingsToServer(UPDATE_MONTH_LIMIT);
                        SettingManager.getInstance().setTodayViewMonthExpenseShouldChange(true);
                        SettingManager.getInstance().setMainViewMonthExpenseShouldChange(true);
                        monthMaxExpense.withNumber(SettingManager.getInstance().getMonthLimit()).setDuration(1000).start();
                    }
                }).show();
            }
        }
    });
    monthWarning = (RiseNumberTextView) findViewById(R.id.warning_expense);
    monthWarning.setText(SettingManager.getInstance().getMonthWarning().toString());
    if (SettingManager.getInstance().getIsMonthLimit() && SettingManager.getInstance().getIsColorRemind())
        monthWarning.withNumber(SettingManager.getInstance().getMonthWarning()).setDuration(1000).start();
    // change month warning/////////////////////////////////////////////////////////////////////////////
    monthWarning.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (SettingManager.getInstance().getIsMonthLimit() && SettingManager.getInstance().getIsColorRemind()) {
                new MaterialDialog.Builder(mContext).theme(Theme.LIGHT).typeface(CoCoinUtil.GetTypeface(), CoCoinUtil.GetTypeface()).title(R.string.set_month_expense_dialog_title).inputType(InputType.TYPE_CLASS_NUMBER).positiveText(R.string.submit).alwaysCallInputCallback().input(null, null, new MaterialDialog.InputCallback() {

                    @Override
                    public void onInput(final MaterialDialog dialog, final CharSequence input) {
                        if (input.length() == 0) {
                            dialog.setContent(mContext.getResources().getString(R.string.set_warning_expense_dialog_title));
                            dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
                        } else if (Integer.parseInt(input.toString()) < 100) {
                            dialog.setContent("≥ 100");
                            dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
                        } else if (Integer.parseInt(input.toString()) > SettingManager.getInstance().getMonthLimit()) {
                            dialog.setContent("≤ " + SettingManager.getInstance().getMonthLimit().toString());
                            dialog.getActionButton(DialogAction.POSITIVE).setEnabled(false);
                        } else {
                            dialog.setContent(mContext.getResources().getString(R.string.set_warning_expense_dialog_title));
                            dialog.getActionButton(DialogAction.POSITIVE).setEnabled(true);
                        }
                        dialog.getActionButton(DialogAction.POSITIVE).setOnClickListener(new View.OnClickListener() {

                            @Override
                            public void onClick(View v) {
                                SettingManager.getInstance().setMonthWarning(Integer.parseInt(input.toString()));
                                updateSettingsToServer(UPDATE_MONTH_WARNING);
                                SettingManager.getInstance().setMainViewRemindColorShouldChange(true);
                                monthWarning.withNumber(SettingManager.getInstance().getMonthWarning()).setDuration(1000).start();
                                dialog.dismiss();
                            }
                        });
                    }
                }).show();
            }
        }
    });
    // change month remind color////////////////////////////////////////////////////////////////////////
    monthColorRemindSelect.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            SettingManager.getInstance().setMainViewRemindColorShouldChange(true);
            remindColorSelectDialog.show((AppCompatActivity) mContext);
        }
    });
    monthMaxExpense.setTypeface(CoCoinUtil.typefaceLatoLight);
    monthWarning.setTypeface(CoCoinUtil.typefaceLatoLight);
    monthLimitTV = (TextView) findViewById(R.id.month_limit_text);
    monthLimitTV.setTypeface(CoCoinUtil.GetTypeface());
    monthWarningTV = (TextView) findViewById(R.id.warning_expense_text);
    monthWarningTV.setTypeface(CoCoinUtil.GetTypeface());
    monthMaxExpenseTV = (TextView) findViewById(R.id.month_expense_text);
    monthMaxExpenseTV.setTypeface(CoCoinUtil.GetTypeface());
    monthColorRemindTV = (TextView) findViewById(R.id.month_color_remind_text);
    monthColorRemindTV.setTypeface(CoCoinUtil.GetTypeface());
    monthColorRemindTypeTV = (TextView) findViewById(R.id.month_color_type_text);
    monthColorRemindTypeTV.setTypeface(CoCoinUtil.GetTypeface());
    monthForbiddenTV = (TextView) findViewById(R.id.month_forbidden_text);
    monthForbiddenTV.setTypeface(CoCoinUtil.GetTypeface());
    accountBookNameLayout = (MaterialRippleLayout) findViewById(R.id.account_book_name_layout);
    accountBookNameLayout.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            changeAccountBookName();
        }
    });
    accountBookName = (TextView) findViewById(R.id.account_book_name);
    accountBookName.setTypeface(CoCoinUtil.GetTypeface());
    accountBookName.setText(SettingManager.getInstance().getAccountBookName());
    accountBookNameTV = (TextView) findViewById(R.id.account_book_name_text);
    accountBookNameTV.setTypeface(CoCoinUtil.GetTypeface());
    changePasswordLayout = (MaterialRippleLayout) findViewById(R.id.change_password_layout);
    changePasswordLayout.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            changePassword();
        }
    });
    changePasswordTV = (TextView) findViewById(R.id.change_password_text);
    changePasswordTV.setTypeface(CoCoinUtil.GetTypeface());
    sortTagsLayout = (MaterialRippleLayout) findViewById(R.id.sort_tags_layout);
    sortTagsLayout.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            sortTags();
        }
    });
    sortTagsTV = (TextView) findViewById(R.id.sort_tags_text);
    sortTagsTV.setTypeface(CoCoinUtil.GetTypeface());
    showPictureLayout = (MaterialRippleLayout) findViewById(R.id.whether_show_picture_layout);
    showPictureIcon = (MaterialIconView) findViewById(R.id.whether_show_picture_icon);
    showPictureSB = (Switch) findViewById(R.id.whether_show_picture_button);
    showPictureSB.setOnCheckedChangeListener(this);
    showPictureTV = (TextView) findViewById(R.id.whether_show_picture_text);
    showPictureTV.setTypeface(CoCoinUtil.GetTypeface());
    hollowLayout = (MaterialRippleLayout) findViewById(R.id.whether_show_circle_layout);
    hollowIcon = (MaterialIconView) findViewById(R.id.whether_show_circle_icon);
    hollowSB = (Switch) findViewById(R.id.whether_show_circle_button);
    hollowSB.setOnCheckedChangeListener(this);
    hollowTV = (TextView) findViewById(R.id.whether_show_circle_text);
    hollowTV.setTypeface(CoCoinUtil.GetTypeface());
    updateLayout = (MaterialRippleLayout) findViewById(R.id.update_layout);
    updateLayout.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            CoCoinUtil.showToast(mContext, mContext.getResources().getString(R.string.checking_update), SuperToast.Background.BLUE);
            AppUpdateManager appUpdateManager = new AppUpdateManager(mContext);
            appUpdateManager.checkUpdateInfo(true);
        }
    });
    currentVersionTV = (TextView) findViewById(R.id.update_text);
    currentVersionTV.setTypeface(CoCoinUtil.GetTypeface());
    currentVersionTV.setText(mContext.getResources().getString(R.string.current_version) + CoCoinUtil.GetCurrentVersion());
    canBeUpdatedTV = (TextView) findViewById(R.id.update_tag);
    canBeUpdatedTV.setTypeface(CoCoinUtil.GetTypeface());
    if (SettingManager.getInstance().getCanBeUpdated()) {
        canBeUpdatedTV.setVisibility(View.VISIBLE);
    } else {
        canBeUpdatedTV.setVisibility(View.GONE);
    }
    boolean loggenOn = SettingManager.getInstance().getLoggenOn();
    if (loggenOn) {
        // is logged on, set the user name and email
        userName.setText(SettingManager.getInstance().getUserName());
        userEmail.setText(SettingManager.getInstance().getUserEmail());
        loginButton.setText(mContext.getResources().getText(R.string.logout_button));
        loginButton.setBackgroundResource(R.drawable.button_logout);
    } else {
        userName.setText("");
        userEmail.setText("");
        loginButton.setText(getResourceString(R.string.login_button));
    }
    setIconEnable(userNameIcon, loggenOn);
    setIconEnable(userEmailIcon, loggenOn);
    loadLogo();
    monthSB.setCheckedImmediately(SettingManager.getInstance().getIsMonthLimit());
    setMonthState();
    showPictureSB.setCheckedImmediately(SettingManager.getInstance().getShowPicture());
    setShowPictureState(SettingManager.getInstance().getShowPicture());
    hollowSB.setCheckedImmediately(SettingManager.getInstance().getIsHollow());
    setHollowState(SettingManager.getInstance().getIsHollow());
}
Also used : MaterialDialog(com.afollestad.materialdialogs.MaterialDialog) AppCompatActivity(android.support.v7.app.AppCompatActivity) CircleImageView(de.hdodenhof.circleimageview.CircleImageView) RiseNumberTextView(com.nightonke.saver.ui.RiseNumberTextView) View(android.view.View) TextView(android.widget.TextView) MaterialIconView(net.steamcrafted.materialiconlib.MaterialIconView) AppUpdateManager(com.nightonke.saver.model.AppUpdateManager)

Aggregations

CircleImageView (de.hdodenhof.circleimageview.CircleImageView)30 View (android.view.View)27 TextView (android.widget.TextView)23 ImageView (android.widget.ImageView)13 ActionBar (android.support.v7.app.ActionBar)6 AdapterView (android.widget.AdapterView)6 ListView (android.widget.ListView)6 Intent (android.content.Intent)5 Bitmap (android.graphics.Bitmap)5 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)5 RecyclerView (android.support.v7.widget.RecyclerView)5 BmobUser (cn.bmob.v3.BmobUser)4 DescriptionAnimation (com.daimajia.slider.library.Animations.DescriptionAnimation)4 BaseSliderView (com.daimajia.slider.library.SliderTypes.BaseSliderView)4 User (com.nightonke.saver.model.User)4 CustomSliderView (com.nightonke.saver.ui.CustomSliderView)4 IntentFilter (android.content.IntentFilter)3 ColorDrawable (android.graphics.drawable.ColorDrawable)3 Handler (android.os.Handler)3 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)3