Ablepsia 是一个可以替代 startActivity() 的框架

网友投稿 762 2022-10-24 10:56:05

Ablepsia 是一个可以替代 startActivity() 的框架

Ablepsia(放弃维护)

Simplify startActivity() ,More convenient transmission parameters;Intercept startActivity,Redirect to the other Activity;

#Use it#

///////////////////////////////////////////// //// Start Activity //// /////////////////////////////////////////////Intent intent = new Intent(context,TargetActivity.class);intent.putExtra("name","tom");intent.putExtra("age",100);intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);context.startActivity(intent);//native start ↑ ------------------------ Ablepsia start ↓Ablepsia.kv("name","tom").kv("age",100).flags(Intent.FLAG_ACTIVITY_NEW_TASK).open(context,TargetActivity.class);

///////////////////////////////////////////// //// Intercept Activity //// /////////////////////////////////////////////@Symptom(ActivityIntercept.SYMPTOM_LOGIN)class TargetActivity extends AppCompatActivity {}class ActivityIntercept extends Doctor { static final String SYMPTOM_LOGIN = "Login is required to open"; static final String KEY_LOGIN = "Go to login"; @Override protected Anagraph treatment(String symptom, Context context, Class targetActivity) { switch (symptom) { case SYMPTOM_LOGIN: if (SignInStatus.isSign()) return Anagraph.alive(); else { Ablepsia.open(context, LoginActivity.class); return Anagraph.detained(KEY_LOGIN); } default: return Anagraph.die(); } }}//LoginActivity#loginOk()void loginOk() { ActivityIntercept.alive(ActivityIntercept.KEY_LOGIN); finish();}//...Activity#start()void start(){ Ablepsia.open(context,TargetActivity.class);}

///////////////////////////////////////////// //// Start Activity For Result //// /////////////////////////////////////////////int requestCode = 1024;Ablepsia.open(context,TargetActivity.class,requestCode);

///////////////////////////////////////////// //// Animation Bundle //// /////////////////////////////////////////////Bundle animaB = ActivityOptionsCompat.makeSceneTransitionAnimation(this, view, "sharedElementName").toBundle();Ablepsia.options(animaB).open(this, TargetActivity.class);

Gradle

allprojects { repositories { ... maven { url "https://jitpack.io" } } } ...dependencies { compile 'com.github.XiaoGerGer:Ablepsia:v1.0.7' }

Other

Ablepsia.jar only 16 KB,Does not make your application bulge

Have questions please email me

is.me.xiao@gmail.comimprott@163.com

License

Copyright 2016 XiaoGerGer Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:[easyUI]datagrid用法
下一篇:Infer.NET- 基于模型的机器学习框架
相关文章