@AfterViews public void bindLvData(){ moduleBeans=DataUtils.getAdapterData(); if(mAdapter==null) { mAdapter = new QuickAdapter<ModuleBean>(this, R.layout.lv_item_base_layout,moduleBeans) { @Override protected void convert(BaseAdapterHelper helper, ModuleBean item) { //列表底下显示进度 mAdapter.showIndeterminateProgress(true); helper.setText(R.id.text_lv_item_title, item.getModulename()) .setText(R.id.text_lv_item_description, item.getDescription()) .setImageUrl(R.id.img_lv_item, item.getImgurl()); } }; lv_base_adapter.setAdapter(mAdapter); } }
@AfterViews public void bindLvData(){ moduleBeans=DataUtils.getAdapterData(); if(mAdapter==null) { mAdapter = new QuickAdapter<ModuleBean>(this, R.layout.lv_item_base_layout,moduleBeans) { @Override protected void convert(BaseAdapterHelper helper, ModuleBean item) { //列表底下显示进度 mAdapter.showIndeterminateProgress(true); helper.setText(R.id.text_lv_item_title, item.getModulename()) .setText(R.id.text_lv_item_description, item.getDescription()); //setImageUrl(R.id.img_lv_item, item.getImgurl()); //使用ImageLoader进行加载图片 ImageView loader_img=helper.getView(R.id.img_lv_item); listener=ImageLoader.getImageListener(loader_img,R.drawable.ic_loading,R.drawable.ic_loading); imageLoader.get(item.getImgurl(),listener); } }; lv_base_adapter.setAdapter(mAdapter); } }
@AfterViews protected void initViews() { setTitle(R.string.load_more_title); recyclerView.setLayoutManager(new LinearLayoutManager(this)); //初始化adapter adapter = new BaseItemAdapter(); //为XXBean数据源注册XXManager管理类 adapter.register(TextBean.class, new TextViewManager()); adapter.addHeadItem(new TextBean("我是Head View")); adapter.addFootItem(new TextBean("我是Foot View")); recyclerView.setAdapter(adapter); //开启加载更多视图 adapter.enableLoadMore(new LoadMoreHolderManager(this::loadData)); //下拉刷新视图,此处采用SwipeRefreshLayout swipeRefreshLayout.setOnRefreshListener(() -> refresh()); refresh(); }
@AfterViews protected void initViews() { setTitle(R.string.data_bind_title); recyclerView.setLayoutManager(new LinearLayoutManager(this)); //初始化adapter BaseItemAdapter adapter = new BaseItemAdapter(); //绑定写法一(简单):直接传入BR.itemData(VariableId) adapter.register(TextBean.class, new DataBindViewHolderManager<>(R.layout.item_text_data_bind, BR.itemData)); //绑定写法二(自由):传入ItemBindView接口实例,可以定制绑定业务逻辑 adapter.register(ImageTextBean.class, new DataBindViewHolderManager<>( R.layout.item_image_text_data_bind, this::onBindViewHolder)); recyclerView.setAdapter(adapter); List<Object> list = new ArrayList<>(); for (int i = 0; i < 20; i++) { list.add(new TextBean("AAA" + i)); list.add(new ImageTextBean("img2", "BBB" + i)); } adapter.setDataItems(list); }
@AfterViews protected void initViews() { setTitle(R.string.chat_title); recyclerView.setLayoutManager(new LinearLayoutManager(this)); //初始化adapter BaseItemAdapter adapter = new BaseItemAdapter(); //为XXBean数据源注册XXManager管理类组合 adapter.register(MessageBean.class, new ViewHolderManagerGroup<MessageBean>(new SendMessageManager(), new ReceiveMessageManager()) { @Override public int getViewHolderManagerIndex(MessageBean itemData) { //根据message判断是否本人发送并返回对应ViewHolderManager的index值 return itemData.getSender().equals(UID) ? 0 : 1; } }); recyclerView.setAdapter(adapter); List<MessageBean> list = new ArrayList<>(); list.add(new MessageBean("在吗?", OTHER)); list.add(new MessageBean("在啊啊啊啊啊啊啊!", UID)); list.add(new MessageBean("目前展示的是聊天界面中一个消息对应两种布局的情况,看看效果如何?", OTHER)); list.add(new MessageBean("不错!", UID)); adapter.setDataItems(list); }
@AfterViews protected void initViews() { setTitle(R.string.input_title); recyclerView.setLayoutManager(new LinearLayoutManager(this)); //初始化adapter adapter = new InputItemAdapter(); recyclerView.setAdapter(adapter); List<Object> list = new ArrayList<>(); //姓名和性别录入Item,一个录入item对应多个提交的值{"name":"","sex":""} list.add(new ItemNameAndSex()); //正常的EditText录入Item list.add(new ItemEdit("height").setName("身高:")); list.add(new ItemEdit("weight").setName("体重:")); list.add(new ItemEdit("age").setName("年龄:")); list.add(new ItemEdit("default").setName("国家:").setDefValue("中国")); //利用DataBinding的录入Item list.add(new ItemInfoDataBind("info").setName("介绍:")); //添加user id对应的隐藏域的Item(用户不可见) adapter.addHiddenItem("id", "隐藏域中携带id"); adapter.setDataItems(list); }
@AfterViews protected void initViews() { setTitle(R.string.empty_error_title); recyclerView.setLayoutManager(new LinearLayoutManager(this)); //初始化adapter BaseItemAdapter adapter = new BaseItemAdapter(); //为XXBean数据源注册XXManager管理类 adapter.register(TextBean.class, new TextViewManager()); recyclerView.setAdapter(adapter); adapter.addDataItem(new TextBean("展示空白页")); adapter.addDataItem(new TextBean("展示错误页")); //设置点击监听,再点击Item的时候展示空白或者错误页面 setOnItemClickListener(adapter); //初始化空白页辅助类 emptyViewHelper = newStateViewHelper("列表数据为空"); //初始化错误页辅助类 errorViewHelper = newStateViewHelper("数据加载错误"); }
@AfterViews protected void initViews() { setTitle(R.string.animation_title); recyclerView.setLayoutManager(new LinearLayoutManager(this)); //初始化adapter adapter = new BaseItemAdapter(); //为XXBean数据源注册XXManager管理类 adapter.register(ImageTextBean.class, new ImageAndTextManager()); recyclerView.setAdapter(adapter); List<Object> list = new ArrayList<>(); for (int i = 0; i < 20; i++) { list.add(new ImageTextBean(R.drawable.img2, "BBB" + i)); } adapter.setDataItems(list); }
@AfterViews protected void initViews() { setTitle(R.string.multi_item_title); recyclerView.setLayoutManager(new LinearLayoutManager(this)); //初始化adapter BaseItemAdapter adapter = new BaseItemAdapter(); //为XXBean数据源注册XXManager管理类 adapter.register(TextBean.class, new TextViewManager()); adapter.register(ImageTextBean.class, new ImageAndTextManager()); adapter.register(ImageBean.class, new ImageViewManager()); recyclerView.setAdapter(adapter); List<Object> list = new ArrayList<>(); for (int i = 0; i < 20; i++) { list.add(new TextBean("AAA" + i)); list.add(new ImageBean(R.drawable.img1)); list.add(new ImageTextBean(R.drawable.img2, "BBB" + i)); } adapter.setDataItems(list); }
@AfterViews protected void initViews() { setTitle(R.string.user_info_title); UserBean userBean = getUserBean(); recyclerView.setLayoutManager(new LinearLayoutManager(this)); //初始化adapter BaseItemAdapter adapter = new BaseItemAdapter(); //为UserBean数据源注册数据绑定View Holder Manager管理类 adapter.register(ItemInfo.class, new DataBindViewHolderManager<>( R.layout.item_info, BR.itemData)); recyclerView.setAdapter(adapter); //构建用户信息需要展示的ItemInfo的集合,每个ItemInfo代表页面中的一行 List<ItemInfo> list = new ArrayList<>(5); list.add(new ItemInfo("名字", userBean.getName())); list.add(new ItemInfo("性别", userBean.getSex())); list.add(new ItemInfo("年龄", userBean.getAge())); list.add(new ItemInfo("城市", userBean.getAddr())); list.add(new ItemInfo("介绍", userBean.getInfo())); adapter.setDataItems(list); }
@AfterViews void afterViews(){ setToolbar("레크레크", 0, R.drawable.ic_menu_white_24dp, R.drawable.ic_note_add_white_24dp, 0); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(ActivityMain.this, ActivityRecordVoice_.class)); } }); navigationView.setNavigationItemSelectedListener(this); if(adapter == null) return; setupRecyclerView(); super.setupSwipeRefreshLayout(); loadData(0); }
@AfterViews protected void beginOAuth() { URL authUrl = this.helper.getAuthorizationUrl(this.credentials, true, true, this.scopes); this.webviewLogin.loadUrl(authUrl.toExternalForm()); this.webviewLogin.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { if (url.contains("code=")) { LoginActivity.this.handleOAuthSuccess(url); } else if (url.contains("error=")) { LoginActivity.this.handleOAuthError(url); } } }); }
@AfterViews @SuppressLint("SetJavaScriptEnabled") protected void visitUrl() { this.webview.setWebChromeClient(new WebChromeClient()); // the default webview client will occasionally open the browser // we don't want this - we want content to be displayed, // by default, in the app. this.webview.setWebViewClient(new WebViewClient()); // allow js WebSettings settings = this.webview.getSettings(); // attempt to initially fit content without requiring zooms settings.setUseWideViewPort(true); settings.setLoadWithOverviewMode(true); // allow zooming settings.setBuiltInZoomControls(true); // allow js settings.setJavaScriptEnabled(true); this.webview.loadUrl(this.url); }
@AfterViews void setUpViews() { ThemeColorManager.addActivityStatusBar(this); setUpToolbar(); initMenuItem(); setUpEditor(); }
@AfterViews void setUpViews() { setUpToolbar(); setUpTabViewPager(); setUpDrawerHeader(); setUpFragment(); getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); registerBackPressHandlers(); }
@AfterViews void setUpViews() { init(); final boolean noRunningScript = mTaskListRecyclerView.getAdapter().getItemCount() == 0; mNoRunningScriptNotice.setVisibility(noRunningScript ? View.VISIBLE : View.GONE); mCloseAllView.setVisibility(noRunningScript ? View.GONE : View.VISIBLE); }
@AfterViews void setUpViews() { ((TextView) findViewById(R.id.summary)).setText(mSummary); ThemeColorManager.addActivityStatusBar(this); BaseActivity.setToolbarAsBack(this, R.id.toolbar, mTitle); setUpEditor(); }
@AfterViews public void initDatas(){ fragments=new ArrayList<>(); fragments.add(new OneFragment()); fragments.add(new TwoFragment()); fragments.add(new ThreeFragment()); fragments.add(new FourFragment()); mPagerAdater=new FixedPagerAdapter(getChildFragmentManager()); mPagerAdater.setFragments(fragments); info_viewpager.setAdapter(mPagerAdater); id_indicator.setViewPager(info_viewpager,0); }
@AfterViews public void initViews(){ top_bar_title.setText("RecyclerView集合AA注入框架实例"); //进行设置RecyerView ,并且绑定数据 LinearLayoutManager linearLayoutManager=new LinearLayoutManager(this); linearLayoutManager.setOrientation(OrientationHelper.VERTICAL); aa_recyclerview.setLayoutManager(linearLayoutManager); adapter.setItems(userFinder.findAll()); aa_recyclerview.setAdapter(adapter); }
@AfterViews @UiThread void init() { mItemName.setText(mName); mItemIcon.setImageResource(mNormal); mInited = true; setSelected(mIsSelected); }
@AfterViews void setUpViews() { mSwipeRefreshLayout.setOnRefreshListener(this::fetchTopics); mTopicListRecyclerView.setLayoutManager(new LinearLayoutManager(getContext())); mTopicListRecyclerView.setAdapter(mTopicListAdapter); mTopicListRecyclerView.addItemDecoration(new HorizontalDividerItemDecoration.Builder(getContext()) .colorResId(R.color.color_topic_list_divider) .sizeResId(R.dimen.size_topic_list_divider) .build()); fetchTopics(); }
@AfterViews public void onAfterViews() { mRequestQueue = Volley.newRequestQueue(this); userInfoSp = MyApplication.getInstance().getUserInfoSp(); loginPassword = userInfoSp.getString(AppDelegate.PASSWORD, ""); initToolbar(); initEditText(); tv_lgName.setText("用户登录名:" + userInfoSp.getString(AppDelegate.LG_NAME, "")); tv_platformName.setText("登录平台名:" + MyApplication_.getInstance().getPlatFormString()); }
@AfterViews public void onAfterViews() { initToolbar(); showView(mProgressbar); if (mViewPager != null) { TableLayoutAdapter mAdapter = new TableLayoutAdapter(getSupportFragmentManager()); mAdapter.addFragment(new T_MyInvoice_InvoiceNoticeFragment_(), getStrings(R.string.invoice_notice)); mAdapter.addFragment(new T_MyInvoice_InvoiceInformationFragment_(), getStrings(R.string.invoice_information)); mViewPager.setAdapter(mAdapter); mTabLayout.setupWithViewPager(mViewPager); } hideView(mProgressbar); }
@AfterViews public void onAfterViews() { initToolbar(); mRequestQueue = Volley.newRequestQueue(this); userInfoSp = MyApplication_.getInstance().getUserInfoSp(); showView(mProgressbar); hideView(mCardView); onBackgrounds(); }
@AfterViews void afterViewInjected() { startProxy(); if (visibleForUser) { startPlayer(); } }
@AfterViews void registerEvents() { passwordView.numKey.subscribe(i -> numKeySelected()); passwordView.backKey.subscribe(i -> backKeyPressed()); passwordView.deleteKey.subscribe(i -> deleteKeyPressed()); passwordView.fourKeyEntered.subscribe((code) -> { new Handler().postDelayed(() -> codeEntered(code), 200); }); }
@AfterViews void registerEvents() { passwordView.numKey.subscribe(i -> numKeySelected()); passwordView.backKey.subscribe(i -> backKeyPress.onNext(null)); passwordView.deleteKey.subscribe(i -> deleteKeyPressed()); passwordView.fourKeyEntered.subscribe((code) -> { new Handler().postDelayed(() -> codeEntered(code), 200); }); }
@AfterViews void setupNavigationView() { mDrawerToggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.app_name, R.string.app_name); mDrawerToggle.setDrawerIndicatorEnabled(true); drawer.setDrawerListener(mDrawerToggle); navigation.setNavigationItemSelectedListener(this::navigationItemSelected); navigation.getMenu().getItem(0).setChecked(true); }
@AfterViews void init() { pin[0] = pin1; pin[1] = pin2; pin[2] = pin3; pin[3] = pin4; }
@AfterViews void init() { setUpEditor(); setUpInputMethodEnhancedBar(); setUpFunctionsKeyboard(); setMenuItemStatus(R.id.save, false); mDocsWebView.getWebView().getSettings().setDisplayZoomControls(true); mDocsWebView.getWebView().loadUrl(Pref.getDocumentationUrl() + "index.html"); }
@AfterViews void setUpViews() { ThemeColorManager.addViewBackground(mHeaderView); initMenuItems(); if (Pref.isFloatingMenuShown()) { setChecked(mFloatingWindowItem, true); } setChecked(mConnectionItem, DevPluginService.getInstance().isConnected()); }
@AfterViews void setUpViews() { mWebView = mEWebView.getWebView(); String url = "http://www.autojs.org/"; Bundle savedWebViewState = getArguments().getBundle("savedWebViewState"); if (savedWebViewState != null) { mWebView.restoreState(savedWebViewState); } else { mWebView.loadUrl(url); } }
@AfterViews void setUpViews() { setUpToolbar(); setUpTabViewPager(); getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); registerBackPressHandlers(); ThemeColorManager.addViewBackground(findViewById(R.id.app_bar)); }
@AfterViews void setUpViews() { ScriptList.SortConfig sortConfig = ScriptList.SortConfig.from(PreferenceManager.getDefaultSharedPreferences(getContext())); mScriptFileList.setSortConfig(sortConfig); mScriptFileList.setStorageFileProvider(StorageFileProvider.getDefault()); mScriptFileList.setOnScriptFileClickListener((view, file) -> Scripts.edit(file)); }
@AfterViews void setupViews() { setToolbarAsBack(getString(R.string.text_timed_task)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { mToolbar.setSubtitle(mScriptFile.getName()); } findDayOfWeekCheckBoxes(mWeeklyTaskContainer); setUpTime(); }
@AfterViews void initThis() { adapter = new SSHServersListAdapter(this.getContext(), sshServers, this); sshServersList.setAdapter(adapter); floatingActionButton.setImageDrawable(new IconicsDrawable(this.getContext()).icon(GoogleMaterial.Icon.gmd_add).colorRes(R.color.colorFloatIcon).sizeDp(48)); refresh(); }
@AfterViews void setUpViews() { setToolbarAsBack(getString(R.string.text_tutorial)); mWebView = mEWebView.getWebView(); String url = getIntent().getStringExtra(EXTRA_URL); if (url == null) { url = Pref.getDocumentationUrl() + "index.html"; } mWebView.loadUrl(url); }
@AfterViews void setUpViews() { mWebView = mEWebView.getWebView(); String url = Pref.getDocumentationUrl() + "index.html"; Bundle savedWebViewState = getArguments().getBundle("savedWebViewState"); if (savedWebViewState != null) { mWebView.restoreState(savedWebViewState); } else { mWebView.loadUrl(getArguments().getString(ARGUMENT_URL, url)); } }
@AfterViews void setUpViews() { mEditorView.handleIntent(getIntent() .putExtra(EXTRA_RUN_ENABLED, false) .putExtra(EXTRA_SAVE_ENABLED, false)); BaseActivity.setToolbarAsBack(this, R.id.toolbar, mEditorView.getName()); }
@AfterViews protected void initViews() { setTitle(R.string.head_foot_grid_title); recyclerView.setLayoutManager(new GridLayoutManager(this, 2)); //初始化adapter BaseItemAdapter adapter = new BaseItemAdapter(); //为XXBean数据源注册XXManager管理类 adapter.register(TextBean.class, new FullSpanTextViewManager()); adapter.register(ImageTextBean.class, new ImageAndTextManager()); adapter.register(ImageBean.class, new ImageViewManager()); //充满宽度详见ViewHolderManager#isFullSpan返回true即可,其实不一定是head或者foot TextView headView1 = new TextView(this); headView1.setText("通过addHeadView增加的充满宽度的head"); //使用HeadFootHolderManager已经实现isFullSpan方法,默认全屏 adapter.addHeadView(headView1); TextView footView1 = new TextView(this); footView1.setText("通过addFootView增加充满宽度的foot1"); adapter.addFootView(footView1); recyclerView.setAdapter(adapter); List<Object> list = new ArrayList<>(); for (int i = 0; i < 3; i++) { if (i == 1) { list.add(new TextBean("FullSpanTextViewManager充满宽度Item")); } list.add(new ImageBean(R.drawable.img1)); list.add(new ImageTextBean(R.drawable.img2, "BBB" + i)); } adapter.setDataItems(list); }