简单置顶功能 #5

Merged
pbyhqr72x merged 0 commits from hxs_xiaomi2 into master 3 years ago

@ -1,2 +0,0 @@
# Xiao_Mi_promote

@ -0,0 +1,2 @@
#Sat Sep 11 10:03:18 CST 2021
gradle.version=7.2

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -0,0 +1,123 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
</component>

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="16" />
</component>
</project>

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\Lenovo\.android\avd\Pixel_5_API_23.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2021-09-12T08:09:43.695989200Z" />
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="PROJECT" charset="UTF-8" />
</component>
</project>

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<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="openjdk-16" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
<option name="url" value="https://jcenter.bintray.com/" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
</component>
</project>

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/Android app/Notes-master/app/src/main/res/drawable/new_note.xml" value="0.24270833333333333" />
<entry key="..\:/Android app/Notes-master/app/src/main/res/layout/add_account_text.xml" value="0.10260416666666666" />
<entry key="..\:/Android app/Notes-master/app/src/main/res/layout/datetime_picker.xml" value="0.10260416666666666" />
<entry key="..\:/Android app/Notes-master/app/src/main/res/layout/note_edit.xml" value="0.26145833333333335" />
<entry key="..\:/Android app/Notes-master/app/src/main/res/layout/note_item.xml" value="0.146875" />
<entry key="..\:/Android app/Notes-master/app/src/main/res/menu/call_note_edit.xml" value="0.19444444444444445" />
<entry key="..\:/Android app/Notes-master/app/src/main/res/menu/note_edit.xml" value="0.22291666666666668" />
<entry key="..\:/Android app/Notes-master/app/src/main/res/xml/preferences.xml" value="0.12158054711246201" />
</map>
</option>
</component>
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_15" project-jdk-name="16" 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,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" type="JAVA_MODULE" version="4" />

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SonarLintProjectState">
<lastEventPolling>1631850246765</lastEventPolling>
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SonarLintProjectSettings">
<option name="bindingEnabled" value="true" />
<option name="projectKey" value="Kilito" />
<option name="serverId" value="Kilito" />
</component>
</project>

@ -0,0 +1,11 @@
m
java:S37765"RRefactor this method to reduce its Cognitive Complexity from 16 to the 15 allowed.(üßú–ùÿÿÿÿ
O
java:S1874A"9Remove this use of "setTextAppearance"; it is deprecated.(¤ñÝ×
O
java:S1874H"9Remove this use of "setTextAppearance"; it is deprecated.(Á†<C381>ö
O
java:S1874N"9Remove this use of "setTextAppearance"; it is deprecated.(¤ñÝ×
>
java:S1068("(Remove this unused "mTop" private field.(èÞ†´

@ -0,0 +1,15 @@
ƒ
Sapp/build/generated/source/buildConfig/debug/net/micode/notes/ui/NotesListItem.java,6\5\65510b2703c0c5abe5f48e74f16618d1815996ad
<
build.gradle,f\0\f07866736216be0ee2aba49e392191aeae700a35
A
gradle.properties,2\a\2afbb999f001938c88fa43fc2ef52abf0f8213e4
?
settings.gradle,0\5\05efc8b1657769a27696d478ded1e95f38737233
X
(gradle/wrapper/gradle-wrapper.properties,f\b\fbe448ebfc3eb2d4e308f6b8b043666f5b57235e
@
app/build.gradle,f\4\f4a01d6a4fcb971362ec00a83903fd3902f52164
@
local.properties,0\7\0712df971a99ac4d2fccb8e0fb19f377f3374cca

@ -0,0 +1,69 @@
apply plugin: 'com.android.application'
//apply plugin: 'kotlin-android'
apply plugin: 'org.sonarqube'
sonarqube {
properties {
//Sonar
property "sonar.host.url", "*****************************"
//Token
property "sonar.login","**********************************"
//
//property "sonar.login","*******"
//property "sonar.password","******"
property "sonar.sourceEncoding", "UTF-8"
property "sonar.projectKey", "Android_DuoApp"
property "sonar.projectName", project.name
//(APPjava)
property "sonar.sources", "src/main/java"
property "sonar.projectVersion", project.version
}
}
android {
compileSdkVersion 31
buildToolsVersion "31.0.0"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "net.micode.notes"
minSdkVersion 14
targetSdkVersion 31
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
repositories {
mavenCentral()
}
dependencies {
// implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
google()
//mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7"
}
}
apply plugin: "org.sonarqube"
allprojects {
repositories {
google()
//mavenCentral()
jcenter()
}
}
apply plugin: 'org.sonarqube'

@ -0,0 +1,12 @@
/**
* Automatically generated file. DO NOT MODIFY
*/
package net.micode.notes;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "net.micode.notes";
public static final String BUILD_TYPE = "debug";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "0.1";
}

@ -165,6 +165,8 @@ public class Notes {
* <P> Type : INTEGER (long) </P>
*/
public static final String VERSION = "version";
public static final String TOP = "top";
}
public interface DataColumns {

@ -60,7 +60,8 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
NoteColumns.LOCAL_MODIFIED + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.ORIGIN_PARENT_ID + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.GTASK_ID + " TEXT NOT NULL DEFAULT ''," +
NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0" +
NoteColumns.VERSION + " INTEGER NOT NULL DEFAULT 0," +
NoteColumns.TOP+" INTEGER NOT NULL DEFAULT 0" +
")";
private static final String CREATE_DATA_TABLE_SQL =
@ -322,6 +323,11 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
oldVersion++;
}
if (oldVersion == 4) {
upgradeToV5(db);
oldVersion++;
}
if (reCreateTriggers) {
reCreateNoteTableTriggers(db);
reCreateDataTableTriggers(db);
@ -359,4 +365,9 @@ public class NotesDatabaseHelper extends SQLiteOpenHelper {
db.execSQL("ALTER TABLE " + TABLE.NOTE + " ADD COLUMN " + NoteColumns.VERSION
+ " INTEGER NOT NULL DEFAULT 0");
}
private void upgradeToV5(SQLiteDatabase db){
db.execSQL("ALTER TABLE " + TABLE.NOTE + " ADD CLOUMN" + NoteColumns.TOP
+ " INTEGER NOT NULL DEFAULT 0");
}
}

@ -49,7 +49,7 @@ public class SqlNote {
NoteColumns.NOTES_COUNT, NoteColumns.PARENT_ID, NoteColumns.SNIPPET, NoteColumns.TYPE,
NoteColumns.WIDGET_ID, NoteColumns.WIDGET_TYPE, NoteColumns.SYNC_ID,
NoteColumns.LOCAL_MODIFIED, NoteColumns.ORIGIN_PARENT_ID, NoteColumns.GTASK_ID,
NoteColumns.VERSION
NoteColumns.VERSION,NoteColumns.TOP
};
public static final int ID_COLUMN = 0;
@ -86,6 +86,8 @@ public class SqlNote {
public static final int VERSION_COLUMN = 16;
public static final int Top_COLUMN = 17;
private Context mContext;
private ContentResolver mContentResolver;
@ -122,6 +124,8 @@ public class SqlNote {
private ArrayList<SqlData> mDataList;
private String mTop ;
public SqlNote(Context context) {
mContext = context;
mContentResolver = context.getContentResolver();
@ -141,6 +145,7 @@ public class SqlNote {
mVersion = 0;
mDiffNoteValues = new ContentValues();
mDataList = new ArrayList<SqlData>();
mTop = getmTop();
}
public SqlNote(Context context, Cursor c) {
@ -152,6 +157,7 @@ public class SqlNote {
if (mType == Notes.TYPE_NOTE)
loadDataContent();
mDiffNoteValues = new ContentValues();
mTop = getmTop();
}
public SqlNote(Context context, long id) {
@ -163,6 +169,7 @@ public class SqlNote {
if (mType == Notes.TYPE_NOTE)
loadDataContent();
mDiffNoteValues = new ContentValues();
mTop = getmTop();
}
@ -198,6 +205,7 @@ public class SqlNote {
mWidgetId = c.getInt(WIDGET_ID_COLUMN);
mWidgetType = c.getInt(WIDGET_TYPE_COLUMN);
mVersion = c.getLong(VERSION_COLUMN);
mTop = c.getString(Top_COLUMN);
}
private void loadDataContent() {
@ -436,6 +444,10 @@ public class SqlNote {
return mSnippet;
}
public String getmTop(){
return mTop;
}
public boolean isNoteType() {
return mType == Notes.TYPE_NOTE;
}

@ -77,8 +77,13 @@ public class GTaskASyncTask extends AsyncTask<Void, String, Integer> {
pendingIntent = PendingIntent.getActivity(mContext, 0, new Intent(mContext,
NotesListActivity.class), 0);
}
notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content,
pendingIntent);
Notification.Builder builder = new Notification.Builder(mContext);
builder.setContentTitle(mContext.getString(R.string.app_name));
builder.setContentText(content);
builder.setContentIntent(pendingIntent);
notification = builder.getNotification();
/*notification.setLatestEventInfo(mContext, mContext.getString(R.string.app_name), content,
pendingIntent);*/
mNotifiManager.notify(GTASK_SYNC_NOTIFICATION_ID, notification);
}

@ -75,6 +75,11 @@ public class Note {
mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1);
mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis());
}
public void setTopValue(String key, String value) {
mNoteDiffValues.put(key, value);
mNoteDiffValues.put(NoteColumns.LOCAL_MODIFIED, 1);
mNoteDiffValues.put(NoteColumns.MODIFIED_DATE, System.currentTimeMillis());
}
public void setTextData(String key, String value) {
mNoteData.setTextData(key, value);

@ -60,6 +60,9 @@ public class WorkingNote {
private boolean mIsDeleted;
/////////////
private String mTop;
private NoteSettingChangedListener mNoteSettingStatusListener;
public static final String[] DATA_PROJECTION = new String[] {
@ -101,6 +104,8 @@ public class WorkingNote {
private static final int NOTE_MODIFIED_DATE_COLUMN = 5;
private static final int NOTE_TOP_COLUMN = 6 ;
// New note construct
private WorkingNote(Context context, long folderId) {
mContext = context;
@ -112,6 +117,7 @@ public class WorkingNote {
mIsDeleted = false;
mMode = 0;
mWidgetType = Notes.TYPE_WIDGET_INVALIDE;
mTop = "0" ;
}
// Existing note construct
@ -121,6 +127,7 @@ public class WorkingNote {
mFolderId = folderId;
mIsDeleted = false;
mNote = new Note();
mTop = "0" ;
loadNote();
}
@ -137,6 +144,7 @@ public class WorkingNote {
mWidgetType = cursor.getInt(NOTE_WIDGET_TYPE_COLUMN);
mAlertDate = cursor.getLong(NOTE_ALERTED_DATE_COLUMN);
mModifiedDate = cursor.getLong(NOTE_MODIFIED_DATE_COLUMN);
}
cursor.close();
} else {
@ -288,6 +296,13 @@ public class WorkingNote {
}
}
public void setTop(String Top){
if (Top != mTop){
mTop = Top;
mNote.setTopValue(NoteColumns.TOP,mTop);
}
}
public void convertToCallNote(String phoneNumber, long callDate) {
mNote.setCallData(CallNote.CALL_DATE, String.valueOf(callDate));
mNote.setCallData(CallNote.PHONE_NUMBER, phoneNumber);
@ -338,7 +353,16 @@ public class WorkingNote {
return mWidgetId;
}
public int getWidgetType() {
public int getTopId() {
if (mTop.equals("1")) {
return 1;
} else {
return 0;
}
}
public int getWidgetType() {
return mWidgetType;
}

@ -71,6 +71,11 @@ import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.view.View;
import android.widget.Button;
import android.content.Intent;
public class NoteEditActivity extends Activity implements OnClickListener,
NoteSettingChangedListener, OnTextViewChangeListener {
@ -502,11 +507,18 @@ public class NoteEditActivity extends Activity implements OnClickListener,
} else {
menu.findItem(R.id.menu_delete_remind).setVisible(false);
}
if (mWorkingNote.getTopId() == 1) {
menu.findItem(R.id.top).setTitle("取消置顶");
} else if(mWorkingNote.getTopId() == 0){
menu.findItem(R.id.top).setTitle("置顶");
}
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
//////////////////
final Button topBtn = (Button) findViewById(R.id.top);
switch (item.getItemId()) {
case R.id.menu_new_note:
createNewNote();
@ -547,6 +559,9 @@ public class NoteEditActivity extends Activity implements OnClickListener,
case R.id.menu_delete_remind:
mWorkingNote.setAlertDate(0, false);
break;
case R.id.top:
mWorkingNote.setTop((mWorkingNote.getTopId()) == 1 ? "0" : "1");
break;
default:
break;
}

@ -0,0 +1,2 @@
appMetadataVersion=1.0
androidGradlePluginVersion=7.0.2

@ -0,0 +1,10 @@
{
"version": 3,
"artifactType": {
"type": "COMPATIBLE_SCREEN_MANIFEST",
"kind": "Directory"
},
"applicationId": "net.micode.notes",
"variantName": "debug",
"elements": []
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save