From aa7718e3a631393d26f7ec6ae930232125638b71 Mon Sep 17 00:00:00 2001 From: Ali Hasan Date: Sun, 14 Oct 2018 20:30:59 +0530 Subject: [PATCH 1/5] adding four buttons --- .idea/caches/build_file_checksums.ser | Bin 0 -> 538 bytes .idea/codeStyles/Project.xml | 29 +++++++++ .idea/compiler.xml | 22 ------- .idea/copyright/profiles_settings.xml | 3 - .idea/misc.xml | 15 +++-- .idea/modules.xml | 1 - .idea/vcs.xml | 2 +- app/build.gradle | 2 +- .../calculaterhacktober/MainActivity.java | 48 ++++++++++++++- app/src/main/res/layout/activity_main.xml | 58 ++++++++++++++++++ app/src/main/res/values/strings.xml | 2 + build.gradle | 4 +- gradle/wrapper/gradle-wrapper.properties | 4 +- 13 files changed, 153 insertions(+), 37 deletions(-) create mode 100644 .idea/caches/build_file_checksums.ser create mode 100644 .idea/codeStyles/Project.xml delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/copyright/profiles_settings.xml diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser new file mode 100644 index 0000000000000000000000000000000000000000..3ed0c6663020378b7b7004398ea4e52d5e4db5e7 GIT binary patch literal 538 zcmZ4UmVvdnh`~NNKUXg?FQq6yGexf?KR>5fFEb@IQ7^qHF(oHeub?PDD>b=9F91S2 zm1gFoxMk*~I%lLNXBU^|7Q2L-Ts|(GuF1r}{tERG_;AL2`N^IX#cW;tZfX zEBmd3hs6>uGBYr_F>vMNC#JY1CYR(Fc`|U8WE7F()%4u{beLA8LR;B6JE;i%K$6i%Sa`>KNESrd*Njx!KRKiREPj=ZrT$ zoa#y#c#=S&2D2Nk@UC;^{!O}H-tSqkgIPby$*qJzASXXLF$Wap7^c2YV0*IpS(MVT zJ=PL7`#ge57zFXSVM}kE@U^cUk77>*KXAQ~x(;Y`VnKmEc6T&X>D*0!ty;4F + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 96cc43e..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index ba7052b..e0d5b93 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -5,26 +5,31 @@ - + diff --git a/.idea/modules.xml b/.idea/modules.xml index 6169877..3480a4a 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,6 @@ - diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 94a25f7..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index d496a8c..e89940f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.application' android { compileSdkVersion 26 - buildToolsVersion "26.0.2" + buildToolsVersion '28.0.3' defaultConfig { applicationId "tech.iosd.calculaterhacktober" minSdkVersion 15 diff --git a/app/src/main/java/tech/iosd/calculaterhacktober/MainActivity.java b/app/src/main/java/tech/iosd/calculaterhacktober/MainActivity.java index a0cb52b..708892a 100644 --- a/app/src/main/java/tech/iosd/calculaterhacktober/MainActivity.java +++ b/app/src/main/java/tech/iosd/calculaterhacktober/MainActivity.java @@ -8,9 +8,12 @@ import android.widget.EditText; import android.widget.TextView; +import static java.lang.Math.sqrt; + public class MainActivity extends AppCompatActivity { - Button add,sub,div,mul,one,two,three,four,five,six,seven,eight,nine,zero,equal,clear,decimal,clearall,percent,change,sign; + Button add,sub,div,mul,one,two,three,four,five,six,seven,eight,nine,zero,equal,clear,decimal,clearall,percent,change,sign, + pi,root,power,mod; TextView edit2,edit1; float value1,value2; @@ -20,6 +23,20 @@ public class MainActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); + + + /** + * 14th October 2018 + * HactoberFest + * Zyro adds four buttons PI,root,power,mod + **/ + + pi=(Button)findViewById(R.id.pi); + root=(Button)findViewById(R.id.root); + power=(Button)findViewById(R.id.power); + mod=(Button)findViewById(R.id.mod); + + add=(Button)findViewById(R.id.add); sub=(Button)findViewById(R.id.sub); mul=(Button)findViewById(R.id.mul); @@ -44,6 +61,35 @@ protected void onCreate(Bundle savedInstanceState) { sign= (Button) findViewById(R.id.sign); // change= (Button) findViewById(R.id.change); + /** Zyro add onCLickListener + * + */ + + //What happens on PI? + + pi.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + edit1.setText(edit1.getText()+"3.14159"); + } + }); + + //What happens on root? + + root.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + try{ + value1=Float.parseFloat(edit1.getText()+""); + + edit1.setText((sqrt(value1))+""); + } + catch (Exception e){ + edit1.setText("error"); + } + } + }); + one.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 1376ff9..cbb3cb7 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -47,6 +47,64 @@ android:layout_weight="1.75" android:orientation="vertical"> + + + + +