Skip to content

Commit

Permalink
r115
Browse files Browse the repository at this point in the history
- Новые звуки
- Исправления и улучшения
- Пункт "О программе"
- Пункт "Обратная связь"
- Новая иконка
  • Loading branch information
ZorgeR committed Aug 6, 2016
1 parent 034450d commit e492ac3
Show file tree
Hide file tree
Showing 14 changed files with 139 additions and 15 deletions.
78 changes: 64 additions & 14 deletions app/src/main/java/com/zlab/noizer/app/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
package com.zlab.noizer.app;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ListView;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

Expand Down Expand Up @@ -43,17 +52,19 @@ private void renderList(){
private List<ListViewItem> getItemsList(){
List<ListViewItem> list = new ArrayList<ListViewItem>();

list.add(new ListViewItem(mContext, "Белый шум", "Успокоит вашего ребенка", R.raw.whitenoise, "raw/whitenoise.ogg", false, 25, R.drawable.whitenoise));
list.add(new ListViewItem(mContext, "Ветер", "Меланхолия", R.raw.wind, "raw/wind.ogg", false, 25, R.drawable.wind));
list.add(new ListViewItem(mContext, "Дождь", "Расслабляет", R.raw.rain, "raw/rain.ogg", false, 25, R.drawable.rain));
list.add(new ListViewItem(mContext, "Гроза", "Будьте бдительны", R.raw.storm, "raw/storm.ogg", false, 25, R.drawable.storm));
list.add(new ListViewItem(mContext, "Камин", "Истинное наслаждение", R.raw.fireplace, "raw/fireplace.ogg", false, 25, R.drawable.fireplace));
list.add(new ListViewItem(mContext, "Птицы в парке", "Получайте удовольствие", R.raw.birds, "raw/birds.ogg", false, 25, R.drawable.birds));
list.add(new ListViewItem(mContext, "Шумная улица", "Кого нибудь может успокоить", R.raw.street, "raw/street.ogg", false, 25, R.drawable.street));
list.add(new ListViewItem(mContext, "Бар", "Многим помогает", R.raw.bar, "raw/bar.ogg", false, 25, R.drawable.bar));
list.add(new ListViewItem(mContext, "Волны", "Закройте глаза, оденьте наушники", R.raw.waves, "raw/waves.ogg", false, 25, R.drawable.waves));
list.add(new ListViewItem(mContext, "Листья на ветру", "Садитесь и слушайте", R.raw.foliage, "raw/foliage.ogg", false, 25, R.drawable.foliage));
list.add(new ListViewItem(mContext, "Поезд", "Чу-чух-Чу-чух", R.raw.train, "raw/train.ogg", false, 25, R.drawable.train));
list.add(new ListViewItem(mContext, getResources().getString(R.string.sound_title_whitenoise), getResources().getString(R.string.sound_description_whitenoise), R.raw.whitenoise, "raw/whitenoise.ogg", false, 25, R.drawable.noise));
list.add(new ListViewItem(mContext, getResources().getString(R.string.sound_title_brownnoise), getResources().getString(R.string.sound_description_brownnoise), R.raw.brownnoise, "raw/brownnoise.ogg", false, 25, R.drawable.noise));
list.add(new ListViewItem(mContext, getResources().getString(R.string.sound_title_intrauterine), getResources().getString(R.string.sound_description_intrauterine), R.raw.intrauterine, "raw/intrauterine.ogg", false, 25, R.drawable.intrauterine));
list.add(new ListViewItem(mContext, getResources().getString(R.string.sound_title_wind), getResources().getString(R.string.sound_description_wind), R.raw.wind, "raw/wind.ogg", false, 25, R.drawable.wind));
list.add(new ListViewItem(mContext, getResources().getString(R.string.sound_title_rain), getResources().getString(R.string.sound_description_rain), R.raw.rain, "raw/rain.ogg", false, 25, R.drawable.rain));
list.add(new ListViewItem(mContext, getResources().getString(R.string.sound_title_storm), getResources().getString(R.string.sound_description_storm), R.raw.storm, "raw/storm.ogg", false, 25, R.drawable.storm));
list.add(new ListViewItem(mContext, getResources().getString(R.string.sound_title_fireplace), getResources().getString(R.string.sound_description_fireplace), R.raw.fireplace, "raw/fireplace.ogg", false, 25, R.drawable.fireplace));
list.add(new ListViewItem(mContext, getResources().getString(R.string.sound_title_birds), getResources().getString(R.string.sound_description_birds), R.raw.birds, "raw/birds.ogg", false, 25, R.drawable.birds));
list.add(new ListViewItem(mContext, getResources().getString(R.string.sound_title_street), getResources().getString(R.string.sound_description_street), R.raw.street, "raw/street.ogg", false, 25, R.drawable.street));
list.add(new ListViewItem(mContext, getResources().getString(R.string.sound_title_bar), getResources().getString(R.string.sound_description_bar), R.raw.bar, "raw/bar.ogg", false, 25, R.drawable.bar));
list.add(new ListViewItem(mContext, getResources().getString(R.string.sound_title_waves), getResources().getString(R.string.sound_description_waves), R.raw.waves, "raw/waves.ogg", false, 25, R.drawable.waves));
list.add(new ListViewItem(mContext, getResources().getString(R.string.sound_title_foliage), getResources().getString(R.string.sound_description_foliage), R.raw.foliage, "raw/foliage.ogg", false, 25, R.drawable.foliage));
list.add(new ListViewItem(mContext, getResources().getString(R.string.sound_title_train), getResources().getString(R.string.sound_description_train), R.raw.train, "raw/train.ogg", false, 25, R.drawable.train));

return list;
}
Expand All @@ -67,17 +78,55 @@ public boolean onCreateOptionsMenu(Menu menu) {
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();

if (id == R.id.action_exit) {
for(int i=0;i<listAdaptor.getCount();i++){
listAdaptor.getItem(i).stopPlaying();
}
stopAllSound();
this.finish();
return true;
} else if (id == R.id.action_contact){
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("plain/text");
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "zorg.rhrd@gmail.com" });
intent.putExtra(Intent.EXTRA_SUBJECT, "Noizer app request");
intent.putExtra(Intent.EXTRA_TEXT, "Your text here");
startActivity(Intent.createChooser(intent, ""));
return true;
} else if (id == R.id.action_about){

PackageManager manager = getPackageManager();
PackageInfo info = null;
String version = "Can't identify";
try {
info = manager.getPackageInfo(getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
if(info!=null){
version = info.versionName;
}

final SpannableString msg = new SpannableString(getResources().getString(R.string.action_about_description)+"Build: "+version);
Linkify.addLinks(msg, Linkify.ALL);

final AlertDialog aboutDialog = new AlertDialog.Builder(this)
.setTitle(getResources().getString(R.string.action_about_title))
.setMessage(msg)
.setIcon(android.R.drawable.ic_dialog_info)
.create();
aboutDialog.show();

((TextView)aboutDialog.findViewById(android.R.id.message)).setMovementMethod(LinkMovementMethod.getInstance());
}

return super.onOptionsItemSelected(item);
}

private void stopAllSound(){
for(int i=0;i<listAdaptor.getCount();i++){
listAdaptor.getItem(i).stopPlaying();
}
}

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
Expand All @@ -89,4 +138,5 @@ public boolean onKeyDown(int keyCode, KeyEvent event)
return super.onKeyDown(keyCode, event);
}


}
Binary file added app/src/main/res/drawable/intrauterine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
11 changes: 10 additions & 1 deletion app/src/main/res/menu/menu_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
tools:context=".MainActivity">
<item android:id="@+id/action_exit"
android:title="@string/action_exit"
android:orderInCategory="100"
android:orderInCategory="110"
app:showAsAction="never"/>
<item android:id="@+id/action_contact"
android:title="@string/action_contact"
android:orderInCategory="105"
app:showAsAction="never"/>
<item android:id="@+id/action_about"
android:title="@string/action_about"
android:orderInCategory="108"
app:showAsAction="never"/>

</menu>
Binary file modified app/src/main/res/mipmap-hdpi/ic_launcher.png
100644 → 100755
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
100644 → 100755
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
100644 → 100755
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
100644 → 100755
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
100644 → 100755
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/raw/brownnoise.ogg
Binary file not shown.
Binary file added app/src/main/res/raw/intrauterine.ogg
Binary file not shown.
Binary file modified app/src/main/res/raw/whitenoise.ogg
Binary file not shown.
32 changes: 32 additions & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,36 @@
<string name="action_exit">Выход</string>
<string name="off">Выкл</string>
<string name="on">Вкл</string>
<string name="action_contact">Обратная связь</string>
<string name="sound_title_whitenoise">Белый шум</string>
<string name="sound_title_brownnoise">Коричневый шум</string>
<string name="sound_title_intrauterine">Внутриутробные звуки</string>
<string name="sound_title_wind">Ветер</string>
<string name="sound_title_storm">Гроза</string>
<string name="sound_title_rain">Дождь</string>
<string name="sound_title_fireplace">Камин</string>
<string name="sound_title_birds">Птицы в парке</string>
<string name="sound_title_train">Поезд</string>
<string name="sound_title_street">Шумная улица</string>
<string name="sound_title_bar">Бар</string>
<string name="sound_title_waves">Волны</string>
<string name="sound_title_foliage">Листья на ветру</string>
<string name="sound_description_intrauterine">Знакомая младенцу атмосфера</string>
<string name="sound_description_whitenoise">Успокоит вашего ребенка</string>
<string name="sound_description_brownnoise">Успокоит и вас</string>
<string name="sound_description_wind">Меланхолия</string>
<string name="sound_description_rain">Расслабляет</string>
<string name="sound_description_street">Кого нибудь может успокоить</string>
<string name="sound_description_storm">Будьте бдительны</string>
<string name="sound_description_fireplace">Истинное наслаждение</string>
<string name="sound_description_birds">Получайте удовольствие</string>
<string name="sound_description_bar">Многим помогает</string>
<string name="sound_description_waves">Закройте глаза, наденьте наушники</string>
<string name="sound_description_foliage">Садитесь и слушайте</string>
<string name="sound_description_train">Чу-чух-Чу-чух</string>
<string name="action_about">О программе</string>
<string name="action_about_title">О программе</string>
<string name="action_about_description">Noizer - менеджер шума с открытым исходным кодом.\r\n\r\nБудем рады вашим
комментариям, через форму обратной связи доступную через меню.\r\n\r\nИсходный код:\r\n<a href="https://github.com/ZorgeR/Noizer">https://github.com/ZorgeR/Noizer</a>\r\n\r\n
</string>
</resources>
33 changes: 33 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,39 @@
<resources>
<string name="app_name">Noizer</string>
<string name="action_exit">Exit</string>
<string name="action_contact">Feedback</string>
<string name="action_about">About</string>
<string name="action_about_title">About</string>
<string name="action_about_description">Noizer - open source noise manager.\r\n\r\nFeel free to send feedback from menu.\r\n\r\nSource code:\r\n<a href="https://github.com/ZorgeR/Noizer">https://github.com/ZorgeR/Noizer</a>\r\n\r\n</string>
<string name="on">On</string>
<string name="off">Off</string>
<!-- Title -->
<string name="sound_title_whitenoise">White noise</string>
<string name="sound_title_brownnoise">Brown noise</string>
<string name="sound_title_intrauterine">Intrauterine sound</string>
<string name="sound_title_wind">Wind</string>
<string name="sound_title_rain">Rain</string>
<string name="sound_title_storm">Storm</string>
<string name="sound_title_fireplace">Fireplace</string>
<string name="sound_title_birds">Birds</string>
<string name="sound_title_street">Street</string>
<string name="sound_title_bar">Bar</string>
<string name="sound_title_waves">Waves</string>
<string name="sound_title_foliage">Foliage</string>
<string name="sound_title_train">Train</string>
<!-- Desription -->
<string name="sound_description_whitenoise">Soothe your baby</string>
<string name="sound_description_brownnoise">Calm down and you</string>
<string name="sound_description_intrauterine">The familiar atmosphere of the baby</string>
<string name="sound_description_wind">Melancholy</string>
<string name="sound_description_rain">Relaxes</string>
<string name="sound_description_storm">Be carefull</string>
<string name="sound_description_fireplace">Pure pleasure</string>
<string name="sound_description_birds">Enjoy</string>
<string name="sound_description_street">Who can soothe a</string>
<string name="sound_description_bar">Many help</string>
<string name="sound_description_waves">Close your eyes, put on your headphones</string>
<string name="sound_description_foliage">Sit down and listen to</string>
<string name="sound_description_train">Choo-choo-choo-Choo</string>

</resources>

0 comments on commit e492ac3

Please sign in to comment.