This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #822 from 1814080911138/master
- Loading branch information
Showing
4 changed files
with
140 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package edu.hzuapps.androidlabs.Sec1814080911138; | ||
|
||
import android.app.Activity; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.os.Bundle; | ||
|
||
public class AboutActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_about); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="edu.hzuapps.androidlabs.Sec1814080911138"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".ChartActivity"></activity> | ||
<activity android:name=".AboutActivity" /> | ||
<activity android:name=".Sec1814080911138Activity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package edu.hzuapps.androidlabs.Sec1814080911138; | ||
|
||
/* 首先我们先往项目里添加一个画折线图需要的依赖包hellocharts-library-1.5.8.jar */ | ||
import android.os.Bundle; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.TreeMap; | ||
|
||
import lecho.lib.hellocharts.model.Axis; | ||
import lecho.lib.hellocharts.model.ChartData; | ||
import lecho.lib.hellocharts.model.Line; | ||
import lecho.lib.hellocharts.model.LineChartData; | ||
import lecho.lib.hellocharts.model.PointValue; | ||
import lecho.lib.hellocharts.model.ValueShape; | ||
import lecho.lib.hellocharts.util.ChartUtils; | ||
import lecho.lib.hellocharts.view.Chart; | ||
import lecho.lib.hellocharts.view.LineChartView; | ||
public class ChartActivity extends AppCompatActivity { | ||
|
||
} | ||
private LineChartView mChart; | ||
private Map<String,Integer> table = new TreeMap<>(); //日期排序 | ||
private LineChartData mData = new LineChartData(); | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_chart); | ||
} | ||
} | ||
private void generateData(){ //设置折线图的线颜色等属性 | ||
List<Line> lines=new ArrayList<>(); | ||
List<PointValue> values=new ArrayList<>(); | ||
int indexX=0; | ||
for(Integer value:table.values()){ | ||
values.add(new PointValue(indexX,value)); | ||
indexX++; | ||
Line line = new Line(values); | ||
line.setColor(ChartUtils.COLOR_GREEN); | ||
line.setShape(ValueShape.CIRCLE); | ||
line.setPointColor(ChartUtils.COLOR_ORANGE); | ||
lines.add(line); | ||
mData = new LineChartData(lines); | ||
mData.setLines(lines); | ||
mChart.setLineChartData(mData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,54 @@ | ||
edu.hzuapps.androidlabs.sec1814080911138.Sec1814080911138Activity.java | ||
package edu.hzuapps.androidlabs.Sec1814080911138; | ||
|
||
public class Sec1814080911138Activity{ | ||
import android.os.Bundle; | ||
|
||
public static void main(String[ ] args){ | ||
System.out.println("hello world") | ||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import java.util.List; | ||
|
||
public class Sec1814080911138Activity extends AppCompatActivity { | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
private List<CostBean> mCostBeanList; | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_sec1814080911138); | ||
} | ||
} | ||
FloatingActionButton fab = findViewById(R.id.fab); | ||
fab.setOnClickListener(new View.OnClickListener() { | ||
public void onClick(View view) { | ||
builder.setTitle("新建支出");//dialog的标题 | ||
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() { | ||
|
||
|
||
public void onClick(DialogInterface dialog, int which) {//当点击确定时, | ||
CostBean costBean = new CostBean(); | ||
costBean.costTitle = title.getText().toString();//将对应的属性输入 | ||
costBean.costMoney = money.getText().toString(); | ||
costBean.costDate = date.getYear() + "-" + (date.getMonth() + 1) + "-" + | ||
date.getDayOfMonth(); | ||
costBean.costDate = date.getYear()+"-"; | ||
|
||
if(date.getMonth()+1<10)costBean.costDate+="0"; | ||
costBean.costDate+=(date.getMonth()+1)+"-"; | ||
if(date.getDayOfMonth()<10) costBean.costDate+="0"; | ||
costBean.costDate+=date.getDayOfMonth(); | ||
|
||
|
||
//当输入为空时提醒 | ||
if("".equals(costBean.costTitle) || "".equals(costBean.costMoney) || "".equals(costBean.costDate)) | ||
{ | ||
Toast.makeText(MainActivity.this,"信息不完整",Toast.LENGTH_SHORT).show(); | ||
return; | ||
} | ||
if(costBean.costMoney.length()>4) | ||
{ | ||
Toast.makeText(MainActivity.this,"金额过大",Toast.LENGTH_SHORT).show(); | ||
return; | ||
} | ||
builder.setNegativeButton("取消", null);//取消时退出 | ||
builder.create().show();//显示dialog,即自定义的布局 | ||
} | ||
}); | ||
} | ||
|