Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
门心叼龙
android-custom-view
提交
1b64a284
A
android-custom-view
项目概览
门心叼龙
/
android-custom-view
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
android-custom-view
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1b64a284
编写于
11月 21, 2019
作者:
门心叼龙
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code perfect
上级
b2521ccc
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
127 addition
and
3 deletion
+127
-3
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+8
-1
app/src/main/java/com/mxdl/customview/MainActivity.java
app/src/main/java/com/mxdl/customview/MainActivity.java
+30
-2
app/src/main/java/com/mxdl/customview/provider/MyContentProvider.java
.../java/com/mxdl/customview/provider/MyContentProvider.java
+51
-0
app/src/main/java/com/mxdl/customview/uml/ContentProvider.puml
...rc/main/java/com/mxdl/customview/uml/ContentProvider.puml
+23
-0
app/src/main/java/com/mxdl/customview/uml/ContentResolver.puml
...rc/main/java/com/mxdl/customview/uml/ContentResolver.puml
+15
-0
未找到文件。
app/src/main/AndroidManifest.xml
浏览文件 @
1b64a284
...
@@ -12,10 +12,17 @@
...
@@ -12,10 +12,17 @@
android:roundIcon=
"@mipmap/ic_launcher_round"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
>
android:theme=
"@style/AppTheme"
>
<provider
android:name=
".provider.MyContentProvider"
android:authorities=
"com.test.provider"
android:process=
":remote"
android:enabled=
"true"
android:exported=
"true"
/>
<service
<service
android:name=
".service.TestService1"
android:name=
".service.TestService1"
android:enabled=
"true"
android:enabled=
"true"
android:exported=
"true"
></service
>
android:exported=
"true"
/
>
<activity
android:name=
".TestServiceActivity"
/>
<activity
android:name=
".TestServiceActivity"
/>
<activity
android:name=
".WindowManagerActivity"
/>
<activity
android:name=
".WindowManagerActivity"
/>
...
...
app/src/main/java/com/mxdl/customview/MainActivity.java
浏览文件 @
1b64a284
package
com.mxdl.customview
;
package
com.mxdl.customview
;
import
android.annotation.TargetApi
;
import
android.app.Service
;
import
android.app.Service
;
import
android.content.Intent
;
import
android.content.Intent
;
import
androidx.annotation.RequiresApi
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.Menu
;
import
android.view.Menu
;
import
android.view.MenuItem
;
import
android.view.MenuItem
;
import
android.view.View
;
import
android.view.View
;
...
@@ -13,6 +19,11 @@ import android.widget.Button;
...
@@ -13,6 +19,11 @@ import android.widget.Button;
import
com.mxdl.customview.test.MainTestActivity
;
import
com.mxdl.customview.test.MainTestActivity
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Locale
;
/**
/**
* Description: <MainActivity><br>
* Description: <MainActivity><br>
* Author: mxdl<br>
* Author: mxdl<br>
...
@@ -50,6 +61,18 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
...
@@ -50,6 +61,18 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
mBtnRectCapture
.
setOnClickListener
(
this
);
mBtnRectCapture
.
setOnClickListener
(
this
);
mBtnService
.
setOnClickListener
(
this
);
mBtnService
.
setOnClickListener
(
this
);
}
@TargetApi
(
Build
.
VERSION_CODES
.
N
)
public
Locale
getCurrentLocale
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
N
)
{
return
getResources
().
getConfiguration
().
getLocales
().
get
(
0
);
}
else
{
//noinspection deprecation
return
getResources
().
getConfiguration
().
locale
;
}
}
}
@Override
@Override
...
@@ -75,6 +98,11 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
...
@@ -75,6 +98,11 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
break
;
break
;
case
R
.
id
.
btn_service
:
case
R
.
id
.
btn_service
:
startActivity
(
new
Intent
(
this
,
TestServiceActivity
.
class
));
startActivity
(
new
Intent
(
this
,
TestServiceActivity
.
class
));
Uri
uri
=
Uri
.
parse
(
"content://com.test.provider"
);
getContentResolver
().
query
(
uri
,
null
,
null
,
null
,
null
);
getContentResolver
().
query
(
uri
,
null
,
null
,
null
,
null
);
getContentResolver
().
query
(
uri
,
null
,
null
,
null
,
null
);
break
;
break
;
}
}
...
@@ -83,13 +111,13 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
...
@@ -83,13 +111,13 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
@Override
@Override
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
public
boolean
onCreateOptionsMenu
(
Menu
menu
)
{
getMenuInflater
().
inflate
(
R
.
menu
.
menu_test
,
menu
);
getMenuInflater
().
inflate
(
R
.
menu
.
menu_test
,
menu
);
return
super
.
onCreateOptionsMenu
(
menu
);
return
super
.
onCreateOptionsMenu
(
menu
);
}
}
@Override
@Override
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
public
boolean
onOptionsItemSelected
(
MenuItem
item
)
{
if
(
item
.
getItemId
()
==
R
.
id
.
test
)
{
if
(
item
.
getItemId
()
==
R
.
id
.
test
)
{
startActivity
(
new
Intent
(
this
,
MainTestActivity
.
class
));
startActivity
(
new
Intent
(
this
,
MainTestActivity
.
class
));
}
}
return
super
.
onOptionsItemSelected
(
item
);
return
super
.
onOptionsItemSelected
(
item
);
...
...
app/src/main/java/com/mxdl/customview/provider/MyContentProvider.java
0 → 100644
浏览文件 @
1b64a284
package
com.mxdl.customview.provider
;
import
android.content.ContentProvider
;
import
android.content.ContentValues
;
import
android.database.Cursor
;
import
android.net.Uri
;
import
android.util.Log
;
public
class
MyContentProvider
extends
ContentProvider
{
public
MyContentProvider
()
{
}
@Override
public
int
delete
(
Uri
uri
,
String
selection
,
String
[]
selectionArgs
)
{
// Implement this to handle requests to delete one or more rows.
Log
.
v
(
"MYTAG"
,
"delete"
);
return
0
;
}
@Override
public
String
getType
(
Uri
uri
)
{
Log
.
v
(
"MYTAG"
,
"getType"
);
return
null
;
}
@Override
public
Uri
insert
(
Uri
uri
,
ContentValues
values
)
{
Log
.
v
(
"MYTAG"
,
"insert..."
);
return
null
;
}
@Override
public
boolean
onCreate
()
{
Log
.
v
(
"MYTAG"
,
"onCreate..."
);
Log
.
v
(
"MYTAG"
,
"currThread:"
+
Thread
.
currentThread
().
getName
());
return
false
;
}
@Override
public
Cursor
query
(
Uri
uri
,
String
[]
projection
,
String
selection
,
String
[]
selectionArgs
,
String
sortOrder
)
{
Log
.
v
(
"MYTAG"
,
"query..."
);
Log
.
v
(
"MYTAG"
,
"currThread:"
+
Thread
.
currentThread
().
getName
());
return
null
;
}
@Override
public
int
update
(
Uri
uri
,
ContentValues
values
,
String
selection
,
String
[]
selectionArgs
)
{
Log
.
v
(
"MYTAG"
,
"update..."
);
return
0
;
}
}
app/src/main/java/com/mxdl/customview/uml/ContentProvider.puml
0 → 100644
浏览文件 @
1b64a284
@startuml
'ActivityThread.main
'ActivityThread.attach
'ActivityManagerService.attachApplication
'ActivityManagerService.attachApplicationLocked
'ApplicationThread.bindApplication
'ActivityThread.handleBindApplication
'ActivityThread.installContentProviders
'ActivityThread.installProvider
'ContentProvider.attachInfo
'ContentProvider.onCreate
ActivityThread -> ActivityThread : main
ActivityThread -> ActivityThread :attach
ActivityThread -> ActivityManagerService:attachApplication
ActivityManagerService -> ActivityManagerService:attachApplicationLocked
ActivityManagerService -> ApplicationThread:bindApplication
ApplicationThread -> ActivityThread:handleBindApplication
ActivityThread -> ActivityThread :installContentProviders
ActivityThread -> ActivityThread :installContentProviders
ActivityThread -> ActivityThread :installProvider
ActivityThread -> ContentProvider :attachInfo
ContentProvider -> ContentProvider :onCreate
@enduml
\ No newline at end of file
app/src/main/java/com/mxdl/customview/uml/ContentResolver.puml
0 → 100644
浏览文件 @
1b64a284
@startuml
'ContentResolver.query
'ApplicationContentResolver.query
'ActivityThread.acquireProvider
'ActivityManagerService.getContentProvider
'Transport.query
'ContentProvider.query
ContextImpl -> ContentResolver :query
ContentResolver -> ApplicationContentResolver :query
ApplicationContentResolver -> ActivityThread:acquireProvider
ActivityThread -> ActivityManagerService:getContentProvider
ActivityManagerService -> Transport:query
Transport -> ContentProvider:query
@enduml
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录