@Nullable @Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { JUtils.Log("onCreateView begin"); View v = super.onCreateView(inflater, container, savedInstanceState); JUtils.Log("onCreateView end"); return v; }
private void checkInput() { if (number.getText().toString().length() != 11) { JUtils.Toast("请输入正确手机号"); return; } if (password.getText().toString().length() < 6 || password.getText().toString().length() > 12) { JUtils.Toast("请输入6-12位密码"); return; } getPresenter().login(number.getText().toString(), password.getText().toString()); }
public RegionVH(View view) { super(new MaterialRippleLayout(view.getContext())); tv = new TextView(getContext()); tv.setLayoutParams( new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, JUtils.dip2px(48))); tv.setGravity(Gravity.CENTER); ((MaterialRippleLayout) itemView).addView(tv); ((MaterialRippleLayout) itemView) .setRippleColor(getContext().getResources().getColor(R.color.gray)); itemView.setLayoutParams( new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, JUtils.dip2px(48))); }
@Override public View onCreateView(ViewGroup parent) { MaterialRippleLayout layout = new MaterialRippleLayout(getContext()); TextView tv = new TextView(parent.getContext()); tv.setLayoutParams( new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, JUtils.dip2px(48))); tv.setGravity(Gravity.CENTER); tv.setText(title); layout.addView(tv); layout.setRippleColor(getContext().getResources().getColor(R.color.gray)); layout.setLayoutParams( new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, JUtils.dip2px(48))); return layout; }
@Override public void onCreate() { StrictModeUtil.init(); super.onCreate(); refWatcher = LeakCanary.install(this); mContext = this; ImageLoadProxy.initImageLoader(this); JUtils.initialize(this); new Thread( new Runnable() { @Override public void run() { mAllArea = AreaArrayDataHelper.getAll(mContext); } }) .start(); if (BuildConfig.DEBUG) { Logger.init().hideThreadInfo().setMethodCount(1).setLogLevel(LogLevel.FULL); } Stetho.initializeWithDefaults(this); Stetho.initialize( Stetho.newInitializerBuilder(this) .enableDumpapp(Stetho.defaultDumperPluginsProvider(this)) .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this)) .build()); // 全局捕获异常 MyCrashHandler handler = MyCrashHandler.getInstance(); Thread.currentThread().setUncaughtExceptionHandler(handler); }
private void check() { if (passwordOriginal.getText().toString().length() < 6 || passwordOriginal.getText().toString().length() > 12) { JUtils.Toast("请输入6-12位旧密码"); return; } if (passwordNew.getText().toString().length() < 6 || passwordNew.getText().toString().length() > 12) { JUtils.Toast("请输入6-12位密码"); return; } if (!passwordConfirm.getText().toString().equals(passwordNew.getText().toString())) { JUtils.Toast("2次密码不一致"); return; } getPresenter().edit(passwordOriginal.getText().toString(), passwordNew.getText().toString()); }
@Override public Fragment getItem(int position) { JUtils.Log("position:" + position); Fragment f = new BlogListFragment(); Bundle b = new Bundle(); b.putInt("style", position); f.setArguments(b); return f; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ButterKnife.inject(this, getWindow().getDecorView()); search.setOnClickListener( v -> { JUtils.closeInputMethod(this); recycler.showProgress(); getPresenter().search(word.getText().toString()); }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ButterKnife.inject(this, getWindow().getDecorView()); word.addTextChangedListener( new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {} @Override public void onTextChanged(CharSequence s, int start, int before, int count) {} @Override public void afterTextChanged(Editable s) { getPresenter().search(word.getText().toString()); } }); search.setOnClickListener( v -> { JUtils.closeInputMethod(this); }); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); JUtils.Log("View onCreate"); }
private void initView() { setOrientation(HORIZONTAL); setBackgroundColor(Color.WHITE); province = new RecyclerView(getContext()); province.setLayoutParams(new LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1)); province.setLayoutManager(new LinearLayoutManager(getContext())); province.setAdapter( (provinceAdapter = new RegionAdapter( getContext(), new RegionSelectCallback() { @Override public void selected(Region region) { cityAdapter.clear(); cityAdapter.addAll(RegionModel.getInstance().getCityList(region.getCid())); cityHeader.setRegion(region); regionAdapter.clear(); regionAdapter.addAll( RegionModel.getInstance().getRegionList(cityAdapter.getItem(0).getCid())); } }))); addView(province); View divider1 = new View(getContext()); divider1.setLayoutParams( new LayoutParams(JUtils.dip2px(0.3f), ViewGroup.LayoutParams.MATCH_PARENT)); divider1.setBackgroundColor(Color.GRAY); addView(divider1); city = new RecyclerView(getContext()); city.setLayoutParams(new LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1)); city.setLayoutManager(new LinearLayoutManager(getContext())); city.setAdapter( (cityAdapter = new RegionAdapter( getContext(), new RegionSelectCallback() { @Override public void selected(Region region) { regionAdapter.clear(); regionAdapter.addAll(RegionModel.getInstance().getRegionList(region.getCid())); regionHeader.setRegion(region); } }))); addView(city); View divider2 = new View(getContext()); divider2.setLayoutParams( new LayoutParams(JUtils.dip2px(0.3f), ViewGroup.LayoutParams.MATCH_PARENT)); divider2.setBackgroundColor(Color.GRAY); addView(divider2); region = new RecyclerView(getContext()); region.setLayoutParams(new LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1)); region.setLayoutManager(new LinearLayoutManager(getContext())); region.setAdapter( (regionAdapter = new RegionAdapter( getContext(), new RegionSelectCallback() { @Override public void selected(Region region) { callback.selected(region); } }))); addView(region); }