diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2b2d83ea..f8239d60 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -39,5 +39,9 @@ + + diff --git a/app/src/main/java/com/simplemobiletools/calculator/AboutActivity.java b/app/src/main/java/com/simplemobiletools/calculator/AboutActivity.java new file mode 100644 index 00000000..392698da --- /dev/null +++ b/app/src/main/java/com/simplemobiletools/calculator/AboutActivity.java @@ -0,0 +1,14 @@ +package com.simplemobiletools.calculator; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; + +public class AboutActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_about); + setTitle(getResources().getString(R.string.about)); + } +} diff --git a/app/src/main/java/com/simplemobiletools/calculator/MainActivity.java b/app/src/main/java/com/simplemobiletools/calculator/MainActivity.java index 7626e228..829a112c 100644 --- a/app/src/main/java/com/simplemobiletools/calculator/MainActivity.java +++ b/app/src/main/java/com/simplemobiletools/calculator/MainActivity.java @@ -1,8 +1,12 @@ package com.simplemobiletools.calculator; +import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.View; import android.widget.TextView; @@ -28,6 +32,25 @@ public class MainActivity extends AppCompatActivity implements Calculator { AutofitHelper.create(result); } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.menu, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.about: + final Intent intent = new Intent(getApplicationContext(), AboutActivity.class); + startActivity(intent); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + private void setupResultView() { final Resources res = getResources(); result.setBackgroundColor(res.getColor(android.R.color.white)); diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml new file mode 100644 index 00000000..cb8fc40e --- /dev/null +++ b/app/src/main/res/layout/activity_about.xml @@ -0,0 +1,6 @@ + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 9ec1759e..cadc4d9b 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -7,6 +7,7 @@ android:layout_height="match_parent" android:background="@color/dark_grey" android:orientation="vertical" + android:theme="@style/MainTheme" tools:context=".MainActivity"> + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a70d9f14..8eec1609 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,3 +1,4 @@ Simple Calculator + About diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 06f0edab..57b137c2 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -4,6 +4,9 @@ @color/colorPrimary @color/colorPrimaryDark @color/colorAccent + + +