Skip to content

在开发过程中为了做一些功能模块的接口调试或为了深入了解某个API接口或者为了研究某个开源库避免不了写一些调试demo。但是每次建立demo 都避免不了新建工程,写ui button 绑定事件 等等... 比较麻烦。并且demo会越来越多,难于管理。这个lib能帮助快速建立demo入口并能通过结构化代码来管理好自己写过的demo代码。

javalive09/CodeBag

Repository files navigation

CodeBag

A lib for accumulate your codes and unit test.

Feature

  • support view test unit with just one line code
  • verify api or app feature with one line code
  • collection your owen code

Import Library

Gradle: add dependencies as follow

implementation 'com.javalive09.codebag:codebag:1.6.8'

Usage

  • Launch
CodeBag.Launch(context);
  • Create a file class with annotation of @Run method(the parameters must be CodeActivity) as the entrance and you can custom class name @Code(name = "HelloWorld 示例") and custom method name as below)

     public class HelloWorld {
     
             @Run
             public void log(CodeActivity codeActivity) {
                 Log.e("HelloWorld", "log");
             }
         
             @Run
             public void showView(CodeActivity codeActivity) {
                 codeActivity.setContentView(R.layout.shape);
             }
         
             @Run
             public void showText(CodeActivity codeActivity) {
                 codeActivity.showText("hello world!!");
             }
         
         
             @Run(name = "启动其他activity")
             public void startActivity(CodeActivity activity) {
                 activity.startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS));
             }
    
             @Run
             public void addButtons(CodeActivity activity) {
                 activity.addClickButton("finish", new View.OnClickListener() {
                     @Override
                     public void onClick(View v) {
                         activity.finish();
                     }
                 });
                 activity.addClickButton("toast", new View.OnClickListener() {
                     @Override
                     public void onClick(View v) {
                         Toast.makeText(activity, "toast", Toast.LENGTH_LONG).show();
                     }
                 });
             }
     
     }
    

Plugin

https://github.com/javalive09/CodeBagPlugin 下载zip包

License

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://www.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.

About

在开发过程中为了做一些功能模块的接口调试或为了深入了解某个API接口或者为了研究某个开源库避免不了写一些调试demo。但是每次建立demo 都避免不了新建工程,写ui button 绑定事件 等等... 比较麻烦。并且demo会越来越多,难于管理。这个lib能帮助快速建立demo入口并能通过结构化代码来管理好自己写过的demo代码。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages