Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
门心叼龙
android-custom-view
提交
f7a565bd
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 搜索 >>
提交
f7a565bd
编写于
11月 13, 2019
作者:
门心叼龙
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
code perfecty
上级
0f01e5df
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
205 addition
and
1 deletion
+205
-1
app/src/main/AndroidManifest.xml
app/src/main/AndroidManifest.xml
+9
-1
app/src/main/aidl/com/mxdl/customview/IMyAidlInterface.aidl
app/src/main/aidl/com/mxdl/customview/IMyAidlInterface.aidl
+15
-0
app/src/main/java/com/mxdl/customview/MainActivity.java
app/src/main/java/com/mxdl/customview/MainActivity.java
+7
-0
app/src/main/java/com/mxdl/customview/TestServiceActivity.java
...rc/main/java/com/mxdl/customview/TestServiceActivity.java
+56
-0
app/src/main/java/com/mxdl/customview/service/IMyService.java
...src/main/java/com/mxdl/customview/service/IMyService.java
+12
-0
app/src/main/java/com/mxdl/customview/service/TestService.java
...rc/main/java/com/mxdl/customview/service/TestService.java
+37
-0
app/src/main/java/com/mxdl/customview/service/TestService1.java
...c/main/java/com/mxdl/customview/service/TestService1.java
+51
-0
app/src/main/res/layout/activity_main.xml
app/src/main/res/layout/activity_main.xml
+7
-0
app/src/main/res/layout/activity_test_service.xml
app/src/main/res/layout/activity_test_service.xml
+11
-0
未找到文件。
app/src/main/AndroidManifest.xml
浏览文件 @
f7a565bd
...
...
@@ -12,7 +12,13 @@
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
>
<activity
android:name=
".WindowManagerActivity"
></activity>
<service
android:name=
".service.TestService1"
android:enabled=
"true"
android:exported=
"true"
></service>
<activity
android:name=
".TestServiceActivity"
/>
<activity
android:name=
".WindowManagerActivity"
/>
<activity
android:name=
".test.view1.SticyLayout2Activity"
/>
<activity
android:name=
".test.view1.ExpandableListView2Activity"
/>
<activity
android:name=
".test.view1.ViewPagerTest2Activity"
/>
...
...
@@ -36,6 +42,8 @@
</activity>
<activity
android:name=
".StickyLayoutActivity"
/>
<activity
android:name=
".HorizontalScrollViewExActivity"
/>
<service
android:name=
".service.TestService"
/>
</application>
</manifest>
\ No newline at end of file
app/src/main/aidl/com/mxdl/customview/IMyAidlInterface.aidl
0 → 100644
浏览文件 @
f7a565bd
//
IMyAidlInterface
.
aidl
package
com
.
mxdl
.
customview
;
//
Declare
any
non
-
default
types
here
with
import
statements
interface
IMyAidlInterface
{
/**
*
Demonstrates
some
basic
types
that
you
can
use
as
parameters
*
and
return
values
in
AIDL
.
*/
void
basicTypes
(
int
anInt
,
long
aLong
,
boolean
aBoolean
,
float
aFloat
,
double
aDouble
,
String
aString
);
void
test
(
String
name
);
String
test1
(
String
name
);
}
app/src/main/java/com/mxdl/customview/MainActivity.java
浏览文件 @
f7a565bd
package
com.mxdl.customview
;
import
android.app.Service
;
import
android.content.Intent
;
import
androidx.appcompat.app.AppCompatActivity
;
...
...
@@ -27,6 +28,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
private
Button
mBtnCaptrueView
;
private
Button
mBtnCricleCapture
;
private
Button
mBtnRectCapture
;
private
Button
mBtnService
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
...
@@ -38,6 +40,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
mBtnCaptrueView
=
findViewById
(
R
.
id
.
btn_capture_square
);
mBtnCricleCapture
=
findViewById
(
R
.
id
.
btn_capture_cricle
);
mBtnRectCapture
=
findViewById
(
R
.
id
.
btn_capture_rect
);
mBtnService
=
findViewById
(
R
.
id
.
btn_service
);
mBtnStickyLayout
.
setOnClickListener
(
this
);
mBtnHorizontalScrollViewEx
.
setOnClickListener
(
this
);
...
...
@@ -45,6 +48,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
mBtnCaptrueView
.
setOnClickListener
(
this
);
mBtnCricleCapture
.
setOnClickListener
(
this
);
mBtnRectCapture
.
setOnClickListener
(
this
);
mBtnService
.
setOnClickListener
(
this
);
}
...
...
@@ -69,6 +73,9 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
case
R
.
id
.
btn_capture_cricle
:
startActivity
(
new
Intent
(
this
,
CaptureCricleViewActivity
.
class
));
break
;
case
R
.
id
.
btn_service
:
startActivity
(
new
Intent
(
this
,
TestServiceActivity
.
class
));
break
;
}
...
...
app/src/main/java/com/mxdl/customview/TestServiceActivity.java
0 → 100644
浏览文件 @
f7a565bd
package
com.mxdl.customview
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.ServiceConnection
;
import
android.os.Bundle
;
import
android.os.IBinder
;
import
android.os.RemoteException
;
import
android.util.Log
;
import
android.view.View
;
import
com.mxdl.customview.service.IMyService
;
import
com.mxdl.customview.service.TestService
;
import
com.mxdl.customview.service.TestService1
;
public
class
TestServiceActivity
extends
AppCompatActivity
{
private
IMyAidlInterface
mMyService
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_test_service
);
findViewById
(
R
.
id
.
btn_bind_service
).
setOnClickListener
(
new
View
.
OnClickListener
(){
@Override
public
void
onClick
(
View
v
)
{
bindService
();
}
});
}
private
void
bindService
()
{
bindService
(
new
Intent
(
TestServiceActivity
.
this
,
TestService1
.
class
),
new
ServiceConnection
()
{
@Override
public
void
onServiceConnected
(
ComponentName
name
,
IBinder
service
)
{
mMyService
=
IMyAidlInterface
.
Stub
.
asInterface
(
service
);
//mMyService = (IMyAidlInterface) service;
Log
.
v
(
"MYTAG"
,
"onServiceConnected succ"
);
try
{
String
result
=
mMyService
.
test1
(
"fafafa"
);
Log
.
v
(
"MYTAG"
,
result
);
}
catch
(
RemoteException
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
onServiceDisconnected
(
ComponentName
name
)
{
}
},
Context
.
BIND_AUTO_CREATE
);
}
}
app/src/main/java/com/mxdl/customview/service/IMyService.java
0 → 100644
浏览文件 @
f7a565bd
package
com.mxdl.customview.service
;
/**
* Description: <IMyService><br>
* Author: mxdl<br>
* Date: 2019/11/13<br>
* Version: V1.0.0<br>
* Update: <br>
*/
public
interface
IMyService
{
void
test
();
}
app/src/main/java/com/mxdl/customview/service/TestService.java
0 → 100644
浏览文件 @
f7a565bd
package
com.mxdl.customview.service
;
import
android.app.Service
;
import
android.content.Intent
;
import
android.os.Binder
;
import
android.os.IBinder
;
import
android.util.Log
;
import
androidx.annotation.Nullable
;
/**
* Description: <TestService><br>
* Author: mxdl<br>
* Date: 2019/11/13<br>
* Version: V1.0.0<br>
* Update: <br>
*/
public
class
TestService
extends
Service
{
MyService
bind
;
@Override
public
void
onCreate
()
{
bind
=
new
MyService
();
}
@Nullable
@Override
public
IBinder
onBind
(
Intent
intent
)
{
return
bind
;
}
class
MyService
extends
Binder
implements
IMyService
{
@Override
public
void
test
()
{
Log
.
v
(
"MYTAG"
,
"hello world..."
);
}
}
}
app/src/main/java/com/mxdl/customview/service/TestService1.java
0 → 100644
浏览文件 @
f7a565bd
package
com.mxdl.customview.service
;
import
android.app.Service
;
import
android.content.Intent
;
import
android.os.IBinder
;
import
android.os.RemoteException
;
import
android.util.Log
;
import
com.mxdl.customview.IMyAidlInterface
;
public
class
TestService1
extends
Service
{
MyService
binder
;
@Override
public
void
onCreate
()
{
Log
.
v
(
"MYTAG"
,
"onCreate"
);
binder
=
new
MyService
();
}
public
TestService1
()
{
}
@Override
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
Log
.
v
(
"MYTAG"
,
"onStartCommand"
);
return
super
.
onStartCommand
(
intent
,
flags
,
startId
);
}
@Override
public
IBinder
onBind
(
Intent
intent
)
{
Log
.
v
(
"MYTAG"
,
"onBind"
);
return
binder
;
}
class
MyService
extends
IMyAidlInterface
.
Stub
{
@Override
public
void
basicTypes
(
int
anInt
,
long
aLong
,
boolean
aBoolean
,
float
aFloat
,
double
aDouble
,
String
aString
)
throws
RemoteException
{
}
@Override
public
void
test
(
String
name
)
throws
RemoteException
{
}
@Override
public
String
test1
(
String
name
)
throws
RemoteException
{
return
"hahaha:"
+
name
;
}
}
}
app/src/main/res/layout/activity_main.xml
浏览文件 @
f7a565bd
...
...
@@ -49,5 +49,12 @@
android:layout_height=
"wrap_content"
android:text=
"CaptureCricleView"
android:textAllCaps=
"false"
/>
<Button
android:id=
"@+id/btn_service"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"TestService"
android:textAllCaps=
"false"
/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
app/src/main/res/layout/activity_test_service.xml
0 → 100644
浏览文件 @
f7a565bd
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<Button
android:id=
"@+id/btn_bind_service"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"绑定服务"
/>
</LinearLayout>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录