123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- package de.tu_darmstadt.informatik.tk.olir;
- import android.content.Intent;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.util.TypedValue;
- import android.view.KeyEvent;
- import android.view.View;
- public class MainActivity extends AppCompatActivity {
- public static String stringFalse = "";
- public static String stringTrue = "";
- private static DrawView drawView;
- private float scale;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- //FROM http://stackoverflow.com/questions/8656968/convert-mm-to-pixels 17.3.17 16.30
- scale = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_MM, 1,
- getResources().getDisplayMetrics());
- /*drawView = (DrawView) this.findViewById(R.id.drawView);
- drawView.setScale(scale);
- drawView.setBackgroundColor(Color.WHITE);
- this.findViewById(R.id.button2).setOnTouchListener(new View.OnTouchListener() {
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- if (event.getAction() == MotionEvent.ACTION_DOWN ) {
- changeText(v);
- return true;
- }
- return false;
- }
- });*/
- }
- public void addObject(View view) {
- Intent intent = new Intent(this, ObjectsActivity.class);
- startActivity(intent);
- }
- public void changeText(View view) {
- /*TextView text = (TextView)this.findViewById(R.id.textView2);
- text.setText(stringTrue);
- text.setTextColor(Color.RED);*/
- }
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- if (keyCode == KeyEvent.KEYCODE_BACK
- && event.getRepeatCount() == 0) {
- this.finishAffinity();
- return true;
- }
- return super.onKeyDown(keyCode, event);
- }
- }
|