parent
d9b949d55b
commit
f4fe963f85
@ -0,0 +1,55 @@ |
||||
package com.community.pocket.data.model; |
||||
|
||||
//信用分历史记录
|
||||
public class CreditScore { |
||||
//用户名
|
||||
private String username; |
||||
//信用分变化
|
||||
private Integer score; |
||||
//变化前分数
|
||||
private Integer beforeScore; |
||||
//备注
|
||||
private String notes; |
||||
//记录时间
|
||||
private Long time; |
||||
|
||||
public String getUsername() { |
||||
return username; |
||||
} |
||||
|
||||
public void setUsername(String username) { |
||||
this.username = username; |
||||
} |
||||
|
||||
public Integer getScore() { |
||||
return score; |
||||
} |
||||
|
||||
public void setScore(Integer score) { |
||||
this.score = score; |
||||
} |
||||
|
||||
public Integer getBeforeScore() { |
||||
return beforeScore; |
||||
} |
||||
|
||||
public void setBeforeScore(Integer beforeScore) { |
||||
this.beforeScore = beforeScore; |
||||
} |
||||
|
||||
public String getNotes() { |
||||
return notes; |
||||
} |
||||
|
||||
public void setNotes(String notes) { |
||||
this.notes = notes; |
||||
} |
||||
|
||||
public Long getTime() { |
||||
return time; |
||||
} |
||||
|
||||
public void setTime(Long time) { |
||||
this.time = time; |
||||
} |
||||
} |
@ -0,0 +1,35 @@ |
||||
package com.community.pocket.ui.main.ui.info; |
||||
|
||||
import android.content.Context; |
||||
import android.widget.TextView; |
||||
|
||||
import androidx.annotation.LayoutRes; |
||||
|
||||
import com.community.pocket.R; |
||||
import com.community.pocket.data.model.CreditScore; |
||||
import com.github.mikephil.charting.components.MarkerView; |
||||
import com.github.mikephil.charting.data.Entry; |
||||
import com.github.mikephil.charting.highlight.Highlight; |
||||
|
||||
import java.util.List; |
||||
|
||||
public class MyChartView extends MarkerView { |
||||
private TextView score; |
||||
private TextView notes; |
||||
private final List<CreditScore> creditScoreList; |
||||
|
||||
public MyChartView(Context context, @LayoutRes int layoutResource, List<CreditScore> creditScoreList) { |
||||
super(context, layoutResource); |
||||
this.creditScoreList = creditScoreList; |
||||
score = findViewById(R.id.score); |
||||
notes = findViewById(R.id.notes); |
||||
} |
||||
|
||||
@Override |
||||
public void refreshContent(Entry e, Highlight highlight) { |
||||
CreditScore creditScore = creditScoreList.get(((int) e.getX()) - 1); |
||||
score.setText(getContext().getString(R.string.change_score, creditScore.getScore())); |
||||
notes.setText(getContext().getString(R.string.score_notes, creditScore.getNotes())); |
||||
super.refreshContent(e, highlight); |
||||
} |
||||
} |
@ -0,0 +1,24 @@ |
||||
<?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:layout_width="match_parent" |
||||
android:layout_height="match_parent"> |
||||
|
||||
<TextView |
||||
android:id="@+id/score" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:gravity="center" |
||||
android:textSize="14sp" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toTopOf="parent" /> |
||||
|
||||
<TextView |
||||
android:id="@+id/notes" |
||||
android:layout_width="match_parent" |
||||
android:layout_height="wrap_content" |
||||
android:singleLine="false" |
||||
android:textSize="14sp" |
||||
app:layout_constraintStart_toStartOf="parent" |
||||
app:layout_constraintTop_toBottomOf="@id/score" /> |
||||
</androidx.constraintlayout.widget.ConstraintLayout> |
Loading…
Reference in new issue