提交结果

main
unknown 8 months ago
parent 680dab8643
commit 06599012fd

7
app/.gitignore vendored

@ -0,0 +1,7 @@
.gradle
/local.properties
/build
/captures
*.iml
.idea
*.apk #optional

@ -0,0 +1,53 @@
plugins {
id 'com.android.application'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.example.travelor"
minSdk 24
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
}
sourceSets {
main{
jniLibs.srcDirs = ['libs']
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation files('libs\\AMap2DMap_6.0.0_AMapSearch_9.7.0_AMapLocation_6.4.2_20231215.jar')
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
// todo added
implementation files('libs/SparkChain.aar')
}

Binary file not shown.

@ -0,0 +1,23 @@
# 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
-keep class com.amap.** { *; }
-dontwarn com.amap.**

@ -0,0 +1,26 @@
package com.example.travelor;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.travelor", appContext.getPackageName());
}
}

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.travelor">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- 允许获取粗略位置若用GPS实现定位小蓝点功能则必选 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- 允许获取网络状态用于网络定位若无gps但仍需实现定位小蓝点功能则此权限必选 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- 允许获取wifi网络信息用于网络定位若无gps但仍需实现定位小蓝点功能则此权限必选 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 允许获取wifi状态改变用于网络定位若无gps但仍需实现定位小蓝点功能则此权限必选 -->
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <!-- 允许写入扩展存储,用于数据缓存,若无此权限则写到私有目录 -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- 允许读设备等信息,用于问题排查 -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher_round_new"
android:label="畅游世界"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round_new"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".AttractionCollectActivity"
android:exported="false" />
<activity
android:name=".EditPlanActivity"
android:exported="false" />
<activity
android:name=".AddActivity"
android:exported="true" />
<activity
android:name=".SparkAiActivity"
android:exported="true" />
<meta-data
android:name="com.amap.api.v2.apikey"
android:value="b04c8bf9f6f3678397eb9fa7f18929b7" />
<activity
android:name=".GaodeMapActivity"
android:exported="false" />
<activity
android:name=".DetailsPageActivity"
android:exported="false" />
<activity
android:name=".PageJumpActivity"
android:exported="false" />
<activity
android:name=".SignInActivity"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".LoginActivity"
android:exported="true" />
</application>
</manifest>

@ -0,0 +1,82 @@
package com.example.travelor;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import com.example.travelor.bean.Plans;
import com.example.travelor.datebase.PlansDbOpenHelper;
import com.example.travelor.util.ToastUtil;
import java.text.SimpleDateFormat;
import java.util.Date;
public class AddActivity extends AppCompatActivity {
private EditText etMainPlan, etDetails;
private PlansDbOpenHelper mPlansDbOpenHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add);
etMainPlan = findViewById(R.id.et_name);
etDetails = findViewById(R.id.et_describe);
mPlansDbOpenHelper = new PlansDbOpenHelper(this);
etMainPlan.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
etMainPlan.setSelected(true);
} else {
etMainPlan.setSelected(false);
}
}
});
etDetails.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
etDetails.setSelected(true);
} else {
etDetails.setSelected(false);
}
}
});
}
public void add(View view) {
String mainPlan = etMainPlan.getText().toString();
String details = etDetails.getText().toString();
if (TextUtils.isEmpty(mainPlan)) {
ToastUtil.toastShort(this, "活动名称不能为空!");
return;
}
Plans plan = new Plans();
plan.setMainPlan(mainPlan);
plan.setDetails(details);
plan.setCreateTime(getCurrentTimeFormat());
long row = mPlansDbOpenHelper.insertData(plan);
if (row != -1) {
ToastUtil.toastShort(this, "添加成功!");
this.finish();
} else {
ToastUtil.toastShort(this, "添加失败!");
}
}
private String getCurrentTimeFormat() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYY年MM月dd HH:mm:ss");
Date date = new Date();
return simpleDateFormat.format(date);
}
}

@ -0,0 +1,122 @@
package com.example.travelor;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;
import com.example.travelor.adapter.AttractionCltAdapter;
import com.example.travelor.adapter.HotelAdapter;
import com.example.travelor.bean.Attractions;
import com.example.travelor.datebase.AttrCltDbOpenHelper;
import com.example.travelor.util.ToastUtil;
import java.util.List;
public class AttractionCollectActivity extends AppCompatActivity {
private TextView vtManage;
private TextView vtBack;
private ViewGroup llDelete;
private TextView chooseAll;
private Button btDelete;
private Boolean isChooseAll = false;
private Boolean managed = false;
private List<Attractions> mAttraction;
private AttrCltDbOpenHelper mAttrCltDbOpenHelper;
private AttractionCltAdapter mAttractionCltAdapter;
private RecyclerView collectRecycler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.attraction_collect_layout);
vtManage = findViewById(R.id.vt_manage);
vtBack = findViewById(R.id.back);
llDelete = findViewById(R.id.ll_delete);
btDelete = findViewById(R.id.bt_delete);
chooseAll = findViewById(R.id.choose_all);
collectRecycler = findViewById(R.id.collect_rlv);
mAttrCltDbOpenHelper = new AttrCltDbOpenHelper(this);
initData();
initEvent();
}
private void initEvent() {
vtManage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(managed == false) {
vtManage.setText("完成");
managed = true;
llDelete.setVisibility(View.VISIBLE);
}
else{
vtManage.setText("管理");
managed = false;
llDelete.setVisibility(View.INVISIBLE);
}
mAttractionCltAdapter.setCheckBoxStatus(managed);
deleteManage();
}
});
vtBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
private void deleteManage() {
chooseAll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(isChooseAll == false) {
isChooseAll = true;
mAttractionCltAdapter.chooseAll();
chooseAll.setText("取消");
}
else {
isChooseAll = false;
mAttractionCltAdapter.cancelAll();
chooseAll.setText("全选");
}
}
});
btDelete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mAttractionCltAdapter.deleteChosen();
ToastUtil.toastShort(AttractionCollectActivity.this, "删除成功!");
}
});
}
private void initData() {
llDelete.setVisibility(View.INVISIBLE); // 初始是看不见的
mAttraction = mAttrCltDbOpenHelper.queryAllFromDb();
mAttractionCltAdapter = new AttractionCltAdapter(this, mAttraction);
collectRecycler.setAdapter(mAttractionCltAdapter);
RecyclerView.LayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
collectRecycler.setLayoutManager(linearLayoutManager); // 创建布局管理器
mAttractionCltAdapter.notifyDataSetChanged();
}
}

@ -0,0 +1,281 @@
package com.example.travelor;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.VideoView;
import com.example.travelor.adapter.HotelAdapter;
import com.example.travelor.adapter.ImagePagerAdapter;
import com.example.travelor.bean.Attractions;
import com.example.travelor.bean.Hotels;
import com.example.travelor.bean.Plans;
import com.example.travelor.datebase.AttrCltDbOpenHelper;
import com.example.travelor.datebase.HotelDbOpenHelper;
import com.example.travelor.fragment.FrontPageFragment;
import com.example.travelor.util.SpfUtil;
import com.example.travelor.util.ToastUtil;
import java.util.ArrayList;
import java.util.List;
public class DetailsPageActivity extends AppCompatActivity {
private ViewPager viewPager;
private List<Integer> imageList;
private ArrayList<View> dots = new ArrayList<>();
private Attractions mAttraction;
private TextView tvName;
private TextView tvRank;
private TextView tvLocation;
private List<ImageView> imageViews = new ArrayList<>();
private TextView tvPrice;
private TextView tvIntroduce;
private TextView back;
private VideoView videoView;
private Button btnToggle;
private int currentPosition = 1;
private boolean isPlaying = false;
private Context mContext;
private View likeItIcon;
private View locationIcon;
public static final String KEY_COLLECTED = "collected";
private RecyclerView hotelRecycler;
private List<Hotels> mHotels;
private HotelAdapter mHotelAdapter;
private HotelDbOpenHelper mHotelDbOpenHelper;
private Button btCollect;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.details_page_layout);
mContext = this;
tvName = findViewById(R.id.name);
tvRank = findViewById(R.id.rank);
tvPrice = findViewById(R.id.price);
tvIntroduce = findViewById(R.id.introduce);
tvLocation = findViewById(R.id.location);
btCollect = findViewById(R.id.buy_now);
imageViews.add((ImageView)findViewById(R.id.photo1));
imageViews.add((ImageView)findViewById(R.id.photo2));
imageViews.add((ImageView)findViewById(R.id.photo3));
hotelRecycler = findViewById(R.id.hotel_rl);
mHotels = new ArrayList<>();
mHotelDbOpenHelper = new HotelDbOpenHelper(this);
initData();
initEvent();
}
private void initEvent() {
imageSwitch();
videoPlayer();
setLikeIt();
viewRoute();
backEvent();
collect();
}
private void collect() {
btCollect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AttrCltDbOpenHelper attractionCollectDbOpenHelper = new AttrCltDbOpenHelper(mContext);
long row = attractionCollectDbOpenHelper.insertData(mAttraction);
if (row != -1) {
ToastUtil.toastShort(mContext, "收藏成功!");
} else {
ToastUtil.toastShort(mContext, "已收藏!");
}
}
});
}
private void backEvent() {
back = findViewById(R.id.turn_back);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
// 查看路线
private void viewRoute() {
locationIcon = findViewById(R.id.location_icon);
locationIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(DetailsPageActivity.this, GaodeMapActivity.class);
intent.putExtra("attraction", mAttraction);
startActivity(intent);
finish();
}
});
}
// 设置收藏点亮
private void setLikeIt() {
likeItIcon = findViewById(R.id.likeIt_icon);
likeItIcon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Boolean isCollected = SpfUtil.getBoolean(DetailsPageActivity.this, KEY_COLLECTED);
if(isCollected) {
likeItIcon.setSelected(false);
SpfUtil.saveBoolean(DetailsPageActivity.this, KEY_COLLECTED, false);
}
else {
likeItIcon.setSelected(true);
SpfUtil.saveBoolean(DetailsPageActivity.this, KEY_COLLECTED, true);
}
}
});
}
// 风景图设置
private void setImages(String imagesString) {
String[] imageNames = imagesString.split("#");
for (int i = 0; i < imageNames.length; i++) {
int id = getResources().getIdentifier(imageNames[i], "drawable", getPackageName());
imageViews.get(i).setImageResource(id);
}
}
// 接收数据并初始化
private void initData() {
Intent intent = getIntent();
mAttraction = (Attractions) intent.getSerializableExtra("attraction");
if (mAttraction != null) {
tvName.setText(mAttraction.getName());
tvRank.setText(mAttraction.getRank());
tvIntroduce.setText(" " + mAttraction.getIntroduce());
tvLocation.setText("地理位置: "+mAttraction.getLocation());
tvPrice.setText("¥ " + mAttraction.getPrice());
setImages(mAttraction.getImages());
}
initHotel(mAttraction.getName());
}
// 处理酒店视图
private void initHotel(String mAttraction) {
mHotels = mHotelDbOpenHelper.queryFromDbByAttraction("杭州西湖"); // todo 动态景点名称
mHotelAdapter = new HotelAdapter(this, mHotels);
hotelRecycler.setAdapter(mHotelAdapter);
RecyclerView.LayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
hotelRecycler.setLayoutManager(linearLayoutManager); // 创建布局管理器
mHotelAdapter.notifyDataSetChanged();
}
//视频播放
private void videoPlayer() {
videoView = findViewById(R.id.videoView);
btnToggle = findViewById(R.id.btnToggle);
String videoPath = "android.resource://" + getPackageName() + "/" + R.raw.west_lack;
Uri uri = Uri.parse(videoPath);
videoView.setVideoURI(uri);
videoView.requestFocus();
videoView.seekTo(currentPosition);
btnToggle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(!isPlaying) {
videoView.seekTo(currentPosition); // 设置播放位置
videoView.start();
isPlaying = true;
btnToggle.setSelected(true);
btnToggle.setVisibility(View.INVISIBLE);
setBtnVisible();
}
else { // 如果正在播放,则停止播放
videoView.pause();
currentPosition = videoView.getCurrentPosition(); // 记录当前播放位置;
isPlaying = false;
btnToggle.setSelected(false);
}
}
});
}
// 开始停止播放逻辑
private void setBtnVisible() {
videoView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(btnToggle.getVisibility() == View.INVISIBLE)
btnToggle.setVisibility(View.VISIBLE);
else btnToggle.setVisibility(View.INVISIBLE);
}
});
};
// 图片轮回切换
private void imageSwitch() {
viewPager = findViewById(R.id.viewPager);
imageList = new ArrayList<>(); // 存储图片资源的列表
final int[] position = {0}; // 当前显示的图片索引
// 添加图片资源到列表
imageList.add(R.drawable.west_lake1);
imageList.add(R.drawable.west_lake2);
imageList.add(R.drawable.west_lake3);
dots.add(findViewById(R.id.p1));
dots.add(findViewById(R.id.p2));
dots.add(findViewById(R.id.p3));
// 创建适配器并设置给ViewPager
ImagePagerAdapter adapter = new ImagePagerAdapter(imageList);
viewPager.setAdapter(adapter);
// 设置自动切换
Handler handler = new Handler();
Runnable runnable = new Runnable() {
@Override
public void run() {
int oldPosition = position[0];
position[0] = (position[0] + 1) % imageList.size();
viewPager.setCurrentItem(position[0], true);
dots.get(oldPosition).setBackgroundResource(R.drawable.dot_normal);
dots.get(position[0]).setBackgroundResource(R.drawable.dot_focus);
handler.postDelayed(this, 1000); // 设置延时时间(单位:毫秒)
}
};
// 启动自动切换
handler.postDelayed(runnable, 1000); // 设置初始延时时间(单位:毫秒)
}
}

@ -0,0 +1,72 @@
package com.example.travelor;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import com.example.travelor.bean.Plans;
import com.example.travelor.datebase.PlansDbOpenHelper;
import com.example.travelor.util.ToastUtil;
import java.text.SimpleDateFormat;
import java.util.Date;
public class EditPlanActivity extends AppCompatActivity {
private TextView et_mainPlan;
private TextView et_details;
private TextView createTime;
private Plans mPlan;
private PlansDbOpenHelper mPlansDbOpenHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit_plan);
et_mainPlan = findViewById(R.id.et_name);
et_details = findViewById(R.id.et_describe);
initData();
}
private void initData() {
Intent intent = getIntent();
mPlan = (Plans) intent.getSerializableExtra("plan");
if (mPlan != null) {
et_mainPlan.setText(mPlan.getMainPlan());
et_details.setText(mPlan.getDetails());
}
mPlansDbOpenHelper = new PlansDbOpenHelper(this);
}
public void save(View view) {
String mainPlan = et_mainPlan.getText().toString();
String details = et_details.getText().toString();
if (TextUtils.isEmpty(mainPlan)) {
ToastUtil.toastShort(this, "标题不能为空!");
return;
}
mPlan.setMainPlan(mainPlan);
mPlan.setDetails(details);
mPlan.setCreateTime(getCurrentTimeFormat());
long rowId = mPlansDbOpenHelper.updateData(mPlan);
if (rowId != -1) {
ToastUtil.toastShort(this, "修改成功!");
this.finish();
}else{
ToastUtil.toastShort(this, "修改失败!");
}
}
private String getCurrentTimeFormat() {
SimpleDateFormat sdf = new SimpleDateFormat("YYYY年MM月dd日 HH:mm:ss");
Date date = new Date();
return sdf.format(date);
}
}

@ -0,0 +1,123 @@
package com.example.travelor;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import androidx.appcompat.app.AppCompatActivity;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.amap.api.maps2d.AMap;
import com.amap.api.maps2d.CameraUpdateFactory;
import com.amap.api.maps2d.MapView;
import com.amap.api.maps2d.MapsInitializer;
import com.amap.api.maps2d.model.LatLng;
import com.amap.api.maps2d.model.MarkerOptions;
import com.amap.api.services.core.ServiceSettings;
import com.example.travelor.bean.Attractions;
public class GaodeMapActivity extends AppCompatActivity {
private MapView mMapView;
private AMapLocationClient mLocationClient;
private Button back;
private Attractions attractions;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gaode_map_layout);//设置对应的XML布局文件
initData();
//定位隐私政策同意
AMapLocationClient.updatePrivacyShow(this,true,true);
AMapLocationClient.updatePrivacyAgree(this,true);
mMapView = (MapView) findViewById(R.id.mapView);
mMapView.onCreate(savedInstanceState);// 此方法必须重写
AMap aMap = mMapView.getMap();
aMap.setTrafficEnabled(true);// 显示实时交通状况
//地图模式可选类型MAP_TYPE_NORMAL,MAP_TYPE_SATELLITE,MAP_TYPE_NIGHT
aMap.setMapType(AMap.MAP_TYPE_SATELLITE);// 卫星地图模式
// 返回
back = findViewById(R.id.back);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(GaodeMapActivity.this, DetailsPageActivity.class);
intent.putExtra("attraction", attractions);
startActivity(intent);
finish();
}
});
// 初始化定位客户端
// try {
// mLocationClient = new AMapLocationClient(getApplicationContext());
// } catch (Exception e) {
// e.printStackTrace();
// }
// AMapLocationClientOption option = new AMapLocationClientOption();
// option.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
// mLocationClient.setLocationOption(option);
// mLocationClient.setLocationListener(new AMapLocationListener() {
// @Override
// public void onLocationChanged(AMapLocation aMapLocation) {
// // 处理定位结果
// if (aMapLocation != null) {
// double latitude = aMapLocation.getLatitude();
// double longitude = aMapLocation.getLongitude();
// // 在地图上显示当前位置
// LatLng latLng = new LatLng(latitude, longitude);
// MarkerOptions markerOptions = new MarkerOptions().position(latLng);
// AMap map = mMapView.getMap();
// map.addMarker(markerOptions);
// map.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 16));
// }
// }
// });
//
// mLocationClient.startLocation();
}
private void initData() {
Intent intent = getIntent();
attractions = (Attractions) intent.getSerializableExtra("attraction");
}
@Override
protected void onDestroy() {
super.onDestroy();
//在activity执行onDestroy时执行mMapView.onDestroy(),销毁地图
mMapView.onDestroy();
}
@Override
protected void onResume() {
super.onResume();
//在activity执行onResume时执行mMapView.onResume (),重新绘制加载地图
mMapView.onResume();
}
@Override
protected void onPause() {
super.onPause();
//在activity执行onPause时执行mMapView.onPause (),暂停地图的绘制
mMapView.onPause();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
//在activity执行onSaveInstanceState时执行mMapView.onSaveInstanceState (outState),保存地图当前的状态
mMapView.onSaveInstanceState(outState);
}
}

@ -0,0 +1,101 @@
package com.example.travelor;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.example.travelor.util.SpfUtil;
import com.example.travelor.datebase.UsersDbOpenHelper;
public class LoginActivity extends AppCompatActivity {
private EditText etAccount, etPassword;
private Button btnLogin;
private TextView etSignIn;
private CheckBox cbRememberMe;
private UsersDbOpenHelper mUsersDbOpenHelper;
public static final String KEY_ACCOUNT = "account";
public static final String KEY_PASSWORD = "password";
public static final String KEY_REMEMBER_CHECK = "remember_check";
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_layout);
etAccount = findViewById(R.id.account);
etPassword = findViewById(R.id.password);
btnLogin = findViewById(R.id.buttonLogin);
etSignIn = findViewById(R.id.sign_new_account);
cbRememberMe = findViewById(R.id.checkbox);
// 自动填充记录
String rmAccount = SpfUtil.getString(this, KEY_ACCOUNT);
String rmPassword = SpfUtil.getString(this, KEY_PASSWORD);
Boolean rmCheck = SpfUtil.getBoolean(this, KEY_REMEMBER_CHECK);
etAccount.setText(rmAccount);
etPassword.setText(rmPassword);
cbRememberMe.setChecked(rmCheck);
btnLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String account = etAccount.getText().toString();
String password = etPassword.getText().toString();
// 进行登录验证逻辑
if (isValidCredentials(account, password)) {
rememberMe(account, password);
// 登录成功,跳转到主界面或其他目标界面
Intent intent = new Intent(LoginActivity.this, PageJumpActivity.class);
startActivity(intent);
finish();
} else {
// 登录失败,显示错误消息
Toast.makeText(LoginActivity.this, "账号或密码错误!", Toast.LENGTH_SHORT).show();
}
}
});
etSignIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(LoginActivity.this, SignInActivity.class);
startActivity(intent);
finish();
}
});
}
private void rememberMe(String account, String password) {
boolean isChecked = cbRememberMe.isChecked();
if(isChecked) {
SpfUtil.saveString(this, KEY_ACCOUNT, account);
SpfUtil.saveString(this, KEY_PASSWORD, password);
SpfUtil.saveBoolean(this, KEY_REMEMBER_CHECK, true);
}
else {
SpfUtil.saveString(this, KEY_ACCOUNT, "");
SpfUtil.saveString(this, KEY_PASSWORD, "");
SpfUtil.saveBoolean(this, KEY_REMEMBER_CHECK, false);
}
}
private boolean isValidCredentials(String account, String password) {
mUsersDbOpenHelper = new UsersDbOpenHelper(this);
String realPassword = mUsersDbOpenHelper.queryFromDbByAccount(account);
if(realPassword.equals("") || !realPassword.equals(password))
return false;
return true;
}
}

@ -0,0 +1,48 @@
package com.example.travelor;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
//import android.util.Log;
//
//import com.iflytek.sparkchain.core.SparkChain;
//import com.iflytek.sparkchain.core.SparkChainConfig;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "test";
private Handler handler = new Handler();
private Runnable runnable = new Runnable() {
@Override
public void run() {
tomainActivity();
}
};
private void tomainActivity(){
startActivity(new Intent(this, LoginActivity.class));
finish();
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// initSpark();
handler.postDelayed(runnable, 1000);
}
// private void initSpark() {
// SparkChainConfig config = SparkChainConfig.builder()
// .appID("cb12df0e")
// .apiKey("5ccdd362e25ff16b77acd893af903ac0")
// .apiSecret("ZGZmYTgyNWFmYWVjYzdlZTgwYzkyOGM0");//从平台获取的授权appidapikey,apisecrety
// int ret = SparkChain.getInst().init(getApplicationContext(), config);
// Log.d(TAG,"sdk init:"+ret);
// }
}

@ -0,0 +1,56 @@
package com.example.travelor;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.example.travelor.fragment.FrontPageFragment;
import com.example.travelor.fragment.MineFragment;
import com.example.travelor.fragment.PlanFragment;
import com.example.travelor.fragment.SparkAiFragment;
public class PageJumpActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_page_layout);
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
FrontPageFragment fgm_front_page = new FrontPageFragment();
ft.replace(R.id.main_fragment, fgm_front_page);
ft.commit();
}
public void page_jump(View view) {
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
FrontPageFragment fgm_front_page = new FrontPageFragment();
PlanFragment fgm_plan_page = new PlanFragment();
MineFragment fgm_mine_page = new MineFragment();
SparkAiFragment fgm_spark_page = new SparkAiFragment();
switch (view.getId()){
case R.id.front_page:
ft.replace(R.id.main_fragment, fgm_front_page);
break;
case R.id.plan:
ft.replace(R.id.main_fragment, fgm_plan_page);
break;
case R.id.mine:
ft.replace(R.id.main_fragment, fgm_mine_page);
break;
case R.id.spark:
ft.replace(R.id.main_fragment, fgm_spark_page);
break;
}
ft.commit();
}
}

@ -0,0 +1,166 @@
package com.example.travelor;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.example.travelor.bean.Users;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import com.example.travelor.datebase.UsersDbOpenHelper;
public class SignInActivity extends AppCompatActivity {
private EditText etAccount;
private EditText etPassword;
private EditText etConfirmPwd;
private EditText etUserName;
private EditText etVerifyCode;
private Button btnSignIn;
private Button btnVerify;
private TextView tvAgree;
private TextView tvLogin;
private CheckBox ckAgree;
private UsersDbOpenHelper mUsersDbOpenHelper;
private String verification_code = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sign_in_layout);
etAccount = findViewById(R.id.sign_account);
etPassword = findViewById(R.id.new_password);
etConfirmPwd = findViewById(R.id.confirm_password);
etVerifyCode = findViewById(R.id.verification_code);
etUserName = findViewById(R.id.username);
btnSignIn = findViewById(R.id.buttonSignIn);
btnVerify = findViewById(R.id.sent_VerifyCode);
tvAgree = findViewById(R.id.agree_pact);
tvLogin = findViewById(R.id.tvlogin);
ckAgree = findViewById(R.id.agree_check);
mUsersDbOpenHelper = new UsersDbOpenHelper(this);
//发送验证码
btnVerify.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Random random = new Random();
int randomNumber = 1000 + random.nextInt(9000);
verification_code = String.valueOf(randomNumber);
Toast.makeText(SignInActivity.this, verification_code, Toast.LENGTH_SHORT).show();
}
});
// 注册按钮
btnSignIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String mAccount = etAccount.getText().toString();
String mPassword = etPassword.getText().toString();
String mConfirmPwd = etConfirmPwd.getText().toString();
String mVerifyCode = etVerifyCode.getText().toString();
String UserName = etUserName.getText().toString();
Boolean is_OK = isValidAccount(mAccount, mPassword, mConfirmPwd, mVerifyCode, UserName);
if(is_OK) {
saveDate(mAccount, mPassword, UserName);
Toast.makeText(SignInActivity.this, "注册成功!", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(SignInActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}
}
});
tvAgree.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(SignInActivity.this);
builder.setTitle("安全协议");
builder.setMessage("xxxxxxxxx\nxxxxxxxxxxxxx\nxxxxxxxxxxxxxxxxxxxxx");
builder.setCancelable(false);
builder.setPositiveButton("同意", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ckAgree.setChecked(true);
}
});
builder.show();
}
});
tvLogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(SignInActivity.this, LoginActivity.class);
startActivity(intent);
finish();
}
});
}
// 获取当前时间
private String getCurrentTimeFormat() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYY年MM月dd HH:mm:ss");
Date date = new Date();
return simpleDateFormat.format(date);
}
// 将新用户保存到数据库
private void saveDate(String mAccount, String mPassword, String userName) {
Users newUser = new Users();
newUser.setAccount(mAccount);
newUser.setUserName(userName);
newUser.setPassword(mPassword);
newUser.setCreatedTime(getCurrentTimeFormat());
mUsersDbOpenHelper.insertData(newUser);
}
// 判断新用户设置是否合法
private Boolean isValidAccount(String mAccount, String mPassword, String mConfirmPwd, String mVerifyCode, String userName) {
String regex = "^1[3456789]\\d{9}$";
if(!mAccount.matches(regex)) {
Toast.makeText(SignInActivity.this, "账号不合法!", Toast.LENGTH_SHORT).show();
return false;
}
if(!mUsersDbOpenHelper.queryFromDbByAccount(mAccount).equals("")) {
Toast.makeText(SignInActivity.this, "此账号已经存在,请登录!", Toast.LENGTH_SHORT).show();
return false;
}
if(mPassword.length() < 6) {
Toast.makeText(SignInActivity.this, "密码太短!", Toast.LENGTH_SHORT).show();
return false;
}
if(!mConfirmPwd.equals(mPassword)) {
Toast.makeText(SignInActivity.this, "密码确认有误!", Toast.LENGTH_SHORT).show();
return false;
}
if(verification_code.equals("") || !mVerifyCode.equals(verification_code)) {
Toast.makeText(SignInActivity.this, "验证码错误!", Toast.LENGTH_SHORT).show();
return false;
}
if(!ckAgree.isChecked()) {
Toast.makeText(SignInActivity.this, "请同意协议!", Toast.LENGTH_SHORT).show();
return false;
}
return true;
}
}

@ -0,0 +1,144 @@
package com.example.travelor;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.travelor.R;
import com.example.travelor.adapter.ChatAdapter;
import com.example.travelor.bean.Chats;
import com.example.travelor.datebase.ChatDbOpenHelper;
import com.example.travelor.util.ToastUtil;
import com.iflytek.sparkchain.core.LLM;
import com.iflytek.sparkchain.core.LLMConfig;
import com.iflytek.sparkchain.core.LLMOutput;
import java.util.ArrayList;
import java.util.List;
public class SparkAiActivity extends AppCompatActivity {
private static final String TAG = "test";
private String results;
// private LLM llm;
private Button btSend;
private EditText etQuestion;
private TextView tvBack;
private List<Chats> mChats;
private ChatAdapter mChatAdapter;
private RecyclerView mRecyclerView;
private ChatDbOpenHelper mChatDbOpenHelper;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_spark_ai);
// initSpark();
initData();
initEvent();
}
private void initData() {
btSend = findViewById(R.id.send);
etQuestion = findViewById(R.id.question);
mRecyclerView = findViewById(R.id.chat_list);
tvBack = findViewById(R.id.back);
mChats = new ArrayList<>();
mChatDbOpenHelper = new ChatDbOpenHelper(this);
}
public void onResume() {
super.onResume();
refreshDataFromDb();
setLayout();
}
private void setLayout() {
mChatAdapter.notifyDataSetChanged();
RecyclerView.LayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
mRecyclerView.setLayoutManager(linearLayoutManager); // 创建布局管理器
}
private void refreshDataFromDb() {
mChats = getDataFromDB();
mChatAdapter.refreshData(mChats);
}
private List<Chats> getDataFromDB() {
return mChatDbOpenHelper.queryAllFromDb();
}
private void initEvent() {
mChatAdapter = new ChatAdapter(this,mChats);
mRecyclerView.setAdapter(mChatAdapter);
btSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String content = etQuestion.getText().toString();
etQuestion.setText(""); // 发送后设置为空
Chats newUserChat = new Chats();
newUserChat.setContent(content);
newUserChat.setIdentity("user");
addItem(newUserChat);
String result = "亚布力雪乡位于中国黑龙江省属于寒温带大陆性气候区。冬季气温极低属于严寒地区。一般来说12月至次年2月是雪乡最寒冷的季节气温可达到零下20摄氏度甚至更低。在雪乡旅游时一定要做好保暖工作穿着厚重的冬装戴上帽子、手套和围巾等防寒物品以确保自己的身体能保持温暖。同时还要注意防寒措施如避免长时间暴露在室外、及时进食热食、多喝水等以确保身体的健康和安全。";
// String result = interact(content);
Chats newAiChat = new Chats();
newAiChat.setContent(result);
newAiChat.setIdentity("ai");
addItem(newAiChat);
}
});
tvBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
}
private void addItem(Chats newChat) {
long row = mChatDbOpenHelper.insertData(newChat);
if (row != -1) {
ToastUtil.toastShort(this, "添加成功!");
} else {
ToastUtil.toastShort(this, "添加失败!");
}
refreshDataFromDb();
}
// private String interact(String question) {
// LLMOutput syncOutput = llm.run(question);
// String result = "对不起,我的能力不足,不能回答!";
// if(syncOutput.getErrCode() == 0) {
// Log.i(TAG, "同步调用:" + syncOutput.getRole() + ":" + syncOutput.getContent());
// results = syncOutput.getContent();
// System.out.println(results);
// }else {
// Log.e(TAG, "同步调用:" + "errCode" + syncOutput.getErrCode() + " errMsg:" + syncOutput.getErrMsg());
// }
// return result;
// }
//
// private void initSpark() {
// LLMConfig llmConfig = LLMConfig.builder();
// llmConfig.domain("generalv2");
// llmConfig.url("ws(s)://spark-api.xf-yun.com/v2.1/chat");//如果使用generalv2domain和url都可缺省SDK默认如果使用generalurl可缺省SDK会自动补充如果是其他则需要设置domain和url。
// llm = new LLM(llmConfig);
// }
}

@ -0,0 +1,109 @@
package com.example.travelor.adapter;
import android.content.Context;
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.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.travelor.DetailsPageActivity;
import com.example.travelor.R;
import com.example.travelor.bean.Attractions;
import java.util.List;
import com.example.travelor.datebase.AttractionDbOpenHelper;
public class AttractionCardAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private List<Attractions> mAttractionList;
private LayoutInflater mLayoutInflater;
private Context mContext;
private AttractionDbOpenHelper mAttractionDbOpenHelper;
public AttractionCardAdapter(Context context, List<Attractions> mAttractionList){
this.mAttractionList = mAttractionList;
this.mContext = context;
mLayoutInflater = LayoutInflater.from(mContext);
mAttractionDbOpenHelper = new AttractionDbOpenHelper(mContext);
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = mLayoutInflater.inflate(R.layout.attraction_card, parent, false);
MyViewHolder myViewHolder = new MyViewHolder(view);
return myViewHolder;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
bindViewHolder((MyViewHolder) holder, position);
}
private void bindViewHolder(MyViewHolder holder, int position) {
Attractions attraction = mAttractionList.get(position);
holder.mAttrName.setText(attraction.getName());
holder.mAttrRank.setText(attraction.getRank());
holder.mAttrLocation.setText(attraction.getLocation());
// holder.mAttrImage.setImageResource(R.drawable.circular_image);
// 动态设置图片
holder.mAttrImage.setImageResource(getResourceId(attraction.getImages()));
holder.mCardContain.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(mContext, DetailsPageActivity.class);
intent.putExtra("attraction", attraction);
mContext.startActivity(intent);
}
});
}
public int getResourceId(String fileNames) {
String[] imageNames = fileNames.split("#");
String resourceName = imageNames[0];
String resourceType = "drawable";
String packageName = mContext.getPackageName();
return mContext.getResources().getIdentifier(resourceName, resourceType, packageName);
}
@Override
public int getItemCount() {
return mAttractionList.size();
}
public void refreshData(List<Attractions> mAttractions) {
this.mAttractionList = mAttractions;
notifyDataSetChanged();
}
// 用于保存 list_item.xml 中的视图组件
class MyViewHolder extends RecyclerView.ViewHolder{
ImageView mAttrImage;
TextView mAttrName;
TextView mAttrRank;
TextView mAttrLocation;
ViewGroup mCardContain;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
this.mAttrImage = itemView.findViewById(R.id.attraction_image);
this.mAttrName = itemView.findViewById(R.id.attraction_name);
this.mAttrRank = itemView.findViewById(R.id.rank);
this.mAttrLocation = itemView.findViewById(R.id.location);
this.mCardContain = itemView.findViewById(R.id.card_contain);
}
}
}

@ -0,0 +1,164 @@
package com.example.travelor.adapter;
import android.content.Context;
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.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.travelor.DetailsPageActivity;
import com.example.travelor.LoginActivity;
import com.example.travelor.R;
import com.example.travelor.SignInActivity;
import com.example.travelor.bean.Attractions;
import com.example.travelor.datebase.AttrCltDbOpenHelper;
import java.util.ArrayList;
import java.util.List;
public class AttractionCltAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private List<Attractions> mAttractionList;
private LayoutInflater mLayoutInflater;
private Context mContext;
private Boolean checkboxVisible = false;
private Boolean mChooseAll = false;
private AttrCltDbOpenHelper mAttrCltDbOpenHelper;
private boolean mCancelAll = false;
private boolean[] checkedPositions; // 跟踪复选框的选中状态
public AttractionCltAdapter(Context context, List<Attractions> mAttraction) {
this.mAttractionList = mAttraction;
this.mContext = context;
mLayoutInflater = LayoutInflater.from(mContext);
mAttrCltDbOpenHelper = new AttrCltDbOpenHelper(mContext);
checkedPositions = new boolean[mAttraction.size()];
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = mLayoutInflater.inflate(R.layout.attraction_collect_card, parent, false);
AttractionCltAdapter.MyViewHolder myViewHolder = new AttractionCltAdapter.MyViewHolder(view);
return myViewHolder;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
bindViewHolder((AttractionCltAdapter.MyViewHolder) holder, position);
}
private void bindViewHolder(AttractionCltAdapter.MyViewHolder holder, int position) {
Attractions attraction = mAttractionList.get(position);
holder.mAttrName.setText(attraction.getName());
holder.mAttrLocation.setText(attraction.getLocation());
// holder.mAttrImage.setImageResource(R.drawable.west_lake1); // todo
// 动态设置图片
holder.mAttrImage.setImageResource(getResourceId(attraction.getImages()));
String introduce = attraction.getIntroduce();
// 卡片简介不能太长
holder.mAttrIntroduce.setText("简介:" + introduce.substring(0, Math.min(introduce.length(), 15)));
if (checkboxVisible) {
holder.mChoice.setVisibility(View.VISIBLE);
} else {
holder.mChoice.setVisibility(View.INVISIBLE);
checkedPositions[position] = false;
}
holder.mChoice.setChecked(checkedPositions[position]);
holder.mChoice.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
checkedPositions[position] = isChecked; // 更新选中状态
}
});
holder.mDetails.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(mContext, DetailsPageActivity.class);
intent.putExtra("attraction", attraction);
mContext.startActivity(intent);
}
});
}
public int getResourceId(String fileNames) {
String[] imageNames = fileNames.split("#");
String resourceName = imageNames[0];
String resourceType = "drawable";
String packageName = mContext.getPackageName();
return mContext.getResources().getIdentifier(resourceName, resourceType, packageName);
}
@Override
public int getItemCount() {
return mAttractionList.size();
}
public void refreshData(List<Attractions> mAttractions) {
this.mAttractionList = mAttractions;
for (int i = 0; i < mAttractionList.size(); i++)
checkedPositions[i] = false;
notifyDataSetChanged();
}
public void setCheckBoxStatus(Boolean managed) {
this.checkboxVisible = managed;
notifyDataSetChanged();
}
public void chooseAll() {
for (int i = 0; i < mAttractionList.size(); i++)
checkedPositions[i] = true;
notifyDataSetChanged();
}
public void deleteChosen() {
List<Attractions> newAttractionList = new ArrayList<>();
for (int i = 0; i < mAttractionList.size(); i++) {
if (checkedPositions[i])
mAttrCltDbOpenHelper.deleteFromDbByName(mAttractionList.get(i).getName());
else newAttractionList.add(mAttractionList.get(i));
}
refreshData(newAttractionList);
}
public void cancelAll() {
for (int i = 0; i < mAttractionList.size(); i++)
checkedPositions[i] = false;
notifyDataSetChanged();
}
class MyViewHolder extends RecyclerView.ViewHolder{
ImageView mAttrImage;
TextView mAttrName;
TextView mAttrLocation;
TextView mAttrIntroduce;
TextView mDetails;
CheckBox mChoice;
ViewGroup mCardContain;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
this.mAttrImage = itemView.findViewById(R.id.image);
this.mAttrName = itemView.findViewById(R.id.name);
this.mAttrLocation = itemView.findViewById(R.id.location);
this.mAttrIntroduce = itemView.findViewById(R.id.introduce);
this.mCardContain = itemView.findViewById(R.id.card_contain);
this.mDetails = itemView.findViewById(R.id.details);
this.mChoice = itemView.findViewById(R.id.cb_choice);
}
}
}

@ -0,0 +1,114 @@
package com.example.travelor.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.travelor.R;
import com.example.travelor.bean.Chats;
import com.example.travelor.datebase.ChatDbOpenHelper;
import com.example.travelor.datebase.PlansDbOpenHelper;
import java.util.List;
public class ChatAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
private List<Chats> mChatsList;
private LayoutInflater mLayoutInflater;
private Context mContext;
private ChatDbOpenHelper mChatDbOpenHelper;
private int viewType;
public static int TYPE_AI_LAYOUT = 0;
public static int TYPE_USER_LAYOUT = 1;
public ChatAdapter(Context context, List<Chats> mChatsList){
this.mChatsList = mChatsList;
this.mContext = context;
mLayoutInflater = LayoutInflater.from(mContext);
mChatDbOpenHelper = new ChatDbOpenHelper(mContext); // 创建数据库管理对象
}
public int getItemViewType(int position) {
String identity = mChatsList.get(position).getIdentity();
if (identity.equals("ai")) viewType = TYPE_AI_LAYOUT;
else viewType = TYPE_USER_LAYOUT;
return viewType;
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
if(viewType == TYPE_AI_LAYOUT){
View view = mLayoutInflater.inflate(R.layout.ai_response_item, parent, false);
AiViewHolder aiViewHolder = new AiViewHolder(view);
return aiViewHolder;
}else if(viewType == TYPE_USER_LAYOUT){
View view = mLayoutInflater.inflate(R.layout.user_ask_item, parent, false);
UserViewHolder myGridViewHolder = new UserViewHolder(view);
return myGridViewHolder;
}
return null;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if (holder == null) {
return;
}
if(holder instanceof AiViewHolder){ // 判断holder的类型
bindAiViewHolder((AiViewHolder) holder, position);
} else if (holder instanceof UserViewHolder) {
bindUserViewHolder((UserViewHolder) holder, position);
}
}
private void bindUserViewHolder(UserViewHolder holder, int position) {
Chats chat = mChatsList.get(position);
holder.userContent.setText(chat.getContent());
// todo 头像
}
private void bindAiViewHolder(AiViewHolder holder, int position) {
Chats chat = mChatsList.get(position);
holder.aiContent.setText(chat.getContent());
}
@Override
public int getItemCount() {
return mChatsList.size();
}
// 刷新数据
public void refreshData(List<Chats> chats) {
this.mChatsList = chats;
notifyDataSetChanged();
}
class AiViewHolder extends RecyclerView.ViewHolder{
TextView aiContent;
public AiViewHolder(@NonNull View itemView) {
super(itemView);
this.aiContent = itemView.findViewById(R.id.ai_content);
}
}
class UserViewHolder extends RecyclerView.ViewHolder{
TextView userContent;
ViewGroup chatContain;
public UserViewHolder(@NonNull View itemView) {
super(itemView);
this.userContent = itemView.findViewById(R.id.user_content);
this.chatContain = itemView.findViewById(R.id.user_contain);
}
}
}

@ -0,0 +1,92 @@
package com.example.travelor.adapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.travelor.R;
import com.example.travelor.bean.Hotels;
import com.example.travelor.datebase.HotelDbOpenHelper;
import java.util.List;
public class HotelAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private List<Hotels> mHotelList;
private LayoutInflater mLayoutInflater;
private Context mContext;
public HotelAdapter(Context context, List<Hotels> mHotelList){
this.mHotelList = mHotelList;
this.mContext = context;
mLayoutInflater = LayoutInflater.from(mContext);
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = mLayoutInflater.inflate(R.layout.hotel_item_layout, parent, false);
HtViewHolder htViewHolder = new HtViewHolder(view);
return htViewHolder;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
bindViewHolder((HtViewHolder) holder, position);
}
private void bindViewHolder(HtViewHolder holder, int position) {
Hotels hotel = mHotelList.get(position);
holder.mHotelName.setText(hotel.getHotelName());
holder.mHotelPrice.setText(hotel.getHotelPrice());
holder.mHotelScore.setText(hotel.getHotelScore());
holder.mHotelRank.setText(hotel.getHotelRank());
holder.mHotelLocation.setText(hotel.getHotelLocation());
holder.mCardContain.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// todo 收藏
}
});
}
@Override
public int getItemCount() {
return mHotelList.size();
}
public void refreshData(List<Hotels> mHotels) {
this.mHotelList = mHotels;
notifyDataSetChanged();
}
class HtViewHolder extends RecyclerView.ViewHolder{
ImageView mHotelImage;
TextView mHotelName;
TextView mHotelRank;
TextView mHotelLocation;
TextView mHotelScore;
TextView mHotelPrice;
ViewGroup mCardContain;
public HtViewHolder(@NonNull View itemView) {
super(itemView);
this.mHotelName = itemView.findViewById(R.id.hotel_name);
this.mHotelImage = itemView.findViewById(R.id.hotel_image);
this.mHotelLocation = itemView.findViewById(R.id.hotel_location);
this.mHotelRank = itemView.findViewById(R.id.hotel_rank);
this.mHotelScore = itemView.findViewById(R.id.hotel_score);
this.mHotelPrice = itemView.findViewById(R.id.hotel_price);
this.mCardContain = itemView.findViewById(R.id.hotel_card);
}
}
}

@ -0,0 +1,43 @@
package com.example.travelor.adapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import androidx.annotation.NonNull;
import androidx.viewpager.widget.PagerAdapter;
import java.util.List;
public class ImagePagerAdapter extends PagerAdapter {
private List<Integer> imageList;
public ImagePagerAdapter(List<Integer> imageList) {
this.imageList = imageList;
}
@Override
public int getCount() {
return imageList.size();
}
@Override
public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
return view == object;
}
@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
ImageView imageView = new ImageView(container.getContext());
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setImageResource(imageList.get(position));
container.addView(imageView);
return imageView;
}
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
container.removeView((View) object);
}
}

@ -0,0 +1,142 @@
package com.example.travelor.adapter;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.travelor.EditPlanActivity;
import com.example.travelor.R;
import com.example.travelor.bean.Plans;
import com.example.travelor.datebase.PlansDbOpenHelper;
import java.util.List;
public class PlanAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>{
private List<Plans> mPlansList;
private LayoutInflater mLayoutInflater;
private Context mContext;
private boolean isSwipeActive = false;
private final int SWIPE_THRESHOLD = 4;
private float startX;
private PlansDbOpenHelper mPlansDbOpenHelper;
public PlanAdapter(Context context, List<Plans> mPlansList){
this.mPlansList = mPlansList;
this.mContext = context;
mLayoutInflater = LayoutInflater.from(mContext);
mPlansDbOpenHelper = new PlansDbOpenHelper(mContext); // 创建数据库管理对象
}
@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = mLayoutInflater.inflate(R.layout.one_plan, parent, false);
PlanAdapter.MyViewHolder myViewHolder = new PlanAdapter.MyViewHolder(view);
return myViewHolder;
}
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
bindViewHolder((PlanAdapter.MyViewHolder) holder, position);
}
private void bindViewHolder(PlanAdapter.MyViewHolder holder, int position) {
Plans plan = mPlansList.get(position);
holder.planIndex.setText(Integer.toString(position + 1));
holder.mainPlan.setText(plan.getMainPlan());
holder.planDetails.setText(plan.getDetails());
holder.createTime.setText(plan.getCreateTime());
holder.planContain.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
startX = event.getX();
isSwipeActive = false;
break;
case MotionEvent.ACTION_MOVE:
float distanceX = event.getX() - startX;
if (distanceX < SWIPE_THRESHOLD) {
isSwipeActive = true;
holder.handleContain.setVisibility(View.VISIBLE);
}
else if(distanceX > SWIPE_THRESHOLD) {
isSwipeActive = false;
holder.handleContain.setVisibility(View.INVISIBLE);
}
break;
}
return true;
}
});
holder.deleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int row = mPlansDbOpenHelper.deleteFromDbById(plan.getId());
if (row > 0) {
removeData(position);
}
}
});
holder.editButton.setOnClickListener((new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(mContext, EditPlanActivity.class);
intent.putExtra("plan", plan);
mContext.startActivity(intent);
}
}));
}
private void removeData(int position) {
mPlansList.remove(position);
notifyItemRemoved(position);
}
@Override
public int getItemCount() {
return mPlansList.size();
}
public void refreshData(List<Plans> mPlansList) {
this.mPlansList = mPlansList;
notifyDataSetChanged();
}
class MyViewHolder extends RecyclerView.ViewHolder{
TextView planIndex;
TextView mainPlan;
TextView planDetails;
TextView createTime;
ViewGroup planContain;
ViewGroup handleContain;
ImageButton editButton;
ImageButton deleteButton;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
this.planIndex = itemView.findViewById(R.id.plan_index);
this.mainPlan = itemView.findViewById(R.id.main_plan);
this.planDetails = itemView.findViewById(R.id.details);
this.createTime = itemView.findViewById(R.id.create_time);
this.planContain = itemView.findViewById(R.id.plan_contain);
this.handleContain = itemView.findViewById(R.id.handle_buttons);
this.editButton = itemView.findViewById(R.id.edit_button);
this.deleteButton = itemView.findViewById(R.id.delete_button);
}
}
}

@ -0,0 +1,108 @@
package com.example.travelor.bean;
import android.text.TextUtils;
import java.io.Serializable;
import java.util.List;
public class Attractions implements Serializable {
private String id;
private String name;
private String location;
private String introduce;
private String hotels;
private String images;
private String video;
private String price;
private String rank;
private String category;
public String getId() { return id; }
public void setId(String id) { this.id = id; }
public void setCategory(String category) { this.category = category; }
public String getCategory() { return category; }
public void setName(String name) {
this.name = name;
}
public void setLocation(String location) {
this.location = location;
}
public void setIntroduce(String introduce) {
this.introduce = introduce;
}
public void setHotels(String hotels) {
this.hotels = hotels;
}
public void setImages(String images) {
this.images = images;
}
public void setVideo(String video) {
this.video = video;
}
public void setPrice(String price) {
this.price = price;
}
public void setRank(String rank) {
this.rank = rank;
}
public String getName() {
return name;
}
public String getLocation() {
return location;
}
public String getIntroduce() {
return introduce;
}
public String getHotels() {
return hotels;
}
public String getImages() {
return images;
}
public String getVideo() {
return video;
}
public String getPrice() {
return price;
}
public String getRank() {
return rank;
}
@Override
public String toString() {
return "Attractions{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", location='" + location + '\'' +
", introduce='" + introduce + '\'' +
", hotels='" + hotels + '\'' +
", images='" + images + '\'' +
", video='" + video + '\'' +
", price='" + price + '\'' +
", rank='" + rank + '\'' +
", category='" + category + '\'' +
'}';
}
}

@ -0,0 +1,42 @@
package com.example.travelor.bean;
import java.io.Serializable;
public class Chats implements Serializable {
private String id;
private String identity;
private String content;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getIdentity() {
return identity;
}
public void setIdentity(String identity) {
this.identity = identity;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@Override
public String toString() {
return "chats{" +
"id='" + id + '\'' +
", identity='" + identity + '\'' +
", content='" + content + '\'' +
'}';
}
}

@ -0,0 +1,72 @@
package com.example.travelor.bean;
import java.io.Serializable;
public class Hotels implements Serializable {
private String hotelName;
private String hotelLocation;
private String hotelImage;
private String hotelRank;
private String hotelScore;
private String hotelPrice;
public String getHotelName() {
return hotelName;
}
public void setHotelName(String hotelName) {
this.hotelName = hotelName;
}
public String getHotelLocation() {
return hotelLocation;
}
public void setHotelLocation(String hotelLocation) {
this.hotelLocation = hotelLocation;
}
public String getHotelImage() {
return hotelImage;
}
public void setHotelImage(String hotelImage) {
this.hotelImage = hotelImage;
}
public String getHotelRank() {
return hotelRank;
}
public void setHotelRank(String hotelRank) {
this.hotelRank = hotelRank;
}
public String getHotelScore() {
return hotelScore;
}
public void setHotelScore(String hotelScore) {
this.hotelScore = hotelScore;
}
public String getHotelPrice() {
return hotelPrice;
}
public void setHotelPrice(String hotelPrice) {
this.hotelPrice = hotelPrice;
}
@Override
public String toString() {
return "Hotels{" +
"hotelName='" + hotelName + '\'' +
", hotelLocation='" + hotelLocation + '\'' +
", hotelImage='" + hotelImage + '\'' +
", hotelRank='" + hotelRank + '\'' +
", hotelScore='" + hotelScore + '\'' +
", hotelPrice='" + hotelPrice + '\'' +
'}';
}
}

@ -0,0 +1,51 @@
package com.example.travelor.bean;
import java.io.Serializable;
public class Plans implements Serializable {
private String mainPlan;
private String details;
private String createTime;
private String id;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getMainPlan() {
return mainPlan;
}
public void setMainPlan(String main_plan) {
this.mainPlan = main_plan;
}
public String getDetails() {
return details;
}
public void setDetails(String details) {
this.details = details;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String create_time) {
this.createTime = create_time;
}
@Override
public String toString() {
return "plans{" +
"main_plan='" + mainPlan + '\'' +
", details='" + details + '\'' +
", create_time='" + createTime + '\'' +
'}';
}
}

@ -0,0 +1,63 @@
package com.example.travelor.bean;
import java.io.Serializable;
public class Users implements Serializable {
private String account;
private String password;
private String username;
private String createdTime;
private String id;
public void setUserName(String userName) {
this.username = userName;
}
public String getUserName() {
return username;
}
public String getAccount() {
return account;
}
public void setCreatedTime(String createdTime) {
this.createdTime = createdTime;
}
public String getCreatedTime() {
return createdTime;
}
public String getPassword() {
return password;
}
public String getId() {
return id;
}
public void setAccount(String account) {
this.account = account;
}
public void setPassword(String password) {
this.password = password;
}
public void setId(String id) {
this.id = id;
}
@Override
public String toString() {
return "Users{" +
"account='" + account + '\'' +
", password='" + password + '\'' +
", createdTime='" + createdTime + '\'' +
", userName='" + username + '\'' +
", id='" + id + '\'' +
'}';
}
}

@ -0,0 +1,101 @@
package com.example.travelor.datebase;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.text.TextUtils;
import com.example.travelor.bean.Attractions;
import java.util.ArrayList;
import java.util.List;
public class AttrCltDbOpenHelper extends SQLiteOpenHelper {
private static final String DB_NAME = "attractionCollectSQLite.db";
private static final String TABLE_NAME_NOTE = "attractions_collect";
private static final String CREATE_TABLE_SQL = "create table " + TABLE_NAME_NOTE + " (id integer primary key autoincrement, " +
"name text UNIQUE, introduce text, location text, hotels text, images text, video text, rank text, price text, category text)";
public AttrCltDbOpenHelper(Context context) {
super(context, DB_NAME, null, 2);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_SQL);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if(oldVersion <= 2){//当数据库版本小于版本2时就要升级下面的所有字段
db.execSQL("drop table if exists " + TABLE_NAME_NOTE);
onCreate(db);
}
}
public long insertData(Attractions attraction) {
SQLiteDatabase db = getWritableDatabase();
ContentValues values = new ContentValues();
values.put("name", attraction.getName());
values.put("introduce", attraction.getIntroduce());
values.put("location", attraction.getLocation());
values.put("hotels", attraction.getHotels());
values.put("images", attraction.getImages());
values.put("video", attraction.getVideo());
values.put("rank", attraction.getRank());
values.put("price", attraction.getPrice());
values.put("category", attraction.getCategory());
return db.insert(TABLE_NAME_NOTE, null, values);
}
public int deleteFromDbByName(String name) {
SQLiteDatabase db = getWritableDatabase();
return db.delete(TABLE_NAME_NOTE, "name = ?", new String[]{name}); // 创建包含单个元素的字符串数组
}
@SuppressLint("Range")
public List<Attractions> queryAllFromDb() {
SQLiteDatabase db = getWritableDatabase();
List<Attractions> attractionList = new ArrayList<>();
Cursor cursor = db.query(TABLE_NAME_NOTE, null, null, null, null, null, null);
if (cursor != null) {
while (cursor.moveToNext()) {
String attrName = cursor.getString(cursor.getColumnIndex("name"));
String attrRank = cursor.getString(cursor.getColumnIndex("rank"));
String attrImage = cursor.getString(cursor.getColumnIndex("images"));
String attrLocation = cursor.getString(cursor.getColumnIndex("location"));
String attrVideo = cursor.getString(cursor.getColumnIndex("video"));
String attrHotels = cursor.getString(cursor.getColumnIndex("hotels"));
String attrPrice = cursor.getString(cursor.getColumnIndex("price"));
String attrIntroduce = cursor.getString(cursor.getColumnIndex("introduce"));
String attrCategory = cursor.getString(cursor.getColumnIndex("category"));
Attractions attraction = new Attractions();
attraction.setImages(attrImage);
attraction.setName(attrName);
attraction.setRank(attrRank);
attraction.setLocation(attrLocation);
attraction.setPrice(attrPrice);
attraction.setVideo(attrVideo);
attraction.setHotels(attrHotels);
attraction.setIntroduce(attrIntroduce);
attraction.setCategory(attrCategory);
attractionList.add(attraction);
}
cursor.close();
}
return attractionList;
}
}

@ -0,0 +1,233 @@
package com.example.travelor.datebase;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.text.TextUtils;
import com.example.travelor.bean.Attractions;
import java.util.ArrayList;
import java.util.List;
public class AttractionDbOpenHelper extends SQLiteOpenHelper {
private static final String DB_NAME = "attractionSQLite.db";
private static final String TABLE_NAME_NOTE = "attractions";
private static final String CREATE_TABLE_SQL = "create table " + TABLE_NAME_NOTE + " (id integer primary key autoincrement, " +
"name text, introduce text, location text, hotels text, images text, video text, rank text, price text, category text)";
public AttractionDbOpenHelper(Context context) {
super(context, DB_NAME, null, 7);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_SQL);
// initDb();
}
private boolean isTableExit(SQLiteDatabase db) {
String query = "SELECT name FROM sqlite_master WHERE type='table' AND name=?";
Cursor cursor = db.rawQuery(query, new String[]{TABLE_NAME_NOTE});
boolean exists = false;
if (cursor != null && cursor.moveToFirst()) {
exists = true;
cursor.close();
}
return exists;
}
private void initDb() {
String[] names = {"西湖", "故宫博物院", "呼伦贝尔草原", "八达岭长城", "里维耶拉", "乌镇西栅"};
String[] introduces = {"西湖的面积约为6.4平方公里,湖水清澈,四周环绕着青山绿树,水的色随季节和气变化而呈现出不同的色彩。湖中有三座岛屿,其中最大的是“花港观鱼”岛,另外还有“苏堤晓”岛和“照红楼”岛,每座岛屿都有着自的特色景观历史建筑西湖周边有多著名的景,如岳庙、雷峰塔、苏堤、白堤等。岳庙是供奉武林至尊岳飞的古建筑,是中国最重要的岳庙之一;雷峰是一座古老佛塔,以其独特的形状和悠久的历史而知名;苏堤和白堤是两条连接岸的人工堤岸,沿途植被繁茂,是游览西湖的佳路径。",
"故宫博物院建于明代始建于1406年修建历时14年总占地面积约72万平方米。整个建筑群呈北南走向呈长方形主要分为外朝和内廷两部分。外朝是宫廷的政治和宗教活动区域包括三大殿午门、太和殿、乾清宫以及充满仪式感的文华殿、武英殿等内廷是皇帝和后妃的居住区域包括乾隆花园、紫禁城等。",
"内蒙古的草原是其最具代表性的景观之一。草原广袤辽阔,牧场遍布,悠闲的牛羊们在碧绿的草地上吃草,成群结队的骏马在飞奔。特别是在夏季时,草原如同一副绿色的画卷,迷人而壮观,吸引着众多游客前往观赏和体验。",
"万里长城是中国古代的一项伟大建筑工程也是世界文化遗产之一被誉为世界奇迹。它是中国古代防御体系的重要组成部分始建于公元前7世纪历经多个朝代的修建形成了如今的规模。万里长城的主体建设始于公元前3世纪的秦朝当时的秦始皇统一了中国大部分地区为了抵御北方游牧民族的入侵下令修筑长城。但目前所见的大部分长城是明朝时期的建筑明朝时期的长城修建者主要是为了抵御满洲族的入侵。",
"里维耶拉Ribeira是葡萄牙波尔图市Porto的一个历史街区也是欧洲最古老的市中心之一位于杜罗河Douro River畔。里维耶拉被列为联合国教科文组织世界遗产并被誉为波尔图最具特色和迷人的地方之一",
"乌镇西栅位于乌镇的西侧,是一个保存完好的古镇建筑群落,被誉为“东方小威尼斯”。西栅地区有着优美的水系,河道纵横交错,古老的石桥横跨其间,整个镇子几乎处处可见水景。一进入西栅,就能感受到它独特的水乡风情和古朴的民俗文化。"};
String[] locations = {"浙江省杭州市", "北京市东城区", "内蒙古呼伦贝尔市", "北京市延庆区", "葡萄牙波尔图市", "浙江省嘉兴市"};
String[] hotels = {"酒店1,酒店2", "酒店3", "酒店4,酒店5", "酒店4#酒店5", "酒店4#酒店5", "酒店4#酒店5"};
String[] images = {"west_lake1#west_lake2#west_lake3",
"gugong#west_lake2#west_lake3",
"hulunbeier#west_lake2#west_lake3",
"greate_wall#west_lake2#west_lake3",
"ribeira#west_lake2#west_lake3",
"wuzhen#west_lake2#west_lake3"};
String[] videos = {"video1", "video2", "video3", "video4", "video5", "video6"};
String[] ranks = {"AAAAA", "AAAA", "AAAAA", "AAAA", "AAAAA", "AAA"};
String[] prices = {"123", "99", "144", "233", "112", "323"};
String[] category = {"风景", "人文", "自然", "风景", "人文", "自然"};
for(int i = 0; i < names.length; i++) {
Attractions oneAttraction = new Attractions();
oneAttraction.setName(names[i]);
oneAttraction.setIntroduce(introduces[i]);
oneAttraction.setLocation(locations[i]);
oneAttraction.setHotels(hotels[i]);
oneAttraction.setImages(images[i]);
oneAttraction.setVideo(videos[i]);
oneAttraction.setRank(ranks[i]);
oneAttraction.setPrice(prices[i]);
oneAttraction.setCategory(category[i]);
insertData(oneAttraction);
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if(oldVersion <= 7){//当数据库版本小于版本2时就要升级下面的所有字段
db.execSQL("drop table if exists " + TABLE_NAME_NOTE);
onCreate(db);
}
}
public long insertData(Attractions attraction) {
SQLiteDatabase db = getWritableDatabase();
ContentValues values = new ContentValues();
values.put("name", attraction.getName());
values.put("introduce", attraction.getIntroduce());
values.put("location", attraction.getLocation());
values.put("hotels", attraction.getHotels());
values.put("images", attraction.getImages());
values.put("video", attraction.getVideo());
values.put("rank", attraction.getRank());
values.put("price", attraction.getPrice());
values.put("category", attraction.getCategory());
return db.insert(TABLE_NAME_NOTE, null, values);
}
public int deleteFromDbById(String id) {
SQLiteDatabase db = getWritableDatabase();
// return db.delete(TABLE_NAME_NOTE, "id = ?", new String[]{id});
// return db.delete(TABLE_NAME_NOTE, "id is ?", new String[]{id});
return db.delete(TABLE_NAME_NOTE, "id like ?", new String[]{id}); // 创建包含单个元素的字符串数组
}
@SuppressLint("Range")
public List<Attractions> queryAllFromDb() {
// initDb(); // todo
SQLiteDatabase db = getWritableDatabase();
List<Attractions> attractionList = new ArrayList<>();
Cursor cursor = db.query(TABLE_NAME_NOTE, null, null, null, null, null, null);
if (cursor != null) {
while (cursor.moveToNext()) {
String attrName = cursor.getString(cursor.getColumnIndex("name"));
String attrRank = cursor.getString(cursor.getColumnIndex("rank"));
String attrImage = cursor.getString(cursor.getColumnIndex("images"));
String attrLocation = cursor.getString(cursor.getColumnIndex("location"));
String attrVideo = cursor.getString(cursor.getColumnIndex("video"));
String attrHotels = cursor.getString(cursor.getColumnIndex("hotels"));
String attrPrice = cursor.getString(cursor.getColumnIndex("price"));
String attrIntroduce = cursor.getString(cursor.getColumnIndex("introduce"));
String attrCategory = cursor.getString(cursor.getColumnIndex("category"));
Attractions attraction = new Attractions();
attraction.setImages(attrImage);
attraction.setName(attrName);
attraction.setRank(attrRank);
attraction.setLocation(attrLocation);
attraction.setPrice(attrPrice);
attraction.setVideo(attrVideo);
attraction.setHotels(attrHotels);
attraction.setIntroduce(attrIntroduce);
attraction.setCategory(attrCategory);
attractionList.add(attraction);
}
cursor.close();
}
return attractionList;
}
@SuppressLint("Range")
public List<Attractions> queryFromDbByName(String name) {
if (TextUtils.isEmpty(name)) {
return queryAllFromDb();
}
SQLiteDatabase db = getWritableDatabase();
List<Attractions> attractionList = new ArrayList<>();
// 模糊查询
Cursor cursor = db.query(TABLE_NAME_NOTE, null, "name like ?", new String[]{"%"+name+"%"}, null, null, null);
if (cursor != null) {
while (cursor.moveToNext()) {
String attrName = cursor.getString(cursor.getColumnIndex("name"));
String attrRank = cursor.getString(cursor.getColumnIndex("rank"));
String attrImage = cursor.getString(cursor.getColumnIndex("images"));
String attrLocation = cursor.getString(cursor.getColumnIndex("location"));
String attrVideo = cursor.getString(cursor.getColumnIndex("video"));
String attrHotels = cursor.getString(cursor.getColumnIndex("hotels"));
String attrPrice = cursor.getString(cursor.getColumnIndex("price"));
String attrIntroduce = cursor.getString(cursor.getColumnIndex("introduce"));
String attrCategory = cursor.getString(cursor.getColumnIndex("category"));
Attractions attraction = new Attractions();
attraction.setImages(attrImage);
attraction.setName(attrName);
attraction.setRank(attrRank);
attraction.setLocation(attrLocation);
attraction.setPrice(attrPrice);
attraction.setVideo(attrVideo);
attraction.setHotels(attrHotels);
attraction.setIntroduce(attrIntroduce);
attraction.setCategory(attrCategory);
attractionList.add(attraction);
}
cursor.close();
}
return attractionList;
}
@SuppressLint("Range")
public List<Attractions> queryFromDbByCategory(String category) {
if (TextUtils.isEmpty(category)) {
return queryAllFromDb();
}
SQLiteDatabase db = getWritableDatabase();
List<Attractions> attractionList = new ArrayList<>();
// 模糊查询
Cursor cursor = db.query(TABLE_NAME_NOTE, null, "category = ?", new String[]{category}, null, null, null);
if (cursor != null) {
while (cursor.moveToNext()) {
String attrName = cursor.getString(cursor.getColumnIndex("name"));
String attrRank = cursor.getString(cursor.getColumnIndex("rank"));
String attrImage = cursor.getString(cursor.getColumnIndex("images"));
String attrLocation = cursor.getString(cursor.getColumnIndex("location"));
String attrVideo = cursor.getString(cursor.getColumnIndex("video"));
String attrHotels = cursor.getString(cursor.getColumnIndex("hotels"));
String attrPrice = cursor.getString(cursor.getColumnIndex("price"));
String attrIntroduce = cursor.getString(cursor.getColumnIndex("introduce"));
String attrCategory = cursor.getString(cursor.getColumnIndex("category"));
Attractions attraction = new Attractions();
attraction.setImages(attrImage);
attraction.setName(attrName);
attraction.setRank(attrRank);
attraction.setLocation(attrLocation);
attraction.setPrice(attrPrice);
attraction.setVideo(attrVideo);
attraction.setHotels(attrHotels);
attraction.setIntroduce(attrIntroduce);
attraction.setCategory(attrCategory);
attractionList.add(attraction);
}
cursor.close();
}
return attractionList;
}
}

@ -0,0 +1,74 @@
package com.example.travelor.datebase;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.example.travelor.bean.Chats;
import com.example.travelor.bean.Hotels;
import java.util.ArrayList;
import java.util.List;
public class ChatDbOpenHelper extends SQLiteOpenHelper {
private static final String DB_NAME = "chatSQLite.db";
private static final String TABLE_NAME_NOTE = "aiChat";
private static final String CREATE_TABLE_SQL = "create table " + TABLE_NAME_NOTE + " (id integer primary key autoincrement, " +
"identity text, content text)";
public ChatDbOpenHelper(Context context) {
super(context, DB_NAME, null, 5);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_SQL);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if(oldVersion <= 5){//当数据库版本小于版本2时就要升级下面的所有字段
db.execSQL("drop table if exists " + TABLE_NAME_NOTE);
onCreate(db);
}
}
public long insertData(Chats chat) {
SQLiteDatabase db = getWritableDatabase();
ContentValues values = new ContentValues();
values.put("identity", chat.getIdentity());
values.put("content", chat.getContent());
return db.insert(TABLE_NAME_NOTE, null, values);
}
@SuppressLint("Range")
public List<Chats> queryAllFromDb() {
SQLiteDatabase db = getWritableDatabase();
List<Chats> chats = new ArrayList<>();
Cursor cursor = db.query(TABLE_NAME_NOTE, null, null, null, null, null, null);
if (cursor != null) {
while (cursor.moveToNext()) {
String identity = cursor.getString(cursor.getColumnIndex("identity"));
String content = cursor.getString(cursor.getColumnIndex("content"));;
Chats chat = new Chats();
chat.setIdentity(identity);
chat.setContent(content);
chats.add(chat);
}
cursor.close();
}
return chats;
}
}

@ -0,0 +1,90 @@
package com.example.travelor.datebase;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.text.TextUtils;
import com.example.travelor.bean.Attractions;
import com.example.travelor.bean.Hotels;
import com.example.travelor.bean.Plans;
import java.util.ArrayList;
import java.util.List;
public class HotelCollectDbOpenHelper extends SQLiteOpenHelper {
private static final String DB_NAME = "hotelCollectSQLite.db";
private static final String TABLE_NAME_NOTE = "hotel_collect";
private static final String CREATE_TABLE_SQL = "create table " + TABLE_NAME_NOTE + " (id integer primary key autoincrement," +
"name text UNIQUE, location text, image text, rank text, score text, price text, attraction text)";
public HotelCollectDbOpenHelper(Context context) {
super(context, DB_NAME, null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_SQL);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
public int deleteFromDbById(String id) {
SQLiteDatabase db = getWritableDatabase();
return db.delete(TABLE_NAME_NOTE, "id = ?", new String[]{id}); // 创建包含单个元素的字符串数组
}
public long insertData(Hotels hotel) {
SQLiteDatabase db = getWritableDatabase();
ContentValues values = new ContentValues();
values.put("name", hotel.getHotelName());
values.put("location", hotel.getHotelLocation());
values.put("image", hotel.getHotelImage());
values.put("rank", hotel.getHotelRank());
values.put("score", hotel.getHotelScore());
values.put("price", hotel.getHotelPrice());
return db.insert(TABLE_NAME_NOTE, null, values);
}
@SuppressLint("Range")
public List<Hotels> queryAllFromDb() {
SQLiteDatabase db = getWritableDatabase();
List<Hotels> hotelList = new ArrayList<>();
Cursor cursor = db.query(TABLE_NAME_NOTE, null, null, null, null, null, null);
if (cursor != null) {
while (cursor.moveToNext()) {
String hotelName = cursor.getString(cursor.getColumnIndex("name"));
String hotelRank = cursor.getString(cursor.getColumnIndex("rank"));
String hotelImage = cursor.getString(cursor.getColumnIndex("image"));
String hotelLocation = cursor.getString(cursor.getColumnIndex("location"));
String hotelPrice = cursor.getString(cursor.getColumnIndex("price"));
String hotelScore = cursor.getString(cursor.getColumnIndex("score"));
Hotels hotel = new Hotels();
hotel.setHotelName(hotelName);
hotel.setHotelImage(hotelImage);
hotel.setHotelLocation(hotelLocation);
hotel.setHotelPrice(hotelPrice);
hotel.setHotelScore(hotelScore);
hotel.setHotelRank(hotelRank);
hotelList.add(hotel);
}
cursor.close();
}
return hotelList;
}
}

@ -0,0 +1,97 @@
package com.example.travelor.datebase;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.text.TextUtils;
import com.example.travelor.bean.Attractions;
import com.example.travelor.bean.Hotels;
import java.util.ArrayList;
import java.util.List;
public class HotelDbOpenHelper extends SQLiteOpenHelper {
private static final String DB_NAME = "travelerSQLite.db";
private static final String TABLE_NAME_NOTE = "hotel";
private static final String[][] INITIAL_DATA = {
{"杭州武林万怡酒店", "浙江省 杭州市 湖墅南路28号", "src/main/res/drawable/hotel1.jpg", "★★★★ 四星级酒店", "8.3", "¥709", "杭州西湖"},
{"浙江西子宾馆", "浙江省 杭州市 南山路37号", "src/main/res/drawable/hotel1.jpg", "★★★★★ 五星级酒店", "9.0", "¥1399", "杭州西湖"},
{"杭州君悦酒店", "浙江省 杭州市 湖滨路28号", "src/main/res/drawable/hotel1.jpg", "★★★★★ 五星级酒店", " 8.1", "¥1699", "杭州西湖"},
};
private static final String CREATE_TABLE_SQL = "create table " + TABLE_NAME_NOTE + " (id integer primary key autoincrement," +
"name text UNIQUE, location text, image text, rank text, score text, price text, attraction text)";
public HotelDbOpenHelper(Context context) {
super(context, DB_NAME, null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_SQL);
insertInitialData(db);
}
private void insertInitialData(SQLiteDatabase db) {
ContentValues values = new ContentValues();
for (String[] data : INITIAL_DATA) {
values.put("name", data[0]);
values.put("location",data[1]);
values.put("image", data[2]);
values.put("rank", data[3]);
values.put("score", data[4]);
values.put("price", data[5]);
values.put("attraction", data[6]);
db.insert(TABLE_NAME_NOTE, null, values);
// 清空ContentValues以便下一次插入数据重新设置值
values.clear();
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if(oldVersion <= 2){//当数据库版本小于版本2时就要升级下面的所有字段
db.execSQL("drop table if exists " + TABLE_NAME_NOTE);
onCreate(db);
}
}
@SuppressLint("Range")
public List<Hotels> queryFromDbByAttraction(String attraction) {
SQLiteDatabase db = getWritableDatabase();
List<Hotels> hotelList = new ArrayList<>();
// 模糊查询
Cursor cursor = db.query(TABLE_NAME_NOTE, null, "attraction = ?", new String[]{attraction}, null, null, null);
if (cursor != null) {
while (cursor.moveToNext()) {
String hotelName = cursor.getString(cursor.getColumnIndex("name"));
String hotelRank = cursor.getString(cursor.getColumnIndex("rank"));
String hotelImage = cursor.getString(cursor.getColumnIndex("image"));
String hotelLocation = cursor.getString(cursor.getColumnIndex("location"));
String hotelPrice = cursor.getString(cursor.getColumnIndex("price"));
String hotelScore = cursor.getString(cursor.getColumnIndex("score"));
Hotels hotel = new Hotels();
hotel.setHotelName(hotelName);
hotel.setHotelImage(hotelImage);
hotel.setHotelLocation(hotelLocation);
hotel.setHotelPrice(hotelPrice);
hotel.setHotelScore(hotelScore);
hotel.setHotelRank(hotelRank);
hotelList.add(hotel);
}
cursor.close();
}
return hotelList;
}
}

@ -0,0 +1,100 @@
package com.example.travelor.datebase;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.example.travelor.bean.Plans;
import com.example.travelor.bean.Users;
import java.util.ArrayList;
import java.util.List;
public class PlansDbOpenHelper extends SQLiteOpenHelper {
private static final String DB_NAME = "plansSQLite.db";
private static final String TABLE_NAME_NOTE = "plans";
private static final String CREATE_TABLE_SQL = "create table " + TABLE_NAME_NOTE + " (id integer primary key autoincrement, main_plan text, details text, create_time text)";
public PlansDbOpenHelper(Context context) {
super(context, DB_NAME, null, 2);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_SQL);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
if(oldVersion <= 2){//当数据库版本小于版本2时就要升级下面的所有字段
db.execSQL("drop table if exists " + TABLE_NAME_NOTE);
onCreate(db);
}
}
public long insertData(Plans plan) {
SQLiteDatabase db = getWritableDatabase();
ContentValues values = new ContentValues();
values.put("main_plan", plan.getMainPlan());
values.put("details", plan.getDetails());
values.put("create_time", plan.getCreateTime());
return db.insert(TABLE_NAME_NOTE, null, values);
}
public int deleteFromDbById(String id) {
SQLiteDatabase db = getWritableDatabase();
return db.delete(TABLE_NAME_NOTE, "id = ?", new String[]{id}); // 创建包含单个元素的字符串数组
}
@SuppressLint("Range")
public List<Plans> queryAllFromDb() {
SQLiteDatabase db = getWritableDatabase();
List<Plans> planList = new ArrayList<>();
Cursor cursor = db.query(TABLE_NAME_NOTE, null, null, null, null, null, null);
if (cursor != null) {
while (cursor.moveToNext()) {
String id = cursor.getString(cursor.getColumnIndex("id"));
String main_plan = cursor.getString(cursor.getColumnIndex("main_plan"));
String details = cursor.getString(cursor.getColumnIndex("details"));
String createTime = cursor.getString(cursor.getColumnIndex("create_time"));
Plans plan = new Plans();
plan.setId(id);
plan.setMainPlan(main_plan);
plan.setDetails(details);
plan.setCreateTime(createTime);
planList.add(plan);
}
cursor.close();
}
return planList;
}
public int updateData(Plans plan) {
SQLiteDatabase db = getWritableDatabase();
ContentValues values = new ContentValues();
values.put("main_plan", plan.getMainPlan());
values.put("details", plan.getDetails());
values.put("create_time", plan.getCreateTime());
return db.update(TABLE_NAME_NOTE, values, "id = ?", new String[]{plan.getId()});
}
}

@ -0,0 +1,114 @@
package com.example.travelor.datebase;
import android.annotation.SuppressLint;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.example.travelor.bean.Users;
public class UsersDbOpenHelper extends SQLiteOpenHelper {
private static final String DB_NAME = "usersSQLite.db";
private static final String TABLE_NAME_NOTE = "users";
private static final String CREATE_TABLE_SQL = "create table " + TABLE_NAME_NOTE + " (id integer primary key autoincrement, account text, password text, username text, create_time text)";
public UsersDbOpenHelper(Context context) {
super(context, DB_NAME, null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_TABLE_SQL);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
public long insertData(Users users) {
SQLiteDatabase db = getWritableDatabase();
ContentValues values = new ContentValues();
values.put("account", users.getAccount());
values.put("password", users.getPassword());
values.put("username", users.getUserName());
values.put("create_time", users.getCreatedTime());
return db.insert(TABLE_NAME_NOTE, null, values);
}
public int deleteFromDbById(String id) {
SQLiteDatabase db = getWritableDatabase();
// return db.delete(TABLE_NAME_NOTE, "id = ?", new String[]{id});
// return db.delete(TABLE_NAME_NOTE, "id is ?", new String[]{id});
return db.delete(TABLE_NAME_NOTE, "id like ?", new String[]{id}); // 创建包含单个元素的字符串数组
}
// public int updateData(Note note) {
//
// SQLiteDatabase db = getWritableDatabase();
//
// ContentValues values = new ContentValues();
// values.put("title", note.getTitle());
// values.put("content", note.getContent());
// values.put("create_time", note.getCreatedTime());
// // 返回整数值 表示受影响的行数
// return db.update(TABLE_NAME_NOTE, values, "id like ?", new String[]{note.getId()});
// }
// public List<Note> queryAllFromDb() {
//
// SQLiteDatabase db = getWritableDatabase();
// List<Note> noteList = new ArrayList<>();
//
// Cursor cursor = db.query(TABLE_NAME_NOTE, null, null, null, null, null, null);
// if (cursor != null) {
// while (cursor.moveToNext()) {
// String id = cursor.getString(cursor.getColumnIndex("id"));
// String title = cursor.getString(cursor.getColumnIndex("title"));
// String content = cursor.getString(cursor.getColumnIndex("content"));
// String createTime = cursor.getString(cursor.getColumnIndex("create_time"));
//
// Note note = new Note();
// note.setId(id);
// note.setTitle(title);
// note.setContent(content);
// note.setCreatedTime(createTime);
//
// noteList.add(note);
// }
// cursor.close();
// }
//
// return noteList;
//
// }
//
@SuppressLint("Range")
public String queryFromDbByAccount(String account) {
SQLiteDatabase db = getWritableDatabase();
String password = "";
Cursor cursor = db.query(TABLE_NAME_NOTE, null, "account=?", new String[]{account}, null, null, null);
if (cursor != null && cursor.moveToFirst()) {
password = cursor.getString(cursor.getColumnIndex("password"));
cursor.close();
}
return password;
}
}

@ -0,0 +1,153 @@
package com.example.travelor.fragment;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SearchView;
import android.widget.TextView;
import com.example.travelor.R;
import com.example.travelor.adapter.AttractionCardAdapter;
import com.example.travelor.bean.Attractions;
import java.util.ArrayList;
import java.util.List;
import com.example.travelor.datebase.AttractionDbOpenHelper;
public class FrontPageFragment extends Fragment{
private RecyclerView mRecyclerView;
private List<Attractions> mAttractions;
private AttractionCardAdapter mAttrAdapter;
private SearchView searchView;
private TextView showAttraction;
private TextView showAll;
private TextView showHumanity;
private TextView showNature;
private AttractionDbOpenHelper mAttractionDbOpenHelper;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.front_page_layout, container, false);
initView(rootView);
initData();
initEvent();
// 搜索框
searchView = rootView.findViewById(R.id.searchView);
showAttraction = rootView.findViewById(R.id.show_attraction);
showAll = rootView.findViewById(R.id.show_all);
showNature = rootView.findViewById(R.id.show_nature);
showHumanity = rootView.findViewById(R.id.show_humanity);
search();
categoryAct();
return rootView;
}
// 按类别查询
private void categoryAct() {
showAll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mAttractions = mAttractionDbOpenHelper.queryAllFromDb();
mAttrAdapter.refreshData(mAttractions);
setLayout();
}
});
showAttraction.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mAttractions = mAttractionDbOpenHelper.queryFromDbByCategory("风景");
mAttrAdapter.refreshData(mAttractions);
setLayout();
}
});
showNature.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mAttractions = mAttractionDbOpenHelper.queryFromDbByCategory("自然");
mAttrAdapter.refreshData(mAttractions);
setLayout();
}
});
showHumanity.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
mAttractions = mAttractionDbOpenHelper.queryFromDbByCategory("人文");
mAttrAdapter.refreshData(mAttractions);
setLayout();
}
});
}
// 景点名搜索
private void search() {
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) { return false; }
@Override
public boolean onQueryTextChange(String newText) {
performSearch(newText);
return true;
}
});
}
private void performSearch(String query) {
mAttractions = mAttractionDbOpenHelper.queryFromDbByName(query);
mAttrAdapter.refreshData(mAttractions);
setLayout();
}
// 回溯
public void onResume() {
super.onResume();
refreshDataFromDb();
setLayout();
}
// 更新视图
private void setLayout() {
RecyclerView.LayoutManager linearLayoutManager = new LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false);
mRecyclerView.setLayoutManager(linearLayoutManager); // 创建布局管理器
mAttrAdapter.notifyDataSetChanged();
}
private void refreshDataFromDb() {
mAttractions = getDataFromDB();
mAttrAdapter.refreshData(mAttractions);
}
private List<Attractions> getDataFromDB() {
return mAttractionDbOpenHelper.queryAllFromDb();
}
private void initEvent() {
mAttrAdapter = new AttractionCardAdapter(requireContext(), mAttractions);
mRecyclerView.setAdapter(mAttrAdapter);
}
private void initData() {
mAttractions = new ArrayList<>();
mAttractionDbOpenHelper = new AttractionDbOpenHelper(requireContext());
}
private void initView(View rootView) {
mRecyclerView = rootView.findViewById(R.id.rlv);
}
}

@ -0,0 +1,51 @@
package com.example.travelor.fragment;
import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.example.travelor.AttractionCollectActivity;
import com.example.travelor.LoginActivity;
import com.example.travelor.R;
import com.example.travelor.SignInActivity;
public class MineFragment extends Fragment {
private Button btLogout;
public ViewGroup vgCollect;
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_mine, container, false);
btLogout = rootView.findViewById(R.id.logout);
vgCollect = rootView.findViewById(R.id.mine_collect);
initEvent();
return rootView;
}
private void initEvent() {
btLogout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getActivity(), LoginActivity.class);
startActivity(intent);
}
});
vgCollect.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getActivity(), AttractionCollectActivity.class);
startActivity(intent);
}
});
}
}

@ -0,0 +1,105 @@
package com.example.travelor.fragment;
import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.travelor.AddActivity;
import com.example.travelor.DetailsPageActivity;
import com.example.travelor.R;
import com.example.travelor.adapter.PlanAdapter;
import com.example.travelor.bean.Plans;
import com.example.travelor.datebase.PlansDbOpenHelper;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class PlanFragment extends Fragment {
private RecyclerView mRecyclerView;
private List<Plans> mPlans;
private PlanAdapter mPlanAdapter;
private FloatingActionButton addButton;
private PlansDbOpenHelper mPlansDbOpenHelper;
private TextView mDate;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.plan_layout, container, false);
addButton = rootView.findViewById(R.id.btn_add);
mDate = rootView.findViewById(R.id.date);
initView(rootView);
initData();
initEvent();
add();
return rootView;
}
public void onResume() {
super.onResume();
refreshDataFromDb();
setLayout();
}
// 更新视图
private void setLayout() {
mPlanAdapter.notifyDataSetChanged();
RecyclerView.LayoutManager linearLayoutManager = new LinearLayoutManager(requireContext(), LinearLayoutManager.VERTICAL, false);
mRecyclerView.setLayoutManager(linearLayoutManager); // 创建布局管理器
}
private void refreshDataFromDb() {
mPlans = getDataFromDB();
mPlanAdapter.refreshData(mPlans);
}
private List<Plans> getDataFromDB() {
return mPlansDbOpenHelper.queryAllFromDb();
}
private void initEvent() {
mPlanAdapter = new PlanAdapter(requireContext(), mPlans);
mRecyclerView.setAdapter(mPlanAdapter);
mDate.setText(getCurrentTimeFormat());
}
private String getCurrentTimeFormat() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM-dd");
Date date = new Date();
return simpleDateFormat.format(date);
}
private void initData() {
mPlans = new ArrayList<>();
mPlansDbOpenHelper = new PlansDbOpenHelper(requireContext());
}
private void initView(View rootView) {
mRecyclerView = rootView.findViewById(R.id.plan_rlv);
}
public void add() {
addButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getActivity(), AddActivity.class);
startActivity(intent);
}
});
}
}

@ -0,0 +1,39 @@
package com.example.travelor.fragment;
import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.travelor.LoginActivity;
import com.example.travelor.PageJumpActivity;
import com.example.travelor.R;
import com.example.travelor.SparkAiActivity;
public class SparkAiFragment extends Fragment {
private TextView tvStart;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_spark_ai, container, false);
tvStart = rootView.findViewById(R.id.start);
initEvent();
return rootView;
}
private void initEvent() {
tvStart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getActivity(), SparkAiActivity.class);
startActivity(intent);
}
});
}
}

@ -0,0 +1,50 @@
package com.example.travelor.util;
import android.content.Context;
import android.content.SharedPreferences;
public class SpfUtil {
private static String SPF_NAME = "noteSpf";
public static void saveString(Context context, String key, String value) {
SharedPreferences spf = context.getSharedPreferences(SPF_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor edit = spf.edit();
edit.putString(key, value);
edit.apply();
}
public static String getString(Context context, String key) {
SharedPreferences spf = context.getSharedPreferences(SPF_NAME, Context.MODE_PRIVATE);
return spf.getString(key, "");
}
public static void saveBoolean(Context context, String key, boolean value) {
SharedPreferences spf = context.getSharedPreferences(SPF_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor edit = spf.edit();
edit.putBoolean(key, value);
edit.apply();
}
public static Boolean getBoolean(Context context, String key) {
SharedPreferences spf = context.getSharedPreferences(SPF_NAME, Context.MODE_PRIVATE);
return spf.getBoolean(key, false);
}
public static void saveInt(Context context, String key, int value) {
SharedPreferences spf = context.getSharedPreferences(SPF_NAME, Context.MODE_PRIVATE);
SharedPreferences.Editor edit = spf.edit();
edit.putInt(key, value);
edit.apply();
}
public static int getInt(Context context, String key) {
SharedPreferences spf = context.getSharedPreferences(SPF_NAME, Context.MODE_PRIVATE);
return spf.getInt(key, -1);
}
public static int getIntWithDefault(Context context, String key, int defValue) {
SharedPreferences spf = context.getSharedPreferences(SPF_NAME, Context.MODE_PRIVATE);
return spf.getInt(key, defValue);
}
}

@ -0,0 +1,15 @@
package com.example.travelor.util;
import android.content.Context;
import android.widget.Toast;
public class ToastUtil {
public static void toastShort(Context context, String msg) {
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}
public static void toastLong(Context context, String msg) {
Toast.makeText(context, msg, Toast.LENGTH_LONG).show();
}
}

@ -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>

@ -0,0 +1,20 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!--阴影-->
<item>
<shape android:shape="rectangle">
<solid android:color="#1F7F7F7F" />
<corners android:radius="100dp" />
</shape>
</item>
<!--前景-->
<item
android:bottom="5dp"
android:left="5dp"
android:right="5dp"
android:top="5dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white"/>
<corners android:radius="100dp" />
</shape>
</item>
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/main_style_green" /> <!-- 设置填充颜色 -->
<corners android:radius="5dp" /> <!-- 设置圆角半径 -->
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_start" android:state_selected="false" />
<item android:drawable="@drawable/btn_stop" android:state_selected="true" />
</selector>

@ -0,0 +1,4 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/green_700" /> <!-- 设置填充颜色 -->
<corners android:radius="50dp" /> <!-- 设置圆角半径 -->
</shape>

@ -0,0 +1,4 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#E3DDD5" /> <!-- 替换为您想要的背景颜色 -->
<corners android:radius="1000dp" />
</shape>

@ -0,0 +1,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="80dp" />
<stroke android:width="1dp"
android:color="#7F7F7F" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle" >
<solid android:color="#0a8c8c8c" />
<corners android:radius="30dp" />
<padding android:bottom="5px"
android:left="2px"
android:right="2px"
android:top="2px" />
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<solid android:color="#0fd7d7d7" />
<corners android:radius="30dp" />
<padding android:bottom="5px"
android:left="2px"
android:right="2px"
android:top="2px" />
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<solid android:color="#14c7c7c7" />
<corners android:radius="30dp" />
<padding android:bottom="5px"
android:left="2px"
android:right="2px"
android:top="2px" />
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<solid android:color="#19c1c1c1" />
<corners android:radius="30dp" />
<padding android:bottom="5px"
android:left="2px"
android:right="2px"
android:top="2px" />
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<solid android:color="#1ec6c6c6" />
<corners android:radius="30dp" />
<padding android:bottom="5px"
android:left="2px"
android:right="2px"
android:top="2px" />
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<solid android:color="#23b7b7b7" />
<corners android:radius="30dp" />
<padding android:bottom="5px"
android:right="2px"/>
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<solid android:color="#28aeaeae" />
<corners android:radius="30dp" />
<padding android:bottom="5px"
android:right="2px"/>
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<solid android:color="#2d9e9e9e" />
<corners android:radius="30dp" />
<padding android:bottom="5px"
android:right="2px"/>
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<corners android:radius="30dp" />
<solid android:color="@color/white" />
</shape>
</item>
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -0,0 +1,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="1dp"
android:color="#575757"
android:dashWidth="4dp"
android:dashGap="5dp"
/>
</shape>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp"/>
<solid android:color="@color/white"/>
</shape>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp"/>
<solid android:color="@color/black"/>
</shape>

@ -0,0 +1,4 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="1dp" android:color="#324C4E"/>
</shape>

@ -0,0 +1,4 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="2dp" android:color="#007693"/>
</shape>

@ -0,0 +1,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@android:color/transparent" /> <!-- 设置背景为透明色 -->
<stroke
android:width="1dp"
android:color="#5B5A5A" /> <!-- 设置边框颜色 -->
</shape>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/edit_text_bg" android:state_selected="false" />
<item android:drawable="@drawable/edit_text_bg_focus" android:state_selected="true" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -0,0 +1,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:type="linear"
android:startColor="#48A57A"
android:endColor="#3CAEA9"
android:angle="135" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

@ -0,0 +1,4 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#4D4D4D" /> <!-- 设置填充颜色 -->
<corners android:radius="5dp" /> <!-- 设置圆角半径 -->
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/like" android:state_selected="false" />
<item android:drawable="@drawable/liked" android:state_selected="true" />
</selector>

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

Loading…
Cancel
Save