Skip to content

Commit 9490d68

Browse files
committed
Create InitProvider
1 parent aaf4af5 commit 9490d68

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright 2018 JessYan
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package me.jessyan.autosize;
17+
18+
import android.app.Application;
19+
import android.content.ContentProvider;
20+
import android.content.ContentValues;
21+
import android.database.Cursor;
22+
import android.net.Uri;
23+
24+
/**
25+
* ================================================
26+
* 通过声明 {@link ContentProvider} 自动完成初始化
27+
* Created by JessYan on 2018/8/19 11:55
28+
* <a href="mailto:[email protected]">Contact me</a>
29+
* <a href="https://github.com/JessYanCoding">Follow me</a>
30+
* ================================================
31+
*/
32+
public class InitProvider extends ContentProvider {
33+
@Override
34+
public boolean onCreate() {
35+
AutoSizeConfig.getInstance()
36+
.setLog(true)
37+
.init((Application) getContext().getApplicationContext())
38+
.setUseDeviceSize(false);
39+
return true;
40+
}
41+
42+
@Override
43+
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
44+
return null;
45+
}
46+
47+
@Override
48+
public String getType(Uri uri) {
49+
return null;
50+
}
51+
52+
@Override
53+
public Uri insert(Uri uri, ContentValues values) {
54+
return null;
55+
}
56+
57+
@Override
58+
public int delete(Uri uri, String selection, String[] selectionArgs) {
59+
return 0;
60+
}
61+
62+
@Override
63+
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
64+
return 0;
65+
}
66+
}

0 commit comments

Comments
 (0)