Skip to content

Commit

Permalink
Criando Activity de Informações
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioars committed Jun 26, 2016
1 parent e725a8e commit c7dce91
Show file tree
Hide file tree
Showing 19 changed files with 181 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
versionName "0.2"
}
buildTypes {
release {
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
<activity android:name=".CalculoOhmCorrente" />
<activity android:name=".CalculoOhmResistencia" />
<activity android:name=".CalculoEfeitoJoule" />
<activity android:name=".CalculoOhmPotencia"></activity>
<activity android:name=".CalculoOhmPotencia" />
<activity android:name=".Info"/>
</application>

</manifest>
71 changes: 71 additions & 0 deletions app/src/main/java/br/com/developbox/desenhosabe/Info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package br.com.developbox.desenhosabe;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;

public class Info extends AppCompatActivity {

Button seeMoreButton;
Button bugReportButton;

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

seeMoreButton = (Button) findViewById(R.id.seeMoreButton);
bugReportButton = (Button) findViewById(R.id.bugReportButton);

seeMoreButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri githubUrl = Uri.parse("https://github.com/1fabiosoares/DesenhoSabe");
Intent it = new Intent(Intent.ACTION_VIEW, githubUrl);

startActivity(it);
}
});

bugReportButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
composeEmail(new String[] {"fabioars@live.com"}, getString(R.string.bug_repport)+":"+getString(R.string.app_name)+" "+getString(R.string.app_version), getString(R.string.bug_text));
}
});
}

@Override
public boolean onCreateOptionsMenu(Menu menu){
getSupportActionBar().setDisplayHomeAsUpEnabled(true);

getSupportActionBar().setTitle(R.string.info);

return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()){
case android.R.id.home:
finish();
return true;
}

return super.onOptionsItemSelected(item);
}
public void composeEmail(String[] addresses, String subject, String text) {
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:")); // only email apps should handle this
intent.putExtra(Intent.EXTRA_EMAIL, addresses);
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
}

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package br.com.developbox.desenhosabe;

import android.content.Intent;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
Expand Down Expand Up @@ -115,10 +117,23 @@ public static Intent shareResult(String formula,String[] variables, String[] val
}
@Override
public boolean onCreateOptionsMenu(Menu menu){
getMenuInflater().inflate(R.menu.lista_de_calculos_menu, menu);

getSupportActionBar().setSubtitle(getString(R.string.app_submane));
getSupportActionBar().setShowHideAnimationEnabled(true);

MenuItemCompat.setShowAsAction(menu.findItem(R.id.infoBarButton), MenuItem.SHOW_AS_ACTION_IF_ROOM);

return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()){
case R.id.infoBarButton:
startActivity(new Intent(getBaseContext(), Info.class));
return true;
}

return super.onOptionsItemSelected(item);
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions app/src/main/res/layout/activity_info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="br.com.developbox.desenhosabe.Info">

<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:id="@+id/imageView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_launcher"/>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/app_name"
android:id="@+id/textView"
android:layout_below="@+id/imageView"
android:layout_centerHorizontal="true" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/app_submane"
android:id="@+id/textView2"
android:layout_below="@+id/textView"
android:layout_centerHorizontal="true" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_version"
android:id="@+id/textView3"
android:layout_below="@+id/textView2"
android:layout_centerHorizontal="true" />

<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/textView3"
android:layout_marginTop="30dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bug_repport"
android:id="@+id/bugReportButton"
style="@style/Widget.AppCompat.Button.Borderless.Colored" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/see_more"
android:id="@+id/seeMoreButton"
style="@style/Widget.AppCompat.Button.Colored" />
</LinearLayout>

</RelativeLayout>
9 changes: 9 additions & 0 deletions app/src/main/res/menu/lista_de_calculos_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/infoBarButton"
android:title="@string/info"
android:icon="@drawable/ic_info_outline_white_24dp"
android:showAsAction="ifRoom"/>

</menu>
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@
<string name="calculate">Calcular</string>
<string name="share">Compartilhar</string>
<string name="app_submane">Definitive Edition</string>
<string name="info">Informações</string>
<string name="download">Baixar</string>
<string name="see_more">Ver Atualizações</string>
<string name="bug_repport">Reportar Bug</string>
<string name="bug_text">O bug foi </string>
</resources>
8 changes: 8 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<resources>
<string name="app_name">Desenho Sabe</string>
<string name="app_submane">Definitive Edition</string>
<string name="app_version" translatable="false">v0.2-alpha</string>

<!-- Title -->
<string name="ohmLaw">Ohms Law</string>
Expand All @@ -19,4 +20,11 @@
<string name="calculate">Calculate</string>,
<string name="share">Share</string>

<!-- Informations -->
<string name="info">Info</string>
<string name="download">Download</string>
<string name="see_more">See more</string>
<string name="bug_repport">Bug Report</string>
<string name="bug_text">The bug was </string>

</resources>

0 comments on commit c7dce91

Please sign in to comment.