Commit 017a22d5 by Jinqiu Bai

second commit

parent 2662c732
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
...@@ -49,19 +49,24 @@ public class AdapterBottom extends RecyclerView.Adapter<AdapterBottom.ViewHolder ...@@ -49,19 +49,24 @@ public class AdapterBottom extends RecyclerView.Adapter<AdapterBottom.ViewHolder
@Override @Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) { public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
try{ try{
viewHolder.mtv_content.setText(mNotificationList.get(i).title_lang.mn); if (!mNotificationList.get(i).title_lang.mn.isEmpty()){
viewHolder.mtv_content.setOnClickListener(new View.OnClickListener() { viewHolder.mtv_content.setText(mNotificationList.get(i).title_lang.mn);
@Override }else {
public void onClick(View v) { viewHolder.mtv_content.setText(mNotificationList.get(i).title_lang.zh);
intent = new Intent(mView.getContext(), ActivityShowContent.class); }
intent.putExtra("type", "notice");
intent.putExtra("id", mNotificationList.get(i).notice_id);
mView.getContext().startActivity(intent);
}
});
}catch (NullPointerException e){ }catch (NullPointerException e){
e.printStackTrace(); e.printStackTrace();
viewHolder.mtv_content.setText(mNotificationList.get(i).title_lang.zh);
} }
viewHolder.mtv_content.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
intent = new Intent(mView.getContext(), ActivityShowContent.class);
intent.putExtra("type", "notice");
intent.putExtra("id", mNotificationList.get(i).notice_id);
mView.getContext().startActivity(intent);
}
});
} }
@Override @Override
......
...@@ -17,7 +17,7 @@ import java.util.List; ...@@ -17,7 +17,7 @@ import java.util.List;
import configs.Configs; import configs.Configs;
import gsonbeans.Gson_schoolNews; import gsonbeans.Gson_schoolNews;
public class AdapterTop extends RecyclerView.Adapter <AdapterTop.ViewHolder>{ public class AdapterTop extends RecyclerView.Adapter<AdapterTop.ViewHolder> {
private View mView; private View mView;
private Intent intent; private Intent intent;
...@@ -25,42 +25,48 @@ public class AdapterTop extends RecyclerView.Adapter <AdapterTop.ViewHolder>{ ...@@ -25,42 +25,48 @@ public class AdapterTop extends RecyclerView.Adapter <AdapterTop.ViewHolder>{
public AdapterTop(List<Gson_schoolNews.DataOut.DataIn> dataList) { public AdapterTop(List<Gson_schoolNews.DataOut.DataIn> dataList) {
super(); super();
mDataList = dataList ; mDataList = dataList;
} }
public class ViewHolder extends RecyclerView.ViewHolder{ public class ViewHolder extends RecyclerView.ViewHolder {
public MongolTextView mtv_content; public MongolTextView mtv_content;
public ViewHolder(@NonNull View itemView) { public ViewHolder(@NonNull View itemView) {
super(itemView); super(itemView);
mtv_content = itemView.findViewById(R.id.mtv_item_content); mtv_content = itemView.findViewById(R.id.mtv_item_content);
Configs.setMtvFont_Content(itemView.getContext(),mtv_content); Configs.setMtvFont_Content(itemView.getContext(), mtv_content);
} }
} }
@NonNull @NonNull
@Override @Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
mView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_news_notice,viewGroup,false); mView = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_news_notice, viewGroup, false);
ViewHolder holder = new ViewHolder(mView); ViewHolder holder = new ViewHolder(mView);
return holder; return holder;
} }
@Override @Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) { public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
try{ try {
viewHolder.mtv_content.setText(mDataList.get(i).title_lang.mn); if (!mDataList.get(i).title_lang.mn.isEmpty()) {
viewHolder.mtv_content.setOnClickListener(new View.OnClickListener() { viewHolder.mtv_content.setText(mDataList.get(i).title_lang.mn);
@Override } else {
public void onClick(View v) { viewHolder.mtv_content.setText(mDataList.get(i).title_lang.zh);
intent = new Intent(mView.getContext(),ActivityShowContent.class); }
intent.putExtra("type","news"); } catch (NullPointerException e) {
intent.putExtra("id",mDataList.get(i).news_id);
mView.getContext().startActivity(intent);
}
});
}catch (NullPointerException e){
e.printStackTrace(); e.printStackTrace();
viewHolder.mtv_content.setText(mDataList.get(i).title_lang.zh);
} }
viewHolder.mtv_content.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
intent = new Intent(mView.getContext(), ActivityShowContent.class);
intent.putExtra("type", "news");
intent.putExtra("id", mDataList.get(i).news_id);
mView.getContext().startActivity(intent);
}
});
} }
@Override @Override
...@@ -69,5 +75,4 @@ public class AdapterTop extends RecyclerView.Adapter <AdapterTop.ViewHolder>{ ...@@ -69,5 +75,4 @@ public class AdapterTop extends RecyclerView.Adapter <AdapterTop.ViewHolder>{
} }
} }
...@@ -3,6 +3,7 @@ package com.example.administrator.bigui; ...@@ -3,6 +3,7 @@ package com.example.administrator.bigui;
import android.graphics.Color; import android.graphics.Color;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.os.Bundle;
import android.text.Html;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
...@@ -24,6 +25,7 @@ import okhttp3.Response; ...@@ -24,6 +25,7 @@ import okhttp3.Response;
public class ActivityShowContent extends AppCompatActivity { public class ActivityShowContent extends AppCompatActivity {
public MongolTextView c_title, public MongolTextView c_title,
c_message_title, c_message_date, c_message_content; c_message_title, c_message_date, c_message_content;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
...@@ -31,6 +33,7 @@ public class ActivityShowContent extends AppCompatActivity { ...@@ -31,6 +33,7 @@ public class ActivityShowContent extends AppCompatActivity {
initUI(); initUI();
initWindows(); initWindows();
} }
public void initUI() { public void initUI() {
c_title = findViewById(R.id.mtv_title_messages_content); c_title = findViewById(R.id.mtv_title_messages_content);
c_message_title = findViewById(R.id.mtv_messages_title); c_message_title = findViewById(R.id.mtv_messages_title);
...@@ -59,7 +62,7 @@ public class ActivityShowContent extends AppCompatActivity { ...@@ -59,7 +62,7 @@ public class ActivityShowContent extends AppCompatActivity {
@Override @Override
public void onResponse(Call call, Response response) throws IOException { public void onResponse(Call call, Response response) throws IOException {
Log.d("321", "onResponse: "+response.request().url().toString()); Log.d("321", "onResponse: " + response.request().url().toString());
if (response.isSuccessful()) { if (response.isSuccessful()) {
Gson gson = new Gson(); Gson gson = new Gson();
try { try {
...@@ -68,17 +71,28 @@ public class ActivityShowContent extends AppCompatActivity { ...@@ -68,17 +71,28 @@ public class ActivityShowContent extends AppCompatActivity {
c_message_title.post(new Runnable() { c_message_title.post(new Runnable() {
@Override @Override
public void run() { public void run() {
c_message_title.setText(" "+content.data.title_lang.mn); try{
if (!content.data.title_lang.mn.isEmpty()) {
c_message_title.setText(" " + content.data.title_lang.mn);
} else {
c_message_title.setText(" " + content.data.title_lang.zh);
}
}catch (NullPointerException e){
e.printStackTrace();
c_message_title.setText(" " + content.data.title_lang.zh);
}
} }
}); });
} catch (NullPointerException e) { } catch (NullPointerException e) {
e.printStackTrace(); e.printStackTrace();
c_message_title.setText(content.data.title_lang.zh);
} }
try { try {
c_message_date.post(new Runnable() { c_message_date.post(new Runnable() {
@Override @Override
public void run() { public void run() {
c_message_date.setText(" "+content.data.create_at); c_message_date.setText(" " + content.data.created_at);
} }
}); });
} catch (NullPointerException e) { } catch (NullPointerException e) {
...@@ -88,11 +102,20 @@ public class ActivityShowContent extends AppCompatActivity { ...@@ -88,11 +102,20 @@ public class ActivityShowContent extends AppCompatActivity {
c_message_content.post(new Runnable() { c_message_content.post(new Runnable() {
@Override @Override
public void run() { public void run() {
c_message_content.setText(" "+content.data.content_lang.mn); try {
if (!content.data.content_lang.mn.isEmpty()) {
c_message_content.setText(" " + content.data.content_lang.mn);
} else {
c_message_content.setText(Html.fromHtml(content.data.content_lang.zh));
}
}catch (NullPointerException e){
c_message_content.setText(Html.fromHtml(content.data.content_lang.zh));
}
} }
}); });
} catch (NullPointerException e) { } catch (NullPointerException e) {
e.printStackTrace(); e.printStackTrace();
c_message_content.setText(Html.fromHtml(content.data.content_lang.zh));
} }
} catch (JsonSyntaxException e) { } catch (JsonSyntaxException e) {
...@@ -123,17 +146,28 @@ public class ActivityShowContent extends AppCompatActivity { ...@@ -123,17 +146,28 @@ public class ActivityShowContent extends AppCompatActivity {
c_message_title.post(new Runnable() { c_message_title.post(new Runnable() {
@Override @Override
public void run() { public void run() {
c_message_title.setText(" "+content.data.title_lang.mn); try {
if (!content.data.title_lang.mn.isEmpty()) {
c_message_title.setText(" " + content.data.title_lang.mn);
} else {
c_message_title.setText(content.data.title_lang.zh);
}
} catch (NullPointerException e) {
e.printStackTrace();
c_message_title.setText(content.data.title_lang.zh);
}
} }
}); });
} catch (NullPointerException e) { } catch (NullPointerException e) {
e.printStackTrace(); e.printStackTrace();
c_message_title.setText(content.data.title_lang.zh);
} }
try { try {
c_message_date.post(new Runnable() { c_message_date.post(new Runnable() {
@Override @Override
public void run() { public void run() {
c_message_date.setText(" "+content.data.create_at); c_message_date.setText(" " + content.data.created_at);
} }
}); });
} catch (NullPointerException e) { } catch (NullPointerException e) {
...@@ -143,11 +177,21 @@ public class ActivityShowContent extends AppCompatActivity { ...@@ -143,11 +177,21 @@ public class ActivityShowContent extends AppCompatActivity {
c_message_content.post(new Runnable() { c_message_content.post(new Runnable() {
@Override @Override
public void run() { public void run() {
c_message_content.setText(" "+content.data.content_lang.mn); try {
if (!content.data.content_lang.mn.isEmpty()) {
c_message_content.setText(" " + content.data.content_lang.mn);
} else {
c_message_content.setText(Html.fromHtml(content.data.content_lang.zh));
}
} catch (NullPointerException e) {
e.printStackTrace();
c_message_content.setText(Html.fromHtml(content.data.content_lang.zh));
}
} }
}); });
} catch (NullPointerException e) { } catch (NullPointerException e) {
e.printStackTrace(); e.printStackTrace();
c_message_content.setText(Html.fromHtml(content.data.content_lang.zh));
} }
} catch (JsonSyntaxException e) { } catch (JsonSyntaxException e) {
......
...@@ -182,7 +182,6 @@ public class MainActivity extends AppCompatActivity implements IHandlerListerner ...@@ -182,7 +182,6 @@ public class MainActivity extends AppCompatActivity implements IHandlerListerner
rv_right_bottom.setAdapter(adapterBottom); rv_right_bottom.setAdapter(adapterBottom);
} }
try { try {
tv_right_temp_total.setText(Gsons.gsonGetWeather.result.templow + " ~ " + Gsons.gsonGetWeather.result.temphigh + "℃"); tv_right_temp_total.setText(Gsons.gsonGetWeather.result.templow + " ~ " + Gsons.gsonGetWeather.result.temphigh + "℃");
} catch (NullPointerException e) { } catch (NullPointerException e) {
...@@ -209,7 +208,7 @@ public class MainActivity extends AppCompatActivity implements IHandlerListerner ...@@ -209,7 +208,7 @@ public class MainActivity extends AppCompatActivity implements IHandlerListerner
e.printStackTrace(); e.printStackTrace();
} }
c_center_bottom.setText(" "+getResources().getString(R.string.slogan_1)); c_center_bottom.setText(" "+getResources().getString(R.string.slogan_1));
} }
......
...@@ -18,7 +18,7 @@ public class Gson_schoolNews_content { ...@@ -18,7 +18,7 @@ public class Gson_schoolNews_content {
public String eclass_id; public String eclass_id;
public String department_id; public String department_id;
public String create_by; public String create_by;
public String create_at; public String created_at;
public String update_by; public String update_by;
public String update_at; public String update_at;
public String school_id; public String school_id;
......
...@@ -13,7 +13,7 @@ public class Gson_schoolNotification_content { ...@@ -13,7 +13,7 @@ public class Gson_schoolNotification_content {
public String eclass_id; public String eclass_id;
public String department_id; public String department_id;
public String create_by; public String create_by;
public String create_at; public String created_at;
public String update_by; public String update_by;
public String update_at; public String update_at;
public String school_id; public String school_id;
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="32dp" android:layout_marginLeft="32dp"
android:layout_marginTop="27dp" android:layout_marginTop="27dp"
app:text="@string/class_teachers" app:text="@string/big_leader"
app:textColor="@color/color_text" app:textColor="@color/color_text"
app:textSize="30sp" /> app:textSize="30sp" />
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="94dp" android:layout_marginLeft="94dp"
app:text="@string/school_news" app:text="@string/big_slogan"
app:textColor="@color/color_text" app:textColor="@color/color_text"
app:textSize="30dp" /> app:textSize="30dp" />
...@@ -180,7 +180,7 @@ ...@@ -180,7 +180,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="32dp" android:layout_marginLeft="32dp"
android:layout_marginTop="27dp" android:layout_marginTop="27dp"
app:text="@string/class_teachers" app:text="@string/big_weather"
app:textColor="@color/color_text" app:textColor="@color/color_text"
app:textSize="30dp" /> app:textSize="30dp" />
...@@ -209,11 +209,12 @@ ...@@ -209,11 +209,12 @@
<ImageView <ImageView
android:id="@+id/iv_right_top" android:id="@+id/iv_right_top"
android:layout_width="25dp" android:layout_width="100dp"
android:layout_height="25dp" android:layout_height="100dp"
android:layout_below="@id/tv_right_top_temp_current" android:layout_below="@+id/tv_right_top_time"
android:layout_marginLeft="20dp"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:layout_toRightOf="@id/mtv_right_top_title" android:layout_toRightOf="@+id/tv_right_temp_total"
android:src="@drawable/img_weather_sunny" /> android:src="@drawable/img_weather_sunny" />
<TextView <TextView
...@@ -223,11 +224,15 @@ ...@@ -223,11 +224,15 @@
android:layout_below="@id/tv_right_top_temp_current" android:layout_below="@id/tv_right_top_temp_current"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginTop="15dp" android:layout_marginTop="15dp"
android:layout_toRightOf="@id/iv_right_top" android:layout_toRightOf="@+id/mtv_right_top_title"
android:text="-10℃~-3℃" android:text="-10℃~-3℃"
android:textColor="@color/color_text_white" android:textColor="@color/color_text_white"
android:textSize="18dp" /> android:textSize="18dp" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <RelativeLayout
...@@ -246,7 +251,7 @@ ...@@ -246,7 +251,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="32dp" android:layout_marginLeft="32dp"
android:layout_marginTop="27dp" android:layout_marginTop="27dp"
app:text="@string/class_demeanor" app:text="@string/school_notice"
app:textColor="@color/color_text" app:textColor="@color/color_text"
app:textSize="30dp" /> app:textSize="30dp" />
......
...@@ -58,5 +58,9 @@ ...@@ -58,5 +58,9 @@
ᠠᠷᠪᠢ ᠦᠭᠡᠢ ᠪᠣᠯ ᠶᠠᠭᠤᠮ᠎ᠠ ᠪᠠᠨ ᠪᠠᠷᠠᠨ᠎ᠠ</string> ᠠᠷᠪᠢ ᠦᠭᠡᠢ ᠪᠣᠯ ᠶᠠᠭᠤᠮ᠎ᠠ ᠪᠠᠨ ᠪᠠᠷᠠᠨ᠎ᠠ</string>
<string name="slogan_5">ᠠᠮᠢᠳᠤ ᠬᠦᠮᠦᠨ ᠠᠷᠭ᠎ᠠ ᠲᠠᠢ <string name="slogan_5">ᠠᠮᠢᠳᠤ ᠬᠦᠮᠦᠨ ᠠᠷᠭ᠎ᠠ ᠲᠠᠢ
ᠠᠷᠭᠠᠯ᠌   ᠤᠨ ᠭᠠᠯ ᠴᠤᠭ ᠲᠠᠢ</string> ᠠᠷᠭᠠᠯ᠌   ᠤᠨ ᠭᠠᠯ ᠴᠤᠭ ᠲᠠᠢ</string>
<string name="big_slogan">ᠮᠡᠷᠭᠡᠨ ᠦᠭᠡᠰ</string>
<string name="big_weather">ᠴᠠᠭ ᠠᠭᠤᠷ</string>
<string name="big_leader">ᠵᠢᠵᠢᠭᠦᠷ ᠡᠷᠬᠢᠯᠡᠭᠴᠢ</string>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment