|
|
|
@ -1,8 +1,14 @@
|
|
|
|
|
package com.example.cmknowledgegraph;
|
|
|
|
|
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
|
|
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
|
|
|
|
|
|
|
import com.loopeer.cardstack.AllMoveDownAnimatorAdapter;
|
|
|
|
|
import com.loopeer.cardstack.CardStackView;
|
|
|
|
|
import com.loopeer.cardstack.UpDownAnimatorAdapter;
|
|
|
|
|
import com.loopeer.cardstack.UpDownStackAnimatorAdapter;
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.LinkedList;
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -23,53 +29,7 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
|
|
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
setContentView(R.layout.activity_search_entry);
|
|
|
|
|
|
|
|
|
|
init();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* //有SearchContent跳转到这里。在这里访问全局变量,实例化ListView
|
|
|
|
|
* Intent intent=new Intent();
|
|
|
|
|
* intent.setClass(this,SearchContentActivity.class);
|
|
|
|
|
*
|
|
|
|
|
* ListView lv = findViewById(R.id.listView1);
|
|
|
|
|
* ListView listView=findViewById(R.id.listView1);
|
|
|
|
|
* ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, SearchServiceGet.label);
|
|
|
|
|
* ArrayAdapter<String> adapter_1 = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, SearchServiceGet.content);
|
|
|
|
|
*
|
|
|
|
|
* lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
|
|
|
* @Override
|
|
|
|
|
* public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
|
|
|
|
* //根据点击不同的item跳转到不同的页面
|
|
|
|
|
* // switch (i){
|
|
|
|
|
* // case 0:
|
|
|
|
|
* // intent.putExtra("label",SearchServiceGet.label.get(1));
|
|
|
|
|
* // startActivity(intent);
|
|
|
|
|
* // break;
|
|
|
|
|
* // case 1:
|
|
|
|
|
* // intent.putExtra("label",SearchServiceGet.label.get(2));
|
|
|
|
|
* // startActivity(intent);
|
|
|
|
|
* // break;
|
|
|
|
|
* // }
|
|
|
|
|
*
|
|
|
|
|
* //做个小测试,做隐藏动画
|
|
|
|
|
* switch (listView.getVisibility()) {
|
|
|
|
|
* // 若显示,则隐藏
|
|
|
|
|
* case 0:
|
|
|
|
|
* listView.setVisibility(View.GONE);
|
|
|
|
|
* break;
|
|
|
|
|
* // 若隐藏,则显示
|
|
|
|
|
* case 8:
|
|
|
|
|
* listView.setVisibility(View.VISIBLE);
|
|
|
|
|
* break;
|
|
|
|
|
* default:
|
|
|
|
|
* break;
|
|
|
|
|
* }
|
|
|
|
|
*
|
|
|
|
|
* }
|
|
|
|
|
* });
|
|
|
|
|
* lv.setAdapter(adapter);
|
|
|
|
|
* listView.setAdapter(adapter_1);
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void onItemExpend(boolean expend) {
|
|
|
|
@ -82,6 +42,16 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
|
|
|
|
|
mCardStack.setAdapter(adapter);
|
|
|
|
|
|
|
|
|
|
mCardStack.setItemExpendListener(this);
|
|
|
|
|
/**
|
|
|
|
|
* 这里分很多种情况,目前有四种模板,每种模板对应的标题内容可能有些不同
|
|
|
|
|
* 为了方便我们先不删除原有模板的items,我们点开之后有几种情况
|
|
|
|
|
* 病-症状:标题是名字,内容是症状
|
|
|
|
|
* 病-治疗药品:标题是药的名字,内容是药的用法(暂时不做)
|
|
|
|
|
* 药-用法:标题是药的名字,内容是药的用法
|
|
|
|
|
* 药-作用:标题是药的名字,内容是药的用法
|
|
|
|
|
*
|
|
|
|
|
* 每种不同的情况对应不同的状态码,用接口实现状态码
|
|
|
|
|
*/
|
|
|
|
|
List<List<LessonData>> lists = new LinkedList<>();
|
|
|
|
|
for(int i = 0;i<4;i++)
|
|
|
|
|
{
|
|
|
|
@ -94,8 +64,8 @@ public class SearchEntryActivity extends AppCompatActivity implements CardStackV
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
adapter.updateData(Arrays.asList(color),lists);
|
|
|
|
|
//mCardStack.setAnimatorAdapter(new AllMoveDownAnimatorAdapter(mCardStack));
|
|
|
|
|
//mCardStack.setAnimatorAdapter(new UpDownAnimatorAdapter(mCardStack));
|
|
|
|
|
//mCardStack.setAnimatorAdapter(new UpDownStackAnimatorAdapter(mCardStack));
|
|
|
|
|
mCardStack.setAnimatorAdapter(new AllMoveDownAnimatorAdapter(mCardStack));
|
|
|
|
|
mCardStack.setAnimatorAdapter(new UpDownAnimatorAdapter(mCardStack));
|
|
|
|
|
mCardStack.setAnimatorAdapter(new UpDownStackAnimatorAdapter(mCardStack));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|