forked from hzuapps/android-labs-2020
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a76b5f8
commit ecf1b52
Showing
4 changed files
with
109 additions
and
26 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 |
---|---|---|
@@ -1,16 +1,16 @@ | ||
package com.example.pomelo_note; | ||
package edu.hzuapps.androidlabs.examples; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.os.Bundle; | ||
|
||
public class AboutActivity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState){ | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.about_view); | ||
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
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.examples; | ||
|
||
/* 首先我们先往项目里添加一个画折线图需要的依赖包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,19 +1,54 @@ | ||
package com.example.pomelonote | ||
package edu.hzuapps.androidlabs.examples; | ||
|
||
import android.os.Bundle; | ||
|
||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import java.util.List; | ||
import android.widget.Toast; | ||
import android.widget.DatePicker; | ||
importimport android.view.Menu; android.view.LayoutInflater; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
|
||
public class MainActivity{ | ||
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() { | ||
|
||
private List < CostBean > mCostBeanList; | ||
mCostBeanList = new ArrayList<>(); | ||
ListView costList = (ListView) findViewById(R.id.lv_main); | ||
|
||
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,即自定义的布局 | ||
} | ||
}); | ||
} | ||
|
||
} |