├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── drawable │ │ │ │ ├── background_sticky.9.png │ │ │ │ ├── ic_build.xml │ │ │ │ ├── ic_refresh.xml │ │ │ │ ├── ic_delete_forever.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── anim │ │ │ │ ├── push_bottom_in.xml │ │ │ │ └── push_bottom_out.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── menu │ │ │ │ ├── menu_detail.xml │ │ │ │ └── menu_main.xml │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ ├── layout │ │ │ │ ├── dialog_connect_to.xml │ │ │ │ ├── sticky_overview.xml │ │ │ │ ├── activity_overview.xml │ │ │ │ └── activity_detail.xml │ │ │ └── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ │ ├── bistu │ │ │ │ └── share │ │ │ │ │ ├── Instruction.java │ │ │ │ │ ├── Detail.java │ │ │ │ │ └── Overview.java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── sticky │ │ │ │ ├── DetailActivity │ │ │ │ ├── HandlerDetailActivity.java │ │ │ │ └── DetailActivity.java │ │ │ │ ├── Overview │ │ │ │ ├── StickyOverviewAdapter.java │ │ │ │ └── OverviewActivity.java │ │ │ │ └── client │ │ │ │ └── Client.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── sticky │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── example │ │ └── sticky │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .idea ├── vcs.xml ├── misc.xml ├── runConfigurations.xml ├── gradle.xml └── codeStyles │ └── Project.xml ├── .gitignore ├── gradle.properties ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name='sticky' 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leafee98/sticky_android_APP/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leafee98/sticky_android_APP/master/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leafee98/sticky_android_APP/master/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leafee98/sticky_android_APP/master/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leafee98/sticky_android_APP/master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/background_sticky.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leafee98/sticky_android_APP/master/app/src/main/res/drawable/background_sticky.9.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leafee98/sticky_android_APP/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leafee98/sticky_android_APP/master/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leafee98/sticky_android_APP/master/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leafee98/sticky_android_APP/master/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leafee98/sticky_android_APP/master/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leafee98/sticky_android_APP/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/caches 5 | /.idea/libraries 6 | /.idea/modules.xml 7 | /.idea/workspace.xml 8 | /.idea/navEditor.xml 9 | /.idea/assetWizardSettings.xml 10 | .DS_Store 11 | /build 12 | /captures 13 | .externalNativeBuild 14 | .cxx 15 | -------------------------------------------------------------------------------- /app/src/main/res/anim/push_bottom_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/push_bottom_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Dec 05 10:18:45 CST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_detail.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/java/bistu/share/Instruction.java: -------------------------------------------------------------------------------- 1 | package bistu.share; 2 | 3 | public class Instruction { 4 | public static final int SERVE_END = 999; 5 | public static final int GET_LIST = 1; 6 | public static final int GET_DETAIL = 2; 7 | public static final int UPDATE_STICKY = 3; 8 | public static final int REMOVE_STICKY = 4; 9 | public static final int ADD_STICKY = 5; 10 | 11 | public static final int ERR_CODE = -1; 12 | public static final int FINE_CODE = 0; 13 | } -------------------------------------------------------------------------------- /app/src/test/java/com/example/sticky/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.example.sticky; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_build.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_refresh.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_delete_forever.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | #000000 8 | #8F8E8E 9 | #FFF2AB 10 | #FFEB81 11 | 12 | #F8BFC2C2 13 | 14 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_connect_to.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 16 | 17 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/example/sticky/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.example.sticky; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.test.platform.app.InstrumentationRegistry; 6 | import androidx.test.ext.junit.runners.AndroidJUnit4; 7 | 8 | import org.junit.Test; 9 | import org.junit.runner.RunWith; 10 | 11 | import static org.junit.Assert.*; 12 | 13 | /** 14 | * Instrumented test, which will execute on an Android device. 15 | * 16 | * @see Testing documentation 17 | */ 18 | @RunWith(AndroidJUnit4.class) 19 | public class ExampleInstrumentedTest { 20 | @Test 21 | public void useAppContext() { 22 | // Context of the app under test. 23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 24 | 25 | assertEquals("com.example.sticky", appContext.getPackageName()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | sticky 3 | refresh list 4 | connect 5 | add sticky 6 | sticky content 7 | sticky modify time 8 | server address. eg: 1.2.3.4:1234 9 | Connect to 10 | delete 11 | sticky content here… 12 | 13 | 14 | long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/java/bistu/share/Detail.java: -------------------------------------------------------------------------------- 1 | package bistu.share; 2 | 3 | import java.io.Serializable; 4 | import java.sql.Timestamp; 5 | 6 | public class Detail implements Serializable { 7 | private long id; 8 | private Timestamp modifyTime; 9 | private String fullText; 10 | 11 | public Detail(long id, Timestamp modifyTime, String fullText) { 12 | this.id = id; 13 | this.modifyTime = modifyTime; 14 | this.fullText = fullText; 15 | } 16 | 17 | public long getId() { return id; } 18 | public void setId(long id) { this.id = id; } 19 | 20 | public Timestamp getModifyTime() { return modifyTime; } 21 | public void setModifyTime(Timestamp modifyTime) { this.modifyTime = modifyTime; } 22 | 23 | public String getFullText() { return fullText; } 24 | public void setFullText(String fullText) { this.fullText = fullText; } 25 | 26 | @Override 27 | public String toString() { 28 | return String.format("Detail: id=%d, modifyTime=%s, fullText=%s", id, modifyTime.toString(), fullText); 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /app/src/main/java/bistu/share/Overview.java: -------------------------------------------------------------------------------- 1 | package bistu.share; 2 | 3 | import java.io.Serializable; 4 | import java.sql.Timestamp; 5 | 6 | public class Overview implements Serializable { 7 | private long id; 8 | private Timestamp modifyTime; 9 | private String summary; 10 | 11 | public Overview(long id, Timestamp modifyTime, String summary) { 12 | this.id = id; 13 | this.modifyTime = modifyTime; 14 | this.summary = summary; 15 | } 16 | 17 | public long getId() { return id; } 18 | public void setId(long id) { this.id = id; } 19 | 20 | public Timestamp getModifyTime() { return modifyTime; } 21 | public void setModifyTime(Timestamp modifyTime) { this.modifyTime = modifyTime; } 22 | 23 | public String getSummary() { return summary; } 24 | public void setSummary(String summary) { this.summary = summary; } 25 | 26 | @Override 27 | public String toString() { 28 | return String.format("Overview: id=%ld, modifyTime=%s, summary=%s", id, modifyTime.toString(), summary); 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Automatically convert third-party libraries to use AndroidX 19 | android.enableJetifier=true 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 14 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 29 5 | buildToolsVersion "29.0.2" 6 | defaultConfig { 7 | applicationId "com.example.sticky" 8 | minSdkVersion 27 9 | targetSdkVersion 29 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | compileOptions { 21 | sourceCompatibility = 1.8 22 | targetCompatibility = 1.8 23 | } 24 | } 25 | 26 | dependencies { 27 | implementation fileTree(dir: 'libs', include: ['*.jar']) 28 | implementation 'androidx.appcompat:appcompat:1.1.0' 29 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' 30 | testImplementation 'junit:junit:4.12' 31 | androidTestImplementation 'androidx.test:runner:1.2.0' 32 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 33 | implementation 'androidx.recyclerview:recyclerview:1.1.0' 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/sticky/DetailActivity/HandlerDetailActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.sticky.DetailActivity; 2 | 3 | import android.os.Handler; 4 | import android.os.Message; 5 | 6 | import androidx.annotation.NonNull; 7 | 8 | import bistu.share.Detail; 9 | 10 | import java.util.Date; 11 | 12 | class HandlerDetailActivity extends Handler { 13 | 14 | private DetailActivity activity; 15 | 16 | static final int HIDE_PROGRESS_BAR = 1; 17 | static final int SHOW_PROGRESS_SAVING = 2; 18 | static final int HIDE_PROGRESS_SAVING = 3; 19 | static final int ASSIGN_DETAIL = 4; 20 | static final int UPDATE_MODIFY = 5; 21 | static final int FINISH_ACTIVITY = 9; 22 | 23 | HandlerDetailActivity(DetailActivity activity) { 24 | this.activity = activity; 25 | } 26 | 27 | @Override 28 | public void handleMessage(@NonNull Message msg) { 29 | super.handleMessage(msg); 30 | switch (msg.what) { 31 | case HIDE_PROGRESS_BAR: this.activity.showProgressLoading(false); break; 32 | case SHOW_PROGRESS_SAVING: this.activity.showProgressSaving(true); break; 33 | case HIDE_PROGRESS_SAVING: this.activity.showProgressSaving(false); break; 34 | case ASSIGN_DETAIL: this.activity.assignDetail((Detail) msg.obj); break; 35 | case UPDATE_MODIFY: this.activity.updateModifyTime((Date) msg.obj); break; 36 | case FINISH_ACTIVITY: this.activity.finish(); break; 37 | } 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/sticky_overview.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 23 | 24 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/sticky/Overview/StickyOverviewAdapter.java: -------------------------------------------------------------------------------- 1 | package com.example.sticky.Overview; 2 | 3 | import android.view.LayoutInflater; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | import android.widget.TextView; 7 | 8 | import androidx.annotation.NonNull; 9 | import androidx.recyclerview.widget.RecyclerView; 10 | 11 | import com.example.sticky.R; 12 | import bistu.share.Overview; 13 | 14 | import java.util.List; 15 | 16 | public class StickyOverviewAdapter extends RecyclerView.Adapter { 17 | 18 | class ViewHolder extends RecyclerView.ViewHolder { 19 | TextView content, modify; 20 | View wholeView; 21 | 22 | ViewHolder(@NonNull View itemView) { 23 | super(itemView); 24 | this.wholeView = itemView; 25 | this.content = itemView.findViewById(R.id.textView_sticky_overview_content); 26 | this.modify = itemView.findViewById(R.id.textView_sticky_overview_modify); 27 | } 28 | } 29 | 30 | private List overviewList; 31 | private OverviewActivity activity; 32 | 33 | StickyOverviewAdapter(OverviewActivity activity, List overviewList) { 34 | this.activity = activity; 35 | this.overviewList = overviewList; 36 | } 37 | 38 | @NonNull 39 | @Override 40 | public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { 41 | View v = LayoutInflater.from(parent.getContext()) 42 | .inflate(R.layout.sticky_overview, parent, false); 43 | return new ViewHolder(v); 44 | } 45 | 46 | @Override 47 | public void onBindViewHolder(@NonNull ViewHolder holder, int position) { 48 | Overview o = this.overviewList.get(position); 49 | holder.content.setText(o.getSummary()); 50 | holder.modify.setText(o.getModifyTime().toString()); 51 | 52 | holder.wholeView.setOnClickListener((View v) -> 53 | activity.viewDetail(this.overviewList.get(holder.getAdapterPosition()).getId()) 54 | ); 55 | } 56 | 57 | @Override 58 | public int getItemCount() { 59 | return this.overviewList.size(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_overview.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 |