补上一些文件
This commit is contained in:
Yutousama 2020-01-17 18:04:57 +08:00
parent 89e337ddf1
commit bce9e9e6c5
12 changed files with 539 additions and 17 deletions

View File

@ -5,7 +5,7 @@ android {
defaultConfig {
//applicationId "com.yutou.jianrmg_v2"
applicationId "com.yutou.jianr_mg"
minSdkVersion 19
minSdkVersion 21
targetSdkVersion 29
versionCode 2
versionName "2.3"

View File

@ -38,6 +38,7 @@
android:value="R" />
<activity
android:screenOrientation="portrait"
android:name="com.yutou.jianr_mg.LoadingActivity"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
@ -92,6 +93,7 @@
<activity android:name=".views.GameDataActivity" />
<activity android:name=".views.NativeAdActivity" />
<activity android:name=".views.UserDataActivity" />
<activity android:name=".views.MapTopActivity" />
<provider

View File

@ -0,0 +1,59 @@
package com.yutou.jianr_mg.Adapters;
import android.app.ActivityOptions;
import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.FragmentActivity;
import com.alibaba.fastjson.JSON;
import com.yutou.jianr_mg.Data.MapNode;
import com.yutou.jianr_mg.Data.MapTop;
import com.yutou.jianr_mg.R;
import com.yutou.jianr_mg.views.MapTopActivity;
import cn.lemon.view.adapter.BaseViewHolder;
import cn.lemon.view.adapter.RecyclerAdapter;
public class MapRecyclierAdapter extends RecyclerAdapter<MapTop> {
public MapRecyclierAdapter(Context context) {
super(context);
}
@Override
public BaseViewHolder<MapTop> onCreateBaseViewHolder(ViewGroup parent, int viewType) {
return new ItemViewHolder(parent,R.layout.item_maptop);
}
class ItemViewHolder extends BaseViewHolder<MapTop>{
private LinearLayout listLayout,titleLayout;
private TextView name;
public ItemViewHolder(ViewGroup parent, int layoutId) {
super(parent, layoutId);
listLayout=findViewById(R.id.listLayout);
titleLayout=findViewById(R.id.titleLayout);
name=findViewById(R.id.title);
listLayout.setVisibility(View.GONE);
}
@Override
public void setData(MapTop data) {
super.setData(data);
MapNode node=data.getNode();
name.setText(node.getLevel_name()+"("+node.getChapter_name()+"):"+node.getNode_name());
}
@Override
public void onItemViewClick(MapTop data) {
super.onItemViewClick(data);
Intent intent=new Intent(getContext(), MapTopActivity.class);
intent.putExtra("map", JSON.toJSONString(data));
getContext().startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(((FragmentActivity)getContext()),name,"transitionTitle").toBundle());
}
}
}

View File

@ -0,0 +1,121 @@
package com.yutou.jianr_mg.Data;
public class MapNode {
private int id;
private String flag;
private int chapter;
private int level;
private int level_pve_id;
private int level_type;
private int type;
private String type_desc;
private String node_name;
private String level_name;
private String chapter_name;
private String chapter_sub_name;
private String chapter_tag;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public int getChapter() {
return chapter;
}
public void setChapter(int chapter) {
this.chapter = chapter;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public int getLevel_pve_id() {
return level_pve_id;
}
public void setLevel_pve_id(int level_pve_id) {
this.level_pve_id = level_pve_id;
}
public int getLevel_type() {
return level_type;
}
public void setLevel_type(int level_type) {
this.level_type = level_type;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getType_desc() {
return type_desc;
}
public void setType_desc(String type_desc) {
this.type_desc = type_desc;
}
public String getNode_name() {
return node_name;
}
public void setNode_name(String node_name) {
this.node_name = node_name;
}
public String getLevel_name() {
return level_name;
}
public void setLevel_name(String level_name) {
this.level_name = level_name;
}
public String getChapter_name() {
return chapter_name;
}
public void setChapter_name(String chapter_name) {
this.chapter_name = chapter_name;
}
public String getChapter_sub_name() {
return chapter_sub_name;
}
public void setChapter_sub_name(String chapter_sub_name) {
this.chapter_sub_name = chapter_sub_name;
}
public String getChapter_tag() {
return chapter_tag;
}
public void setChapter_tag(String chapter_tag) {
this.chapter_tag = chapter_tag;
}
}

View File

@ -0,0 +1,69 @@
package com.yutou.jianr_mg.Data;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class MapTop {
private int id;
private int mapId;
private int mapNode;
private String shipTeam;
private MapNode node;
public MapNode getNode() {
return node;
}
public void setNode(MapNode node) {
this.node = node;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getMapid() {
return mapId;
}
public void setMapid(int mapid) {
this.mapId = mapid;
}
public String getShipTeam() {
return shipTeam;
}
public void setShipTeam(String shipTeam) {
List<Integer> list=new ArrayList<>();
shipTeam=shipTeam.replace("[","");
shipTeam=shipTeam.replace("]","");
for (String ship : shipTeam.split(",")) {
list.add(Integer.parseInt(ship));
}
Collections.sort(list);
shipTeam="[";
for (Integer integer : list) {
shipTeam+=integer+",";
}
shipTeam = shipTeam.substring(0, shipTeam.length() - 1) + "]";
this.shipTeam = shipTeam;
}
public int getMapNode() {
return mapNode;
}
public void setMapNode(int mapNode) {
this.mapNode = mapNode;
}
}

View File

@ -0,0 +1,69 @@
package com.yutou.jianr_mg.Data;
import java.util.Date;
public class UserTeam {
private int id;
private int mid;
private int mapNode;
private String uname;
private String ship;
private String title;
private Date createTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUname() {
return uname;
}
public void setUname(String uname) {
this.uname = uname;
}
public String getShip() {
return ship;
}
public void setShip(String ship) {
this.ship = ship;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public int getMid() {
return mid;
}
public void setMid(int mid) {
this.mid = mid;
}
public int getMapNode() {
return mapNode;
}
public void setMapNode(int mapNode) {
this.mapNode = mapNode;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}

View File

@ -45,6 +45,7 @@ import com.yutou.jianr_mg.Tools.AppPermissions;
import com.yutou.jianr_mg.Tools.ConfigUtils;
import com.yutou.jianr_mg.Tools.Log;
import com.yutou.jianr_mg.Tools.Utils;
import com.yutou.jianr_mg.views.MapView;
import com.yutou.jianr_mg.views.RegisterActivity;
import com.yutou.jianr_mg.views.WebActivity;
@ -80,7 +81,7 @@ public class LoadingActivity extends AppCompatActivity {
System.out.println("update");
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_loading);
//setContentView(R.layout.activity_loading);
Utils.setImmersion(this);
if (url == null) {
clazz = MainActivity.class;
@ -88,9 +89,11 @@ public class LoadingActivity extends AppCompatActivity {
clazz = WebActivity.class;
}
handler = new Handler();
initViews();
/* initViews();
initData();
initAd();
initAd();*/
MapView mapView=new MapView(this);
setContentView(mapView.getView());
}
private void login(String name, String pass) {

View File

@ -6,10 +6,10 @@ package com.yutou.jianr_mg.Network;
public class HttpApi {
//public static final String HOME="http://jianr.jianrmod.cn/";
public static final String HOME = "http://192.168.31.92:8080/"; //zzz_gz wifi
// public static final String HOME = "http://192.168.31.92:8080/"; //zzz_gz wifi
// public static final String HOME = "http://192.168.43.68:8088/"; //zzz_gz wifi
//public static final String HOME = "http://192.168.137.1:8088/"; //笔记本本身WIFI
// public static final String HOME = "http://192.168.1.151:8080/"; //公司
public static final String HOME = "http://192.168.1.151:8080/"; //公司
public static final String HOME_URL=HOME+"android/"; //服务器
public static final String MOD_ALL = "mod/all.do";
@ -54,6 +54,8 @@ public class HttpApi {
public static final String AD_GET="ad/ad.do";
public static final String AD_LOG="ad/user.do";
public static final String MAPTOP_ALL="map/all.do";
public static final String HITOKOTO_API = "https://v1.hitokoto.cn/";
}

View File

@ -0,0 +1,34 @@
package com.yutou.jianr_mg.views;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.alibaba.fastjson.JSON;
import com.yutou.jianr_mg.Data.MapNode;
import com.yutou.jianr_mg.Data.MapTop;
import com.yutou.jianr_mg.R;
public class MapTopActivity extends AppCompatActivity {
private LinearLayout listLayout,titleLayout;
private TextView name;
private MapTop mapTop;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.item_maptop);
mapTop= JSON.parseObject(getIntent().getStringExtra("map"),MapTop.class);
initView();
}
private void initView() {
listLayout=findViewById(R.id.listLayout);
titleLayout=findViewById(R.id.titleLayout);
name=findViewById(R.id.title);
MapNode node=mapTop.getNode();
name.setText(node.getLevel_name()+"("+node.getChapter_name()+"):"+node.getNode_name()+" 配置:"+mapTop.getShipTeam());
}
}

View File

@ -0,0 +1,132 @@
package com.yutou.jianr_mg.views;
import android.content.Context;
import android.os.Handler;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.alibaba.fastjson.JSON;
import com.yutou.jianr_mg.Adapters.MapRecyclierAdapter;
import com.yutou.jianr_mg.Data.MapTop;
import com.yutou.jianr_mg.Interfaces.HttpInterface;
import com.yutou.jianr_mg.Network.HttpApi;
import com.yutou.jianr_mg.Network.HttpUtils;
import com.yutou.jianr_mg.Tools.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
import cn.lemon.view.RefreshRecyclerView;
public class MapView {
private LinearLayout mainLayout;
private Context context;
private Button search;
private RefreshRecyclerView recyclerView;
private MapRecyclierAdapter adapter;
private int limit = 0;
private Handler handler;
public MapView(Context context) {
this.context = context;
handler=new Handler();
initView();
initData(true);
}
public ViewGroup getView() {
return mainLayout;
}
private void initView() {
mainLayout = new LinearLayout(context);
mainLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
mainLayout.setOrientation(LinearLayout.VERTICAL);
search = new Button(context);
search.setText("查询");
adapter = new MapRecyclierAdapter(context);
recyclerView = new RefreshRecyclerView(context);
recyclerView.setSwipeRefreshColors(0xFF437845, 0xFFE44F98, 0xFF2FAC21);
recyclerView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
recyclerView.setAdapter(adapter);
mainLayout.addView(search);
mainLayout.addView(recyclerView);
recyclerView.addRefreshAction(() -> {
limit = 0;
initData(true);
});
recyclerView.setLoadMoreAction(()->{
limit += 100;
initData(false);
});
}
private void initData(boolean init) {
try {
if (init)
limit = 0;
JSONObject json = new JSONObject();
json.put("limit", limit);
HttpUtils.post(HttpApi.HOME_URL + HttpApi.MAPTOP_ALL, json, new HttpInterface() {
@Override
public void httpGetData(String string, int code) {
try {
Log.i(string);
JSONObject json = new JSONObject(string);
JSONArray data = json.getJSONArray("data");
List<MapTop> list = new ArrayList<>();
for (int i = 0; i < data.length(); i++) {
list.add(JSON.parseObject(data.getJSONObject(i).toString(), MapTop.class));
}
handler.post(()-> {
try {
showData(list, json.getBoolean("next"));
} catch (JSONException e) {
e.printStackTrace();
}
});
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void httpError(Exception e) {
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
private void showData(List<MapTop> list, boolean next) {
if(limit==0){
adapter.clear();
}
adapter.addAll(list);
adapter.notifyDataSetChanged();
recyclerView.dismissSwipeRefresh();
if (!next) {
recyclerView.showNoMore();
}
if (limit == 0)
recyclerView.getRecyclerView().scrollToPosition(0);
}
}

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/titleLayout"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="@drawable/selector_lines_edit_view_bg"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:transitionName="transitionTitle"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="20dp"
android:layout_weight="1"
android:text="TextView" />
</LinearLayout>
<LinearLayout
android:id="@+id/listLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/titleLayout">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,11 +0,0 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Switch
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
</RelativeLayout>