Compare commits
	
		
			9 Commits 
		
	
	
		
			master
			...
			wxx_branch
		
	
	| Author | SHA1 | Date | 
|---|---|---|
|  | 018e4ce6c3 | 5 months ago | 
|  | 1817cd9da1 | 5 months ago | 
|  | a65152fabe | 6 months ago | 
|  | 833334db7b | 6 months ago | 
|  | 207784a06b | 6 months ago | 
|  | 24d6560395 | 6 months ago | 
|  | 6d1d3a68ed | 6 months ago | 
|  | 4e16f84bdf | 6 months ago | 
|  | a9b4781db9 | 6 months ago | 
| @ -0,0 +1,2 @@ | ||||
| #Thu Mar 27 09:11:39 CST 2025 | ||||
| gradle.version=7.2 | ||||
| @ -0,0 +1,3 @@ | ||||
| # Default ignored files | ||||
| /shelf/ | ||||
| /workspace.xml | ||||
| @ -0,0 +1 @@ | ||||
| Notes-master | ||||
| @ -0,0 +1,14 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="GradleSettings"> | ||||
|     <option name="linkedExternalProjectsSettings"> | ||||
|       <GradleProjectSettings> | ||||
|         <option name="testRunner" value="GRADLE" /> | ||||
|         <option name="distributionType" value="DEFAULT_WRAPPED" /> | ||||
|         <option name="externalProjectPath" value="$PROJECT_DIR$" /> | ||||
|         <option name="gradleJvm" value="JDK" /> | ||||
|         <option name="resolveModulePerSourceSet" value="false" /> | ||||
|       </GradleProjectSettings> | ||||
|     </option> | ||||
|   </component> | ||||
| </project> | ||||
| @ -0,0 +1,10 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="ExternalStorageConfigurationManager" enabled="true" /> | ||||
|   <component name="ProjectRootManager"> | ||||
|     <output url="file://$PROJECT_DIR$/build/classes" /> | ||||
|   </component> | ||||
|   <component name="ProjectType"> | ||||
|     <option name="id" value="Android" /> | ||||
|   </component> | ||||
| </project> | ||||
| @ -0,0 +1,19 @@ | ||||
| apply plugin: 'com.android.application' | ||||
| 
 | ||||
| android { | ||||
|     compileSdkVersion 30 | ||||
|     buildToolsVersion "34.0.0" | ||||
| 
 | ||||
|     defaultConfig { | ||||
|         applicationId "net.micode.notes" | ||||
|         minSdkVersion 14 | ||||
|         targetSdkVersion 14 | ||||
|     } | ||||
| 
 | ||||
|     buildTypes { | ||||
|         release { | ||||
|             minifyEnabled false | ||||
|             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,150 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| 
 | ||||
| <!-- 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. | ||||
| --> | ||||
| 
 | ||||
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||||
|     package="net.micode.notes" | ||||
|     android:versionCode="1" | ||||
|     android:versionName="0.1" > | ||||
| 
 | ||||
|     <uses-sdk android:minSdkVersion="14" /> | ||||
| 
 | ||||
|     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||||
|     <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /> | ||||
|     <uses-permission android:name="android.permission.INTERNET" /> | ||||
|     <uses-permission android:name="android.permission.READ_CONTACTS" /> | ||||
|     <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" /> | ||||
|     <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" /> | ||||
|     <uses-permission android:name="android.permission.GET_ACCOUNTS" /> | ||||
|     <uses-permission android:name="android.permission.USE_CREDENTIALS" /> | ||||
|     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | ||||
| 
 | ||||
|     <application | ||||
|         android:icon="@drawable/icon_app" | ||||
|         android:label="@string/app_name" > | ||||
|         <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" > | ||||
| 
 | ||||
|             <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" > | ||||
| 
 | ||||
|             <intent-filter> | ||||
|                 <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" > | ||||
|             <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" > | ||||
| 
 | ||||
|             <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" > | ||||
|             <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,123 @@ | ||||
| 
 | ||||
| /* | ||||
|  * 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.gtask.remote; | ||||
| 
 | ||||
| import android.app.Notification; | ||||
| import android.app.NotificationManager; | ||||
| import android.app.PendingIntent; | ||||
| import android.content.Context; | ||||
| import android.content.Intent; | ||||
| import android.os.AsyncTask; | ||||
| 
 | ||||
| import net.micode.notes.R; | ||||
| import net.micode.notes.ui.NotesListActivity; | ||||
| import net.micode.notes.ui.NotesPreferenceActivity; | ||||
| 
 | ||||
| 
 | ||||
| public class GTaskASyncTask extends AsyncTask<Void, String, Integer> { | ||||
| 
 | ||||
|     private static int GTASK_SYNC_NOTIFICATION_ID = 5234235; | ||||
| 
 | ||||
|     public interface OnCompleteListener { | ||||
|         void onComplete(); | ||||
|     } | ||||
| 
 | ||||
|     private Context mContext; | ||||
| 
 | ||||
|     private NotificationManager mNotifiManager; | ||||
| 
 | ||||
|     private GTaskManager mTaskManager; | ||||
| 
 | ||||
|     private OnCompleteListener mOnCompleteListener; | ||||
| 
 | ||||
|     public GTaskASyncTask(Context context, OnCompleteListener listener) { | ||||
|         mContext = context; | ||||
|         mOnCompleteListener = listener; | ||||
|         mNotifiManager = (NotificationManager) mContext | ||||
|                 .getSystemService(Context.NOTIFICATION_SERVICE); | ||||
|         mTaskManager = GTaskManager.getInstance(); | ||||
|     } | ||||
| 
 | ||||
|     public void cancelSync() { | ||||
|         mTaskManager.cancelSync(); | ||||
|     } | ||||
| 
 | ||||
|     public void publishProgess(String message) { | ||||
|         publishProgress(new String[] { | ||||
|             message | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     private void showNotification(int tickerId, String content) { | ||||
|         Notification notification = new Notification(R.drawable.notification, mContext | ||||
|                 .getString(tickerId), System.currentTimeMillis()); | ||||
|         notification.defaults = Notification.DEFAULT_LIGHTS; | ||||
|         notification.flags = Notification.FLAG_AUTO_CANCEL; | ||||
|         PendingIntent pendingIntent; | ||||
|         if (tickerId != R.string.ticker_success) { | ||||
|             pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, | ||||
|                     NotesPreferenceActivity.class), 0); | ||||
| 
 | ||||
|         } else { | ||||
|             pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext, | ||||
|                     NotesListActivity.class), 0); | ||||
|         } | ||||
|         notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content, | ||||
|                 pendingIntent); | ||||
|         mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     protected Integer doInBackground(Void... unused) { | ||||
|         publishProgess(mContext.getString(R.string.sync_progress_login, NotesPreferenceActivity | ||||
|                 .getSyncAccountName(mContext))); | ||||
|         return mTaskManager.sync(mContext, this); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     protected void onProgressUpdate(String... progress) { | ||||
|         showNotification(R.string.ticker_syncing, progress[0]); | ||||
|         if (mContext instanceof GTaskSyncService) { | ||||
|             ((GTaskSyncService) mContext).sendBroadcast(progress[0]); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     protected void onPostExecute(Integer result) { | ||||
|         if (result == GTaskManager.STATE_SUCCESS) { | ||||
|             showNotification(R.string.ticker_success, mContext.getString( | ||||
|                     R.string.success_sync_account, mTaskManager.getSyncAccount())); | ||||
|             NotesPreferenceActivity.setLastSyncTime(mContext, System.currentTimeMillis()); | ||||
|         } else if (result == GTaskManager.STATE_NETWORK_ERROR) { | ||||
|             showNotification(R.string.ticker_fail, mContext.getString(R.string.error_sync_network)); | ||||
|         } else if (result == GTaskManager.STATE_INTERNAL_ERROR) { | ||||
|             showNotification(R.string.ticker_fail, mContext.getString(R.string.error_sync_internal)); | ||||
|         } else if (result == GTaskManager.STATE_SYNC_CANCELLED) { | ||||
|             showNotification(R.string.ticker_cancel, mContext | ||||
|                     .getString(R.string.error_sync_cancelled)); | ||||
|         } | ||||
|         if (mOnCompleteListener != null) { | ||||
|             new Thread(new Runnable() { | ||||
| 
 | ||||
|                 public void run() { | ||||
|                     mOnCompleteListener.onComplete(); | ||||
|                 } | ||||
|             }).start(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @ -0,0 +1,22 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| 
 | ||||
| <!-- 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. | ||||
| --> | ||||
| 
 | ||||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|   <item android:state_pressed="true" android:color="#88555555" /> | ||||
|   <item android:state_selected="true" android:color="#ff999999" /> | ||||
|   <item android:color="#ff000000" /> | ||||
| </selector> | ||||
| @ -0,0 +1,20 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| 
 | ||||
| <!-- 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. | ||||
| --> | ||||
| 
 | ||||
| <selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||||
|   <item android:color="#50000000" /> | ||||
| </selector> | ||||
| Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB | 
| Before Width: | Height: | Size: 245 B After Width: | Height: | Size: 245 B | 
| Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB | 
| Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB | 
| Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB | 
| Before Width: | Height: | Size: 443 B After Width: | Height: | Size: 443 B | 
| Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB | 
| Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB | 
| Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB | 
| Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB | 
| Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB | 
| Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB | 
| Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB | 
| Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 5.9 KiB | 
| Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB | 
| Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB | 
| Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB | 
| Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB | 
| Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB | 
| Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB | 
| Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB | 
| Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB | 
| Before Width: | Height: | Size: 554 KiB After Width: | Height: | Size: 554 KiB | 
| Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB | 
| Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB | 
| Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB | 
| Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB | 
| Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB | 
| Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB | 
| Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB | 
| Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB | 
| Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB | 
| Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB | 
| Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |