|
|
|
@ -1,6 +1,7 @@ |
|
|
|
|
package com.community.pocket.ui.main.ui.visitor; |
|
|
|
|
|
|
|
|
|
import android.os.Build; |
|
|
|
|
import android.os.Bundle; |
|
|
|
|
import android.text.format.DateFormat; |
|
|
|
|
import android.view.Gravity; |
|
|
|
|
import android.view.View; |
|
|
|
@ -8,6 +9,8 @@ import android.widget.Button; |
|
|
|
|
import android.widget.EditText; |
|
|
|
|
import android.widget.TextView; |
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull; |
|
|
|
|
import androidx.annotation.Nullable; |
|
|
|
|
import androidx.annotation.RequiresApi; |
|
|
|
|
import androidx.annotation.StringRes; |
|
|
|
|
import androidx.appcompat.app.AlertDialog; |
|
|
|
@ -16,6 +19,7 @@ import androidx.gridlayout.widget.GridLayout; |
|
|
|
|
import com.community.pocket.R; |
|
|
|
|
import com.community.pocket.data.model.Visitor; |
|
|
|
|
import com.community.pocket.ui.BaseFragment; |
|
|
|
|
import com.community.pocket.util.PropertiesUtil; |
|
|
|
|
|
|
|
|
|
import org.xutils.view.annotation.ViewInject; |
|
|
|
|
|
|
|
|
@ -45,15 +49,25 @@ public abstract class VisitorMyVisitor extends BaseFragment { |
|
|
|
|
@ViewInject(R.id.time) |
|
|
|
|
protected TextView time; |
|
|
|
|
|
|
|
|
|
@ViewInject(R.id.tip) |
|
|
|
|
private TextView tip; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 显示备注最大长度 |
|
|
|
|
*/ |
|
|
|
|
private static final int maxLength = 5; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { |
|
|
|
|
super.onViewCreated(view, savedInstanceState); |
|
|
|
|
this.initTip(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 初始化数据 |
|
|
|
|
*/ |
|
|
|
|
protected <T extends Visitor> void loadData(List<T> visitors) { |
|
|
|
|
gridLayout.removeAllViews(); |
|
|
|
|
for (final Visitor visitor : visitors) { |
|
|
|
|
createTextView(visitor.getName()); |
|
|
|
|
createTextView(DateFormat.format(getString(R.string.dateformat), visitor.getTime())); |
|
|
|
@ -138,4 +152,10 @@ public abstract class VisitorMyVisitor extends BaseFragment { |
|
|
|
|
}); |
|
|
|
|
alertDialog.show(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//初始化日期提示
|
|
|
|
|
private void initTip() { |
|
|
|
|
String format = PropertiesUtil.getValue("date.pattern"); |
|
|
|
|
tip.setText(getString(R.string.dateformat_tip, format, DateFormat.format(format, System.currentTimeMillis()))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|