Notes++ announcement

This commit is contained in:
Sergey Solovyev 2012-05-14 15:10:08 +04:00
parent f75bab4a01
commit 9c3c2e3e3f
5 changed files with 56 additions and 16 deletions

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 2009-2011. Created by serso aka se.solovyev.
~ For more information, please, contact se.solovyev@gmail.com
~ or visit http://se.solovyev.org
-->
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:layout_width="fill_parent"
a:layout_height="fill_parent">
<TextView a:id="@+id/notespp_announce"
style="@style/about_style"
a:layout_width="fill_parent"
a:text="@string/c_notespp_announce_text"
a:layout_height="fill_parent"/>
</LinearLayout>

View File

@ -193,6 +193,10 @@
Пожалуйста, оцените Калькулятор++ \nна <a href="https://market.android.com/details?id=org.solovyev.android.calculator">Google Play</a>,\n оставьте комментарий или \nобсудите приложение \nна нашем <a href="http://calculatorpp.com/forum/">форуме</a>
</string>
<string name="c_notespp_announce_text">Хорошие новости - я только что выпустил новое приложение под Андроид под названием <a href="https://play.google.com/store/apps/details?id=org.solovyev.android.notes">Заметки++</a>.\n
Если вы заинтересованы в быстром и удобном способе оставлять заметки пройдите по <a href="https://play.google.com/store/apps/details?id=org.solovyev.android.notes">ссылке</a> и попробуйте Заметки++!
</string>
<string name="c_angle_units_changed_to">Единицы измерения углов изменены на \'%s\'!</string>
<string name="c_numeral_base_changed_to">Система счисления изменена на \'%s\'!</string>
<string name="c_conversion_tool">Перевод величин</string>

View File

@ -193,6 +193,10 @@
Please rate Calculator++ \non <a href="https://market.android.com/details?id=org.solovyev.android.calculator">Google Play</a>,\n leave a comment or \ndiscuss application \non our <a href="http://calculatorpp.com/forum/">forum</a>
</string>
<string name="c_notespp_announce_text">Good news - I just released new application for Android called <a href="https://play.google.com/store/apps/details?id=org.solovyev.android.notes">Notes++</a>.\n
If you\'re interesting in fast and easy way of making notes please follow the <a href="https://play.google.com/store/apps/details?id=org.solovyev.android.notes">link</a> and try Notes++!
</string>
<string name="c_angle_units_changed_to">Angle units changed to \'%s\'!</string>
<string name="c_numeral_base_changed_to">Numeral base changed to \'%s\'!</string>
<string name="c_conversion_tool">Conversion tool</string>

View File

@ -43,6 +43,7 @@ import org.solovyev.android.calculator.view.OnDragListenerVibrator;
import org.solovyev.android.history.HistoryDragProcessor;
import org.solovyev.android.menu.ActivityMenu;
import org.solovyev.android.menu.LayoutActivityMenu;
import org.solovyev.android.prefs.Preference;
import org.solovyev.android.view.ColorButton;
import org.solovyev.android.view.drag.*;
import org.solovyev.common.utils.Announcer;
@ -460,24 +461,13 @@ public class CalculatorActivity extends Activity implements FontSizeAdjuster, Sh
//Log.d(this.getClass().getName(), "Application was opened " + appOpenedCounter + " time!");
if (!dialogShown) {
if ( appOpenedCounter != null && appOpenedCounter > 10 ) {
final Boolean feedbackWindowShown = CalculatorPreferences.Gui.feedbackWindowShown.getPreference(preferences);
if ( feedbackWindowShown != null && !feedbackWindowShown ) {
final LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
final View view = layoutInflater.inflate(R.layout.feedback, null);
final TextView feedbackTextView = (TextView) view.findViewById(R.id.feedbackText);
feedbackTextView.setMovementMethod(LinkMovementMethod.getInstance());
final AlertDialog.Builder builder = new AlertDialog.Builder(this).setView(view);
builder.setPositiveButton(android.R.string.ok, null);
builder.create().show();
dialogShown = true;
CalculatorPreferences.Gui.feedbackWindowShown.putPreference(preferences, true);
}
dialogShown = showSpecialWindow(preferences, CalculatorPreferences.Gui.feedbackWindowShown, R.layout.feedback, R.id.feedbackText);
}
}
if ( !dialogShown ) {
dialogShown = showSpecialWindow(preferences, CalculatorPreferences.Gui.notesppAnnounceShown, R.layout.notespp_announce, R.id.notespp_announce);
}
ResourceCache.instance.init(R.id.class, this);
@ -485,7 +475,29 @@ public class CalculatorActivity extends Activity implements FontSizeAdjuster, Sh
}
}
@SuppressWarnings({"UnusedDeclaration"})
private boolean showSpecialWindow(@NotNull SharedPreferences preferences, @NotNull Preference<Boolean> specialWindowShownPref, int layoutId, int textViewId) {
boolean result = false;
final Boolean specialWindowShown = specialWindowShownPref.getPreference(preferences);
if ( specialWindowShown != null && !specialWindowShown ) {
final LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
final View view = layoutInflater.inflate(layoutId, null);
final TextView feedbackTextView = (TextView) view.findViewById(textViewId);
feedbackTextView.setMovementMethod(LinkMovementMethod.getInstance());
final AlertDialog.Builder builder = new AlertDialog.Builder(this).setView(view);
builder.setPositiveButton(android.R.string.ok, null);
builder.create().show();
result = true;
specialWindowShownPref.putPreference(preferences, true);
}
return result;
}
@SuppressWarnings({"UnusedDeclaration"})
public void elementaryButtonClickHandler(@NotNull View v) {
throw new UnsupportedOperationException("Not implemented yet!");
}

View File

@ -32,6 +32,7 @@ public final class CalculatorPreferences {
public static final Preference<Theme> theme = StringPreference.newInstance("org.solovyev.android.calculator.CalculatorActivity_calc_theme", Theme.metro_blue_theme, Theme.class);
public static final Preference<Layout> layout = StringPreference.newInstance("org.solovyev.android.calculator.CalculatorActivity_calc_layout", Layout.main_calculator, Layout.class);
public static final Preference<Boolean> feedbackWindowShown = new BooleanPreference("feedback_window_shown", false);
public static final Preference<Boolean> notesppAnnounceShown = new BooleanPreference("notespp_announce_shown", false);
public static final Preference<Boolean> showReleaseNotes = new BooleanPreference("org.solovyev.android.calculator.CalculatorActivity_show_release_notes", true);
public static final Preference<Boolean> usePrevAsBack = new BooleanPreference("org.solovyev.android.calculator.CalculatorActivity_use_back_button_as_prev", false);
public static final Preference<Boolean> showEqualsButton = new BooleanPreference("showEqualsButton", true);