Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#4 #19 第四次实验 #357

Merged
merged 5 commits into from
May 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions AndroidLabs/app/src/main/AndroidManifest1414080903234.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="edu.hzuapps.androidlabs.homework.net1414080903234">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".Net1414080903234Activity"
android:label="1414080903234宿费管理系统">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Net1414080903234AddIncomeActivity" />
<activity android:name=".Net1414080903234AddOutlayActivity"></activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* Created by admin on 2017/4/14.
*/

public class Income {
private String drawee;
private double income;
private String in_date;
public class Income { //收入记录
private String drawee; //付款人
private double income;//收入金额
private String in_date;//日期
public void Income(String user,double in, String date){
drawee = user;
income = in;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ public class Net1414080903234Activity extends AppCompatActivity implements View.
private TextView tabsetting;

private FrameLayout ly_content;
private Net1414080903234_M f1,f2,f3,f4;
private Net1414080903234_M f1;
private Net1414080903234_I f2;
private Net1414080903234_O f3;
private Net1414080903234_S f4;
private android.app.FragmentManager fragmentManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -68,7 +71,7 @@ public void onClick(View v) {
selected();
tabmoney.setSelected(true);
if (f1 == null) {
f1 = new Net1414080903234_M().newInstance("总额");
f1 = new Net1414080903234_M().newInstance("1");
transaction.add(R.id.ly_content, f1);
} else {
transaction.show(f1);
Expand All @@ -78,7 +81,7 @@ public void onClick(View v) {
selected();
tabincome.setSelected(true);
if (f2 == null) {
f2 = new Net1414080903234_M().newInstance("收入");
f2 = new Net1414080903234_I().newInstance("2");
transaction.add(R.id.ly_content, f2);
} else {
transaction.show(f2);
Expand All @@ -88,7 +91,7 @@ public void onClick(View v) {
selected();
taboutlay.setSelected(true);
if (f3 == null) {
f3 = new Net1414080903234_M().newInstance("支出");
f3 = new Net1414080903234_O().newInstance("3");
transaction.add(R.id.ly_content, f3);
} else {
transaction.show(f3);
Expand All @@ -98,7 +101,7 @@ public void onClick(View v) {
selected();
tabsetting.setSelected(true);
if (f4 == null) {
f4 = new Net1414080903234_M().newInstance("设置");
f4 = new Net1414080903234_S().newInstance("4");
transaction.add(R.id.ly_content, f4);
} else {
transaction.show(f4);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package edu.hzuapps.androidlabs.homework.net1414080903234;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class Net1414080903234AddIncomeActivity extends AppCompatActivity implements View.OnClickListener{
private Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_net1414080903234_add_income);
btn=(Button)findViewById(R.id.buttonCancleIncome);
btn.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch(v.getId()){
case R.id.buttonCancleIncome:
super.finish();
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package edu.hzuapps.androidlabs.homework.net1414080903234;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class Net1414080903234AddOutlayActivity extends AppCompatActivity implements View.OnClickListener{
private Button btn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_net1414080903234_add_outlay);
btn=(Button)findViewById(R.id.buttonCancleOutlay);
btn.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch(v.getId()){
case R.id.buttonCancleOutlay:
super.finish();
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package edu.hzuapps.androidlabs.homework.net1414080903234;

import android.app.FragmentManager;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;


/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link Net1414080903234_I.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link Net1414080903234_I#newInstance} factory method to
* create an instance of this fragment.
*/
public class Net1414080903234_I extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER

// TODO: Rename and change types of parameters
private String flag;
private TextView mTextview;
private Button add;
private View view = null;
private OnFragmentInteractionListener mListener;

public Net1414080903234_I() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @return A new instance of fragment Net1414080903234_I.
*/
// TODO: Rename and change types and number of parameters
public static Net1414080903234_I newInstance(String message) {
Net1414080903234_I fragment = new Net1414080903234_I();
Bundle args = new Bundle();
args.putString("message", message);
fragment.setArguments(args);
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
view = inflater.inflate(R.layout.fragment_net1414080903234__i,container,false);
return view;
}

// TODO: Rename method, update argument and hook method into UI event
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/

public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}

@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);

add = (Button)view.findViewById(R.id.addi);
add.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(),Net1414080903234AddIncomeActivity.class);
startActivity(intent);
}
});
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
package edu.hzuapps.androidlabs.homework.net1414080903234;

import android.content.Context;
import android.app.FragmentManager;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;


Expand All @@ -23,8 +26,9 @@ public class Net1414080903234_M extends Fragment {
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER

// TODO: Rename and change types of parameters
private String mContext;
private String flag;
private TextView mTextview;
private Button add;
private OnFragmentInteractionListener mListener;

public Net1414080903234_M() {
Expand Down Expand Up @@ -55,10 +59,21 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment

mContext = getArguments().getString("message");
View view = inflater.inflate(R.layout.fragment_net1414080903234__m,container,false);
mTextview = (TextView)view.findViewById(R.id.tview);
mTextview.setText(mContext);
flag = getArguments().getString("message");
View view = null;
switch (flag){
case "1":
view = inflater.inflate(R.layout.fragment_net1414080903234__m,container,false);
break;
case "2":
view = inflater.inflate(R.layout.fragment_net1414080903234__i,container,false);
break;
case "3":
view = inflater.inflate(R.layout.fragment_net1414080903234__m,container,false);
break;
case "4":
view = inflater.inflate(R.layout.fragment_net1414080903234__m,container,false);
}
return view;
}

Expand All @@ -73,8 +88,23 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/

public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}

/* @Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);

add = (Button)getActivity().findViewById(R.id.addi);
add.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(),Net1414080903234AddIncomeActivity.class);
startActivity(intent);
}
});
}*/
}
Loading