commit
615aba5b03
@ -0,0 +1,15 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
@ -0,0 +1,8 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="17" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="FrameworkDetectionExcludesConfiguration">
|
||||
<file type="web" url="file://$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1 @@
|
||||
/build
|
@ -0,0 +1,47 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'net.micode.notes'
|
||||
compileSdk 33
|
||||
|
||||
defaultConfig {
|
||||
applicationId "net.micode.notes"
|
||||
minSdk 24
|
||||
targetSdk 33
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
exclude 'mozilla/public-suffix-list.txt'
|
||||
exclude 'META-INF/DEPENDENCIES'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||
implementation 'com.google.android.material:material:1.5.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||
implementation 'com.google.firebase:firebase-crashlytics-buildtools:2.8.1'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
implementation 'org.apache.httpcomponents:httpclient:4.5.13'
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
@ -0,0 +1,25 @@
|
||||
package net.micode.notes;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("net.micode.notes", appContext.getPackageName());
|
||||
}
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Minotesmaster"
|
||||
tools:targetApi="31">
|
||||
<!-- <activity-->
|
||||
<!-- android:name=".MainActivity"-->
|
||||
<!-- android:exported="true">-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.MAIN"/>-->
|
||||
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER"/>-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </activity>-->
|
||||
<!-- <uses-sdk android:minSdkVersion="14" tools:ignore="WrongManifestParent"/>-->
|
||||
|
||||
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:ignore="WrongManifestParent"/>-->
|
||||
<!-- <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"-->
|
||||
<!-- tools:ignore="WrongManifestParent"/>-->
|
||||
<!-- <uses-permission android:name="android.permission.INTERNET" tools:ignore="WrongManifestParent"/>-->
|
||||
<!-- <uses-permission android:name="android.permission.READ_CONTACTS" tools:ignore="WrongManifestParent"/>-->
|
||||
<!-- <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" tools:ignore="WrongManifestParent"/>-->
|
||||
<!-- <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" tools:ignore="WrongManifestParent"/>-->
|
||||
<!-- <uses-permission android:name="android.permission.GET_ACCOUNTS" tools:ignore="WrongManifestParent"/>-->
|
||||
<!-- <uses-permission android:name="android.permission.USE_CREDENTIALS" tools:ignore="WrongManifestParent"/>-->
|
||||
<!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" tools:ignore="WrongManifestParent"/>-->
|
||||
<activity
|
||||
android:name=".ui.NotesListActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/NoteTheme"
|
||||
android:uiOptions="splitActionBarWhenNarrow"
|
||||
android:windowSoftInputMode="adjustPan" android:exported="true">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".ui.NoteEditActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/NoteTheme" android:exported="true">
|
||||
|
||||
<intent-filter android:scheme="http" tools:ignore="AppLinkUrlError">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="vnd.android.cursor.item/text_note" />
|
||||
<data android:mimeType="vnd.android.cursor.item/call_note" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.INSERT_OR_EDIT" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="vnd.android.cursor.item/text_note" />
|
||||
<data android:mimeType="vnd.android.cursor.item/call_note" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEARCH" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.app.searchable"
|
||||
android:resource="@xml/searchable" />
|
||||
</activity>
|
||||
|
||||
<provider
|
||||
android:name="net.micode.notes.data.NotesProvider"
|
||||
android:authorities="micode_notes"
|
||||
android:multiprocess="true" />
|
||||
|
||||
<receiver
|
||||
android:name=".widget.NoteWidgetProvider_2x"
|
||||
android:label="@string/app_widget2x2" android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
<action android:name="android.appwidget.action.APPWIDGET_DELETED" />
|
||||
<action android:name="android.intent.action.PRIVACY_MODE_CHANGED" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/widget_2x_info" />
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name=".widget.NoteWidgetProvider_4x"
|
||||
android:label="@string/app_widget4x4" android:exported="true">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
|
||||
<action android:name="android.appwidget.action.APPWIDGET_DELETED" />
|
||||
<action android:name="android.intent.action.PRIVACY_MODE_CHANGED" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/widget_4x_info" />
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".ui.AlarmInitReceiver" android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<receiver
|
||||
android:name="net.micode.notes.ui.AlarmReceiver"
|
||||
android:process=":remote" >
|
||||
</receiver>
|
||||
|
||||
<activity
|
||||
android:name=".ui.AlarmAlertActivity"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleInstance"
|
||||
android:theme="@android:style/Theme.Holo.Wallpaper.NoTitleBar" >
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name="net.micode.notes.ui.NotesPreferenceActivity"
|
||||
android:label="@string/preferences_title"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@android:style/Theme.Holo.Light" >
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name="net.micode.notes.gtask.remote.GTaskSyncService"
|
||||
android:exported="false" >
|
||||
</service>
|
||||
|
||||
<meta-data
|
||||
android:name="android.app.default_searchable"
|
||||
android:value=".ui.NoteEditActivity" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (c) 2010-2011, The MiCode Open Source Community (www.micode.net)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.micode.notes.data;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.provider.ContactsContract.CommonDataKinds.Phone;
|
||||
import android.provider.ContactsContract.Data;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class Contact {
|
||||
private static HashMap<String, String> sContactCache;
|
||||
private static final String TAG = "Contact";
|
||||
|
||||
private static final String CALLER_ID_SELECTION = "PHONE_NUMBERS_EQUAL(" + Phone.NUMBER
|
||||
+ ",?) AND " + Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'"
|
||||
+ " AND " + Data.RAW_CONTACT_ID + " IN "
|
||||
+ "(SELECT raw_contact_id "
|
||||
+ " FROM phone_lookup"
|
||||
+ " WHERE min_match = '+')";
|
||||
|
||||
public static String getContact(Context context, String phoneNumber) {
|
||||
if(sContactCache == null) {
|
||||
sContactCache = new HashMap<String, String>();
|
||||
}
|
||||
|
||||
if(sContactCache.containsKey(phoneNumber)) {
|
||||
return sContactCache.get(phoneNumber);
|
||||
}
|
||||
|
||||
String selection = CALLER_ID_SELECTION.replace("+",
|
||||
PhoneNumberUtils.toCallerIDMinMatch(phoneNumber));
|
||||
Cursor cursor = context.getContentResolver().query(
|
||||
Data.CONTENT_URI,
|
||||
new String [] { Phone.DISPLAY_NAME },
|
||||
selection,
|
||||
new String[] { phoneNumber },
|
||||
null);
|
||||
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
try {
|
||||
String name = cursor.getString(0);
|
||||
sContactCache.put(phoneNumber, name);
|
||||
return name;
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
Log.e(TAG, " Cursor get string error " + e.toString());
|
||||
return null;
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "No contact matched with number:" + phoneNumber);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue