first_commit
15
.gitignore
vendored
Normal file
@ -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
|
3
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
6
.idea/compiler.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
</component>
|
||||
</project>
|
19
.idea/gradle.xml
generated
Normal file
@ -0,0 +1,19 @@
|
||||
<?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="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
91
.idea/misc.xml
generated
Normal file
@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DesignSurface">
|
||||
<option name="filePathToZoomLevelMap">
|
||||
<map>
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/edit_bg.xml" value="0.14583333333333334" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/ic_launcher_background.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/image_style.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/main_pb_bg.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/myblack.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/myblue1.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/mybookinfback.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/mybookitem.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/mychatback.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/mydimgrey.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/mygreen.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/mygrey.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/mypurple.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/pgs_bar_bg.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/push_left_in.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/round_edge.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/selector.xml" value="0.125" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/drawable/shape_pgsb.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_accountmanager.xml" value="0.1638888888888889" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_anthor_introduction.xml" value="0.264" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_book.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_book_info.xml" value="0.264" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_book_information.xml" value="0.2153846153846154" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_bookintro.xml" value="0.4" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_bookshelf.xml" value="0.2" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_findpwd.xml" value="0.264" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_guanli.xml" value="0.25364583333333335" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_kexue.xml" value="0.23802083333333332" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_login.xml" value="0.2994791666666667" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_main.xml" value="0.23177083333333334" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_my.xml" value="0.264" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_my_post.xml" value="0.2" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_myself.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_perception.xml" value="0.264" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_perception_infomation.xml" value="0.32011331444759206" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_re_email.xml" value="0.16041666666666668" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_re_myinfo.xml" value="0.14722222222222223" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_re_phone.xml" value="0.1638888888888889" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_re_sex.xml" value="0.16041666666666668" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_register.xml" value="0.264" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_sendperception.xml" value="0.264" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_wenxue.xml" value="0.2701908957415565" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_xinli.xml" value="0.25364583333333335" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/activity_zhexue.xml" value="0.23802083333333332" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/book_author_item.xml" value="0.4" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/book_item.xml" value="0.264" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/book_item2.xml" value="0.264" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/book_item3.xml" value="0.21388888888888888" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/book_item4.xml" value="0.21388888888888888" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/bookpic_item.xml" value="0.4" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/bookshelf_item.xml" value="0.24947916666666667" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/bottom_nav.xml" value="0.1" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/comment_item.xml" value="0.264" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/comment_popupwindow.xml" value="0.14722222222222223" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/expandable.xml" value="0.24947916666666667" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/expandable2.xml" value="0.24947916666666667" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/expandable3.xml" value="0.19427083333333334" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/expandable4.xml" value="0.24974358974358973" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/goodsuibi_item.xml" value="0.4963768115942029" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/lla.xml" value="0.15052083333333333" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/media_player.xml" value="0.1203125" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/mydialog.xml" value="0.24947916666666667" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/nav_header.xml" value="0.264" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/pageview.xml" value="0.11458333333333333" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/perception_item.xml" value="0.264" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/push_left_in.xml" value="0.11666666666666667" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/round_edge.xml" value="0.2526041666666667" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/test.xml" value="0.176" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/test11.xml" value="0.1203125" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/title.xml" value="0.264" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/video_player.xml" value="0.1203125" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/xialamenu.xml" value="0.4" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/layout/zy.xml" value="0.25364583333333335" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/menu/nav_bookshelf.xml" value="0.25364583333333335" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/menu/nav_menu.xml" value="0.176" />
|
||||
<entry key="..\:/Jianshu/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.1" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
generated
Normal file
@ -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>
|
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
60
app/build.gradle
Normal file
@ -0,0 +1,60 @@
|
||||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-android-extensions'
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk 31
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.zjgsu.jianshu"
|
||||
minSdk 21
|
||||
targetSdk 31
|
||||
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
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// implementation 'android.recyclerview:recyclerview:1.0.0'
|
||||
implementation 'io.github.bmob:android-sdk:3.9.4'
|
||||
implementation 'io.reactivex.rxjava2:rxjava:2.2.8'
|
||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.8.1'
|
||||
implementation 'com.squareup.okio:okio:2.2.2'
|
||||
implementation 'com.google.code.gson:gson:2.8.5'
|
||||
implementation 'androidx.core:core-ktx:1.3.2'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
testImplementation 'junit:junit:4.+'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
||||
implementation 'de.hdodenhof:circleimageview:3.0.1'
|
||||
implementation 'com.google.android.material:material:1.0.0'
|
||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
|
||||
implementation 'com.github.bumptech.glide:glide:3.7.0'
|
||||
implementation 'com.ms-square:expandableTextView:0.1.4'
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation 'junit:junit:4.12'
|
||||
implementation 'com.jakewharton:butterknife:7.0.1'
|
||||
implementation 'com.facebook.fresco:fresco:0.9.0+'
|
||||
}
|
21
app/proguard-rules.pro
vendored
Normal file
@ -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,24 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
|
||||
assertEquals("com.zjgsu.jianshu", appContext.packageName)
|
||||
}
|
||||
}
|
85
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zjgsu.jianshu">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 监听网络的变化 -->
|
||||
<!-- 网络权限 -->
|
||||
|
||||
<!--获取wifi网络状态的信息 -->
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- 设备休眠 -->
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- sd卡存储 -->
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.CAMERA" /> <!-- 摄像头 -->
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <!-- 录音 -->
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:networkSecurityConfig="@xml/test"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Jianshu"
|
||||
android:usesCleartextTraffic="true">
|
||||
<activity android:name=".Book_informationActivity" />
|
||||
<activity android:name=".PerceptionActivity" />
|
||||
<activity android:name=".FindpwdActivity"/>
|
||||
<activity android:name=".WenXueActivity"/>
|
||||
<activity android:name=".xinliActivity"/>
|
||||
<activity android:name=".guanliActivity"/>
|
||||
<activity android:name=".zhexueActivity"/>
|
||||
<!-- <activity android:name=".BookShelfActivity"/>-->
|
||||
<activity android:name=".kexueActivity"/>
|
||||
<activity android:name=".author_introductionActivity"/>
|
||||
<!-- <activity android:name=".MainActivity"-->
|
||||
<!-- android:exported="true"-->
|
||||
<!-- android:label="@string/app_name"-->
|
||||
<!-- >-->
|
||||
<!-- <intent-filter>-->
|
||||
<!-- <action android:name="android.intent.action.MAIN" />-->
|
||||
|
||||
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
|
||||
<!-- </intent-filter>-->
|
||||
<!-- </activity>-->
|
||||
<activity android:name=".Activity.BookIntro"/>
|
||||
<activity android:name=".LoginActivity"
|
||||
android:configChanges="orientation|keyboard|keyboardHidden|navigation"
|
||||
android:windowSoftInputMode="adjustPan|stateVisible"/>
|
||||
<activity android:name=".RegisterActivity" />
|
||||
<activity android:name=".BookShelfActivity"/>
|
||||
<activity android:name=".Activity.Perception_informationActivity"/>
|
||||
<activity android:name=".Activity.sendPerceptionActivity"/>
|
||||
<activity android:name=".MyActivity"/>
|
||||
<activity android:name=".Activity.MyPostActivity"/>
|
||||
<activity android:name=".ReEmailActivity"/>
|
||||
<activity android:name=".RePhoneActivity"/>
|
||||
<activity android:name=".ReMyinfoActivity"/>
|
||||
<activity android:name=".ReNameActivity"/>
|
||||
<activity android:name=".ReSexActivity"/>
|
||||
<activity android:name=".ReSignatureActivity"/>
|
||||
<activity android:name=".Activity.AccountManagerActivity"/>
|
||||
<activity android:name=".ReAddressActivity"/>
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:label="Jianshu">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<provider
|
||||
android:name="cn.bmob.v3.util.BmobContentProvider"
|
||||
android:authorities="com.zjgsu.jianshu.BmobContentProvider">
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
</manifest>
|
9
app/src/main/assets/introduction.txt
Normal file
@ -0,0 +1,9 @@
|
||||
《围城》是钱钟书唯一的一部长篇小说,堪称中国现当代长篇小说的经典。小说塑造了抗战开初一类知识分子的群像,生动反映了在国家特定时期,特殊人群的行为操守、以及困惑。从另一个角度记述了当时的情景、氛围。虽然有具体的历史背景,但这部小说揭示的只是人群的弱点,在今天依然能够引起人们的共鸣。《围城》是中国现代文学史上一部风格独特的讽刺小说。被誉为“新儒林外史”。
|
||||
《当尼采哭泣》是一本经典的心理推理小说,书中人物多来自真实的历史,作者假托19世纪末的两位大师:尼采和布雷尔,基于史实将两人合理虚构连结成医生与病人,开启一段扣人心弦的“谈话治疗”。如诗般的语言,理性缜密的思辩,情节充满悬疑,高潮迭起,结局却出人意表……
|
||||
作为20世纪中文小说100强的《台北人》,是一部深具复杂性的短篇小说集,由十四个一流的短篇小说构成,串联成一体,则效果遽然增加,不但小说之幅面变广,使我们看到社会之“众生相”,更重要的,由于主题命意之一再重复,与互相陪衬辅佐,使我们能更进一步深入了解作品之含义,并使我们得以一窥隐藏在作品内的作者之人生观与宇宙观。
|
||||
这是一部渭河平原五十年变迁的雄奇史诗,一轴中国农村班斓多彩、触目惊心的长幅画卷。主人公六娶六丧,神秘的序曲预示着不祥。一个家族两代子孙,为争夺白鹿原的统治代代争斗不已,上演了一幕幕惊心动魄的活剧
|
||||
《平凡的世界》是一部现实主义小说,也是一部小说形式的家族史。作者浓缩了中国西北农村的历史变迁过程,在小说中全景式地表现了中国当代城乡的社会生活。在近十年的广阔背景下,通过复杂的矛盾纠葛,刻划社会各阶层众多普通人的形象。劳动与爱情,挫折与追求,痛苦与欢乐,日常生活与巨大社会冲突,纷繁地交织在一起,深刻地展示了普通人在大时代历史进程中所走过的艰难曲折的道路。
|
||||
卓有成效是管理者必须做到的事,但是在所有的知识组织中,每一位知识工作者其实都是管理者――即使他没有所谓的职权,只要他能为组织做出突出的贡献。德鲁克集中论述了一个管理者如何做到卓有成效。这本书是德鲁克最著名的管理学著作之一,倾注了德鲁克极大的心血。
|
||||
如果只用一种方式了解某个事物,你就不会真正了解它。了解事物真正含义的秘密取决于如何将其与我们所了解的其他事物相联系。通过联系,你可将想法内化于心,从各种角度看问题,直至找到适合自己的方法。这本书介绍了整体性学习策略的核心思想和具体技术,详细介绍了快速阅读法、流笔记法、比喻法、内在化等七大方法,并为高效学习提供了从生活到时间管理的整体解决方案。
|
||||
导致失败最常见的原因之一就是,人们往往在暂时的挫折面前退却。任何人在取得成功之前,必然要遇到很多暂时的挫折甚至失败。如果一个人遭遇了失败,那么最容易也最顺理成章的做法就是放弃。大多数人正是这样做的。全美国500位最成功人士的经验告诉我们,他们最伟大的成功在于,面临失败时他们能坚持再迈一步。意志的力量是无穷的,除非人为地限制它。贫穷与财富都是意念的产物。《思考致富》是美国成功学家、作家拿破仑?希尔的代表作,被誉为人类历史上最优秀的励志著作之一。
|
||||
整个世界好像串通好了要一致阻碍你拥有专注力。每时每刻,你忙于应付外界的各种干扰。这种情况下,若你还能取得一星半点的成就,那简直是奇迹!要想改变这种手忙脚乱四处救火的情形,你必须拥有专注力!从现在开始,认清对你来说最重要的事,排除一切无关干扰,专注地投入其中。你的成功概率将以指数方式增长!实现你心中真正渴望的目标!
|
@ -0,0 +1,11 @@
|
||||
package com.zjgsu.jianshu.Activity
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.zjgsu.jianshu.R
|
||||
class AccountManagerActivity:AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_accountmanager)
|
||||
}
|
||||
}
|
53
app/src/main/java/com/zjgsu/jianshu/Activity/BookIntro.kt
Normal file
@ -0,0 +1,53 @@
|
||||
package com.zjgsu.jianshu.Activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Bmob.Book_inf_bmob
|
||||
import com.zjgsu.jianshu.Book_informationActivity
|
||||
import com.zjgsu.jianshu.R
|
||||
import kotlinx.android.synthetic.main.activity_book_info.*
|
||||
import kotlinx.android.synthetic.main.activity_bookintro.*
|
||||
import kotlinx.android.synthetic.main.expandable3.*
|
||||
import kotlinx.android.synthetic.main.expandable4.*
|
||||
|
||||
class BookIntro:AppCompatActivity() {
|
||||
private lateinit var Bookname: String
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_bookintro)
|
||||
supportActionBar?.hide()
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
Bookname = intent.getStringExtra("Book_name").toString()
|
||||
Log.d("zy123","yes")
|
||||
inits()
|
||||
intro_titleback.setOnClickListener {
|
||||
val intent = Intent(this, Book_informationActivity::class.java)
|
||||
intent.putExtra("Book_name", Bookname)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
private fun inits(){
|
||||
val query = BmobQuery<Book_inf_bmob>()
|
||||
query.addWhereEqualTo("name", Bookname)
|
||||
query.findObjects(object : FindListener<Book_inf_bmob>() {
|
||||
override fun done(list: List<Book_inf_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
expandable3.text = i.introduce
|
||||
expandable4.text = i.evaluate
|
||||
thebkname.text=Bookname
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Bmob.BookShelf
|
||||
import kotlinx.android.synthetic.main.activity_bookshelf.*
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.activity_perception.*
|
||||
import kotlinx.android.synthetic.main.bookshelf_item.*
|
||||
import kotlinx.android.synthetic.main.expandable.*
|
||||
import kotlin.concurrent.thread
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View.OnLongClickListener
|
||||
|
||||
import android.view.ViewGroup
|
||||
|
||||
import android.widget.TextView
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import android.view.MotionEvent
|
||||
import android.view.View.OnTouchListener
|
||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||
|
||||
class BookShelfActivity : AppCompatActivity() {
|
||||
val Booklist = ArrayList<Book_Shelf>()
|
||||
val Booklist2 = ArrayList<Book_Shelf>()
|
||||
lateinit var adapter:BookshelfAdapter
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_bookshelf)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
inits()
|
||||
val layoutManager=GridLayoutManager(this,3)
|
||||
recyclerView2.layoutManager=layoutManager
|
||||
adapter=BookshelfAdapter(this,Booklist)
|
||||
recyclerView2.adapter=adapter
|
||||
adapter.setRecyclerViewOnItemClickListener(object : BookshelfAdapter.RecyclerViewOnItemClickListener {
|
||||
override fun onItemClickListener(view: View?, position: Int) {
|
||||
Log.d("zyzh","12311")
|
||||
adapter.setSelectItem(position)
|
||||
}
|
||||
|
||||
override fun onItemLongClickListener(view: View?, position: Int): Boolean {
|
||||
Log.d("zy11","123121")
|
||||
adapter.setShowBox()
|
||||
adapter.setSelectItem(position)
|
||||
adapter.notifyDataSetChanged()
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
swipeRefresh2.setOnRefreshListener {
|
||||
refreshBookShelf(adapter)
|
||||
}
|
||||
setupBottomNavigation()
|
||||
}
|
||||
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
|
||||
menuInflater.inflate(R.menu.nav_bookshelf,menu)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when(item.getItemId()) {
|
||||
R.id.addBook-> {
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
R.id.editor->{
|
||||
adapter.initMap()
|
||||
adapter.setShowBox()
|
||||
adapter.notifyDataSetChanged()
|
||||
// bookshelf_checkBox.visibility=View.VISIBLE
|
||||
}
|
||||
}
|
||||
return super.onContextItemSelected(item);
|
||||
}
|
||||
private fun inits() {
|
||||
val bmobQuery = BmobQuery<BookShelf>()
|
||||
bmobQuery.addWhereEqualTo("userid", UserId)
|
||||
bmobQuery.findObjects(object : FindListener<BookShelf>() {
|
||||
override fun done(list: List<BookShelf>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
Booklist.add(Book_Shelf(i.b_name))
|
||||
val adapter =BookshelfAdapter(this@BookShelfActivity,Booklist)
|
||||
recyclerView2.adapter = adapter
|
||||
}
|
||||
Booklist.add(Book_Shelf("添加"))
|
||||
Booklist2.add(Book_Shelf("添加"))
|
||||
val adapter =BookshelfAdapter(this@BookShelfActivity,Booklist)
|
||||
recyclerView2.adapter = adapter
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun refreshBookShelf(adapter: BookshelfAdapter) {
|
||||
thread {
|
||||
Thread.sleep(2000)
|
||||
runOnUiThread {
|
||||
initbookshelf()
|
||||
adapter.notifyDataSetChanged()
|
||||
swipeRefresh2.isRefreshing = false
|
||||
Toast.makeText(this, "刷新成功!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
private fun initbookshelf(){
|
||||
Booklist.clear()
|
||||
val bmobQuery = BmobQuery<BookShelf>()
|
||||
bmobQuery.addWhereEqualTo("userid", UserId)
|
||||
bmobQuery.findObjects(object : FindListener<BookShelf>() {
|
||||
override fun done(list: List<BookShelf>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
Booklist.add(Book_Shelf(i.b_name))
|
||||
}
|
||||
Booklist.add(Book_Shelf("添加"))
|
||||
val adapter =BookshelfAdapter(this@BookShelfActivity,Booklist)
|
||||
recyclerView2.adapter = adapter
|
||||
}else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun setupBottomNavigation() {
|
||||
bookcity.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, MainActivity::class.java)
|
||||
}
|
||||
bookshelf.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, BookShelfActivity::class.java)
|
||||
}
|
||||
reading_comprehension.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, PerceptionActivity::class.java)
|
||||
}
|
||||
homepage.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, MyActivity::class.java)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,322 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
|
||||
import android.util.Log
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.UpdateListener
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
import android.os.Bundle
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import cn.bmob.v3.listener.SaveListener
|
||||
import com.zjgsu.jianshu.Activity.BookIntro
|
||||
import com.zjgsu.jianshu.Adapter.GoodsuibiAdapter
|
||||
import com.zjgsu.jianshu.Bmob.BookShelf
|
||||
import com.zjgsu.jianshu.Bmob.Book_inf_bmob
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import kotlinx.android.synthetic.main.activity_book_info.*
|
||||
import kotlinx.android.synthetic.main.title.*
|
||||
|
||||
|
||||
class Book_informationActivity : AppCompatActivity() {
|
||||
private var author_name: String = ""
|
||||
private val perceptionList = ArrayList<Perception>()
|
||||
var Mycomment: Boolean = false
|
||||
private lateinit var Bookname: String
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_book_info)
|
||||
supportActionBar?.hide()
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
Bookname = intent.getStringExtra("Book_name").toString()
|
||||
inits()
|
||||
val layoutManager =
|
||||
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.HORIZONTAL)//第一个参数是列数
|
||||
recyclerView3.layoutManager = layoutManager
|
||||
var adapter = GoodsuibiAdapter(perceptionList)
|
||||
recyclerView3.adapter = adapter
|
||||
val query = BmobQuery<Book_inf_bmob>()
|
||||
query.addWhereEqualTo("name", Bookname)
|
||||
query.findObjects(object : FindListener<Book_inf_bmob>() {
|
||||
override fun done(p0: MutableList<Book_inf_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
for (p in p0) {
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(p!!.picture.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(5000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
book_imageview.setImageBitmap(bitmap)
|
||||
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
if (p.buxing + p.tuijian + p.buxing != 0) {
|
||||
var tuijian_res: Double = 0.0
|
||||
tuijian_res = (p.tuijian) * 100.0 / (p.buxing + p.tuijian + p.yiban)
|
||||
progressBar_henhao.progress =
|
||||
p.tuijian * 100 / (p.buxing + p.tuijian + p.yiban)
|
||||
progressBar_yiban.progress =
|
||||
p.yiban * 100 / (p.buxing + p.tuijian + p.yiban)
|
||||
progressBar_buxing.progress =
|
||||
p.buxing * 100 / (p.buxing + p.tuijian + p.yiban)
|
||||
val str: String = String.format("%.2f", tuijian_res)
|
||||
textView10.text = "简书推荐值 " + str + "%"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
// val query1 = BmobQuery<Book_video>()
|
||||
// query1.addWhereEqualTo("objectId", Bookname)
|
||||
// query1.findObjects(object : FindListener<Book_video>() {
|
||||
// override fun done(p0: MutableList<Book_video>?, p1: BmobException?) {
|
||||
// if (p1 == null) {
|
||||
// if (p0 != null && p0.size > 0) {
|
||||
// for (p in p0) {
|
||||
// object : Thread() {
|
||||
// override fun run() {
|
||||
// try {
|
||||
// val url = Uri.parse(p!!.view1.url)
|
||||
// mVideoView1.setVideoURI(url)
|
||||
// mVideoView1.start()
|
||||
//
|
||||
// } catch (e: Exception) {
|
||||
// e.printStackTrace()
|
||||
// }
|
||||
// }
|
||||
// }.start()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// query1.findObjects(object : FindListener<Book_video>() {
|
||||
// override fun done(p0: MutableList<Book_video>?, p1: BmobException?) {
|
||||
// if (p1 == null) {
|
||||
// if (p0 != null && p0.size > 0) {
|
||||
// for (p in p0) {
|
||||
// object : Thread() {
|
||||
// override fun run() {
|
||||
// try {
|
||||
// val url = Uri.parse(p!!.view2.url)
|
||||
// mVideoView2.setVideoURI(url)
|
||||
// mVideoView2.start()
|
||||
// } catch (e: Exception) {
|
||||
// e.printStackTrace()
|
||||
// }
|
||||
// }
|
||||
// }.start()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
query.findObjects(object : FindListener<Book_inf_bmob>() {
|
||||
override fun done(list: List<Book_inf_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
Book_name_View.text = i.name
|
||||
book_authorname.text = i.author_name
|
||||
author_name=i.author_name
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
book_authorname.setOnClickListener {
|
||||
val intent = Intent(this, author_introductionActivity::class.java)
|
||||
intent.putExtra("author_name", author_name)
|
||||
startActivity(intent)
|
||||
}
|
||||
b_henhao.setOnClickListener {
|
||||
if (Mycomment == false) {
|
||||
Mycomment = true
|
||||
query.findObjects(object : FindListener<Book_inf_bmob>() {
|
||||
override fun done(list: List<Book_inf_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
i.settuijian(i.tuijian + 1)
|
||||
i.update(i.objectId, object : UpdateListener() {
|
||||
override fun done(p0: BmobException?) {
|
||||
if (p0 == null) {
|
||||
Toast.makeText(
|
||||
this@Book_informationActivity,
|
||||
"评价成功!",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
} else {
|
||||
Log.d(
|
||||
"保存数据!!!!!!!!!!!!!!!!!!",
|
||||
p0.message.toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
} else
|
||||
Toast.makeText(this, "仅能评价一次!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
b_yiban.setOnClickListener {
|
||||
if (Mycomment == false) {
|
||||
Mycomment = true
|
||||
query.findObjects(object : FindListener<Book_inf_bmob>() {
|
||||
override fun done(list: List<Book_inf_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
i.setyiban(i.yiban + 1)
|
||||
i.update(i.objectId, object : UpdateListener() {
|
||||
override fun done(p0: BmobException?) {
|
||||
if (p0 == null) {
|
||||
Toast.makeText(
|
||||
this@Book_informationActivity,
|
||||
"评价成功!",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
} else {
|
||||
Log.d(
|
||||
"保存数据!!!!!!!!!!!!!!!!!!",
|
||||
p0.message.toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
} else
|
||||
Toast.makeText(this, "仅能评价一次!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
b_buxing.setOnClickListener {
|
||||
if (Mycomment == false) {
|
||||
Mycomment = true
|
||||
query.findObjects(object : FindListener<Book_inf_bmob>() {
|
||||
override fun done(list: List<Book_inf_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
i.setbuxing(i.buxing + 1)
|
||||
i.update(i.objectId, object : UpdateListener() {
|
||||
override fun done(p0: BmobException?) {
|
||||
if (p0 == null) {
|
||||
Toast.makeText(
|
||||
this@Book_informationActivity,
|
||||
"评价成功!",
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
} else {
|
||||
Log.d(
|
||||
"保存数据!!!!!!!!!!!!!!!!!!",
|
||||
p0.message.toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
} else
|
||||
Toast.makeText(this, "仅能评价一次!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
titleback.setOnClickListener {
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
titleAddBook.setOnClickListener {
|
||||
val query = BmobQuery<BookShelf>()
|
||||
query.addWhereEqualTo("userid", UserId)
|
||||
query.addWhereEqualTo("b_name", Bookname)
|
||||
query.findObjects(object : FindListener<BookShelf>() {
|
||||
override fun done(p0: MutableList<BookShelf>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
Toast.makeText(this@Book_informationActivity, "书本已在您的书架中!", Toast.LENGTH_SHORT)
|
||||
} else {
|
||||
val bookshelf_record = BookShelf()
|
||||
bookshelf_record.settb_name(Bookname)
|
||||
bookshelf_record.setuserid(UserId)
|
||||
bookshelf_record.save(object : SaveListener<String>() {
|
||||
override fun done(objectId: String?, e: BmobException?) {
|
||||
if (e == null) {
|
||||
titleAddBook.setImageResource(R.drawable.bookshelf2)
|
||||
Toast.makeText(this@Book_informationActivity,"添加成功",Toast.LENGTH_SHORT).show()
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
book_imageview.setOnClickListener {
|
||||
val intent = Intent(this, BookIntro::class.java)
|
||||
intent.putExtra("Book_name", Bookname)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
private fun inits() {
|
||||
val myquery = BmobQuery<Perception_bmob>()
|
||||
myquery.addWhereEqualTo("b_name", Bookname)
|
||||
myquery.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(list: List<Perception_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
perceptionList.add(Perception(i.objectId))
|
||||
val adapter = GoodsuibiAdapter(perceptionList)
|
||||
recyclerView3.adapter = adapter
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
val myquery2 = BmobQuery<BookShelf>()
|
||||
myquery2.addWhereEqualTo("userid", UserId)
|
||||
myquery2.addWhereEqualTo("b_name", Bookname)
|
||||
myquery2.findObjects(object : FindListener<BookShelf>() {
|
||||
override fun done(p0: MutableList<BookShelf>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
titleAddBook.setImageResource(R.drawable.bookshelf2)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.PersistableBundle
|
||||
import android.os.Process
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_findpwd.*
|
||||
import kotlinx.android.synthetic.main.activity_findpwd.image_findpwd_backtoLogin
|
||||
import kotlinx.android.synthetic.main.activity_register.*
|
||||
|
||||
class FindpwdActivity:AppCompatActivity() {
|
||||
private var msg:String=""
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_findpwd)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
image_findpwd_backtoLogin.setOnClickListener{
|
||||
val intent=Intent(this,LoginActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
inits()
|
||||
}
|
||||
private val click2 = DialogInterface.OnClickListener { arg0, arg1 -> arg0.cancel()
|
||||
val intent=Intent(this,LoginActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
public fun showdialog(view:View){
|
||||
val alertdialog:AlertDialog.Builder=AlertDialog.Builder(this)
|
||||
alertdialog.setMessage(msg)
|
||||
alertdialog.setNegativeButton("确认", click2);
|
||||
val alertdialog1:AlertDialog=alertdialog.create();
|
||||
alertdialog1.show();
|
||||
}
|
||||
public fun inits(){
|
||||
bt_find_nextstep.setOnClickListener{
|
||||
var flag:Boolean=false
|
||||
val user_account: String = et_find_account.text.toString()
|
||||
val user_email:String=et_find_mail.text.toString()
|
||||
if(user_account.isEmpty()||user_email.isEmpty()) {
|
||||
Toast.makeText(this, "账号或邮箱不能为空!", Toast.LENGTH_SHORT).show()
|
||||
Log.d("zy",user_account)
|
||||
}
|
||||
else{
|
||||
val bmobQuery = BmobQuery<User_bmob>()
|
||||
var tempPwd:String=""
|
||||
bmobQuery.findObjects(object :FindListener<User_bmob>(){
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (user_account.equals(i.account)&&user_email.equals(i.email)) {
|
||||
flag = true
|
||||
tempPwd=i.password
|
||||
msg="您的密码为: "+tempPwd
|
||||
showdialog(bt_find_nextstep)
|
||||
}
|
||||
}
|
||||
if(flag!=true)
|
||||
Toast.makeText(this@FindpwdActivity,"账号不存在,请重新输入!",Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.os.PersistableBundle
|
||||
import android.util.Log
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.core.content.ContextCompat
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.BmobUser
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_login.*
|
||||
import kotlinx.android.synthetic.main.activity_register.*
|
||||
|
||||
class LoginActivity : AppCompatActivity() {
|
||||
// var mBtnLogin:TextView= TextView(this)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
var flag: Boolean = false
|
||||
var done: Boolean = false
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_login)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
forget_password.setOnClickListener {
|
||||
val intent = Intent(this, FindpwdActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
bt_register.setOnClickListener {
|
||||
val intent = Intent(this, RegisterActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
bt_login.setOnClickListener {
|
||||
val use_account: String = et_blackOutName.text.toString()
|
||||
val use_pwd: String = et_UserPassword.text.toString()
|
||||
val bmobQuery = BmobQuery<User_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (use_account.equals(i.account) && use_pwd.equals(i.password)) {
|
||||
val editor=getSharedPreferences("userinf", Context.MODE_PRIVATE).edit()
|
||||
editor.putString("user_id",i.objectId)
|
||||
editor.apply()
|
||||
flag = true
|
||||
val intent = Intent(this@LoginActivity, MainActivity::class.java)
|
||||
intent.putExtra("userid",i.objectId)
|
||||
startActivity(intent)
|
||||
Toast.makeText(this@LoginActivity, "登陆成功!", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
break
|
||||
}
|
||||
}
|
||||
done = true
|
||||
}
|
||||
}
|
||||
})
|
||||
if (done) {
|
||||
var a: String = ""
|
||||
if (flag)
|
||||
a = "1"
|
||||
else
|
||||
a = "0"
|
||||
Log.d("zynnnb", a)
|
||||
if (use_account.isEmpty() || use_pwd.isEmpty())
|
||||
Toast.makeText(this, "账号或密码不能为空白", Toast.LENGTH_SHORT).show()
|
||||
else if (flag != true)
|
||||
Toast.makeText(this@LoginActivity, "账号或密码不正确", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
363
app/src/main/java/com/zjgsu/jianshu/Activity/MainActivity.kt
Normal file
@ -0,0 +1,363 @@
|
||||
//package com.zjgsu.jianshu
|
||||
//import android.content.ClipData
|
||||
//import android.content.Intent
|
||||
//import androidx.appcompat.app.AppCompatActivity
|
||||
//import android.os.Bundle
|
||||
//import android.text.TextUtils
|
||||
//import android.util.Log
|
||||
//import android.view.Menu
|
||||
//import android.view.MenuItem
|
||||
//import android.widget.Adapter
|
||||
//import android.widget.SearchView
|
||||
//import android.widget.Toast
|
||||
//import androidx.core.view.GravityCompat
|
||||
//import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
//import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
//import cn.bmob.v3.Bmob
|
||||
//import cn.bmob.v3.BmobQuery
|
||||
//import cn.bmob.v3.exception.BmobException
|
||||
//import cn.bmob.v3.listener.FindListener
|
||||
//import kotlinx.android.synthetic.main.activity_main.*
|
||||
//import kotlinx.android.synthetic.main.activity_xinli.*
|
||||
//import java.io.BufferedReader
|
||||
//import java.io.IOException
|
||||
//import java.io.InputStream
|
||||
//import java.io.InputStreamReader
|
||||
//import java.lang.StringBuilder
|
||||
//import kotlin.concurrent.thread
|
||||
//
|
||||
//var UserId: String = ""
|
||||
//
|
||||
//class MainActivity : AppCompatActivity() {
|
||||
// private var user_id: String = ""
|
||||
// private var bookList = ArrayList<Book>()
|
||||
// private var bookList1 = ArrayList<Book>()
|
||||
// private var bookList2 = ArrayList<Book>()
|
||||
// private var bookList3 = ArrayList<Book>()
|
||||
// public fun Search(query: String): ArrayList<Book> {
|
||||
// val bookList1 = ArrayList<Book>()
|
||||
// for (source in bookList) {
|
||||
// if (source.name.contains(query))
|
||||
// bookList1.add(
|
||||
// Book(
|
||||
// source.name,
|
||||
// source.introduce,
|
||||
// source.tuijian,
|
||||
// source.yiban,
|
||||
// source.buxing
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
// return bookList1
|
||||
// }
|
||||
//
|
||||
// override fun onCreate(savedInstanceState: Bundle?) {
|
||||
// super.onCreate(savedInstanceState)
|
||||
// setContentView(R.layout.activity_main)
|
||||
// supportActionBar?.let {
|
||||
// it.setDisplayHomeAsUpEnabled(true)
|
||||
// it.setHomeAsUpIndicator(R.drawable.menu)
|
||||
// }
|
||||
// Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
// UserId = intent.getStringExtra("userid").toString()
|
||||
// inits()
|
||||
// val layoutManager =
|
||||
// StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)//第一个参数是列数
|
||||
// recyclerView.layoutManager = layoutManager
|
||||
// var adapter = BookAdapter(bookList)
|
||||
// recyclerView.adapter = adapter
|
||||
// swipeRefresh.setOnRefreshListener {
|
||||
// refreshBooks(adapter)
|
||||
// }
|
||||
// navView.setCheckedItem(R.id.goodbook)
|
||||
// navView.setNavigationItemSelectedListener {
|
||||
// val intentwenxue = Intent(this, WenXueActivity::class.java)
|
||||
// val intentguanli = Intent(this, guanliActivity::class.java)
|
||||
// val intentxinli = Intent(this, xinliActivity::class.java)
|
||||
// val intentkexue = Intent(this, kexueActivity::class.java)
|
||||
// val intentzhexue = Intent(this, zhexueActivity::class.java)
|
||||
// when (it.itemId) {
|
||||
// R.id.wenxue -> startActivity(intentwenxue)
|
||||
// R.id.guanli -> startActivity(intentguanli)
|
||||
// R.id.xinli -> startActivity(intentxinli)
|
||||
// R.id.zhexue -> startActivity(intentzhexue)
|
||||
// R.id.kexue -> startActivity(intentkexue)
|
||||
// }
|
||||
// drawerLayout.closeDrawers()
|
||||
// true
|
||||
// }
|
||||
// main_searchview.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
|
||||
// // 设置搜索文本监听{
|
||||
// override fun onQueryTextSubmit(query: String): Boolean { //搜索时触发事件
|
||||
// return false
|
||||
// }
|
||||
//
|
||||
// override fun onQueryTextChange(newText: String): Boolean {
|
||||
// if (TextUtils.isEmpty(newText)) {
|
||||
// bookList.clear()
|
||||
// bookList.addAll(bookList2)
|
||||
// } else {
|
||||
// bookList1.clear()
|
||||
// bookList.clear()
|
||||
// bookList1.addAll(bookList2)
|
||||
// for (source in bookList1) {
|
||||
// if (source.name.contains(newText)) {
|
||||
// bookList.add(
|
||||
// Book(
|
||||
// source.name,
|
||||
// source.introduce,
|
||||
// source.tuijian,
|
||||
// source.yiban,
|
||||
// source.buxing
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
// for (i in bookList)
|
||||
// Log.d("zy123", i.name)
|
||||
// bookList3.addAll(bookList)
|
||||
// thread {
|
||||
// Thread.sleep(2000)
|
||||
// runOnUiThread {
|
||||
// initBooks()
|
||||
// adapter.notifyDataSetChanged()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return false
|
||||
// }
|
||||
// })
|
||||
// book_recommend.setOnClickListener {
|
||||
// val intent = Intent(this, MainActivity::class.java)
|
||||
// startActivity(intent)
|
||||
// finish()
|
||||
// }
|
||||
// book_bookshelf.setOnClickListener {
|
||||
// val intent = Intent(this, BookShelfActivity::class.java)
|
||||
// startActivity(intent)
|
||||
// finish()
|
||||
// }
|
||||
// reading_comprehension.setOnClickListener {
|
||||
// val intent = Intent(this, PerceptionActivity::class.java)
|
||||
// startActivity(intent)
|
||||
// finish()
|
||||
// }
|
||||
// self.setOnClickListener {
|
||||
// val intent = Intent(this, MyActivity::class.java)
|
||||
// startActivity(intent)
|
||||
// finish()
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private fun refreshBooks(adapter: BookAdapter) {
|
||||
// thread {
|
||||
// Thread.sleep(2000)
|
||||
// runOnUiThread {
|
||||
// initBooks()
|
||||
// adapter.notifyDataSetChanged()
|
||||
// swipeRefresh.isRefreshing = false
|
||||
// Toast.makeText(this, "刷新成功!", Toast.LENGTH_SHORT).show()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
// when (item.itemId) {
|
||||
// android.R.id.home -> drawerLayout.openDrawer(GravityCompat.START)
|
||||
// }
|
||||
// return true
|
||||
// }
|
||||
//
|
||||
// private fun initBooks() {
|
||||
// if (bookList3.isNotEmpty()) {
|
||||
// bookList.clear()
|
||||
// bookList.addAll(bookList3)
|
||||
// val adapter = BookAdapter(bookList)
|
||||
// recyclerView.adapter = adapter
|
||||
// bookList3.clear()
|
||||
// } else {
|
||||
// bookList.clear()
|
||||
// val bmobQuery = BmobQuery<Book_bmob>()
|
||||
// bmobQuery.findObjects(object : FindListener<Book_bmob>() {
|
||||
// override fun done(list: List<Book_bmob>, e: BmobException?) {
|
||||
// var cnt: Int = 0
|
||||
// if (e == null) {
|
||||
// for (i in list) {
|
||||
// if (cnt < 15) {
|
||||
// bookList.add(
|
||||
// Book(
|
||||
// i.name,
|
||||
// i.introduce,
|
||||
// i.tuijian,
|
||||
// i.yiban,
|
||||
// i.buxing
|
||||
// )
|
||||
// )
|
||||
// val adapter = BookAdapter(bookList)
|
||||
// recyclerView.adapter = adapter
|
||||
// cnt++
|
||||
// }
|
||||
// }
|
||||
//// bookList.sortBy { it.tuijian * 100 / (it.buxing + it.tuijian + it.buxing) }
|
||||
// } else {
|
||||
// Log.d("error", "error")
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private fun inits() {
|
||||
//// initsIntroduction()
|
||||
//// val books= mutableListOf(Book("围城","1111111111111",R.drawable.weicheng),Book("当尼采哭泣","2222222222",R.drawable.nicai),Book("台北人","333333333",R.drawable.taibei))
|
||||
//// for(index in 0..2) {
|
||||
//// bookList.add(books[index])
|
||||
//// bookList2.add(books[index])
|
||||
//// val adapter = BookAdapter(this@MainActivity, bookList)
|
||||
//// recyclerView.adapter = adapter
|
||||
//// }
|
||||
// val bmobQuery = BmobQuery<Book_bmob>()
|
||||
// bmobQuery.findObjects(object : FindListener<Book_bmob>() {
|
||||
// override fun done(list: List<Book_bmob>, e: BmobException?) {
|
||||
// var cnt: Int = 0
|
||||
// if (e == null) {
|
||||
// for (i in list) {
|
||||
// if (cnt < 15) {
|
||||
// bookList.add(Book(i.name, i.introduce, i.tuijian, i.yiban, i.buxing))
|
||||
// bookList2.add(Book(i.name, i.introduce, i.tuijian, i.yiban, i.buxing))
|
||||
// val adapter = BookAdapter(bookList)
|
||||
// recyclerView.adapter = adapter
|
||||
// cnt++
|
||||
// }
|
||||
// }
|
||||
//// bookList.add(Book("www","www",11,12,13))
|
||||
// } else {
|
||||
// Log.d("error", "error")
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.app.Person
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import android.widget.SearchView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
import com.zjgsu.jianshu.Bmob.Book_inf_bmob
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||
|
||||
var UserId: String = ""
|
||||
class MainActivity : AppCompatActivity() {
|
||||
private lateinit var adapter: BookAdapter
|
||||
private var bookList = ArrayList<Book>()
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
supportActionBar?.setHomeAsUpIndicator(R.drawable.menu)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")
|
||||
adapter = BookAdapter(bookList)
|
||||
recyclerView.layoutManager = StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)
|
||||
recyclerView.adapter = adapter
|
||||
|
||||
swipeRefresh.setOnRefreshListener {
|
||||
loadBooks() //下拉刷新
|
||||
}
|
||||
|
||||
main_searchview.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
|
||||
override fun onQueryTextSubmit(query: String): Boolean = false
|
||||
|
||||
override fun onQueryTextChange(newText: String): Boolean {
|
||||
val filteredList = if (TextUtils.isEmpty(newText)) {
|
||||
bookList
|
||||
} else {
|
||||
bookList.filter { it.name.contains(newText) }
|
||||
}
|
||||
adapter.updateBooks(filteredList) //搜索框刷新
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
navView.setCheckedItem(R.id.goodbook)
|
||||
navView.setNavigationItemSelectedListener { menuItem ->
|
||||
startActivity(Intent(this, when(menuItem.itemId) {
|
||||
R.id.wenxue -> WenXueActivity::class.java
|
||||
R.id.guanli -> guanliActivity::class.java
|
||||
R.id.xinli -> xinliActivity::class.java
|
||||
R.id.zhexue -> zhexueActivity::class.java
|
||||
R.id.kexue -> kexueActivity::class.java
|
||||
else -> MainActivity::class.java
|
||||
}))
|
||||
drawerLayout.closeDrawers()
|
||||
true
|
||||
}
|
||||
|
||||
loadBooks()
|
||||
setupBottomNavigation()
|
||||
}
|
||||
|
||||
private fun loadBooks() {
|
||||
val query = BmobQuery<Book_bmob>()
|
||||
query.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(books: List<Book_bmob>?, e: BmobException?) {
|
||||
swipeRefresh.isRefreshing = false
|
||||
if (e == null) {
|
||||
bookList.clear()
|
||||
books?.let {
|
||||
bookList.addAll(it.map { b ->
|
||||
// 使用安全调用和Elvis操作符提供默认值或进行错误处理
|
||||
val url = b.picture?.url ?: "default_url_or_handling_case"
|
||||
Book(b.name, b.introduce, url)
|
||||
})
|
||||
}
|
||||
adapter.notifyDataSetChanged()
|
||||
} else {
|
||||
Toast.makeText(this@MainActivity, "Failed to retrieve books: ${e.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun setupBottomNavigation() {
|
||||
bookcity.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, MainActivity::class.java)
|
||||
}
|
||||
bookshelf.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, BookShelfActivity::class.java)
|
||||
}
|
||||
reading_comprehension.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, PerceptionActivity::class.java)
|
||||
}
|
||||
homepage.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, MyActivity::class.java)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
if (item.itemId == android.R.id.home) {
|
||||
drawerLayout.openDrawer(GravityCompat.START)
|
||||
return true
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,161 @@
|
||||
package com.zjgsu.jianshu.Activity;
|
||||
import android.app.Activity;
|
||||
import android.app.LocalActivityManager;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Matrix;
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.TranslateAnimation;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.VideoView;
|
||||
import com.zjgsu.jianshu.R;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class MediaPlayerActivity extends Activity implements View.OnClickListener{
|
||||
|
||||
private ViewPager viewPager;
|
||||
private ArrayList<View> pageview;
|
||||
private TextView videoLayout;
|
||||
private TextView musicLayout;
|
||||
// 滚动条图片
|
||||
private ImageView scrollbar;
|
||||
// 滚动条初始偏移量
|
||||
private int offset = 0;
|
||||
// 当前页编号
|
||||
private int currIndex = 0;
|
||||
// 滚动条宽度
|
||||
private int bmpW;
|
||||
//一倍滚动量
|
||||
private int one;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.pageview);
|
||||
viewPager = (ViewPager) findViewById(R.id.viewPager);
|
||||
//查找布局文件用LayoutInflater.inflate
|
||||
LayoutInflater inflater =getLayoutInflater();
|
||||
View view1 = inflater.inflate(R.layout.video_player, null);
|
||||
View view2 = inflater.inflate(R.layout.media_player, null);
|
||||
videoLayout = (TextView)findViewById(R.id.videoLayout);
|
||||
musicLayout = (TextView)findViewById(R.id.musicLayout);
|
||||
scrollbar = (ImageView)findViewById(R.id.scrollbar);
|
||||
videoLayout.setOnClickListener(this);
|
||||
musicLayout.setOnClickListener(this);
|
||||
pageview =new ArrayList<View>();
|
||||
//添加想要切换的界面
|
||||
pageview.add(view1);
|
||||
pageview.add(view2);
|
||||
//数据适配器
|
||||
PagerAdapter mPagerAdapter = new PagerAdapter(){
|
||||
|
||||
@Override
|
||||
//获取当前窗体界面数
|
||||
public int getCount() {
|
||||
// TODO Auto-generated method stub
|
||||
return pageview.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
//判断是否由对象生成界面
|
||||
public boolean isViewFromObject(View arg0, Object arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
return arg0==arg1;
|
||||
}
|
||||
//使从ViewGroup中移出当前View
|
||||
public void destroyItem(View arg0, int arg1, Object arg2) {
|
||||
((ViewPager) arg0).removeView(pageview.get(arg1));
|
||||
}
|
||||
|
||||
//返回一个对象,这个对象表明了PagerAdapter适配器选择哪个对象放在当前的ViewPager中
|
||||
public Object instantiateItem(View arg0, int arg1){
|
||||
((ViewPager)arg0).addView(pageview.get(arg1));
|
||||
return pageview.get(arg1);
|
||||
}
|
||||
};
|
||||
//绑定适配器
|
||||
viewPager.setAdapter(mPagerAdapter);
|
||||
//设置viewPager的初始界面为第一个界面
|
||||
viewPager.setCurrentItem(0);
|
||||
//添加切换界面的监听器
|
||||
viewPager.addOnPageChangeListener(new MyOnPageChangeListener());
|
||||
// 获取滚动条的宽度
|
||||
bmpW = BitmapFactory.decodeResource(getResources(), R.drawable.weicheng).getWidth();
|
||||
//为了获取屏幕宽度,新建一个DisplayMetrics对象
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
//将当前窗口的一些信息放在DisplayMetrics类中
|
||||
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
//得到屏幕的宽度
|
||||
int screenW = displayMetrics.widthPixels;
|
||||
//计算出滚动条初始的偏移量
|
||||
offset = (screenW / 2 - bmpW) / 2;
|
||||
//计算出切换一个界面时,滚动条的位移量
|
||||
one = offset * 2 + bmpW;
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.postTranslate(offset, 0);
|
||||
//将滚动条的初始位置设置成与左边界间隔一个offset
|
||||
scrollbar.setImageMatrix(matrix);
|
||||
}
|
||||
|
||||
public class MyOnPageChangeListener implements ViewPager.OnPageChangeListener {
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int arg0) {
|
||||
Animation animation = null;
|
||||
switch (arg0) {
|
||||
case 0:
|
||||
/**
|
||||
* TranslateAnimation的四个属性分别为
|
||||
* float fromXDelta 动画开始的点离当前View X坐标上的差值
|
||||
* float toXDelta 动画结束的点离当前View X坐标上的差值
|
||||
* float fromYDelta 动画开始的点离当前View Y坐标上的差值
|
||||
* float toYDelta 动画开始的点离当前View Y坐标上的差值
|
||||
**/
|
||||
animation = new TranslateAnimation(one, 0, 0, 0);
|
||||
break;
|
||||
case 1:
|
||||
animation = new TranslateAnimation(offset, one, 0, 0);
|
||||
break;
|
||||
}
|
||||
//arg0为切换到的页的编码
|
||||
currIndex = arg0;
|
||||
// 将此属性设置为true可以使得图片停在动画结束时的位置
|
||||
animation.setFillAfter(true);
|
||||
//动画持续时间,单位为毫秒
|
||||
animation.setDuration(200);
|
||||
//滚动条开始动画
|
||||
scrollbar.startAnimation(animation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrolled(int arg0, float arg1, int arg2) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int arg0) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view){
|
||||
switch (view.getId()){
|
||||
case R.id.videoLayout:
|
||||
//点击"视频“时切换到第一页
|
||||
viewPager.setCurrentItem(0);
|
||||
break;
|
||||
case R.id.musicLayout:
|
||||
//点击“音乐”时切换的第二页
|
||||
viewPager.setCurrentItem(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
113
app/src/main/java/com/zjgsu/jianshu/Activity/MyActivity.kt
Normal file
@ -0,0 +1,113 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Activity.AccountManagerActivity
|
||||
import com.zjgsu.jianshu.Activity.MyPostActivity
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.activity_my.*
|
||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
class MyActivity : AppCompatActivity() {
|
||||
|
||||
//登录的用户名
|
||||
public val user_account="0509"
|
||||
// public val user="斤鱼"
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_my)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754") //连接bmob
|
||||
val query = BmobQuery<User_bmob>()
|
||||
query.addWhereEqualTo("objectId", UserId)
|
||||
query.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(p0: MutableList<User_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if(p0!=null&&p0.size>0) {
|
||||
for (p in p0) {
|
||||
tUserName.text=p.nickName
|
||||
tUserSignature.text=p.signature
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(p!!.face.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(5000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
iv_avatar.setImageBitmap(bitmap)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
//个人信息修改
|
||||
re_myinfo.setOnClickListener {
|
||||
val extra_account=user_account
|
||||
val intent= Intent(this,ReMyinfoActivity::class.java)
|
||||
intent.putExtra("extra_account",extra_account)
|
||||
// Log.d("helloSend","$signatureData")
|
||||
// Log.d("helloSend","$userData")
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
//我的发布
|
||||
myPost.setOnClickListener {
|
||||
val intent= Intent(this,MyPostActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
//账号管理
|
||||
account_manager.setOnClickListener{
|
||||
val intent= Intent(this,AccountManagerActivity::class.java)
|
||||
val userData=user_account
|
||||
intent.putExtra("extra_user_data",userData)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
|
||||
tuichu.setOnClickListener {
|
||||
val intent= Intent(this,LoginActivity::class.java)
|
||||
UserId=""
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
setupBottomNavigation()
|
||||
}
|
||||
private fun setupBottomNavigation() {
|
||||
bookcity.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, MainActivity::class.java)
|
||||
}
|
||||
bookshelf.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, BookShelfActivity::class.java)
|
||||
}
|
||||
reading_comprehension.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, PerceptionActivity::class.java)
|
||||
}
|
||||
homepage.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, MyActivity::class.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
package com.zjgsu.jianshu.Activity
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.*
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import kotlinx.android.synthetic.main.activity_my_post.*
|
||||
|
||||
class MyPostActivity : AppCompatActivity() {
|
||||
private val PerceptionList = ArrayList<Perception>()
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_my_post)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
inits()
|
||||
|
||||
val layoutManager=LinearLayoutManager(this)
|
||||
myPost_recyclerView.layoutManager = layoutManager
|
||||
val adapter =PerceptionAdapter(PerceptionList)
|
||||
|
||||
myPost_recyclerView.adapter = adapter
|
||||
|
||||
Log.d("myLog",myPost_recyclerView.adapter.toString())
|
||||
mypost_back.setOnClickListener {
|
||||
val intent = Intent(this, MyActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
private fun inits() {
|
||||
val bmobQuery = BmobQuery<Perception_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(list: List<Perception_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list){
|
||||
if(i.userid== UserId) {
|
||||
PerceptionList.add(Perception(i.objectId))
|
||||
val adapter = PerceptionAdapter(PerceptionList)
|
||||
myPost_recyclerView.adapter = adapter
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Log.d("error","error")}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Activity.sendPerceptionActivity
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import kotlinx.android.synthetic.main.activity_perception.*
|
||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
class PerceptionActivity : AppCompatActivity() {
|
||||
private val PerceptionList = ArrayList<Perception>()
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_perception)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
inits()
|
||||
val layoutManager=LinearLayoutManager(this)
|
||||
perception_recyclerView.layoutManager = layoutManager
|
||||
val adapter =PerceptionAdapter(PerceptionList)
|
||||
|
||||
perception_recyclerView.adapter = adapter
|
||||
perception_swipeRefresh.setOnRefreshListener {
|
||||
refreshPerception(adapter)
|
||||
}
|
||||
|
||||
Log.d("myLog",perception_recyclerView.adapter.toString())
|
||||
|
||||
fab.setOnClickListener {
|
||||
Toast.makeText(this,"新建随笔",Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
fab.setOnClickListener {
|
||||
val intent=Intent(this,sendPerceptionActivity::class.java)
|
||||
intent.putExtra("userid", UserId)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
setupBottomNavigation()
|
||||
}
|
||||
private fun inits() {
|
||||
val bmobQuery = BmobQuery<Perception_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(list: List<Perception_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list){
|
||||
PerceptionList.add(Perception(i.objectId))
|
||||
val adapter =PerceptionAdapter(PerceptionList)
|
||||
perception_recyclerView.adapter = adapter
|
||||
}
|
||||
}
|
||||
else {
|
||||
Log.d("error","error")}
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun refreshPerception(adapter: PerceptionAdapter) {
|
||||
thread {
|
||||
Thread.sleep(2000)
|
||||
runOnUiThread {
|
||||
inits()
|
||||
adapter.notifyDataSetChanged()
|
||||
perception_swipeRefresh.isRefreshing = false
|
||||
Toast.makeText(this, "刷新成功!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
private fun setupBottomNavigation() {
|
||||
bookcity.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, MainActivity::class.java)
|
||||
}
|
||||
bookshelf.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, BookShelfActivity::class.java)
|
||||
}
|
||||
reading_comprehension.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, PerceptionActivity::class.java)
|
||||
}
|
||||
homepage.setOnClickListener {
|
||||
NavigationHelper.navigateTo(this, MyActivity::class.java)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,196 @@
|
||||
package com.zjgsu.jianshu.Activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.SaveListener
|
||||
import com.zjgsu.jianshu.*
|
||||
import com.zjgsu.jianshu.Adapter.CommentAdapter
|
||||
import com.zjgsu.jianshu.Bmob.Book_inf_bmob
|
||||
import com.zjgsu.jianshu.Bmob.Comment_bmob
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_perception_infomation.*
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
class Perception_informationActivity:AppCompatActivity() {
|
||||
private lateinit var perceptionid:String
|
||||
private lateinit var bookName:String
|
||||
private val commentlist=ArrayList<Comment>()
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_perception_infomation)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
perceptionid = intent.getStringExtra("PerceptionId").toString()
|
||||
Log.d("mytest",perceptionid)
|
||||
inits()
|
||||
val layoutManager =
|
||||
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)//第一个参数是列数
|
||||
comment_recyclerview.layoutManager = layoutManager
|
||||
var adapter = CommentAdapter(commentlist)
|
||||
comment_recyclerview.adapter = adapter
|
||||
submitComment.setOnClickListener {
|
||||
val comment=Comment_bmob()
|
||||
comment.text=yourcomment.text.toString()
|
||||
comment.perceptionid=perceptionid
|
||||
comment.comment_personid= UserId
|
||||
comment.save(object : SaveListener<String>() {
|
||||
override fun done(objectId: String?, e: BmobException?) {
|
||||
if (e == null) {
|
||||
Toast.makeText(
|
||||
this@Perception_informationActivity,
|
||||
"评论成功!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
yourcomment.text=null
|
||||
} else {
|
||||
Toast.makeText(
|
||||
this@Perception_informationActivity,
|
||||
"评论失败!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
inf_bookInf.setOnClickListener{
|
||||
val intent = Intent(this, Book_informationActivity::class.java)
|
||||
intent.putExtra("Book_name", bookName)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
private fun inits(){
|
||||
val query = BmobQuery<Perception_bmob>()
|
||||
query.addWhereEqualTo("objectId",perceptionid)
|
||||
//加载用户头像
|
||||
query.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(p0: MutableList<Perception_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
for (p in p0) {
|
||||
//找发布用户
|
||||
inf_textView_perception.text=p.perception
|
||||
postTime.text="发表于 "+p.createdAt
|
||||
val queryUser = BmobQuery<User_bmob>()
|
||||
queryUser.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (p.userid.equals(i.objectId)) {
|
||||
inf_postPersonName.text=i.nickName
|
||||
// flag = true //找到
|
||||
Log.d("myLog", "find sucessflly")
|
||||
//加载图片
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(i!!.face?.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(3000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
inf_user_icon.setImageBitmap(bitmap)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d("myLog", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
//加载书籍封面
|
||||
query.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(p0: MutableList<Perception_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
for (p in p0) {
|
||||
Log.d("myLog", p.b_name)
|
||||
bookName = p.b_name
|
||||
inf_bookName.text = bookName
|
||||
val queryBook = BmobQuery<Book_inf_bmob>()
|
||||
queryBook.findObjects(object : FindListener<Book_inf_bmob>() {
|
||||
override fun done(list: List<Book_inf_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (p.b_name.equals(i.name)) {
|
||||
inf_bookAuthor.text =
|
||||
i.author_name
|
||||
//加载图片
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(i!!.picture?.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(3000)
|
||||
val `in`: InputStream =
|
||||
connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
inf_book_pic.setImageBitmap(
|
||||
bitmap
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d("myLog", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
val bmobquery=BmobQuery<Comment_bmob>()
|
||||
bmobquery.addWhereEqualTo("perceptionid",perceptionid)
|
||||
bmobquery.findObjects(object:FindListener<Comment_bmob>(){
|
||||
override fun done(list:List<Comment_bmob>,e:BmobException?){
|
||||
if(e==null){
|
||||
var cnt=0
|
||||
for(i in list){
|
||||
cnt++
|
||||
commentlist.add(Comment(i.objectId))
|
||||
val adapter = CommentAdapter(commentlist)
|
||||
comment_recyclerview.adapter = adapter
|
||||
}
|
||||
comment_cnt.text="评论 "+cnt.toString()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.UpdateListener
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_re_email.*
|
||||
|
||||
class ReAddressActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_re_email)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754") //连接bmob
|
||||
|
||||
t_title.setText("修改地址")
|
||||
val extra_account = intent.getStringExtra("extra_account")
|
||||
val extra_address = intent.getStringExtra("extra_address")
|
||||
cur_email.setHint(extra_address)
|
||||
|
||||
btnOk.setOnClickListener {
|
||||
var flag: Boolean = false
|
||||
val user_account: String = et_account.text.toString()
|
||||
var curAddress = cur_email.text.toString()
|
||||
//
|
||||
// val intent=Intent(this,ReMyinfoActivity::class.java)
|
||||
val intent = Intent(this, ReMyinfoActivity::class.java)
|
||||
if (user_account.isEmpty()) {
|
||||
Toast.makeText(this, "账号不能为空!", Toast.LENGTH_SHORT).show()
|
||||
Log.d("zy", user_account)
|
||||
} else {
|
||||
val bmobQuery = BmobQuery<User_bmob>()
|
||||
var tempPwd: String = ""
|
||||
bmobQuery.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (user_account.equals(i.account)) {
|
||||
flag = true //找到
|
||||
Log.d("myLog", "find sucessflly")
|
||||
//-------更新数据库中的sex
|
||||
i.setaddress(curAddress)
|
||||
i.update(i.objectId, object : UpdateListener() {
|
||||
override fun done(p0: BmobException?) {
|
||||
if (p0 == null) {
|
||||
Toast.makeText(
|
||||
this@ReAddressActivity,
|
||||
"地址修改成功!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
//跳转个人信息页面,但是跳转之后原来的信息消失,需要重新进才能刷新
|
||||
startActivity(intent)
|
||||
// startActivityForResult(intent,1)
|
||||
finish()
|
||||
|
||||
} else {
|
||||
Log.d("myLog", "can't modify name")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (flag != true)
|
||||
Toast.makeText(
|
||||
this@ReAddressActivity,
|
||||
"账号不存在,请重新输入!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.UpdateListener
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_re_email.*
|
||||
import kotlinx.android.synthetic.main.activity_re_email.back2my
|
||||
|
||||
class ReEmailActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_re_email)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754") //连接bmob
|
||||
|
||||
val emailPatten="^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+\$".toRegex()
|
||||
// val matched=emailPatten.matches(input = "812872040@qq.com")
|
||||
// Log.d("myLog",matched.toString())
|
||||
|
||||
val extra_account = intent.getStringExtra("extra_account")
|
||||
val extra_email = intent.getStringExtra("extra_email")
|
||||
cur_email.setHint(extra_email)
|
||||
back2my.setOnClickListener() {
|
||||
val intent = Intent(this, ReMyinfoActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
|
||||
btnOk.setOnClickListener {
|
||||
var flag: Boolean = false
|
||||
val user_account: String = et_account.text.toString()
|
||||
var curEmail = cur_email.text.toString()
|
||||
//
|
||||
// val intent=Intent(this,ReMyinfoActivity::class.java)
|
||||
val intent = Intent(this, ReMyinfoActivity::class.java)
|
||||
if (user_account.isEmpty()) {
|
||||
Toast.makeText(this, "账号不能为空!", Toast.LENGTH_SHORT).show()
|
||||
Log.d("zy", user_account)
|
||||
} else {
|
||||
val bmobQuery = BmobQuery<User_bmob>()
|
||||
var tempPwd: String = ""
|
||||
bmobQuery.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (user_account.equals(i.account)) {
|
||||
flag = true //找到
|
||||
Log.d("myLog", "find sucessflly")
|
||||
//-------更新数据库中的sex
|
||||
if (emailPatten.matches(input = curEmail) == true) {
|
||||
i.setemail(curEmail)
|
||||
i.update(i.objectId, object : UpdateListener() {
|
||||
override fun done(p0: BmobException?) {
|
||||
if (p0 == null) {
|
||||
Toast.makeText(
|
||||
this@ReEmailActivity,
|
||||
"邮箱修改成功!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
//跳转个人信息页面,但是跳转之后原来的信息消失,需要重新进才能刷新
|
||||
startActivity(intent)
|
||||
// startActivityForResult(intent,1)
|
||||
finish()
|
||||
|
||||
} else {
|
||||
Log.d("myLog", "can't modify name")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this@ReEmailActivity,"邮箱输入不合法!"
|
||||
,Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag != true)
|
||||
Toast.makeText(
|
||||
this@ReEmailActivity,
|
||||
"账号不存在,请重新输入!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
121
app/src/main/java/com/zjgsu/jianshu/Activity/ReMyinfoActivity.kt
Normal file
@ -0,0 +1,121 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.R.attr
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import androidx.appcompat.view.menu.MenuAdapter
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import kotlinx.android.synthetic.main.activity_my.*
|
||||
import kotlinx.android.synthetic.main.activity_re_myinfo.*
|
||||
import android.R.attr.data
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
|
||||
|
||||
class ReMyinfoActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_re_myinfo)
|
||||
//返回个人信息
|
||||
back.setOnClickListener(){
|
||||
val intent=Intent(this,MyActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
|
||||
|
||||
val extra_account=intent.getStringExtra("extra_account")
|
||||
// Log.d("helloReceive","$extraUserData")
|
||||
Log.d("myLog",extra_account.toString())
|
||||
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754") //连接bmob
|
||||
val query = BmobQuery<User_bmob>()
|
||||
// query.addWhereEqualTo("account",extra_account)
|
||||
query.findObjects(object : FindListener<User_bmob>() {
|
||||
var flag:Boolean=false
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (extra_account.equals(i.account)) {
|
||||
flag = true
|
||||
tCurrentName.setText(i.nickName)
|
||||
tCurrentSignature.setText(i.signature)
|
||||
tCurrentAddress.setText((i.address))
|
||||
tCurrentEmail.setText(i.email)
|
||||
tCurrentTel.setText(i.phone)
|
||||
tCurrentSex.setText(i.sex)
|
||||
}
|
||||
}
|
||||
if(flag==false){
|
||||
Log.d("myLog","can't find account")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
//跳转修改昵称
|
||||
re_name.setOnClickListener(){
|
||||
val extra_user_data=tCurrentName.text
|
||||
val intent=Intent(this,ReNameActivity::class.java)
|
||||
intent.putExtra("extra_account",extra_account)
|
||||
intent.putExtra("extra_user_data",extra_user_data)
|
||||
// startActivity(intent
|
||||
startActivityForResult(intent,1)
|
||||
finish()
|
||||
}
|
||||
//跳转修改个性签名
|
||||
re_signature.setOnClickListener(){
|
||||
val extra_signature=tCurrentSignature.text
|
||||
val intent=Intent(this,ReSignatureActivity::class.java)
|
||||
intent.putExtra("extra_account",extra_account)
|
||||
intent.putExtra("extra_signature",extra_signature)
|
||||
startActivityForResult(intent,1)
|
||||
finish()
|
||||
}
|
||||
//跳转修改性别
|
||||
re_sex.setOnClickListener(){
|
||||
val extra_sex=tCurrentSex.text
|
||||
val intent=Intent(this,ReSexActivity::class.java)
|
||||
intent.putExtra("extra_account",extra_account)
|
||||
intent.putExtra("extra_sex",extra_sex)
|
||||
startActivityForResult(intent,1)
|
||||
finish()
|
||||
}
|
||||
//跳转修改邮箱
|
||||
re_email.setOnClickListener(){
|
||||
val extra_email=tCurrentEmail.text
|
||||
val intent=Intent(this,ReEmailActivity::class.java)
|
||||
intent.putExtra("extra_account",extra_account)
|
||||
intent.putExtra("extra_email",extra_email)
|
||||
startActivityForResult(intent,1)
|
||||
finish()
|
||||
}
|
||||
//跳转修改手机号
|
||||
re_telephone.setOnClickListener(){
|
||||
val extra_tel=tCurrentTel.text
|
||||
val intent=Intent(this,RePhoneActivity::class.java)
|
||||
intent.putExtra("extra_account",extra_account)
|
||||
intent.putExtra("extra_tel",extra_tel)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
//跳转修改地址
|
||||
re_address.setOnClickListener(){
|
||||
val extra_address=tCurrentAddress.text
|
||||
val intent=Intent(this,ReAddressActivity::class.java)
|
||||
intent.putExtra("extra_account",extra_account)
|
||||
intent.putExtra("extra_address",extra_address)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.UpdateListener
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_findpwd.*
|
||||
import kotlinx.android.synthetic.main.activity_re_myinfo.*
|
||||
import kotlinx.android.synthetic.main.activity_re_name.*
|
||||
import kotlinx.android.synthetic.main.activity_re_name.back2my
|
||||
import kotlinx.android.synthetic.main.activity_register.*
|
||||
|
||||
class ReNameActivity : AppCompatActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_re_name)
|
||||
back2my.setOnClickListener() {
|
||||
val intent = Intent(this, ReMyinfoActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
val extra_account = intent.getStringExtra("extra_account")
|
||||
val oldName = intent.getStringExtra("extra_user_data")
|
||||
et_rename.setHint(oldName)
|
||||
//读取输入
|
||||
btnOk.setOnClickListener {
|
||||
var flag: Boolean = false
|
||||
val user_account: String = et_account.text.toString()
|
||||
var curName: String = et_rename.text.toString()
|
||||
//
|
||||
// val intent=Intent(this,ReMyinfoActivity::class.java)
|
||||
val intent=Intent(this,MyActivity::class.java)
|
||||
if (user_account.isEmpty() || curName.isEmpty()) {
|
||||
Toast.makeText(this, "账号或昵称不能为空!", Toast.LENGTH_SHORT).show()
|
||||
Log.d("zy", user_account)
|
||||
} else {
|
||||
val bmobQuery = BmobQuery<User_bmob>()
|
||||
var tempPwd: String = ""
|
||||
bmobQuery.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (user_account.equals(i.account)) {
|
||||
flag = true //找到
|
||||
Log.d("myLog", "find sucessflly")
|
||||
//-------更新数据库中的nickName
|
||||
i.setnickName(curName)
|
||||
i.update(i.objectId, object : UpdateListener() {
|
||||
override fun done(p0: BmobException?) {
|
||||
if (p0 == null) {
|
||||
Toast.makeText(
|
||||
this@ReNameActivity,
|
||||
"昵称修改成功!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
//跳转个人信息页面,但是跳转之后原来的信息消失,需要重新进才能刷新
|
||||
startActivity(intent)
|
||||
// startActivityForResult(intent,1)
|
||||
finish()
|
||||
} else {
|
||||
Log.d("myLog", "can't modify name")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Log.d("myLog","error")
|
||||
}
|
||||
if (flag != true)
|
||||
Toast.makeText(
|
||||
this@ReNameActivity,
|
||||
"账号不存在,请重新输入!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.UpdateListener
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
|
||||
import kotlinx.android.synthetic.main.activity_re_phone.*
|
||||
|
||||
class RePhoneActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_re_phone)
|
||||
|
||||
back2my.setOnClickListener() {
|
||||
val intent = Intent(this, ReMyinfoActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
val telPatten="^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}\$".toRegex()
|
||||
// Log.d("myLog",telPatten.matches(input = "19883120190").toString())
|
||||
|
||||
val extra_account = intent.getStringExtra("extra_account")
|
||||
val extra_tel = intent.getStringExtra("extra_tel")
|
||||
Log.d("myLog",extra_tel.toString())
|
||||
cur_tel.setHint(extra_tel.toString())
|
||||
|
||||
btnOk.setOnClickListener {
|
||||
var flag: Boolean = false
|
||||
val user_account: String = et_account.text.toString()
|
||||
var curTel = cur_tel.text.toString()
|
||||
//
|
||||
// val intent=Intent(this,ReMyinfoActivity::class.java)
|
||||
val intent = Intent(this, ReMyinfoActivity::class.java)
|
||||
if (user_account.isEmpty()) {
|
||||
Toast.makeText(this, "账号不能为空!", Toast.LENGTH_SHORT).show()
|
||||
Log.d("zy", user_account)
|
||||
} else {
|
||||
val bmobQuery = BmobQuery<User_bmob>()
|
||||
var tempPwd: String = ""
|
||||
bmobQuery.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (user_account.equals(i.account)) {
|
||||
flag = true //找到
|
||||
Log.d("myLog", "find sucessflly")
|
||||
//-------更新数据库中的sex
|
||||
if (telPatten.matches(input = curTel) == true) {
|
||||
i.setphone(curTel)
|
||||
i.update(i.objectId, object : UpdateListener() {
|
||||
override fun done(p0: BmobException?) {
|
||||
if (p0 == null) {
|
||||
Toast.makeText(
|
||||
this@RePhoneActivity,
|
||||
"电话号码修改成功!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
//跳转个人信息页面,但是跳转之后原来的信息消失,需要重新进才能刷新
|
||||
startActivity(intent)
|
||||
// startActivityForResult(intent,1)
|
||||
finish()
|
||||
|
||||
} else {
|
||||
Log.d("myLog", "can't modify name")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
else{
|
||||
Toast.makeText(this@RePhoneActivity,"手机号输入不合法!"
|
||||
, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flag != true)
|
||||
Toast.makeText(
|
||||
this@RePhoneActivity,
|
||||
"账号不存在,请重新输入!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
108
app/src/main/java/com/zjgsu/jianshu/Activity/ReSexActivity.kt
Normal file
@ -0,0 +1,108 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.ArrayAdapter
|
||||
import android.widget.Toast
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.UpdateListener
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_re_name.*
|
||||
import kotlinx.android.synthetic.main.activity_re_sex.*
|
||||
import kotlinx.android.synthetic.main.activity_re_sex.back2my
|
||||
import kotlinx.android.synthetic.main.activity_re_sex.btnOk
|
||||
import kotlinx.android.synthetic.main.activity_re_sex.et_account
|
||||
import kotlinx.android.synthetic.main.activity_re_sex.et_resex
|
||||
|
||||
class ReSexActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_re_sex)
|
||||
|
||||
val extra_account = intent.getStringExtra("extra_account")
|
||||
val extra_sex = intent.getStringExtra("extra_sex")
|
||||
val hint_text=extra_sex+' '+ et_resex.hint
|
||||
Log.d("myLog",hint_text)
|
||||
|
||||
et_resex.setHint(hint_text)
|
||||
|
||||
back2my.setOnClickListener() {
|
||||
val intent = Intent(this, ReMyinfoActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
|
||||
val sexChoice = arrayOf("男", "女", "未知")
|
||||
btnOk.setOnClickListener {
|
||||
var flag: Boolean = false
|
||||
val user_account: String = et_account.text.toString()
|
||||
var curSex = et_resex.text.toString()
|
||||
//
|
||||
// val intent=Intent(this,ReMyinfoActivity::class.java)
|
||||
val intent = Intent(this, ReMyinfoActivity::class.java)
|
||||
if (user_account.isEmpty()) {
|
||||
Toast.makeText(this, "账号不能为空!", Toast.LENGTH_SHORT).show()
|
||||
Log.d("zy", user_account)
|
||||
} else {
|
||||
val bmobQuery = BmobQuery<User_bmob>()
|
||||
var tempPwd: String = ""
|
||||
bmobQuery.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (user_account.equals(i.account)) {
|
||||
flag = true //找到
|
||||
Log.d("myLog", "find sucessflly")
|
||||
//-------更新数据库中的sex
|
||||
if (curSex.toInt() in sexChoice.indices) {
|
||||
if(curSex.toInt()==0)
|
||||
i.setsex("男")
|
||||
if(curSex.toInt()==1)
|
||||
i.setsex("女")
|
||||
if(curSex.toInt()==2)
|
||||
i.setsex("未知")
|
||||
i.update(i.objectId, object : UpdateListener() {
|
||||
override fun done(p0: BmobException?) {
|
||||
if (p0 == null) {
|
||||
Toast.makeText(
|
||||
this@ReSexActivity,
|
||||
"性别修改成功!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
//跳转个人信息页面,但是跳转之后原来的信息消失,需要重新进才能刷新
|
||||
startActivity(intent)
|
||||
// startActivityForResult(intent,1)
|
||||
finish()
|
||||
|
||||
} else {
|
||||
Log.d("myLog", "can't modify name")
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
Toast.makeText(
|
||||
this@ReSexActivity,
|
||||
"请输入‘男’、‘女、’未知‘",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag != true)
|
||||
Toast.makeText(
|
||||
this@ReSexActivity,
|
||||
"账号不存在,请重新输入!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.UpdateListener
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_re_myinfo.*
|
||||
import kotlinx.android.synthetic.main.activity_re_name.*
|
||||
|
||||
class ReSignatureActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754") //连接bmob
|
||||
|
||||
setContentView(R.layout.activity_re_name)
|
||||
t_title.setText("修改个性签名")
|
||||
|
||||
val extra_account = intent.getStringExtra("extra_account")
|
||||
val extra_signature=intent.getStringExtra("extra_signature")
|
||||
et_rename.setHint(extra_signature)
|
||||
|
||||
back2my.setOnClickListener(){
|
||||
val intent = Intent(this, ReMyinfoActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
btnOk.setOnClickListener {
|
||||
var flag: Boolean = false
|
||||
val user_account: String = et_account.text.toString()
|
||||
var curSignature=et_rename.text.toString()
|
||||
//
|
||||
// val intent=Intent(this,ReMyinfoActivity::class.java)
|
||||
val intent= Intent(this,ReMyinfoActivity::class.java)
|
||||
if (user_account.isEmpty() ) {
|
||||
Toast.makeText(this, "账号不能为空!", Toast.LENGTH_SHORT).show()
|
||||
Log.d("zy", user_account)
|
||||
} else {
|
||||
val bmobQuery = BmobQuery<User_bmob>()
|
||||
var tempPwd: String = ""
|
||||
bmobQuery.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (user_account.equals(i.account)) {
|
||||
flag = true //找到
|
||||
Log.d("myLog", "find sucessflly")
|
||||
//-------更新数据库中的nickName
|
||||
i.setsignature(curSignature)
|
||||
i.update(i.objectId, object : UpdateListener() {
|
||||
override fun done(p0: BmobException?) {
|
||||
if (p0 == null) {
|
||||
Toast.makeText(
|
||||
this@ReSignatureActivity,
|
||||
"个性签名修改成功!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
//跳转个人信息页面,但是跳转之后原来的信息消失,需要重新进才能刷新
|
||||
startActivity(intent)
|
||||
// startActivityForResult(intent,1)
|
||||
finish()
|
||||
} else {
|
||||
Log.d("myLog", "can't modify name")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Log.d("myLog","error")
|
||||
}
|
||||
if (flag != true)
|
||||
Toast.makeText(
|
||||
this@ReSignatureActivity,
|
||||
"账号不存在,请重新输入!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
120
app/src/main/java/com/zjgsu/jianshu/Activity/RegisterActivity.kt
Normal file
@ -0,0 +1,120 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.QueryListListener
|
||||
import cn.bmob.v3.listener.SaveListener
|
||||
import cn.bmob.v3.listener.UpdateListener
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.activity_register.*
|
||||
|
||||
class RegisterActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_register)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
inits()
|
||||
}
|
||||
|
||||
private fun inits() {
|
||||
image_backtoLogin.setOnClickListener{
|
||||
val intent=Intent(this,LoginActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
button_check.setOnClickListener {
|
||||
var flag: Boolean = false
|
||||
val use_account: String = et_reg_account.text.toString()
|
||||
Log.d("zhangyu", use_account)
|
||||
val bmobQuery = BmobQuery<User_bmob>()
|
||||
// bmobQuery.addWhereEqualTo("account", use_account)
|
||||
bmobQuery.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (use_account.equals(i.account)) {
|
||||
Toast.makeText(this@RegisterActivity, "账号已注册!", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
flag=true
|
||||
}
|
||||
}
|
||||
if(flag!=true)
|
||||
Toast.makeText(this@RegisterActivity,"可以注册",Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
bt_reg_register.setOnClickListener {
|
||||
var sex: String = ""
|
||||
if (rg_reg_man.isChecked)
|
||||
sex = "男"
|
||||
else if (rg_reg_woman.isChecked)
|
||||
sex = "女"
|
||||
else
|
||||
sex = "未知"
|
||||
val user = User_bmob()
|
||||
val use_account: String = et_reg_account.text.toString()
|
||||
val use_pwd: String = et_reg_pwd.text.toString()
|
||||
val use_agapwd: String = et_reg_agapwd.text.toString()
|
||||
val use_name: String = et_reg_name.text.toString()
|
||||
val use_mail: String = et_reg_email.text.toString()
|
||||
val use_phone: String = et_reg_phone.text.toString()
|
||||
val bmobQuery = BmobQuery<User_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (use_account.equals(i.account)) {
|
||||
Toast.makeText(this@RegisterActivity, "账号已注册!", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
if (use_account.isEmpty() || use_pwd.isEmpty() || use_agapwd.isEmpty())
|
||||
Toast.makeText(this, "账号或密码不能为空白!", Toast.LENGTH_SHORT).show()
|
||||
if (use_mail.isEmpty())
|
||||
Toast.makeText(this, "邮箱不能为空白!", Toast.LENGTH_SHORT).show()
|
||||
else if (use_agapwd != use_pwd) {
|
||||
Toast.makeText(this, "两次密码输入不一致!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
else {
|
||||
user.setaccount(use_account)
|
||||
user.setpassword(use_pwd)
|
||||
user.setemail(use_mail)
|
||||
user.setnickName(use_name)
|
||||
user.setphone(use_phone)
|
||||
user.setsex(sex)
|
||||
user.save(object : SaveListener<String>() {
|
||||
override fun done(objectId: String?, e: BmobException?) {
|
||||
if (e == null) {
|
||||
Toast.makeText(
|
||||
this@RegisterActivity,
|
||||
objectId + "注册成功!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
} else {
|
||||
Toast.makeText(
|
||||
this@RegisterActivity,
|
||||
"注册失败!" + e.message,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
})
|
||||
val intent = Intent(this, LoginActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
141
app/src/main/java/com/zjgsu/jianshu/Activity/WenXueActivity.kt
Normal file
@ -0,0 +1,141 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.PersistableBundle
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Adapter.BookAdapter2
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.activity_wenxue.*
|
||||
import kotlinx.android.synthetic.main.activity_xinli.*
|
||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
class WenXueActivity:AppCompatActivity() {
|
||||
private var bookList = ArrayList<Book>()
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_wenxue)
|
||||
supportActionBar?.let {
|
||||
it.setDisplayHomeAsUpEnabled(true)
|
||||
it.setHomeAsUpIndicator(R.drawable.menu)
|
||||
}
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
inits()
|
||||
val layoutManager =
|
||||
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)//第一个参数是列数
|
||||
wenxue_recyclerView.layoutManager = layoutManager
|
||||
var adapter = BookAdapter2(bookList)
|
||||
wenxue_recyclerView.adapter = adapter
|
||||
wenxue_swipeRefresh.setOnRefreshListener {
|
||||
refreshBooks(adapter)
|
||||
}
|
||||
wenxue_navView.setCheckedItem(R.id.wenxue)
|
||||
wenxue_navView.setNavigationItemSelectedListener {
|
||||
val intentwenxue = Intent(this, WenXueActivity::class.java)
|
||||
val intentguanli = Intent(this, guanliActivity::class.java)
|
||||
val intentxinli = Intent(this, xinliActivity::class.java)
|
||||
val intentkexue=Intent(this,kexueActivity::class.java)
|
||||
val intentzhexue=Intent(this,zhexueActivity::class.java)
|
||||
val intentgood=Intent(this,MainActivity::class.java)
|
||||
when (it.itemId) {
|
||||
R.id.wenxue -> startActivity(intentwenxue)
|
||||
R.id.guanli -> startActivity(intentguanli)
|
||||
R.id.xinli -> startActivity(intentxinli)
|
||||
R.id.kexue->startActivity(intentkexue)
|
||||
R.id.zhexue->startActivity(intentzhexue)
|
||||
R.id.goodbook->startActivity(intentgood)
|
||||
}
|
||||
wenxue_drawerLayout.closeDrawers()
|
||||
true
|
||||
}
|
||||
|
||||
wenxue_back.setOnClickListener{
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
bookcity.setOnClickListener{
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
bookshelf.setOnClickListener{
|
||||
val intent = Intent(this, BookShelfActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
reading_comprehension.setOnClickListener {
|
||||
val intent = Intent(this, PerceptionActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
homepage.setOnClickListener {
|
||||
val intent = Intent(this, MyActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
android.R.id.home -> wenxue_drawerLayout.openDrawer(GravityCompat.START)
|
||||
}
|
||||
return true
|
||||
}
|
||||
private fun inits() {
|
||||
val bmobQuery = BmobQuery<Book_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(list: List<Book_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if(i.category_id==1){
|
||||
bookList.add(Book(i.name, i.introduce,i.picture.url))
|
||||
// bookList2.add(Book(i.name, i.introduce))
|
||||
val adapter = BookAdapter2(bookList)
|
||||
wenxue_recyclerView.adapter = adapter
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun refreshBooks(adapter: BookAdapter2) {
|
||||
thread {
|
||||
Thread.sleep(2000)
|
||||
runOnUiThread {
|
||||
initBooks()
|
||||
adapter.notifyDataSetChanged()
|
||||
wenxue_swipeRefresh.isRefreshing = false
|
||||
Toast.makeText(this, "刷新成功!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
private fun initBooks() {
|
||||
bookList.clear()
|
||||
val bmobQuery = BmobQuery<Book_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(list: List<Book_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if(i.category_id==1)
|
||||
bookList.add(Book(i.name, i.introduce,i.picture.url))
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Bmob.Book_inf_bmob
|
||||
import kotlinx.android.synthetic.main.activity_anthor_introduction.*
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.book_author_item.*
|
||||
import kotlinx.android.synthetic.main.expandable.*
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
class author_introductionActivity : AppCompatActivity() {
|
||||
private var bookList = ArrayList<BookAuthor>()
|
||||
private var author_selfintro:String=""
|
||||
private val url_list = mutableListOf<String>()
|
||||
private var flag: Int =0
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_anthor_introduction)
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
book_authorname1.text = intent.getStringExtra("author_name")
|
||||
inits()
|
||||
val layoutManager =
|
||||
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.HORIZONTAL)//第一个参数是列数
|
||||
recyclerView1.layoutManager = layoutManager
|
||||
var adapter = Book_authorAdapter(bookList)
|
||||
recyclerView1.adapter = adapter
|
||||
expand_collapse.setOnClickListener{
|
||||
val myDialog:MyDialog= MyDialog(this)
|
||||
myDialog.setTitle("作者介绍")
|
||||
myDialog.setMessage(author_selfintro)
|
||||
myDialog.setCancel("cancel",MyDialog.IOnCancelListener {
|
||||
fun onCancel(dialog:MyDialog) {
|
||||
Toast.makeText(this,"取消",Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
})
|
||||
myDialog.setConfirm("confirm",MyDialog.IOnConfirmListener {
|
||||
fun OnConfirm(dialog:MyDialog){
|
||||
Toast.makeText(this,"确认",Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
})
|
||||
myDialog.show()
|
||||
}
|
||||
}
|
||||
private fun inits() {
|
||||
val bmobQuery = BmobQuery<Book_inf_bmob>()
|
||||
bmobQuery.addWhereEqualTo("author_name",book_authorname1.text.toString())
|
||||
bmobQuery.findObjects(object : FindListener<Book_inf_bmob>() {
|
||||
override fun done(list: List<Book_inf_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if(flag==0){
|
||||
author_selfintro=i.author_introduce
|
||||
flag=1
|
||||
url_list.add(i!!.picture.url)
|
||||
//加载authorPic
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
//作者
|
||||
val url = URL(i!!.authorpic.url)
|
||||
Log.d("myLog", url.toString())
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(5000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
// Log.d("myLog","fine")
|
||||
//yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
|
||||
author_img.setImageBitmap(bitmap)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
bookList.add(BookAuthor(i.name, i.author_name))
|
||||
val adapter = Book_authorAdapter(bookList)
|
||||
recyclerView1.adapter = adapter
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
expand_text_view.text=author_selfintro
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
139
app/src/main/java/com/zjgsu/jianshu/Activity/guanliActivity.kt
Normal file
@ -0,0 +1,139 @@
|
||||
package com.zjgsu.jianshu
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.PersistableBundle
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Adapter.BookAdapter2
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.activity_guanli.*
|
||||
import kotlinx.android.synthetic.main.activity_xinli.*
|
||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
class guanliActivity:AppCompatActivity() {
|
||||
private var bookList = ArrayList<Book>()
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_guanli)
|
||||
supportActionBar?.let {
|
||||
it.setDisplayHomeAsUpEnabled(true)
|
||||
it.setHomeAsUpIndicator(R.drawable.menu)
|
||||
}
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
inits()
|
||||
val layoutManager =
|
||||
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)//第一个参数是列数
|
||||
guanli_recyclerView.layoutManager = layoutManager
|
||||
var adapter = BookAdapter2(bookList)
|
||||
guanli_recyclerView.adapter = adapter
|
||||
guanli_swipeRefresh.setOnRefreshListener {
|
||||
refreshBooks(adapter)
|
||||
}
|
||||
guanli_navView.setCheckedItem(R.id.guanli)
|
||||
guanli_navView.setNavigationItemSelectedListener {
|
||||
val intentwenxue = Intent(this, WenXueActivity::class.java)
|
||||
val intentguanli = Intent(this, guanliActivity::class.java)
|
||||
val intentxinli = Intent(this, xinliActivity::class.java)
|
||||
val intentkexue=Intent(this,kexueActivity::class.java)
|
||||
val intentzhexue=Intent(this,zhexueActivity::class.java)
|
||||
val intentgood=Intent(this,MainActivity::class.java)
|
||||
when (it.itemId) {
|
||||
R.id.wenxue -> startActivity(intentwenxue)
|
||||
R.id.guanli -> startActivity(intentguanli)
|
||||
R.id.kexue->startActivity(intentkexue)
|
||||
R.id.zhexue->startActivity(intentzhexue)
|
||||
R.id.xinli->startActivity(intentxinli)
|
||||
R.id.goodbook->startActivity(intentgood)
|
||||
}
|
||||
guanli_drawerLayout.closeDrawers()
|
||||
true
|
||||
}
|
||||
guanli_back.setOnClickListener{
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
bookshelf.setOnClickListener{
|
||||
val intent = Intent(this, BookShelfActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
bookcity.setOnClickListener{
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
reading_comprehension.setOnClickListener {
|
||||
val intent = Intent(this, PerceptionActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
homepage.setOnClickListener {
|
||||
val intent = Intent(this, MyActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
android.R.id.home -> guanli_drawerLayout.openDrawer(GravityCompat.START)
|
||||
}
|
||||
return true
|
||||
}
|
||||
private fun inits() {
|
||||
val bmobQuery = BmobQuery<Book_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(list: List<Book_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if(i.category_id==2){
|
||||
bookList.add(Book(i.name, i.introduce,i.picture.url))
|
||||
// bookList2.add(Book(i.name, i.introduce))
|
||||
val adapter = BookAdapter2(bookList)
|
||||
guanli_recyclerView.adapter = adapter
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun refreshBooks(adapter: BookAdapter2) {
|
||||
thread {
|
||||
Thread.sleep(2000)
|
||||
runOnUiThread {
|
||||
initBooks()
|
||||
adapter.notifyDataSetChanged()
|
||||
guanli_swipeRefresh.isRefreshing = false
|
||||
Toast.makeText(this, "刷新成功!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
private fun initBooks() {
|
||||
bookList.clear()
|
||||
val bmobQuery = BmobQuery<Book_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(list: List<Book_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if(i.category_id==2)
|
||||
bookList.add(Book(i.name, i.introduce,i.picture.url))
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
141
app/src/main/java/com/zjgsu/jianshu/Activity/kexueActivity.kt
Normal file
@ -0,0 +1,141 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.PersistableBundle
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Adapter.BookAdapter2
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.activity_kexue.*
|
||||
import kotlinx.android.synthetic.main.activity_xinli.*
|
||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
class kexueActivity:AppCompatActivity() {
|
||||
private var bookList = ArrayList<Book>()
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_kexue)
|
||||
supportActionBar?.let {
|
||||
it.setDisplayHomeAsUpEnabled(true)
|
||||
it.setHomeAsUpIndicator(R.drawable.menu)
|
||||
}
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
inits()
|
||||
val layoutManager =
|
||||
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)//第一个参数是列数
|
||||
kexue_recyclerView.layoutManager = layoutManager
|
||||
var adapter = BookAdapter2(bookList)
|
||||
kexue_recyclerView.adapter = adapter
|
||||
kexue_swipeRefresh.setOnRefreshListener {
|
||||
refreshBooks(adapter)
|
||||
}
|
||||
kexue_navView.setCheckedItem(R.id.kexue)
|
||||
kexue_navView.setNavigationItemSelectedListener {
|
||||
val intentwenxue = Intent(this, WenXueActivity::class.java)
|
||||
val intentguanli = Intent(this, guanliActivity::class.java)
|
||||
val intentxinli = Intent(this, xinliActivity::class.java)
|
||||
val intentkexue=Intent(this,kexueActivity::class.java)
|
||||
val intentzhexue=Intent(this,zhexueActivity::class.java)
|
||||
val intentgood=Intent(this,MainActivity::class.java)
|
||||
when (it.itemId) {
|
||||
R.id.wenxue -> startActivity(intentwenxue)
|
||||
R.id.guanli -> startActivity(intentguanli)
|
||||
R.id.xinli -> startActivity(intentxinli)
|
||||
R.id.kexue->startActivity(intentkexue)
|
||||
R.id.zhexue->startActivity(intentzhexue)
|
||||
R.id.goodbook->startActivity(intentgood)
|
||||
}
|
||||
kexue_drawerLayout.closeDrawers()
|
||||
true
|
||||
}
|
||||
|
||||
kexue_back.setOnClickListener{
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
bookcity.setOnClickListener{
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
bookshelf.setOnClickListener{
|
||||
val intent = Intent(this, BookShelfActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
reading_comprehension.setOnClickListener {
|
||||
val intent = Intent(this, PerceptionActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
homepage.setOnClickListener {
|
||||
val intent = Intent(this, MyActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
android.R.id.home -> kexue_drawerLayout.openDrawer(GravityCompat.START)
|
||||
}
|
||||
return true
|
||||
}
|
||||
private fun inits() {
|
||||
val bmobQuery = BmobQuery<Book_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(list: List<Book_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if(i.category_id==4){
|
||||
bookList.add(Book(i.name, i.introduce,i.picture.url))
|
||||
// bookList2.add(Book(i.name, i.introduce))
|
||||
val adapter = BookAdapter2(bookList)
|
||||
kexue_recyclerView.adapter = adapter
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun refreshBooks(adapter: BookAdapter2) {
|
||||
thread {
|
||||
Thread.sleep(2000)
|
||||
runOnUiThread {
|
||||
initBooks()
|
||||
adapter.notifyDataSetChanged()
|
||||
kexue_swipeRefresh.isRefreshing = false
|
||||
Toast.makeText(this, "刷新成功!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
private fun initBooks() {
|
||||
bookList.clear()
|
||||
val bmobQuery = BmobQuery<Book_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(list: List<Book_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if(i.category_id==4)
|
||||
bookList.add(Book(i.name, i.introduce,i.picture.url))
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
package com.zjgsu.jianshu.Activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.SaveListener
|
||||
import com.zjgsu.jianshu.*
|
||||
import com.zjgsu.jianshu.Bmob.Book_inf_bmob
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import kotlinx.android.synthetic.main.activity_sendperception.*
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
class sendPerceptionActivity:AppCompatActivity() {
|
||||
private var bookList = ArrayList<BookAuthor>()
|
||||
lateinit var myuserid:String
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_sendperception)
|
||||
supportActionBar?.hide()
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
myuserid=intent.getStringExtra("userid").toString()
|
||||
inits()
|
||||
val layoutManager =
|
||||
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.HORIZONTAL)//第一个参数是列数
|
||||
send_recyclerview.layoutManager = layoutManager
|
||||
var adapter = send_perceptionAdapter(bookList)
|
||||
send_recyclerview.adapter = adapter
|
||||
delete.setOnClickListener {
|
||||
val intent= Intent(this,PerceptionActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
submit.setOnClickListener {
|
||||
if(selectedBook.equals("")){
|
||||
Toast.makeText(this,"请选择一本书!",Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
else {
|
||||
val perception = Perception_bmob()
|
||||
perception.perception = mycontent.text.toString()
|
||||
perception.userid = myuserid
|
||||
perception.b_name = selectedBook
|
||||
perception.save(object : SaveListener<String>() {
|
||||
override fun done(objectId: String?, e: BmobException?) {
|
||||
if (e == null) {
|
||||
Toast.makeText(
|
||||
this@sendPerceptionActivity, "发布成功!",
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
val intent =
|
||||
Intent(this@sendPerceptionActivity, PerceptionActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
} else {
|
||||
Toast.makeText(
|
||||
this@sendPerceptionActivity,
|
||||
"发布失败" + e.message,
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
private fun inits(){
|
||||
val bmobQuery = BmobQuery<Book_inf_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<Book_inf_bmob>() {
|
||||
override fun done(list: List<Book_inf_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
bookList.add(BookAuthor(i.name, i.author_name))
|
||||
val adapter = send_perceptionAdapter(bookList)
|
||||
send_recyclerview.adapter = adapter
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
val query=BmobQuery<User_bmob>()
|
||||
query.findObjects(object:FindListener<User_bmob>(){
|
||||
override fun done(list:List<User_bmob>,e:BmobException?){
|
||||
if(e==null){
|
||||
for(i in list){
|
||||
if(i.objectId.equals(UserId)) {
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(i!!.face.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(5000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
touxiang.setImageBitmap(bitmap)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
54
app/src/main/java/com/zjgsu/jianshu/Activity/testgood.kt
Normal file
@ -0,0 +1,54 @@
|
||||
//package com.zjgsu.jianshu
|
||||
//
|
||||
//import android.content.Intent
|
||||
//import android.graphics.Bitmap
|
||||
//import android.graphics.BitmapFactory
|
||||
//import androidx.appcompat.app.AppCompatActivity
|
||||
//import android.os.Bundle
|
||||
//import android.util.Log
|
||||
//import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
//import cn.bmob.v3.Bmob
|
||||
//import cn.bmob.v3.BmobQuery
|
||||
//import cn.bmob.v3.exception.BmobException
|
||||
//import cn.bmob.v3.listener.FindListener
|
||||
//import com.zjgsu.jianshu.Activity.AccountManagerActivity
|
||||
//import com.zjgsu.jianshu.Activity.MyPostActivity
|
||||
//import com.zjgsu.jianshu.Adapter.CommentAdapter
|
||||
//import com.zjgsu.jianshu.Bmob.Comment_bmob
|
||||
//import kotlinx.android.synthetic.main.activity_main.*
|
||||
//import kotlinx.android.synthetic.main.activity_my.*
|
||||
//import kotlinx.android.synthetic.main.activity_perception_infomation.*
|
||||
//import kotlinx.android.synthetic.main.test11.*
|
||||
//import java.io.InputStream
|
||||
//import java.net.HttpURLConnection
|
||||
//import java.net.URL
|
||||
//
|
||||
//class testgood : AppCompatActivity() {
|
||||
// private val commentlist=ArrayList<Comment>()
|
||||
// override fun onCreate(savedInstanceState: Bundle?) {
|
||||
// super.onCreate(savedInstanceState)
|
||||
// setContentView(R.layout.test11)
|
||||
// Bmob.initialize(this, "3ef45cbaebfff5cc05e559f8206b523f") //连接bmob
|
||||
// val bmobquery=BmobQuery<Comment_bmob>()
|
||||
// bmobquery.addWhereEqualTo("perceptionid","e0cd40a953")
|
||||
// bmobquery.findObjects(object:FindListener<Comment_bmob>(){
|
||||
// override fun done(list:List<Comment_bmob>, e:BmobException?){
|
||||
// if(e==null){
|
||||
// var cnt=0
|
||||
// for(i in list){
|
||||
// cnt++
|
||||
// commentlist.add(Comment(i.objectId))
|
||||
// val adapter = CommentAdapter(commentlist)
|
||||
// recyclerView100.adapter = adapter
|
||||
// }
|
||||
// comment_cnt.text="评论 "+cnt.toString()
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// val layoutManager =
|
||||
// StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)//第一个参数是列数
|
||||
// recyclerView100.layoutManager = layoutManager
|
||||
// var adapter = CommentAdapter(commentlist)
|
||||
// }
|
||||
//}
|
||||
//
|
138
app/src/main/java/com/zjgsu/jianshu/Activity/xinliActivity.kt
Normal file
@ -0,0 +1,138 @@
|
||||
package com.zjgsu.jianshu
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.PersistableBundle
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Adapter.BookAdapter2
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.activity_xinli.*
|
||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
class xinliActivity:AppCompatActivity() {
|
||||
private var bookList = ArrayList<Book>()
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_xinli)
|
||||
supportActionBar?.let {
|
||||
it.setDisplayHomeAsUpEnabled(true)
|
||||
it.setHomeAsUpIndicator(R.drawable.menu)
|
||||
}
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
inits()
|
||||
val layoutManager =
|
||||
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)//第一个参数是列数
|
||||
xinli_recyclerView.layoutManager = layoutManager
|
||||
var adapter = BookAdapter2(bookList)
|
||||
xinli_recyclerView.adapter = adapter
|
||||
xinli_swipeRefresh.setOnRefreshListener {
|
||||
refreshBooks(adapter)
|
||||
}
|
||||
xinli_navView.setCheckedItem(R.id.xinli)
|
||||
xinli_navView.setNavigationItemSelectedListener {
|
||||
val intentwenxue = Intent(this, WenXueActivity::class.java)
|
||||
val intentguanli = Intent(this, guanliActivity::class.java)
|
||||
val intentxinli = Intent(this, xinliActivity::class.java)
|
||||
val intentkexue=Intent(this,kexueActivity::class.java)
|
||||
val intentzhexue=Intent(this,zhexueActivity::class.java)
|
||||
val intentgood=Intent(this,MainActivity::class.java)
|
||||
when (it.itemId) {
|
||||
R.id.wenxue -> startActivity(intentwenxue)
|
||||
R.id.guanli -> startActivity(intentguanli)
|
||||
R.id.kexue->startActivity(intentkexue)
|
||||
R.id.zhexue->startActivity(intentzhexue)
|
||||
R.id.xinli->startActivity(intentxinli)
|
||||
R.id.goodbook->startActivity(intentgood)
|
||||
}
|
||||
xinli_drawerLayout.closeDrawers()
|
||||
true
|
||||
}
|
||||
xinli_back.setOnClickListener{
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
bookshelf.setOnClickListener{
|
||||
val intent = Intent(this, BookShelfActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
bookcity.setOnClickListener{
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
reading_comprehension.setOnClickListener {
|
||||
val intent = Intent(this, PerceptionActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
homepage.setOnClickListener {
|
||||
val intent = Intent(this, MyActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
android.R.id.home -> xinli_drawerLayout.openDrawer(GravityCompat.START)
|
||||
}
|
||||
return true
|
||||
}
|
||||
private fun inits() {
|
||||
val bmobQuery = BmobQuery<Book_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(list: List<Book_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if(i.category_id==3){
|
||||
bookList.add(Book(i.name, i.introduce,i.picture.url))
|
||||
// bookList2.add(Book(i.name, i.introduce))
|
||||
val adapter = BookAdapter2(bookList)
|
||||
xinli_recyclerView.adapter = adapter
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun refreshBooks(adapter: BookAdapter2) {
|
||||
thread {
|
||||
Thread.sleep(2000)
|
||||
runOnUiThread {
|
||||
initBooks()
|
||||
adapter.notifyDataSetChanged()
|
||||
xinli_swipeRefresh.isRefreshing = false
|
||||
Toast.makeText(this, "刷新成功!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
private fun initBooks() {
|
||||
bookList.clear()
|
||||
val bmobQuery = BmobQuery<Book_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(list: List<Book_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if(i.category_id==3)
|
||||
bookList.add(Book(i.name, i.introduce,i.picture.url))
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
141
app/src/main/java/com/zjgsu/jianshu/Activity/zhexueActivity.kt
Normal file
@ -0,0 +1,141 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.PersistableBundle
|
||||
import android.util.Log
|
||||
import android.view.MenuItem
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.view.GravityCompat
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import cn.bmob.v3.Bmob
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Adapter.BookAdapter2
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.activity_zhexue.*
|
||||
import kotlinx.android.synthetic.main.activity_xinli.*
|
||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
class zhexueActivity:AppCompatActivity() {
|
||||
private var bookList = ArrayList<Book>()
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_zhexue)
|
||||
supportActionBar?.let {
|
||||
it.setDisplayHomeAsUpEnabled(true)
|
||||
it.setHomeAsUpIndicator(R.drawable.menu)
|
||||
}
|
||||
Bmob.initialize(this, "8f9f1d1ea520b0ce4f84a6fa83a5f754")//连接bmob
|
||||
inits()
|
||||
val layoutManager =
|
||||
StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)//第一个参数是列数
|
||||
zhexue_recyclerView.layoutManager = layoutManager
|
||||
var adapter = BookAdapter2(bookList)
|
||||
zhexue_recyclerView.adapter = adapter
|
||||
zhexue_swipeRefresh.setOnRefreshListener {
|
||||
refreshBooks(adapter)
|
||||
}
|
||||
zhexue_navView.setCheckedItem(R.id.zhexue)
|
||||
zhexue_navView.setNavigationItemSelectedListener {
|
||||
val intentwenxue = Intent(this, WenXueActivity::class.java)
|
||||
val intentguanli = Intent(this, guanliActivity::class.java)
|
||||
val intentxinli = Intent(this, xinliActivity::class.java)
|
||||
val intentzhexue=Intent(this,zhexueActivity::class.java)
|
||||
val intentkexue=Intent(this,kexueActivity::class.java)
|
||||
val intentgood=Intent(this,MainActivity::class.java)
|
||||
when (it.itemId) {
|
||||
R.id.wenxue -> startActivity(intentwenxue)
|
||||
R.id.guanli -> startActivity(intentguanli)
|
||||
R.id.xinli -> startActivity(intentxinli)
|
||||
R.id.zhexue->startActivity(intentzhexue)
|
||||
R.id.kexue->startActivity(intentkexue)
|
||||
R.id.goodbook->startActivity(intentgood)
|
||||
}
|
||||
zhexue_drawerLayout.closeDrawers()
|
||||
true
|
||||
}
|
||||
|
||||
zhexue_back.setOnClickListener{
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
bookcity.setOnClickListener{
|
||||
val intent = Intent(this, MainActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
bookshelf.setOnClickListener{
|
||||
val intent = Intent(this, BookShelfActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
reading_comprehension.setOnClickListener {
|
||||
val intent = Intent(this, PerceptionActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
homepage.setOnClickListener {
|
||||
val intent = Intent(this, MyActivity::class.java)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
android.R.id.home -> zhexue_drawerLayout.openDrawer(GravityCompat.START)
|
||||
}
|
||||
return true
|
||||
}
|
||||
private fun inits() {
|
||||
val bmobQuery = BmobQuery<Book_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(list: List<Book_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if(i.category_id==5){
|
||||
bookList.add(Book(i.name, i.introduce,i.picture.url))
|
||||
// bookList2.add(Book(i.name, i.introduce))
|
||||
val adapter = BookAdapter2(bookList)
|
||||
zhexue_recyclerView.adapter = adapter
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
private fun refreshBooks(adapter: BookAdapter2) {
|
||||
thread {
|
||||
Thread.sleep(2000)
|
||||
runOnUiThread {
|
||||
initBooks()
|
||||
adapter.notifyDataSetChanged()
|
||||
zhexue_swipeRefresh.isRefreshing = false
|
||||
Toast.makeText(this, "刷新成功!", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
private fun initBooks() {
|
||||
bookList.clear()
|
||||
val bmobQuery = BmobQuery<Book_bmob>()
|
||||
bmobQuery.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(list: List<Book_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if(i.category_id==5)
|
||||
bookList.add(Book(i.name, i.introduce,i.picture.url))
|
||||
}
|
||||
} else {
|
||||
Log.d("error", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
93
app/src/main/java/com/zjgsu/jianshu/Adapter/BookAdapter.kt
Normal file
@ -0,0 +1,93 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
|
||||
class BookAdapter(var bookList: List<Book>) : RecyclerView.Adapter<BookAdapter.ViewHolder>() {
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val bookList_Image: ImageView = view.findViewById(R.id.book_Image)
|
||||
val bookList_Name: TextView = view.findViewById(R.id.book_Name)
|
||||
val bookList_Introduce: TextView = view.findViewById(R.id.book_Introduce)
|
||||
val innerLinearLayout: LinearLayout = view.findViewById(R.id.bookItem_innerLinearLayout)
|
||||
val outerLinearLayout:LinearLayout=view.findViewById(R.id.bookItem_outerLinearLayout)
|
||||
val rankimg:ImageView=view.findViewById(R.id.bookItem_rankimg)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.book_item, parent, false)
|
||||
return ViewHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val book = bookList[position]
|
||||
holder.bookList_Name.text = book.name
|
||||
holder.bookList_Introduce.text = book.introduce
|
||||
val backgrounds = arrayOf(R.drawable.color_lightpurple, R.drawable.color_lightblue,R.drawable.color_lightgreen, R.drawable.color_flesh)
|
||||
holder.innerLinearLayout.setBackgroundResource(backgrounds[position % backgrounds.size])
|
||||
if (position == 0) { // 假设第一名使用金牌图片
|
||||
holder.rankimg.setImageResource(R.drawable.gold)
|
||||
} else if (position == 1) { // 第二名使用其他图片,以此类推
|
||||
holder.rankimg.setImageResource(R.drawable.silver)
|
||||
}
|
||||
else if(position==2){
|
||||
holder.rankimg.setImageResource(R.drawable.copper)
|
||||
}
|
||||
val query = BmobQuery<Book_bmob>()
|
||||
query.addWhereEqualTo("name", book.name)
|
||||
query.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(p0: MutableList<Book_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
for (p in p0) {
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(p!!.picture.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(5000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
holder.bookList_Image.setImageBitmap(bitmap)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
// Glide.with(context).load(book.imageId).into(holder.bookList_Image)
|
||||
holder.outerLinearLayout.setOnClickListener{
|
||||
val intent = Intent(holder.itemView.context, Book_informationActivity::class.java)
|
||||
intent.putExtra("Book_name", book.name)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
}
|
||||
override fun getItemCount() = bookList.size
|
||||
fun updateBooks(newBooks: List<Book>) {
|
||||
bookList = newBooks
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
94
app/src/main/java/com/zjgsu/jianshu/Adapter/BookAdapter2.kt
Normal file
@ -0,0 +1,94 @@
|
||||
package com.zjgsu.jianshu.Adapter
|
||||
|
||||
import com.zjgsu.jianshu.Book
|
||||
import com.zjgsu.jianshu.Book_informationActivity
|
||||
import com.zjgsu.jianshu.R
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.widget.ActivityChooserView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.datatype.BmobFile
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.bumptech.glide.Glide
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
class BookAdapter2(val bookList: List<Book>) : RecyclerView.Adapter<BookAdapter2.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val bookList_Image: ImageView = view.findViewById(R.id.book_Image)
|
||||
val bookList_Name: TextView = view.findViewById(R.id.book_Name)
|
||||
val bookList_Introduce: TextView = view.findViewById(R.id.book_Introduce)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = View.inflate(parent.context, R.layout.book_item, null)
|
||||
return ViewHolder(view)
|
||||
}
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val book = bookList[position]
|
||||
holder.bookList_Name.text = book.name
|
||||
holder.bookList_Introduce.text = book.introduce
|
||||
val query = BmobQuery<Book_bmob>()
|
||||
query.addWhereEqualTo("name", book.name)
|
||||
query.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(p0: MutableList<Book_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
for (p in p0) {
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(p!!.picture.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(5000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
holder.bookList_Image.setImageBitmap(bitmap)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
// Glide.with(context).load(book.imageId).into(holder.bookList_Image)
|
||||
|
||||
holder.bookList_Image.setOnClickListener {
|
||||
val intent = Intent(holder.itemView.context, Book_informationActivity::class.java)
|
||||
intent.putExtra("Book_name", book.name)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
holder.bookList_Introduce.setOnClickListener {
|
||||
val intent = Intent(holder.itemView.context, Book_informationActivity::class.java)
|
||||
intent.putExtra("Book_name", book.name)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
holder.bookList_Name.setOnClickListener {
|
||||
val intent = Intent(holder.itemView.context, Book_informationActivity::class.java)
|
||||
intent.putExtra("Book_name", book.name)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount() = bookList.size
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.*
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.SaveListener
|
||||
import com.zjgsu.jianshu.Bmob.BookShelf
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
import kotlinx.android.synthetic.main.activity_main.view.*
|
||||
import kotlinx.android.synthetic.main.book_author_item.*
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
class Book_authorAdapter(val bookList:List<BookAuthor>):RecyclerView.Adapter<Book_authorAdapter.ViewHolder>() {
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val bookList_Image: ImageView = view.findViewById(R.id.book_Image1)
|
||||
val addButton:Button=view.findViewById(R.id.addButton)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.book_author_item, parent, false)
|
||||
return ViewHolder(view)
|
||||
}
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val book = bookList[position]
|
||||
val query = BmobQuery<Book_bmob>()
|
||||
query.addWhereEqualTo("name",book.name)
|
||||
query.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(p0: MutableList<Book_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
for (p in p0) {
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(p!!.picture.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(5000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
holder.bookList_Image.setImageBitmap(bitmap)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
val query1=BmobQuery<BookShelf>()
|
||||
query1.addWhereEqualTo("userid", UserId)
|
||||
query1.addWhereEqualTo("b_name",book.name)
|
||||
query1.findObjects(object :FindListener<BookShelf>() {
|
||||
override fun done(p0: MutableList<BookShelf>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
holder.addButton.setText("已添加")
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
holder.bookList_Image.setOnClickListener {
|
||||
val intent= Intent(holder.itemView.context,Book_informationActivity::class.java)
|
||||
intent.putExtra("Book_name",book.name)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
holder.addButton.setOnClickListener{
|
||||
// val intent = Intent(holder.itemView.context,BookShelfActivity::class.java)
|
||||
// intent.putExtra("Book_name",book.name)
|
||||
// ContextCompat.startActivity(holder.itemView.context,intent,null)
|
||||
val query= BmobQuery<BookShelf>()
|
||||
query.addWhereEqualTo("userid", UserId)
|
||||
query.addWhereEqualTo("b_name",book.name)
|
||||
query.findObjects(object :FindListener<BookShelf>(){
|
||||
override fun done(p0: MutableList<BookShelf>?, p1: BmobException?) {
|
||||
if(p1==null){
|
||||
if(p0!=null&&p0.size>0){
|
||||
// Toast.makeText(author_introductionActivity, "11", Toast.LENGTH_SHORT)
|
||||
}
|
||||
else{
|
||||
val bookshelf_record=BookShelf()
|
||||
bookshelf_record.settb_name(book.name)
|
||||
bookshelf_record.setuserid(UserId)
|
||||
bookshelf_record.save(object : SaveListener<String>() {
|
||||
override fun done(objectId: String?, e: BmobException?) {
|
||||
if (e == null) {
|
||||
holder.addButton.text="已添加"
|
||||
} else {
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
override fun getItemCount() =bookList.size
|
||||
}
|
214
app/src/main/java/com/zjgsu/jianshu/Adapter/BookshelfAdapter.kt
Normal file
@ -0,0 +1,214 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.opengl.Visibility
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.CheckBox
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
import android.widget.AdapterView.OnItemLongClickListener
|
||||
import android.widget.AdapterView.VISIBLE
|
||||
import android.widget.Toast
|
||||
import android.view.View.OnLongClickListener
|
||||
|
||||
import android.widget.CompoundButton
|
||||
|
||||
import android.view.animation.Animation
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
|
||||
|
||||
class BookshelfAdapter(val context: Context, val bookshelf: ArrayList<Book_Shelf>) : RecyclerView.Adapter<BookshelfAdapter.ViewHolder>(),
|
||||
View.OnLongClickListener, View.OnClickListener {
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val book_img: ImageView = view.findViewById(R.id.bookshelf_bkimg)
|
||||
val book_name: TextView = view.findViewById(R.id.bookshelf_bkname)
|
||||
// val mCheckBox: CheckBox = view.findViewById(R.id.bookshelf_checkBox)
|
||||
}
|
||||
private var onItemClickListener: RecyclerViewOnItemClickListener? = null
|
||||
private var isshowBox: Boolean = false
|
||||
private val map: MutableMap<Int, Boolean?> = HashMap()
|
||||
private var flag: Boolean = false
|
||||
fun initMap() {
|
||||
for (i in bookshelf.indices) {
|
||||
map[i] = false
|
||||
}
|
||||
Log.d("initmap", "no")
|
||||
}
|
||||
|
||||
fun setSelectItem(position: Int) {
|
||||
//对当前状态取反
|
||||
if (map[position]!!) {
|
||||
map[position] = false
|
||||
} else {
|
||||
map[position] = true
|
||||
}
|
||||
notifyItemChanged(position)
|
||||
}
|
||||
|
||||
fun setShowBox() {
|
||||
//取反
|
||||
isshowBox = !isshowBox
|
||||
}
|
||||
|
||||
fun getMap(): Map<Int, Boolean?> {
|
||||
return map
|
||||
}
|
||||
|
||||
// fun setOnItemLongClickListener(onItemLongClickListener: RecyclerViewOnItemLongClickListener) {
|
||||
// this.onItemLongClickListener = onItemLongClickListener;
|
||||
// }
|
||||
// interface RecyclerViewOnItemClickListener {
|
||||
// fun onItemClickListener(view: View?, position: Int)
|
||||
// }
|
||||
// interface RecyclerViewOnItemLongClickListener {
|
||||
// fun onItemLongClickListener(view: View, position: Int): Boolean;
|
||||
// }
|
||||
interface RecyclerViewOnItemClickListener {
|
||||
//点击事件
|
||||
fun onItemClickListener(view: View?, position: Int)
|
||||
|
||||
//长按事件
|
||||
fun onItemLongClickListener(view: View?, position: Int): Boolean
|
||||
}
|
||||
|
||||
fun setRecyclerViewOnItemClickListener(onItemClickListener: RecyclerViewOnItemClickListener?) {
|
||||
this.onItemClickListener = onItemClickListener
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
if (onItemClickListener != null) {
|
||||
//注意这里使用getTag方法获取数据
|
||||
onItemClickListener!!.onItemClickListener(v, v.tag as Int)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLongClick(v: View): Boolean {
|
||||
initMap()
|
||||
return onItemClickListener != null && onItemClickListener!!.onItemLongClickListener(
|
||||
v,
|
||||
(v.tag as Int)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(context).inflate(R.layout.bookshelf_item, parent, false)
|
||||
view.setOnLongClickListener(this)
|
||||
view.setOnClickListener(this)
|
||||
return ViewHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
// Log.d("check", isshowBox.toString())
|
||||
// if (isshowBox) {
|
||||
// holder.mCheckBox.visibility = VISIBLE
|
||||
// } else {
|
||||
// holder.mCheckBox.visibility = View.INVISIBLE
|
||||
// }
|
||||
// holder.mCheckBox.setOnCheckedChangeListener(CompoundButton.OnCheckedChangeListener { buttonView, isChecked -> //用map集合保存
|
||||
// map[position] = isChecked
|
||||
// })
|
||||
// 设置CheckBox的状态
|
||||
if (map[position] == null) {
|
||||
map[position] = false
|
||||
}
|
||||
// holder.mCheckBox.isChecked = map[position]!!
|
||||
// holder.itemView.setOnClickListener{
|
||||
// if(!flag){
|
||||
// holder.mCheckBox.visibility=View.VISIBLE
|
||||
// flag=true
|
||||
// }
|
||||
// else{
|
||||
// holder.mCheckBox.visibility=View.INVISIBLE
|
||||
// flag=false
|
||||
// }
|
||||
// }
|
||||
val book = bookshelf[position]
|
||||
// if (holder is ViewHolder) {
|
||||
// val viewHolder: ViewHolder = holder
|
||||
// if (selected == position) {
|
||||
// viewHolder.mCheckBox.setChecked(true)
|
||||
// viewHolder.itemView.setSelected(true)
|
||||
// } else {
|
||||
// viewHolder.mCheckBox.setChecked(false)
|
||||
// viewHolder.itemView.setSelected(false)
|
||||
// }
|
||||
// if (onItemClickListener != null) {
|
||||
// viewHolder.itemView.setOnClickListener(View.OnClickListener {
|
||||
// onItemClickListener!!.onItemClickListener(
|
||||
// viewHolder.itemView,
|
||||
// viewHolder.adapterPosition
|
||||
// )
|
||||
// })
|
||||
// }
|
||||
// }
|
||||
var flag: Boolean = false
|
||||
holder.book_img.setTag("1")
|
||||
if (book.bkname.equals("添加")) {
|
||||
holder.book_img.scaleType = ImageView.ScaleType.CENTER_INSIDE
|
||||
holder.book_img.setImageResource(R.drawable.add)
|
||||
flag = true
|
||||
}
|
||||
holder.book_name.text = book.bkname
|
||||
val query = BmobQuery<Book_bmob>()
|
||||
query.addWhereEqualTo("name", book.bkname)
|
||||
query.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(p0: MutableList<Book_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
for (p in p0) {
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
if (flag) {
|
||||
|
||||
} else {
|
||||
holder.book_img.setTag("0")
|
||||
val url = URL(p!!.picture.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(5000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap = BitmapFactory.decodeStream(`in`)
|
||||
holder.book_img.setImageBitmap(bitmap)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
holder.book_img.setOnClickListener {
|
||||
val res = holder.book_img.getTag()
|
||||
if (res == "0") {
|
||||
val intent = Intent(holder.itemView.context, Book_informationActivity::class.java)
|
||||
intent.putExtra("Book_name", book.bkname)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
} else {
|
||||
val intent = Intent(context, MainActivity::class.java)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount() = bookshelf.size
|
||||
}
|
||||
|
@ -0,0 +1,82 @@
|
||||
package com.zjgsu.jianshu.Adapter
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Button
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Bmob.Comment_bmob
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import com.zjgsu.jianshu.Book_authorAdapter
|
||||
import com.zjgsu.jianshu.Comment
|
||||
import com.zjgsu.jianshu.R
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
class CommentAdapter(val commentlist: List<Comment>) :
|
||||
RecyclerView.Adapter<CommentAdapter.ViewHolder>() {
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val user_icon: ImageView = view.findViewById(R.id.inf_comment_user_icon)
|
||||
val user_name: TextView = view.findViewById(R.id.inf_comment_postPersonName)
|
||||
val content: TextView = view.findViewById(R.id.inf_comment_textView_perception)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.comment_item, parent, false)
|
||||
return ViewHolder(view)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: CommentAdapter.ViewHolder, position: Int) {
|
||||
val comment = commentlist[position]
|
||||
val query = BmobQuery<Comment_bmob>()
|
||||
query.addWhereEqualTo("objectId", comment.commentid)
|
||||
query.findObjects(object : FindListener<Comment_bmob>() {
|
||||
override fun done(list: List<Comment_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
holder.content.text = i.text
|
||||
Log.d("zytt",i.text)
|
||||
val query2 = BmobQuery<User_bmob>()
|
||||
query2.addWhereEqualTo("objectId",i.comment_personid)
|
||||
query2.findObjects(object:FindListener<User_bmob>(){
|
||||
override fun done(list:List<User_bmob>,e:BmobException?){
|
||||
if(e==null){
|
||||
for(j in list){
|
||||
holder.user_name.text=j.nickName
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(j!!.face.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(5000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
holder.user_icon.setImageBitmap(bitmap)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
override fun getItemCount() = commentlist.size
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package com.zjgsu.jianshu.Adapter
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import com.zjgsu.jianshu.Perception
|
||||
import com.zjgsu.jianshu.R
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
|
||||
class GoodsuibiAdapter(val perceptionList: List<Perception>) : RecyclerView.Adapter<GoodsuibiAdapter.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val user_Image: ImageView = view.findViewById(R.id.user_Image)
|
||||
val user_name: TextView = view.findViewById(R.id.user_Name)
|
||||
val perception: TextView = view.findViewById(R.id.goodContent)
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.goodsuibi_item, parent, false)
|
||||
return ViewHolder(view)
|
||||
}
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val perception = perceptionList[position]
|
||||
val query = BmobQuery<Perception_bmob>()
|
||||
query.addWhereEqualTo("objectId",perception.perceptionid)
|
||||
query.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(p0: MutableList<Perception_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
for (p in p0) {
|
||||
holder.perception.text = p.perception
|
||||
// holder.user_Image.setImageResource(R.drawable.touxiang)
|
||||
val bmob=BmobQuery<User_bmob>()
|
||||
bmob.addWhereEqualTo("objectId",p.userid)
|
||||
bmob.findObjects(object :FindListener<User_bmob>(){
|
||||
override fun done(p2: MutableList<User_bmob>?, p3: BmobException?) {
|
||||
if(p3==null){
|
||||
if(p2!=null&&p2.size>0){
|
||||
for(i in p2){
|
||||
holder.user_name.text=i.nickName
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(i!!.face.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(5000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
holder.user_Image.setImageBitmap(bitmap)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
override fun getItemCount() =perceptionList.size
|
||||
|
||||
}
|
170
app/src/main/java/com/zjgsu/jianshu/Adapter/PerceptionAdapter.kt
Normal file
@ -0,0 +1,170 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import com.zjgsu.jianshu.Activity.Perception_informationActivity
|
||||
import com.zjgsu.jianshu.Bmob.Book_inf_bmob
|
||||
import com.zjgsu.jianshu.Bmob.Perception_bmob
|
||||
import com.zjgsu.jianshu.Bmob.User_bmob
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
|
||||
|
||||
class PerceptionAdapter(val perceptionList: List<Perception>) : RecyclerView.Adapter<PerceptionAdapter.ViewHolder>() {
|
||||
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val perceptionList_perception: TextView = view.findViewById(R.id.textView_perception)
|
||||
//用户头像
|
||||
val perceptionList_userIcon: ImageView = view.findViewById(R.id.user_icon)
|
||||
val perceptionList_posetPerson: TextView = view.findViewById(R.id.postPersonName)
|
||||
//书籍封面
|
||||
val perceptionList_bookPic: ImageView = view.findViewById(R.id.book_pic)
|
||||
val perceptionList_bookName: TextView = view.findViewById(R.id.bookName)
|
||||
val perceptionList_bookAuthor: TextView = view.findViewById(R.id.bookAuthor)
|
||||
val perceptionList_bookInf: View = view.findViewById(R.id.bookInf)
|
||||
val comment:ImageView=view.findViewById(R.id.gotocomment)
|
||||
lateinit var perceptionid:String
|
||||
|
||||
|
||||
}
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.perception_item, parent, false)
|
||||
return ViewHolder(view)
|
||||
}
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
var bookName:String=""
|
||||
val perception = perceptionList[position]
|
||||
//设置text
|
||||
holder.perceptionid=perception.perceptionid
|
||||
val query = BmobQuery<Perception_bmob>()
|
||||
query.addWhereEqualTo("objectId",perception.perceptionid)
|
||||
//加载用户头像
|
||||
query.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(p0: MutableList<Perception_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
for (p in p0) {
|
||||
Log.d("myLog123", p.post_person)
|
||||
//找发布用户
|
||||
holder.perceptionList_perception.text=p.perception
|
||||
val queryUser = BmobQuery<User_bmob>()
|
||||
queryUser.findObjects(object : FindListener<User_bmob>() {
|
||||
override fun done(list: List<User_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (p.userid.equals(i.objectId)) {
|
||||
holder.perceptionList_posetPerson.setText(i.nickName)
|
||||
// flag = true //找到
|
||||
Log.d("myLog", "find sucessflly")
|
||||
//加载图片
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(i!!.face?.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(3000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
holder.perceptionList_userIcon.setImageBitmap(bitmap)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d("myLog", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
//加载书籍封面
|
||||
query.findObjects(object : FindListener<Perception_bmob>() {
|
||||
override fun done(p0: MutableList<Perception_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
for (p in p0) {
|
||||
Log.d("myLog", p.b_name)
|
||||
bookName=p.b_name
|
||||
holder.perceptionList_bookName.text=bookName
|
||||
val queryBook = BmobQuery<Book_inf_bmob>()
|
||||
queryBook.findObjects(object : FindListener<Book_inf_bmob>() {
|
||||
override fun done(list: List<Book_inf_bmob>, e: BmobException?) {
|
||||
if (e == null) {
|
||||
for (i in list) {
|
||||
if (p.b_name.equals(i.name)) {
|
||||
holder.perceptionList_bookAuthor.text=i.author_name
|
||||
//加载图片
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(i!!.picture?.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(3000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
holder.perceptionList_bookPic.setImageBitmap(bitmap)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Log.d("myLog", "error")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
holder.perceptionList_bookInf.setOnClickListener(){
|
||||
val intent= Intent(holder.itemView.context,Book_informationActivity::class.java)
|
||||
intent.putExtra("Book_name",bookName)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
holder.perceptionList_perception.setOnClickListener {
|
||||
val intent= Intent(holder.itemView.context,Perception_informationActivity::class.java)
|
||||
intent.putExtra("PerceptionId",holder.perceptionid)
|
||||
ContextCompat.startActivity(holder.itemView.context, intent, null)
|
||||
}
|
||||
//给评论图标设置点击事件
|
||||
//给评论图标设置点击事件
|
||||
holder.comment.setOnClickListener(View.OnClickListener { showPopupcomment() })
|
||||
}
|
||||
|
||||
override fun getItemCount() =perceptionList.size
|
||||
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Color
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.*
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import cn.bmob.v3.BmobQuery
|
||||
import cn.bmob.v3.exception.BmobException
|
||||
import cn.bmob.v3.listener.FindListener
|
||||
import cn.bmob.v3.listener.SaveListener
|
||||
import com.zjgsu.jianshu.Activity.sendPerceptionActivity
|
||||
import com.zjgsu.jianshu.Bmob.BookShelf
|
||||
import com.zjgsu.jianshu.Bmob.Book_bmob
|
||||
import kotlinx.android.synthetic.main.activity_main.view.*
|
||||
import kotlinx.android.synthetic.main.book_author_item.*
|
||||
import java.io.InputStream
|
||||
import java.net.HttpURLConnection
|
||||
import java.net.URL
|
||||
lateinit var selectedBook:String
|
||||
class send_perceptionAdapter(val bookList:List<BookAuthor>):RecyclerView.Adapter<send_perceptionAdapter.ViewHolder>() {
|
||||
inner class ViewHolder(view: View) : RecyclerView.ViewHolder(view) {
|
||||
val book_Image: ImageView = view.findViewById(R.id.book_Image2)
|
||||
val book_Name: TextView = view.findViewById(R.id.book_name)
|
||||
val background: LinearLayout = view.findViewById(R.id.bookpic_background)
|
||||
}
|
||||
private val map: MutableMap<Int, Boolean?> = HashMap()
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
val view = LayoutInflater.from(parent.context).inflate(R.layout.bookpic_item, parent, false)
|
||||
// val viewHolder=ViewHolder(view)
|
||||
// viewHolder.book_Image.setOnClickListener {
|
||||
// val position=viewHolder.adapterPosition
|
||||
// val book=bookList[position]
|
||||
// var cnt=0
|
||||
// for (i in map){
|
||||
// if(i.value==true)
|
||||
// cnt++
|
||||
// }
|
||||
// if(cnt==0) {
|
||||
// if (map[position] == false) {
|
||||
// map[position] = true
|
||||
// viewHolder.background.setBackgroundColor(Color.CYAN)
|
||||
// selectedBook = book.name
|
||||
// } else {
|
||||
// map[position] = false
|
||||
// viewHolder.background.setBackgroundColor(Color.WHITE)
|
||||
// selectedBook = ""
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// Toast.makeText(parent.context,"只能选择一本书!",Toast.LENGTH_SHORT).show()
|
||||
// }
|
||||
// }
|
||||
return ViewHolder(view)
|
||||
}
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val book = bookList[position]
|
||||
val query = BmobQuery<Book_bmob>()
|
||||
query.addWhereEqualTo("name",book.name)
|
||||
query.findObjects(object : FindListener<Book_bmob>() {
|
||||
override fun done(p0: MutableList<Book_bmob>?, p1: BmobException?) {
|
||||
if (p1 == null) {
|
||||
if (p0 != null && p0.size > 0) {
|
||||
for (p in p0) {
|
||||
holder.book_Name.text=p.name
|
||||
object : Thread() {
|
||||
override fun run() {
|
||||
try {
|
||||
val url = URL(p!!.picture.url)
|
||||
val connection: HttpURLConnection =
|
||||
url.openConnection() as HttpURLConnection
|
||||
connection.setRequestMethod("GET")
|
||||
connection.setConnectTimeout(5000)
|
||||
val `in`: InputStream = connection.getInputStream()
|
||||
val bitmap: Bitmap =
|
||||
BitmapFactory.decodeStream(`in`)
|
||||
holder.book_Image.setImageBitmap(bitmap)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
holder.book_Image.setOnClickListener {
|
||||
var cnt=0
|
||||
for (i in map){
|
||||
if(i.value==true)
|
||||
cnt++
|
||||
}
|
||||
if(cnt==0) {
|
||||
map[position]=true
|
||||
holder.background.setBackgroundColor(Color.CYAN)
|
||||
selectedBook = book.name
|
||||
}
|
||||
else if(cnt==1){
|
||||
if (map[position] == true){
|
||||
map[position] = false
|
||||
holder.background.setBackgroundColor(Color.WHITE)
|
||||
selectedBook = ""
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
else{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun getItemCount() =bookList.size
|
||||
}
|
4
app/src/main/java/com/zjgsu/jianshu/AvatarImageView.java
Normal file
@ -0,0 +1,4 @@
|
||||
package com.zjgsu.jianshu;
|
||||
|
||||
public class AvatarImageView {
|
||||
}
|
14
app/src/main/java/com/zjgsu/jianshu/Bmob/BookShelf.kt
Normal file
@ -0,0 +1,14 @@
|
||||
package com.zjgsu.jianshu.Bmob
|
||||
|
||||
import cn.bmob.v3.BmobObject
|
||||
|
||||
class BookShelf:BmobObject(){
|
||||
var b_name:String = ""
|
||||
var userid:String=""
|
||||
fun settb_name(bookname: String){
|
||||
this.b_name=bookname
|
||||
}
|
||||
fun setuserid(uid: String){
|
||||
this.userid=uid
|
||||
}
|
||||
}
|
16
app/src/main/java/com/zjgsu/jianshu/Bmob/Book_bmob.kt
Normal file
@ -0,0 +1,16 @@
|
||||
package com.zjgsu.jianshu.Bmob
|
||||
|
||||
import cn.bmob.v3.BmobObject
|
||||
import cn.bmob.v3.datatype.BmobFile
|
||||
|
||||
//class Book_bmob(val name:String, val picture: BmobFile, val introduce:String,val tuijian:Int,val yiban:Int,val buxing:Int,val is_like:Boolean,val category_id:Int)
|
||||
class Book_bmob: BmobObject(){
|
||||
var name:String=""
|
||||
var picture: BmobFile=BmobFile()
|
||||
var introduce:String=""
|
||||
var tuijian:Int=0
|
||||
var yiban:Int=0
|
||||
var buxing:Int=0
|
||||
var category_id:Int=0
|
||||
|
||||
}
|
27
app/src/main/java/com/zjgsu/jianshu/Bmob/Book_inf_bmob.kt
Normal file
@ -0,0 +1,27 @@
|
||||
package com.zjgsu.jianshu.Bmob
|
||||
|
||||
import cn.bmob.v3.BmobObject
|
||||
import cn.bmob.v3.datatype.BmobFile
|
||||
|
||||
class Book_inf_bmob:BmobObject(){
|
||||
var name: String=""
|
||||
var picture: BmobFile= BmobFile()
|
||||
var introduce: String=""
|
||||
var author_name: String=""
|
||||
var author_introduce: String=""
|
||||
var evaluate: String=""
|
||||
var authorpic:BmobFile=BmobFile()
|
||||
var yiban:Int=0
|
||||
var tuijian:Int=0
|
||||
var buxing:Int=0
|
||||
fun settuijian(tuijian1: Int){
|
||||
this.tuijian=tuijian1
|
||||
}
|
||||
fun setyiban(yiban1: Int){
|
||||
this.yiban=yiban1
|
||||
}
|
||||
fun setbuxing(buxing1: Int){
|
||||
this.buxing=buxing1
|
||||
}
|
||||
|
||||
}
|
9
app/src/main/java/com/zjgsu/jianshu/Bmob/Comment_bmob.kt
Normal file
@ -0,0 +1,9 @@
|
||||
package com.zjgsu.jianshu.Bmob
|
||||
|
||||
import cn.bmob.v3.BmobObject
|
||||
|
||||
class Comment_bmob:BmobObject() {
|
||||
var text:String=""
|
||||
var perceptionid:String=""
|
||||
var comment_personid:String=""
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.zjgsu.jianshu.Bmob
|
||||
import cn.bmob.v3.BmobObject
|
||||
|
||||
class Perception_bmob:BmobObject() {
|
||||
var perception: String = ""
|
||||
var b_name: String = ""
|
||||
var post_person: String = ""
|
||||
var userid: String = ""
|
||||
}
|
65
app/src/main/java/com/zjgsu/jianshu/Bmob/User_bmob.kt
Normal file
@ -0,0 +1,65 @@
|
||||
package com.zjgsu.jianshu.Bmob
|
||||
|
||||
import cn.bmob.v3.BmobObject
|
||||
import cn.bmob.v3.datatype.BmobFile
|
||||
|
||||
class User_bmob:BmobObject(){
|
||||
var account:String=""
|
||||
var signature:String=""
|
||||
var nickName:String=""
|
||||
var password:String=""
|
||||
var email:String=""
|
||||
var sex:String=""
|
||||
var phone:String=""
|
||||
var address:String=""
|
||||
var face:BmobFile=BmobFile()
|
||||
fun setaccount(account:String){
|
||||
this.account=account
|
||||
}
|
||||
fun getaccount():String{
|
||||
return this.account
|
||||
}
|
||||
fun setsignature(signature:String){
|
||||
this.signature=signature
|
||||
}
|
||||
fun getsignature():String{
|
||||
return this.signature
|
||||
}
|
||||
fun setnickName(nickName:String){
|
||||
this.nickName=nickName
|
||||
}
|
||||
fun getnickName():String{
|
||||
return this.nickName
|
||||
}
|
||||
fun setpassword(password:String){
|
||||
this.password=password
|
||||
}
|
||||
fun getpassword():String{
|
||||
return this.password
|
||||
}
|
||||
fun setemail(email:String){
|
||||
this.email=email
|
||||
}
|
||||
fun getemail():String{
|
||||
return this.email
|
||||
}
|
||||
fun setsex(sex:String){
|
||||
this.sex=sex
|
||||
}
|
||||
fun getsex():String{
|
||||
return this.sex
|
||||
}
|
||||
fun setphone(phone:String){
|
||||
this.phone=phone
|
||||
}
|
||||
fun getphone():String{
|
||||
return this.phone
|
||||
}
|
||||
fun setaddress(address:String){
|
||||
this.address=address
|
||||
}
|
||||
fun getaddress():String{
|
||||
return this.address
|
||||
}
|
||||
|
||||
}
|
8
app/src/main/java/com/zjgsu/jianshu/Book.kt
Normal file
@ -0,0 +1,8 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
|
||||
class Book(
|
||||
var name: String,
|
||||
var introduce: String,
|
||||
var picUrl: String
|
||||
)
|
3
app/src/main/java/com/zjgsu/jianshu/BookAuthor.kt
Normal file
@ -0,0 +1,3 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
class BookAuthor(val name:String,val author_name:String)
|
5
app/src/main/java/com/zjgsu/jianshu/Book_Shelf.kt
Normal file
@ -0,0 +1,5 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import cn.bmob.v3.datatype.BmobFile
|
||||
|
||||
class Book_Shelf(val bkname:String)
|
5
app/src/main/java/com/zjgsu/jianshu/Book_video.kt
Normal file
@ -0,0 +1,5 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import cn.bmob.v3.datatype.BmobFile
|
||||
|
||||
class Book_video(val name:String, val view1: BmobFile,val view2: BmobFile)
|
3
app/src/main/java/com/zjgsu/jianshu/Comment.kt
Normal file
@ -0,0 +1,3 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
class Comment(val commentid:String)
|
291
app/src/main/java/com/zjgsu/jianshu/DragableLuncher.java
Normal file
@ -0,0 +1,291 @@
|
||||
package com.zjgsu.jianshu;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.VelocityTracker;
|
||||
import android.view.View;
|
||||
import android.view.ViewConfiguration;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Scroller;
|
||||
|
||||
public class DragableLuncher extends ViewGroup {
|
||||
|
||||
private Scroller mScroller;// 负责得到滚动属性的对象
|
||||
private VelocityTracker mVelocityTracker;// 负责触摸的功能类
|
||||
|
||||
private int mScrollX = 0;// 滚动的起始X坐标
|
||||
private float mLastMotionX;// 滚动结束X坐标
|
||||
private int mCurrentScreen = 0;// 默认显示第几屏
|
||||
|
||||
private static final int SNAP_VELOCITY = 1000;
|
||||
|
||||
private final static int TOUCH_STATE_REST = 0;
|
||||
private final static int TOUCH_STATE_SCROLLING = 1;
|
||||
|
||||
private int mTouchState = TOUCH_STATE_REST;
|
||||
|
||||
private int mTouchSlop = 0;//用户滑动的距离最小值
|
||||
|
||||
public DragableLuncher(Context context) {
|
||||
super(context);
|
||||
mScroller = new Scroller(context);
|
||||
//获取触发移动事件的最短距离,系统内定?
|
||||
mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
|
||||
|
||||
this.setLayoutParams(new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.FILL_PARENT));
|
||||
}
|
||||
|
||||
public DragableLuncher(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
mScroller = new Scroller(context);
|
||||
//获取触发移动事件的最短距离,系统内定?
|
||||
mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
|
||||
|
||||
this.setLayoutParams(new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.FILL_PARENT));
|
||||
|
||||
mCurrentScreen = 1;
|
||||
}
|
||||
|
||||
/* touch事件拦截器,返回true继续执行onTouchEvent回调函数
|
||||
* 即mTouchState ?= TOUCH_STATE_REST
|
||||
*/
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
//获取触发事件的类型,主要有:ACTION_DOWN、ACTION_MOVE、ACTION_UP
|
||||
final int action = ev.getAction();
|
||||
//当动作正在滑动 且 屏幕在滚动中
|
||||
if ((action == MotionEvent.ACTION_MOVE) && (mTouchState != TOUCH_STATE_REST)) {
|
||||
return true;
|
||||
}
|
||||
//获取触发点的X坐标
|
||||
final float x = ev.getX();
|
||||
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
//mLastMotionX相当于初始时按下的坐标点
|
||||
mLastMotionX = x;
|
||||
//一种特殊情况,界面按初速度滚动时,触屏
|
||||
mTouchState = mScroller.isFinished() ? TOUCH_STATE_REST
|
||||
: TOUCH_STATE_SCROLLING;
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
// 获取滑动距离
|
||||
final int xDiff = (int) Math.abs(x - mLastMotionX);
|
||||
//X滑动距离大于mTouchSlop开始滚动,小于则放弃
|
||||
boolean xMoved = xDiff > mTouchSlop;
|
||||
if (xMoved) {
|
||||
mTouchState = TOUCH_STATE_SCROLLING;//进入滑动状态
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
case MotionEvent.ACTION_UP:
|
||||
mTouchState = TOUCH_STATE_REST;//改成闲置状态
|
||||
break;
|
||||
}
|
||||
|
||||
//判断进入滚动状态方可通过拦截器,否则不通过,通过后自动调用进一步的onTouchEvent
|
||||
return mTouchState != TOUCH_STATE_REST;
|
||||
}
|
||||
|
||||
//isOpen用以控制是否开启滚动效果,可在isOpenTouchAnima中设置
|
||||
public boolean isOpen = true; // 设置是否打开触摸滑动
|
||||
|
||||
public boolean isOpenTouchAnima(boolean isOpen) {
|
||||
this.isOpen = isOpen;
|
||||
return isOpen;
|
||||
}
|
||||
|
||||
//响应滑动时间
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (isOpen) {
|
||||
//确保速率探测器不为空
|
||||
if (mVelocityTracker == null) {
|
||||
mVelocityTracker = VelocityTracker.obtain();
|
||||
}
|
||||
//将event事件添加到探测器中,即绑定两者关系
|
||||
mVelocityTracker.addMovement(event);
|
||||
|
||||
final int action = event.getAction();
|
||||
final float x = event.getX();
|
||||
|
||||
//处理各种touch事件
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
//当页面正在滚动时按钮,则暂停滚动效果
|
||||
if (!mScroller.isFinished()) {
|
||||
mScroller.abortAnimation();
|
||||
}
|
||||
//只有ACTION_DOWN条件下的坐标才是初始坐标
|
||||
mLastMotionX = x;
|
||||
break;
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
//移动距离,注:此处的移动带有方向,因此不取绝对值,负值向右,正值向左
|
||||
final int deltaX = (int) (mLastMotionX - x);
|
||||
mLastMotionX = x;
|
||||
//deltaX<0表示向右
|
||||
//mScrollX表示当前View滚动,左边框的X坐标,即:mScrollX>0为向右
|
||||
if (deltaX < 0) {
|
||||
if (mScrollX > 0) {
|
||||
scrollBy(Math.max(-mScrollX, deltaX), 0);
|
||||
}
|
||||
} else if (deltaX > 0) {
|
||||
//取得可滚动的最大距离
|
||||
final int availableToScroll =
|
||||
getChildAt(getChildCount() - 1).getRight()
|
||||
- mScrollX - getWidth();
|
||||
if (availableToScroll > 0) {
|
||||
scrollBy(Math.min(availableToScroll, deltaX), 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
//计算当前速率
|
||||
final VelocityTracker velocityTracker = mVelocityTracker;
|
||||
velocityTracker.computeCurrentVelocity(1000);
|
||||
int velocityX = (int) velocityTracker.getXVelocity();
|
||||
|
||||
if (velocityX > SNAP_VELOCITY
|
||||
&& mCurrentScreen > 0) {
|
||||
// 滑动到左边的界面
|
||||
snapToScreen(mCurrentScreen - 1);
|
||||
} else if (velocityX < -SNAP_VELOCITY
|
||||
&& mCurrentScreen < getChildCount() - 1) {
|
||||
// 滑动到右边的界面
|
||||
snapToScreen(mCurrentScreen + 1);
|
||||
} else {
|
||||
//滑动到判定的界面
|
||||
snapToDestination();
|
||||
}
|
||||
|
||||
if (mVelocityTracker != null) {
|
||||
mVelocityTracker.recycle();
|
||||
mVelocityTracker = null;
|
||||
}
|
||||
mTouchState = TOUCH_STATE_REST;
|
||||
break;
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
mTouchState = TOUCH_STATE_REST;
|
||||
}
|
||||
//
|
||||
mScrollX = this.getScrollX();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//滑动到判定的界面
|
||||
private void snapToDestination() {
|
||||
final int screenWidth = getWidth();
|
||||
final int whichScreen = (mScrollX + (screenWidth / 2)) / screenWidth;
|
||||
snapToScreen(whichScreen);
|
||||
}
|
||||
|
||||
/**
|
||||
* 带动画效果显示界面
|
||||
* 跳转到指定页面,id = whichScreen
|
||||
*/
|
||||
public void snapToScreen(int whichScreen) {
|
||||
mCurrentScreen = whichScreen;
|
||||
final int newX = whichScreen * getWidth();
|
||||
final int delta = newX - mScrollX;
|
||||
mScroller.startScroll(mScrollX, 0, delta, 0, Math.abs(delta) * 2);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* 不带动画效果显示界面
|
||||
*/
|
||||
public void setToScreen(int whichScreen) {
|
||||
mCurrentScreen = whichScreen;
|
||||
final int newX = whichScreen * getWidth();
|
||||
mScroller.startScroll(newX, 0, 0, 0, 10);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
//获得当前屏幕是第几屏
|
||||
public int getCurrentScreen() {
|
||||
return mCurrentScreen;
|
||||
}
|
||||
//当主界面布局改变时调用
|
||||
|
||||
|
||||
/*
|
||||
* 在此方法内逐个设置页面在parent内显示的position
|
||||
* 从左往右一张一张贴过去
|
||||
*/
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
int childLeft = 0;
|
||||
final int count = getChildCount();
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
final View child = getChildAt(i);
|
||||
|
||||
//View不是隐藏状态都进行显示
|
||||
if (child.getVisibility() != View.GONE) {
|
||||
final int childWidth = child.getMeasuredWidth();
|
||||
|
||||
//设置View在parent内的显示范围
|
||||
//前两个参数:左上顶点的坐标
|
||||
//后两个参数:右下顶点的坐标
|
||||
child.layout(childLeft, 0, childLeft + childWidth,
|
||||
child.getMeasuredHeight());
|
||||
|
||||
childLeft += childWidth;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//取得测量得到的高宽
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
||||
|
||||
final int width = MeasureSpec.getSize(widthMeasureSpec);//提取出宽度
|
||||
|
||||
final int widthMode = MeasureSpec.getMode(widthMeasureSpec);//提取宽度的模式
|
||||
if (widthMode != MeasureSpec.EXACTLY) {
|
||||
/*测量规范模式
|
||||
* MeasureSpec.AT_MOS
|
||||
* ——The child can be as large as it wants up to the specified size.
|
||||
* MeasureSpec.EXACTLY
|
||||
* ——The parent has determined an exact size for the child.
|
||||
* MeasureSpec.UNSPECIFIED
|
||||
* ——The parent has not imposed any constraint on the child.
|
||||
* */
|
||||
throw new IllegalStateException("error mode.");
|
||||
}
|
||||
|
||||
|
||||
final int heightMode = MeasureSpec.getMode(heightMeasureSpec);//提取高度的模式
|
||||
if (heightMode != MeasureSpec.EXACTLY) {
|
||||
throw new IllegalStateException("error mode.");
|
||||
}
|
||||
|
||||
// 子元素将被分配给同样的高和宽
|
||||
final int count = getChildCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
getChildAt(i).measure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
//滚动到指定的屏幕
|
||||
scrollTo(mCurrentScreen * width, 0);
|
||||
}
|
||||
|
||||
//计算滚动的坐标
|
||||
@Override
|
||||
public void computeScroll() {
|
||||
if (mScroller.computeScrollOffset()) {
|
||||
mScrollX = mScroller.getCurrX();
|
||||
scrollTo(mScrollX, 0);
|
||||
postInvalidate();
|
||||
}
|
||||
}
|
||||
}
|
120
app/src/main/java/com/zjgsu/jianshu/MyDialog.java
Normal file
@ -0,0 +1,120 @@
|
||||
package com.zjgsu.jianshu;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Display;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class MyDialog extends Dialog implements View.OnClickListener {
|
||||
//声明xml文件里的组件
|
||||
private TextView tv_title,tv_message;
|
||||
private Button bt_cancel,bt_confirm;
|
||||
|
||||
//声明xml文件中组件中的text变量,为string类,方便之后改
|
||||
private String title,message;
|
||||
private String cancel,confirm;
|
||||
|
||||
//声明两个点击事件,等会一定要为取消和确定这两个按钮也点击事件
|
||||
private IOnCancelListener cancelListener;
|
||||
private IOnConfirmListener confirmListener;
|
||||
|
||||
//设置四个组件的内容
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
public void setCancel(String cancel,IOnCancelListener cancelListener) {
|
||||
this.cancel = cancel;
|
||||
this.cancelListener=cancelListener;
|
||||
}
|
||||
public void setConfirm(String confirm,IOnConfirmListener confirmListener){
|
||||
this.confirm=confirm;
|
||||
this.confirmListener=confirmListener;
|
||||
}
|
||||
|
||||
//MyDialog类的构造方法
|
||||
public MyDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
public MyDialog(@NonNull Context context, int themeResId) {
|
||||
super(context, themeResId);
|
||||
}
|
||||
|
||||
//在app上以对象的形式把xml里面的东西呈现出来的方法!
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
//为了锁定app界面的东西是来自哪个xml文件
|
||||
setContentView(R.layout.mydialog);
|
||||
|
||||
//设置弹窗的宽度
|
||||
WindowManager m = getWindow().getWindowManager();
|
||||
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
||||
Display d = m.getDefaultDisplay();
|
||||
WindowManager.LayoutParams p =getWindow().getAttributes();
|
||||
p.dimAmount=0.4f;
|
||||
Point size = new Point();
|
||||
d.getSize(size);
|
||||
p.width = (int)(size.x * 0.8);//是dialog的宽度为app界面的80%
|
||||
getWindow().setAttributes(p);
|
||||
|
||||
//找到组件
|
||||
tv_title=findViewById(R.id.tv_title);
|
||||
tv_message=findViewById(R.id.tv_message);
|
||||
bt_cancel=findViewById(R.id.bt_cancel);
|
||||
bt_confirm=findViewById(R.id.bt_confirm);
|
||||
|
||||
//设置组件对象的text参数
|
||||
if (!TextUtils.isEmpty(title)){
|
||||
tv_title.setText(title);
|
||||
}
|
||||
if (!TextUtils.isEmpty(message)){
|
||||
tv_message.setText(message);
|
||||
}
|
||||
// if (!TextUtils.isEmpty(cancel)){
|
||||
// bt_cancel.setText(cancel);
|
||||
// }
|
||||
|
||||
//为两个按钮添加点击事件
|
||||
bt_confirm.setOnClickListener(this);
|
||||
bt_cancel.setOnClickListener(this);
|
||||
}
|
||||
|
||||
//重写onClick方法
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()){
|
||||
case R.id.bt_cancel:
|
||||
if(cancelListener!=null){
|
||||
cancelListener.onCancel(this);
|
||||
}
|
||||
dismiss();
|
||||
break;
|
||||
case R.id.bt_confirm:
|
||||
if(confirmListener!=null){
|
||||
confirmListener.onConfirm(this);
|
||||
}
|
||||
dismiss();//按钮按之后会消失
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//写两个接口,当要创建一个CustomDialog对象的时候,必须要实现这两个接口
|
||||
//也就是说,当要弹出一个自定义dialog的时候,取消和确定这两个按钮的点击事件,一定要重写!
|
||||
public interface IOnCancelListener{
|
||||
void onCancel(MyDialog dialog);
|
||||
}
|
||||
public interface IOnConfirmListener{
|
||||
void onConfirm(MyDialog dialog);
|
||||
}
|
||||
}
|
13
app/src/main/java/com/zjgsu/jianshu/NavigationHelper.kt
Normal file
@ -0,0 +1,13 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import kotlinx.android.synthetic.main.layout_bottom_navigation.*
|
||||
|
||||
object NavigationHelper {
|
||||
fun <T> navigateTo(activity: AppCompatActivity, destinationClass: Class<T>) {
|
||||
val intent = Intent(activity, destinationClass)
|
||||
activity.startActivity(intent)
|
||||
activity.finish()
|
||||
}
|
||||
}
|
5
app/src/main/java/com/zjgsu/jianshu/Perception.kt
Normal file
@ -0,0 +1,5 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import cn.bmob.v3.datatype.BmobFile
|
||||
|
||||
class Perception(val perceptionid:String)
|
14
app/src/main/java/com/zjgsu/jianshu/TypeView.kt
Normal file
@ -0,0 +1,14 @@
|
||||
package com.zjgsu.jianshu
|
||||
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import android.widget.TextView
|
||||
import com.zjgsu.jianshu.R
|
||||
|
||||
class TypeView(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
var textView: TextView
|
||||
|
||||
init {
|
||||
textView = itemView.findViewById(R.id.book_Name)
|
||||
}
|
||||
}
|
123
app/src/main/java/com/zjgsu/jianshu/showPopupcomment.java
Normal file
@ -0,0 +1,123 @@
|
||||
package com.zjgsu.jianshu;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Build;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class showPopupcomment extends AppCompatActivity {
|
||||
private PopupWindow popupWindow;
|
||||
private View popupView = null;
|
||||
private EditText inputComment;
|
||||
private String nInputContentText;
|
||||
private TextView btn_submit;
|
||||
private RelativeLayout rl_input_container;
|
||||
private InputMethodManager mInputManager;
|
||||
@SuppressLint("WrongConstant")
|
||||
private void showPopupcomment() {
|
||||
if (popupView == null){
|
||||
//加载评论框的资源文件
|
||||
popupView = LayoutInflater.from(null).inflate(R.layout.comment_popupwindow, null);
|
||||
}
|
||||
inputComment = (EditText) popupView.findViewById(R.id.et_discuss);
|
||||
btn_submit = (Button) popupView.findViewById(R.id.btn_confirm);
|
||||
rl_input_container = (RelativeLayout)popupView.findViewById(R.id.rl_input_container);
|
||||
//利用Timer这个Api设置延迟显示软键盘,这里时间为200毫秒
|
||||
Timer timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
|
||||
public void run()
|
||||
{
|
||||
mInputManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
mInputManager.showSoftInput(inputComment, 0);
|
||||
}
|
||||
|
||||
}, 200);
|
||||
if (popupWindow == null){
|
||||
popupWindow = new PopupWindow(popupView, RelativeLayout.LayoutParams.MATCH_PARENT,
|
||||
RelativeLayout.LayoutParams.WRAP_CONTENT, false);
|
||||
|
||||
}
|
||||
//popupWindow的常规设置,设置点击外部事件,背景色
|
||||
popupWindow.setTouchable(true);
|
||||
popupWindow.setFocusable(true);
|
||||
popupWindow.setOutsideTouchable(true);
|
||||
popupWindow.setBackgroundDrawable(new ColorDrawable(0x00000000));
|
||||
popupWindow.setTouchInterceptor(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
if (event.getAction() == MotionEvent.ACTION_OUTSIDE)
|
||||
popupWindow.dismiss();
|
||||
return false;
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// 设置弹出窗体需要软键盘,放在setSoftInputMode之前
|
||||
popupWindow.setSoftInputMode(PopupWindow.INPUT_METHOD_NEEDED);
|
||||
// 再设置模式,和Activity的一样,覆盖,调整大小。
|
||||
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
//设置popupwindow的显示位置,这里应该是显示在底部,即Bottom
|
||||
popupWindow.showAtLocation(popupView, Gravity.BOTTOM, 0, 0);
|
||||
|
||||
popupWindow.update();
|
||||
|
||||
//设置监听
|
||||
popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
|
||||
|
||||
// 在dismiss中恢复透明度
|
||||
@RequiresApi(api = Build.VERSION_CODES.CUPCAKE)
|
||||
public void onDismiss() {
|
||||
|
||||
mInputManager.hideSoftInputFromWindow(inputComment.getWindowToken(), 0); //强制隐藏键盘
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
//外部点击事件
|
||||
rl_input_container.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
|
||||
mInputManager.hideSoftInputFromWindow(inputComment.getWindowToken(), 0); //强制隐藏键盘
|
||||
popupWindow.dismiss();
|
||||
|
||||
}
|
||||
});
|
||||
//评论框内的发送按钮设置点击事件
|
||||
btn_submit.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
|
||||
nInputContentText = inputComment.getText().toString().trim();
|
||||
|
||||
if (nInputContentText == null || "".equals(nInputContentText)) {
|
||||
// showToastMsgShort("请输入评论内容");
|
||||
return;
|
||||
}
|
||||
mInputManager.hideSoftInputFromWindow(inputComment.getWindowToken(),0);
|
||||
popupWindow.dismiss();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
14
app/src/main/res/anim/push_left_in.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<translate
|
||||
android:duration="500"
|
||||
android:fromXDelta="100%p"
|
||||
android:toXDelta="0" />
|
||||
|
||||
<alpha
|
||||
android:duration="500"
|
||||
android:fromAlpha="0.1"
|
||||
android:toAlpha="1.0" />
|
||||
|
||||
</set>
|
14
app/src/main/res/anim/push_left_out.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<translate
|
||||
android:duration="500"
|
||||
android:fromXDelta="0"
|
||||
android:toXDelta="-100%p" />
|
||||
|
||||
<alpha
|
||||
android:duration="500"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.1" />
|
||||
|
||||
</set>
|
14
app/src/main/res/anim/push_right_in.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<translate
|
||||
android:duration="500"
|
||||
android:fromXDelta="-100%p"
|
||||
android:toXDelta="0" />
|
||||
|
||||
<alpha
|
||||
android:duration="500"
|
||||
android:fromAlpha="0.1"
|
||||
android:toAlpha="1.0" />
|
||||
|
||||
</set>
|
14
app/src/main/res/anim/push_right_out.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<translate
|
||||
android:duration="500"
|
||||
android:fromXDelta="0"
|
||||
android:toXDelta="100%p" />
|
||||
|
||||
<alpha
|
||||
android:duration="500"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.1" />
|
||||
|
||||
</set>
|
30
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="85.84757"
|
||||
android:endY="92.4963"
|
||||
android:startX="42.9492"
|
||||
android:startY="49.59793"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
|
||||
android:strokeWidth="1"
|
||||
android:strokeColor="#00000000" />
|
||||
</vector>
|
BIN
app/src/main/res/drawable/account.png
Normal file
After Width: | Height: | Size: 6.0 KiB |
BIN
app/src/main/res/drawable/add.png
Normal file
After Width: | Height: | Size: 244 B |
BIN
app/src/main/res/drawable/addtobookshelf.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable/back_icon.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
app/src/main/res/drawable/background.png
Normal file
After Width: | Height: | Size: 7.1 MiB |
BIN
app/src/main/res/drawable/bailu.jpeg
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
app/src/main/res/drawable/biji.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
app/src/main/res/drawable/black.png
Normal file
After Width: | Height: | Size: 896 B |
BIN
app/src/main/res/drawable/bookcity1.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
app/src/main/res/drawable/bookcity2.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
app/src/main/res/drawable/bookshelf1.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
app/src/main/res/drawable/bookshelf2.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
app/src/main/res/drawable/btn_list_item_bg.png
Normal file
After Width: | Height: | Size: 691 B |
BIN
app/src/main/res/drawable/buxing.jpg
Normal file
After Width: | Height: | Size: 4.2 KiB |
4
app/src/main/res/drawable/color_flesh.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="20dp" />
|
||||
<solid android:color="#FFFAFA" />
|
||||
</shape>
|
4
app/src/main/res/drawable/color_lightblue.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="20dp" />
|
||||
<solid android:color="#F0F8FF" />
|
||||
</shape>
|
6
app/src/main/res/drawable/color_lightgreen.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="20dp" />
|
||||
<!-- <solid android:color="#7FFFD4" />-->
|
||||
<!-- <solid android:color="#ffaeb9" />-->
|
||||
<solid android:color="#f0fff0"/>
|
||||
</shape>
|
4
app/src/main/res/drawable/color_lightpurple.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="20dp" />
|
||||
<solid android:color="#E6E6FA" />
|
||||
</shape>
|
BIN
app/src/main/res/drawable/comment.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
app/src/main/res/drawable/copper.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable/delete.png
Normal file
After Width: | Height: | Size: 600 B |
20
app/src/main/res/drawable/edit_bg.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle"
|
||||
>
|
||||
<solid
|
||||
android:color="#FFFFFF"/>
|
||||
<corners
|
||||
android:radius="5dip"
|
||||
/>
|
||||
<stroke
|
||||
android:width="0.1px"
|
||||
android:color="#E0FFFF"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
BIN
app/src/main/res/drawable/email.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
app/src/main/res/drawable/gold.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable/good.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable/guanlizhe.jpeg
Normal file
After Width: | Height: | Size: 142 KiB |
BIN
app/src/main/res/drawable/henhao.jpg
Normal file
After Width: | Height: | Size: 9.7 KiB |
BIN
app/src/main/res/drawable/hot.png
Normal file
After Width: | Height: | Size: 893 B |
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#3DDC84"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeWidth="0.8"
|
||||
android:strokeColor="#33FFFFFF" />
|
||||
</vector>
|