ongbodev
ongbo 6 years ago
parent 1cf9b0b333
commit d3d8e727dd

@ -51,7 +51,7 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.0.0'
implementation 'com.github.ibrahimsn98:SmoothBottomBar:1.5'
//OKhttp
//// implementation "com.squareup.okhttp3:okhttp:4.2.2"
// implementation "com.squareup.okhttp3:okhttp:4.2.2"
// implementation 'com.alibaba:fastjson:1.2.61'
implementation 'com.alibaba:fastjson:1.1.71.android'
//
@ -62,6 +62,7 @@ dependencies {
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.squareup.picasso:picasso:2.5.0'
// implementation 'com.squareup.picasso:picasso:2.71828'
//home
implementation 'com.github.DingMouRen:LayoutManagerGroup:1e6f4f96eb'
implementation 'de.hdodenhof:circleimageview:2.2.0'
@ -93,6 +94,6 @@ dependencies {
//
implementation 'com.yarolegovich:discrete-scrollview:1.4.9'
//
implementation 'com.android.support:percent:28.3.0'
// implementation 'com.android.support:percent:28.3.0'
}

@ -83,10 +83,10 @@ public class MenuListFragment extends Fragment {
/*
*
* */
Picasso.with(getAppCompatActivity())
.load(R.drawable.tiantiansifangmao_09)
// .placeholder(R.drawable.img_circle_placeholder)
.into(ivMenuUserProfilePhoto);
// Picasso.with(getAppCompatActivity())
// .load(R.drawable.tiantiansifangmao_09)
//// .placeholder(R.drawable.img_circle_placeholder)
// .into(ivMenuUserProfilePhoto);
avatarOnclickListener headerListener = new avatarOnclickListener(getAppCompatActivity(),this);

@ -44,6 +44,7 @@ import com.hanks.htextview.rainbow.RainbowTextView;
import com.mxn.soul.flowingdrawer_core.ElasticDrawer;
import com.mxn.soul.flowingdrawer_core.FlowingDrawer;
import com.skyfishjy.library.RippleBackground;
import com.squareup.picasso.Picasso;
import com.yarolegovich.discretescrollview.DSVOrientation;
import com.yarolegovich.discretescrollview.DiscreteScrollView;
import com.yarolegovich.discretescrollview.InfiniteScrollAdapter;
@ -113,6 +114,9 @@ private List<Image> data;
//头像
ImageView avatarImageView = (ImageView) appCompatActivity.findViewById(R.id.iv_avatar);
// Picasso.with(appCompatActivity).load("http://114.55.30.62:8080/product_pictures/a.jpg").into(avatarImageView);
// Picasso.get().load("http://114.55.30.62:8080/product_pictures/a.jpg").into(avatarImageView);
Glide.with(getAppCompatActivity()).load(R.drawable.draw7).into(avatarImageView);
ViewOutlineProvider vop = new ViewOutlineProvider() {
@Override

@ -27,6 +27,7 @@ public class MainActivity extends AppCompatActivity {
private FragmentTransaction transaction;
private FragmentManager fragmentManager;
public AppCompatActivity appCompatActivity;
// private static ContextCompat contextCompat;
BottomNavigationView navView;

@ -31,205 +31,7 @@
android:text="这里放一些热门搜索关键词这里放一些热门搜索关键词这里放一些热门搜索关键词这里放一些热门搜索关键词这里放一
些热门搜索关键词这里放一些热门搜索关键词这里放一些热门搜索关键词这里放一些热门搜索关键词"/>
</androidx.cardview.widget.CardView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
>
<androidx.cardview.widget.CardView
android:layout_width="380dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:elevation="10dp"
app:cardCornerRadius="8dp"
app:cardElevation="8dp">
<RelativeLayout
android:layout_width="400dp"
android:layout_height="wrap_content">
<!-- 方药-->
<androidx.cardview.widget.CardView
android:layout_width="95dp"
android:layout_height="75dp"
app:cardElevation="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@drawable/fangyao"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="方药"
android:layout_centerHorizontal="true"
android:textSize="16dp"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="95dp"
android:layout_height="75dp"
android:layout_marginLeft="95dp"
app:cardElevation="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@drawable/mingyijianyan"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="名医检验"
android:layout_centerHorizontal="true"
android:textSize="16dp"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="95dp"
android:layout_height="75dp"
android:layout_marginLeft="190dp"
app:cardElevation="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@drawable/xunzheng"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="循证"
android:layout_centerHorizontal="true"
android:textSize="16dp"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="95dp"
android:layout_height="75dp"
android:layout_marginLeft="285dp"
app:cardElevation="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@drawable/zhinan"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="指南"
android:layout_centerHorizontal="true"
android:textSize="16dp"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="95dp"
android:layout_height="75dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="80dp"
app:cardElevation="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@drawable/yangsheng"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="养生"
android:layout_centerHorizontal="true"
android:textSize="16dp"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="95dp"
android:layout_height="75dp"
android:layout_marginLeft="95dp"
android:layout_marginTop="80dp"
app:cardElevation="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@drawable/zhengliao"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="诊疗"
android:layout_centerHorizontal="true"
android:textSize="16dp"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="95dp"
android:layout_height="75dp"
android:layout_marginLeft="190dp"
android:layout_marginTop="80dp"
app:cardElevation="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@drawable/wenxian"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="文献"
android:layout_centerHorizontal="true"
android:textSize="16dp"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="95dp"
android:layout_height="75dp"
android:layout_marginLeft="285dp"
android:layout_marginTop="80dp"
app:cardElevation="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="45dp"
android:layout_height="45dp"
android:src="@drawable/zhenduan"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:text="诊断"
android:layout_centerHorizontal="true"
android:textSize="16dp"/>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>

@ -0,0 +1,79 @@
package com.example.cmknowledgegraph;
import android.util.Log;
import org.junit.Test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
public class getTest {
@Test
public void executeSearchGet(){
String name = "头痛";
HttpURLConnection connection = null;
InputStream in = null;
String address="/rest/cmkg/question/hello";
String Url = "http://10.0.0.2:8080"+address;
String path = Url + "?name="+name;
URL url = null;
try {
try {
url = new URL(path);
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
connection = (HttpURLConnection)url.openConnection();
} catch (IOException e) {
e.printStackTrace();
}
connection.setRequestMethod("GET");
connection.setConnectTimeout(100000);//建立连接超时
connection.setReadTimeout(80000);//传输数据超时
in = connection.getInputStream();
BufferedReader reader = null;//输入流
String line = "";//读取返回的每一行
StringBuilder response = new StringBuilder();
try {
reader = new BufferedReader(new InputStreamReader(in));
while((line = reader.readLine()) != null) {
response.append(line);
}
//这时候response就是一个连续字符串了吧
Log.i("response+++++",response+"返回值");
System.out.println(response.toString());
//
} catch (IOException e) {
e.printStackTrace();
}finally {
if(reader!=null){
try {
reader.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (ProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Loading…
Cancel
Save