Skip to content

Commit

Permalink
Merge pull request #778 from BingoTrai/master
Browse files Browse the repository at this point in the history
#1 #88 #89 #90 #91 #95 #26 基本完成
  • Loading branch information
zengsn committed May 19, 2016
2 parents 0a452f3 + 42c8457 commit 2a13ab7
Show file tree
Hide file tree
Showing 5 changed files with 534 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package edu.hzuapps.androidworks.homeworks.com1314080901102;

import android.content.Context;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.TextView;

/**
* Created by Administrator on 2016/5/11.
*/
public class Card extends FrameLayout {

public Card(Context context){
super(context);
label = new TextView(getContext());
label.setTextSize(32);
label.setBackgroundColor(0x33ffffff);
label.setGravity(Gravity.CENTER);

LayoutParams lp = new LayoutParams(-1,-1);
lp.setMargins(10, 10, 0, 0);
addView(label,lp);

setNum(0);
}

public int getNum() {
return num;
}

public void setNum(int num) {
if(num<0){
label.setText("");
}else{
label.setText(num+"");
}
this.num = num;
}

private int num = 0;
private TextView label;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package edu.hzuapps.androidworks.homeworks.com1314080901102;

import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import android.util.Log;

import edu.hzuapps.androidworks.homeworks.simple_2048.R;


public class Com1314080901102MainActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_com1314080901102_main);

Button bt1 = (Button) findViewById(R.id.Paly);
Button bt2 = (Button) findViewById(R.id.check);

bt1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Com1314080901102MainActivity.this,HomeActivity.class);
startActivity(intent);
}
});
bt2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Com1314080901102MainActivity.this,ScoreActivity.class);
startActivity(intent);
}
});
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_com1314080901102_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}

}
Loading

0 comments on commit 2a13ab7

Please sign in to comment.