Merge remote-tracking branch 'origin/master'

master
ongbo 5 years ago
commit dd207daf39

@ -109,13 +109,19 @@ public class CMKGStackAdapter extends StackAdapter<Integer> implements Condition
* * -
* * -
*/
if(returnData.getCode()==DiseaseToSymptom||returnData.getCode()==MedicineToOperation||returnData.getCode()==MedicineToSymptom){
if(returnData.getCode()==DiseaseToSymptom||returnData.getCode()==MedicineToOperation){
//对应病症,那么标题只有一个就是病的名字
titleText.setText(returnData.getMsg());
}else {
}else if(returnData.getCode()==DiseaseToMedicines){
//对应治疗方法,那么标题就要有多个
titleText.setText(SearchEntryActivity.content.get(title_num));
title_num++;
}else{
if(title_num==0) {
titleText.setText(returnData.getMsg());
title_num++;
}
else titleText.setText("可以治疗的病症");
}
cardTitle.getBackground().setColorFilter(ContextCompat.getColor(getContext(),backgroundColorId), PorterDuff.Mode.SRC_IN);//传入的int值其实是一个颜色在这里改变头部的颜色

@ -80,7 +80,6 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
//获取response后将这个json数据解析
ReturnData response = (ReturnData) bundle.getSerializable("msg");
System.out.println("code=!!!!!!!!1"+response.getCode());
Log.i("response+++++",response+"返回值");
try {
@ -110,6 +109,7 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
List<ContentData> list=new LinkedList<>();
list.add(new ContentData("我是您的用法哦~请您看看我嘞\n我无比的期待您的光临嘞\n我们没有连数据呢马上就有嘞"));
content.add((String) jsonArray.get(i));
System.out.println("content.size="+content.size());
lists.add(list);
}
new_color=new Integer[jsonArray.length()];
@ -130,19 +130,21 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
*/
List<ContentData> list = new LinkedList<>();
String data=(String)response.getData();
JSONObject jo=new JSONObject(data);
String medicine_symptom=jo.getString("symptom");
list.add(new ContentData(medicine_symptom));
String str=(String)response.getData();
JSONObject jo=new JSONObject(str.toString());
String function=jo.getString("function");
list.add(new ContentData(function));
lists.add(list);
String disease_names=new String(jo.getString("name"));
String disease_names=new String(jo.getString("disease"));
JSONArray ja=new JSONArray(disease_names);
List<ContentData> list_1=new LinkedList<>();
for(int i=0;i<ja.length();i++){
List<ContentData> list_1=new LinkedList<>();
list_1.add(new ContentData(content.get(i)));
lists.add(list);
// list_1=new LinkedList<>();
list_1.add(new ContentData(ja.get(i).toString()));
System.out.println("病症有这些!="+ja.get(i).toString());
}
new_color=new Integer[1];
lists.add(list_1);
new_color=new Integer[2];
}
for(int i=0;i<new_color.length;i++){
@ -183,20 +185,25 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
* nhmnhmnhm
*/
TextView asscoiate_text=findViewById(R.id.asscoiate_text);//显示文本“你可能感兴趣”
String[] texts=new String[3];//存放listView中的显示的数据
// String[] texts=new String[3];//存放listView中的显示的数据,只针对
// String[] new_texts=new String[1];
// String[]
String[] texts;
if(response.getCode()==DiseaseToSymptom){
/**
* nm
*/
texts=new String[1];
texts[0]=response.getMsg()+"应该吃什么药";
model_Text=Model_Symptom;
model_Text=Model_Medicines;
}else if(response.getCode()==DiseaseToMedicines){
/**
* nhmnhmnhm
*
*/
Random r=new Random();
texts=new String[3];
for(int i=0;i<3;i++) {
index[i] = r.nextInt(9) + 1;
texts[i]=content.get(index[i])+"能治什么病症";
@ -207,6 +214,7 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
*
* nhm
*/
texts=new String[1];
texts[0]=response.getMsg()+"能治什么病";
model_Text=Model_Function;
}else {
@ -214,6 +222,7 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
*
* nhm
*/
texts=new String[1];
texts[0]=response.getMsg()+"的用法";
model_Text=Model_Operation;
}
@ -246,6 +255,8 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
}
});
listView.setAdapter(view_adapter);
for(int i:new_color)
System.out.println("i="+i);
adapter.updateData(Arrays.asList(new_color),lists);
}
}

@ -6,12 +6,12 @@ public interface ConditionCode {
* DiseaseToSymptom
* DiseaseToMedeicines
* MedicineToOperation
* MedicineToSympton
* MedicineToFunction
*/
public final int DiseaseToSymptom=100;
public final int DiseaseToMedicines=200;
public final int MedicineToOperation=300;
public final int MedicineToSymptom=400;
public final int MedicineToFunction=400;
/***
*Model_Symptom
* Model_Medicines
@ -19,7 +19,7 @@ public interface ConditionCode {
* Model_Function
*/
public final String Model_Symptom="的症状";
public final String Model_Medicines="治疗方法";
public final String Model_Medicines="吃什么药";
public final String Model_Operation="用法";
public final String Model_Function="作用";

@ -1,46 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:context=".SearchEntryActivity">
<com.loopeer.cardstack.CardStackView
android:id="@+id/cardStackView"
android:layout_width="match_parent"
android:layout_height="299dp"></com.loopeer.cardstack.CardStackView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp"
android:text="你可能感兴趣"
android:textStyle="bold"
android:paddingLeft="100dp"
android:paddingTop="150dp"
android:id="@+id/asscoiate_text"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:id="@+id/asscoiate_entry"
/>
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="40dp"
android:paddingLeft="20dp"
android:divider="@null"
android:id="@+id/listview_group"
android:textSize="16sp"
android:textColor="#ff000000"
android:shadowDx="4"
android:shadowDy="4"
android:shadowRadius="2"
/>
</LinearLayout>
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical"
android:fadingEdge="vertical">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context=".MainActivity">
<com.loopeer.cardstack.CardStackView
android:id="@+id/cardStackView"
android:layout_width="match_parent"
android:layout_height="500dp"></com.loopeer.cardstack.CardStackView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp"
android:text="你可能感兴趣"
android:textStyle="bold"
android:paddingLeft="100dp"
android:paddingTop="150dp"
android:id="@+id/asscoiate_text"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="20dp"
android:id="@+id/asscoiate_entry"
/>
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="40dp"
android:paddingLeft="20dp"
android:divider="@null"
android:id="@+id/listview_group"
android:textSize="16sp"
android:textColor="#ff000000"
android:shadowDx="4"
android:shadowDy="4"
android:shadowRadius="2"
/>
</LinearLayout>
</ScrollView>
<!--<?xml version="1.0" encoding="utf-8"?>-->
<!--<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"-->
<!-- xmlns:app="http://schemas.android.com/apk/res-auto"-->
<!-- xmlns:tools="http://schemas.android.com/tools"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="vertical"-->
<!-- tools:context=".SearchEntryActivity">-->
<!-- <com.loopeer.cardstack.CardStackView-->
<!-- android:id="@+id/cardStackView"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"></com.loopeer.cardstack.CardStackView>-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:textSize="24sp"-->
<!-- android:text="你可能感兴趣"-->
<!-- android:textStyle="bold"-->
<!-- android:paddingLeft="100dp"-->
<!-- android:paddingTop="150dp"-->
<!-- android:id="@+id/asscoiate_text"-->
<!-- />-->
<!-- <TextView-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:paddingLeft="20dp"-->
<!-- android:id="@+id/asscoiate_entry"-->
<!-- />-->
<!-- <ListView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:paddingTop="40dp"-->
<!-- android:paddingLeft="20dp"-->
<!-- android:divider="@null"-->
<!-- android:id="@+id/listview_group"-->
<!-- android:textSize="16sp"-->
<!-- android:textColor="#ff000000"-->
<!-- android:shadowDx="4"-->
<!-- android:shadowDy="4"-->
<!-- android:shadowRadius="2"-->
<!-- />-->
<!--</LinearLayout>-->

@ -2,9 +2,8 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
>
<!--
@ -18,32 +17,30 @@
android:background="#ffffff"
android:id="@+id/card_title"
>
<TextView
android:layout_width="match_parent"
android:id="@+id/card_title_text"
android:layout_width="340dp"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="#ffffff"
android:id="@+id/card_title_text"
/>
android:textSize="20sp"
android:textStyle="bold" />
</FrameLayout>
<!-- android:text="2016-2017-2学期"-->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="468dp">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:id="@+id/scores_list"
android:layout_width="match_parent"
android:layout_height="350dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="16dp"
>
</androidx.recyclerview.widget.RecyclerView>
android:background="#ffffff"></androidx.recyclerview.widget.RecyclerView>
</FrameLayout>
</LinearLayout>

@ -100,8 +100,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="80dp"
android:id="@+id/search_content"
style="@style/scores_item_style"
android:paddingLeft="10dp"

@ -49,7 +49,7 @@
<style name="scores_item_style">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">12sp</item>
<item name="android:textSize">20sp</item>
<item name="android:textColor">@color/text_black</item>
</style>

Loading…
Cancel
Save