Пример #1
0
def generate_cm_file(cm_name):
    """生成cm代码"""
    template.generate_code_then_write(
        template.PathConfig.runtime_cm,
        initializer.AndroidConfig.generate_config_by_default_config(
        ).application_cm_path + '/' + cm_name + 'CM.java',
        package_name=initializer.AndroidConfig.get_package_name(),
        model_name=cm_name)
Пример #2
0
def generate_activity_file(layout_file_name, activity_name):
    """生成Activity代码"""
    view_by_ids_code = '\n    '.join(
        layout.Layout(layout_file_name).get_view_by_ids().split("\n"))
    template.generate_code_then_write(
        template.PathConfig.runtime_base_activity,
        initializer.AndroidConfig.generate_config_by_default_config(
        ).ui_activity_path + '/' + activity_name + 'Activity.java',
        package_name=initializer.AndroidConfig.get_package_name(),
        model_name=activity_name,
        layout_id=layout_file_name.split('.')[0],
        view_by_ids=view_by_ids_code)
Пример #3
0
def generate_cell_file(layout_file_name, cell_name):
    """生成cell代码"""
    view_by_ids_code = "\n    ".join(
        layout.Layout(layout_file_name).get_view_by_ids().split("\n"))
    template.generate_code_then_write(
        template.PathConfig.runtime_cell,
        initializer.AndroidConfig.generate_config_by_default_config(
        ).ui_cell_path + '/' + cell_name + 'Cell.java',
        package_name=initializer.AndroidConfig.get_package_name(),
        layout_id=layout_file_name.split('.')[0],
        model_name=cell_name,
        view_by_ids=view_by_ids_code)
Пример #4
0
def generate_container_file(container_type, container_name):
    """ 生成容器类文件 """
    if container_type == 'activity-title-content':
        template.generate_code_then_write(
            template.PathConfig.runtime_title_content_activity,
            initializer.AndroidConfig.generate_config_by_default_config(
            ).ui_activity_path + '/' + container_name + 'Activity.java',
            package_name=initializer.AndroidConfig.get_package_name(),
            model_name=container_name)
    if container_type == 'activity-content':
        template.generate_code_then_write(
            template.PathConfig.runtime_content_activity,
            initializer.AndroidConfig.generate_config_by_default_config(
            ).ui_activity_path + '/' + container_name + 'Activity.java',
            package_name=initializer.AndroidConfig.get_package_name(),
            model_name=container_name)
    if container_type == 'fragment-content':
        template.generate_code_then_write(
            template.PathConfig.runtime_content_fragment,
            initializer.AndroidConfig.generate_config_by_default_config(
            ).ui_fragment_path + '/' + container_name + 'Fragment.java',
            package_name=initializer.AndroidConfig.get_package_name(),
            model_name=container_name)
        pass
    if container_type == 'view-content':
        template.generate_code_then_write(
            template.PathConfig.runtime_content_view,
            initializer.AndroidConfig.generate_config_by_default_config(
            ).ui_view_path + '/' + container_name + 'ContentView.java',
            package_name=initializer.AndroidConfig.get_package_name(),
            model_name=container_name)