context

android textview 自动换行 整齐排版

杀马特。学长 韩版系。学妹 提交于 2020-01-20 11:03:38
package cc.snser.test; import android.content.Context; import android.graphics.Paint; import android.text.TextUtils; import android.util.AttributeSet; import android.widget.TextView; public class AutoSplitTextView extends TextView { private boolean mEnabled = true; public AutoSplitTextView(Context context) { super(context); } public AutoSplitTextView(Context context, AttributeSet attrs) { super(context, attrs); } public AutoSplitTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public void setAutoSplitEnabled(boolean enabled) { mEnabled = enabled;

Spring学习系列(二) 自动化装配Bean

☆樱花仙子☆ 提交于 2020-01-20 11:02:56
一、Spring装配-自动化装配 @Component和@ComponentScan 通过spring注解(@Component)来表明该类会作为组件类,并告知Spring要为这类创建bean,不过组件扫描默认是不启动的,需要显式的配置Spring,从而命令Spring去寻找带有(@Component)注解的类,并为其创建bean。 1、定义接口 package com.seven.springTest.service; public interface HelloWorldApi { public void sayHello(); } 2、定义接口的实现类 package com.seven.springTest.service.impl; import org.springframework.stereotype.Component; import com.seven.springTest.service.HelloWorldApi; @Component //通过注解指定该类组件类,告知spring要为它创建Bean public class PersonHelloWorld implements HelloWorldApi { @Override public void sayHello() { System.out.println("Hello World,This Is

Springboot 应用启动原理分析

梦想与她 提交于 2020-01-20 10:54:18
在 spring boot 中,很吸引人的一个特性是可以直接把应用打包称为一个 jar/war,这个 jar/war 是可以直接启动的,不需要额外配置 web server。 疑问 Spring boot 如何启动? Spring boot 内置的 embed tomcat 是如何工作的?静态文件,jsp,网页模板是如何加载到的? 打包为单个 jar 包时,spring boot 的启动方式 maven 打包之后,会生成两个 jar 文件: demo-0.0.1-SNAPSHOT.jar demo-0.0.1-SNAPSHOT.jar.original 其中 demo-0.0.1-SNAPSHOT.jar.original 是默认的 maven-jar-plugin 生成的包。demo-0.0.1-SNAPSHOT.jar 是 spring boot maven 插件生成的 jar 包,里面包含了应用的依赖,以及 spring boot 相关的类。 先来看看 spring boot 打包好的目录结构: ├── META-INF │ ├── MANIFEST.MF ├── application.properties ├── com │ └── example │ └── SpringBootDemoApplication.class ├── lib │ ├──

Spring Boot 开启 HTTPS

可紊 提交于 2020-01-20 10:16:33
操作系统:Windows 10 x64 java version “1.8.0_221” 获取证书 获取 SSL 证书主要有两种,一种是自己通过工具生成,另外一种是通过 SSL 证书服务商获取。 以下介绍使用 JDK 自带的 keytool 工具来生成 SSL 证书。 在命令行中输入命令 keytool -help 查看我们的 JDK 是否带有 keytool 工具。 若输出如下信息,则证明此 JDK 版本带有 keytool 工具。 密钥和证书管理工具 命令: -certreq 生成证书请求 -changealias 更改条目的别名 -delete 删除条目 -exportcert 导出证书 -genkeypair 生成密钥对 -genseckey 生成密钥 -gencert 根据证书请求生成证书 -importcert 导入证书或证书链 -importpass 导入口令 -importkeystore 从其他密钥库导入一个或所有条目 -keypasswd 更改条目的密钥口令 -list 列出密钥库中的条目 -printcert 打印证书内容 -printcertreq 打印证书请求的内容 -printcrl 打印 CRL 文件的内容 -storepasswd 更改密钥库的存储口令 使用 "keytool -command_name -help" 获取 command_name

Spring MVC - 静态页面

对着背影说爱祢 提交于 2020-01-20 02:48:19
环境搭建 以下示例显示如何使用 Spring MVC Framework 编写一个简单的基于Web的应用程序,它可以使用 <mvc:resources> 标记访问静态页面和动态页面。首先使用Intellij IDEA创建一个动态WEB项目,并按照以下步骤使用 Spring Web Framework 开发基于动态表单的Web应用程序: 创建一个简单的动态Web项目: StaticPages ,并在 src 目录下创建一个 com.ktao.controller 包。 在 com.ktao.controller 包下创建一个Java类 WebController 。 在pages子文件夹下创建一个静态文件 final.html 。 在web /WEB-INF 文件夹下创建一个Spring配置文件 StaticPages-servlet.xml ,如下所述。 最后一步是创建所有源和配置文件的内容并运行应用程序,如下所述。 完整的项目文件结构如下: 配置文件 web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi

Spring MVC - 静态页面

混江龙づ霸主 提交于 2020-01-20 02:44:05
环境搭建 以下示例显示如何使用 Spring MVC Framework 编写一个简单的基于Web的应用程序,它可以使用 <mvc:resources> 标记访问静态页面和动态页面。首先使用Intellij IDEA创建一个动态WEB项目,并按照以下步骤使用 Spring Web Framework 开发基于动态表单的Web应用程序: 创建一个简单的动态Web项目: StaticPages ,并在 src 目录下创建一个 com.ktao.controller 包。 在 com.ktao.controller 包下创建一个Java类 WebController 。 在pages子文件夹下创建一个静态文件 final.html 。 在 web /WEB-INF 文件夹下创建一个Spring配置文件 StaticPages-servlet.xml ,如下所述。 最后一步是创建所有源和配置文件的内容并运行应用程序,如下所述。 完整的项目文件结构如下: 配置文件 web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi

Flutter状态管理之路(一)

匆匆过客 提交于 2020-01-20 01:28:36
背景 原生提供了StatefulWidget这个有状态组件来管理状态,对于多组件的状态交互可以选择由父组件进行统一管理分发,但是当业务一旦复杂,组件树的分支足够多,会出现状态下沉过深入,状态传递复杂的问题。 简单情况是这样的: 随着功能的增加,你的应用程序将会有几十个甚至上百个状态。这个时候你的应用应该会是这样: 上述实际就是多个页面需要共享状态和传递信息场景下出现的,直接的做法是: 通过父widget来分发通知,有嵌套层级深的问题,父层级的setState导致不必要build问题 通过回调传递,同样存在传递深的问题 ,回调也会出现漏调用的问题 面临的问题 如何获取数据源 如何更新数据源 如何通知组件数据源更新 跨组件数据源如何共享 数据流概念 状态管理里会出现基于单向数据流的情况,这里先介绍下数据流的概念 单向数据流 state:驱动应用的数据源。 view:以声明方式将 state 映射到视图 。 actions:响应在 view 上的用户输入导致的状态变化 单向数据流的状态管理:通过定义和隔离状态管理中的各种概念并强制遵守一定的规则,我们的代码将会变得更结构化且易维护 特点: (1) 所有状态的改变可记录、可跟踪,源头易追溯; (2) 所有数据只有一份,组件数据只有唯一的入口和出口,使得程序更直观更容易理解,有利于应用的可维护性; (3) 一旦数据变化,就去更新页面(data

springboot代码摘记:highlight_spring4 ElConfig

人走茶凉 提交于 2020-01-20 01:22:17
package com.wisely.highlight_spring4.ch2.el; import org.apache.commons.io.IOUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.core.env.Environment; import org.springframework

Spring事务处理案例基于声明式(拦截器)-订单处理(添加订单)

ε祈祈猫儿з 提交于 2020-01-20 00:40:49
<?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <import resource="spring-dao.xml"/> <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">

功耗之使用job任务

蓝咒 提交于 2020-01-19 22:45:18
性能优化(8.5)-JobScheduler的源码分析 .JobSchedulerService 因为实例化一个JobSchedulerService类的时候,会执行构造函数的代码: public final class JobSchedulerService extends com.android.server.SystemService implements StateChangedListener, JobCompletedListener { final JobHandler mHandler;//主要处理任务到期,任务检查,任务结束等消息 final Constants mConstants;//存放一些常量 final JobSchedulerStub mJobSchedulerStub;//Binder接口的代理类 final JobStore mJobs;//里面维护了一个Job集合,从data/system/job/jobs.xml文件中读取的永久性任务 List mControllers;//控制器集合 … public JobSchedulerService(Context context) { super(context); //初始化 mHandler = new JobHandler(context.getMainLooper());