Author: kmorin Date: 2014-03-29 12:23:32 +0100 (Sat, 29 Mar 2014) New Revision: 6 Url: http://forge.chorem.org/projects/say-my-texts/repository/revisions/6 Log: test Added: trunk/res/layout/ trunk/res/layout/say_my_texts_widget.xml trunk/res/xml/say_my_texts_widget_info.xml trunk/src/org/chorem/android/saymytexts/SayMyTextsWidgetProvider.java Removed: trunk/project.properties Modified: trunk/AndroidManifest.xml trunk/src/org/chorem/android/saymytexts/SettingsActivity.java trunk/src/site/fr/rst/dev.rst trunk/src/site/fr/rst/index.rst trunk/src/site/fr/rst/user.rst trunk/src/site/rst/dev.rst trunk/src/site/rst/index.rst trunk/src/site/rst/user.rst trunk/src/site/site_en.xml trunk/src/site/site_fr.xml Modified: trunk/AndroidManifest.xml =================================================================== --- trunk/AndroidManifest.xml 2014-03-28 21:42:08 UTC (rev 5) +++ trunk/AndroidManifest.xml 2014-03-29 11:23:32 UTC (rev 6) @@ -53,5 +53,13 @@ android:excludeFromRecents="true" android:finishOnTaskLaunch="true" /> + <receiver android:name=".SayMyTextsWidgetProvider" > + <intent-filter> + <action android:name="android.appwidget.action.APPWIDGET_UPDATE" /> + </intent-filter> + <meta-data android:name="android.appwidget.provider" + android:resource="@xml/say_my_texts_widget_info" /> + </receiver> + </application> </manifest> Deleted: trunk/project.properties =================================================================== --- trunk/project.properties 2014-03-28 21:42:08 UTC (rev 5) +++ trunk/project.properties 2014-03-29 11:23:32 UTC (rev 6) @@ -1,14 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -# Project target. -target=android-16 Added: trunk/res/layout/say_my_texts_widget.xml =================================================================== --- trunk/res/layout/say_my_texts_widget.xml (rev 0) +++ trunk/res/layout/say_my_texts_widget.xml 2014-03-29 11:23:32 UTC (rev 6) @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> + +<ImageButton xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/say_my_texts_widget_id" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:src="@drawable/logo_small"> + +</ImageButton> \ No newline at end of file Added: trunk/res/xml/say_my_texts_widget_info.xml =================================================================== --- trunk/res/xml/say_my_texts_widget_info.xml (rev 0) +++ trunk/res/xml/say_my_texts_widget_info.xml 2014-03-29 11:23:32 UTC (rev 6) @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="utf-8"?> + +<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" + android:minWidth="40dp" + android:minHeight="40dp" + android:updatePeriodMillis="0" + android:initialLayout="@layout/say_my_texts_widget" + android:resizeMode="none"> +</appwidget-provider> \ No newline at end of file Added: trunk/src/org/chorem/android/saymytexts/SayMyTextsWidgetProvider.java =================================================================== --- trunk/src/org/chorem/android/saymytexts/SayMyTextsWidgetProvider.java (rev 0) +++ trunk/src/org/chorem/android/saymytexts/SayMyTextsWidgetProvider.java 2014-03-29 11:23:32 UTC (rev 6) @@ -0,0 +1,57 @@ +package org.chorem.android.saymytexts; + +import android.app.PendingIntent; +import android.appwidget.AppWidgetManager; +import android.appwidget.AppWidgetProvider; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.preference.PreferenceManager; +import android.util.Log; +import android.widget.RemoteViews; + +/** + * @author Kevin Morin (Code Lutin) + * @since x.x + */ +public class SayMyTextsWidgetProvider extends AppWidgetProvider { + + private static final String TAG = "SayMyTextsWidgetProvider"; + + protected static final String CLICK_ACTION = "org.chorem.android.saymytexts.action.APPWIDGET_CLICKED"; + + public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { + final int N = appWidgetIds.length; + + // Perform this loop procedure for each App Widget that belongs to this provider + for (int i=0; i<N; i++) { + int appWidgetId = appWidgetIds[i]; + + // Create an Intent to call this onReceive method + Intent intent = new Intent(context, getClass()); + intent.setAction(CLICK_ACTION); + PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0); + + // Get the layout for the App Widget and attach an on-click listener + // to the button + RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.say_my_texts_widget); + views.setOnClickPendingIntent(R.id.say_my_texts_widget_id, pendingIntent); + + // Tell the AppWidgetManager to perform an update on the current app widget + appWidgetManager.updateAppWidget(appWidgetId, views); + } + } + + @Override + public void onReceive(Context context, Intent intent) { + super.onReceive(context, intent); + Log.d(TAG, "on receive " + intent.getAction()); + if (CLICK_ACTION.equals(intent.getAction())) { + SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(context); + String key = context.getString(R.string.preference_enable_reading_key); + boolean enabled = sharedPref.getBoolean(key, true); + Log.d(TAG, "enabled " + enabled); + sharedPref.edit().putBoolean(key, !enabled).commit(); + } + } +} Modified: trunk/src/org/chorem/android/saymytexts/SettingsActivity.java =================================================================== --- trunk/src/org/chorem/android/saymytexts/SettingsActivity.java 2014-03-28 21:42:08 UTC (rev 5) +++ trunk/src/org/chorem/android/saymytexts/SettingsActivity.java 2014-03-29 11:23:32 UTC (rev 6) @@ -28,12 +28,15 @@ import android.app.PendingIntent; import android.content.Context; import android.content.Intent; +import android.content.SharedPreferences; import android.database.Cursor; import android.media.AudioManager; import android.net.Uri; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceFragment; +import android.preference.PreferenceManager; +import android.preference.SwitchPreference; import android.speech.tts.TextToSpeech; import android.telephony.SmsManager; import android.telephony.TelephonyManager; @@ -61,7 +64,6 @@ .replace(android.R.id.content, new SettingsFragment()) .commit(); - Intent checkIntent = new Intent(); checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA); startActivityForResult(checkIntent, CHECK_TTS_REQUEST_CODE); @@ -100,6 +102,23 @@ }); } + @Override + public void onResume() { + super.onResume(); + + SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getActivity()); + + String key = getString(R.string.preference_enable_reading_key); + SwitchPreference enableReadingPref = (SwitchPreference) getPreferenceScreen().findPreference(key); + boolean enabled = sharedPref.getBoolean(key, enableReadingPref.isChecked()); + enableReadingPref.setChecked(enabled); + + key = getString(R.string.preference_enable_heisendroid_mode_key); + enableReadingPref = (SwitchPreference) getPreferenceScreen().findPreference(key); + enabled = sharedPref.getBoolean(key, enableReadingPref.isChecked()); + enableReadingPref.setChecked(enabled); + } + protected void sendSMS() { Context context = getActivity(); Modified: trunk/src/site/fr/rst/dev.rst =================================================================== --- trunk/src/site/fr/rst/dev.rst 2014-03-28 21:42:08 UTC (rev 5) +++ trunk/src/site/fr/rst/dev.rst 2014-03-29 11:23:32 UTC (rev 6) @@ -1,3 +1,26 @@ +.. - +.. * #%L +.. * Say My Texts +.. * $Id:$ +.. * $HeadURL:$ +.. * %% +.. * Copyright (C) 2014 Code Lutin +.. * %% +.. * This program is free software: you can redistribute it and/or modify +.. * it under the terms of the GNU General Public License as +.. * published by the Free Software Foundation, either version 3 of the +.. * License, or (at your option) any later version. +.. * +.. * This program is distributed in the hope that it will be useful, +.. * but WITHOUT ANY WARRANTY; without even the implied warranty of +.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.. * GNU General Public License for more details. +.. * +.. * You should have received a copy of the GNU General Public +.. * License along with this program. If not, see +.. * <http://www.gnu.org/licenses/gpl-3.0.html>. +.. * #L% +.. - Documentation développeur ######################### Modified: trunk/src/site/fr/rst/index.rst =================================================================== --- trunk/src/site/fr/rst/index.rst 2014-03-28 21:42:08 UTC (rev 5) +++ trunk/src/site/fr/rst/index.rst 2014-03-29 11:23:32 UTC (rev 6) @@ -1,3 +1,26 @@ +.. - +.. * #%L +.. * Say My Texts +.. * $Id:$ +.. * $HeadURL:$ +.. * %% +.. * Copyright (C) 2014 Code Lutin +.. * %% +.. * This program is free software: you can redistribute it and/or modify +.. * it under the terms of the GNU General Public License as +.. * published by the Free Software Foundation, either version 3 of the +.. * License, or (at your option) any later version. +.. * +.. * This program is distributed in the hope that it will be useful, +.. * but WITHOUT ANY WARRANTY; without even the implied warranty of +.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.. * GNU General Public License for more details. +.. * +.. * You should have received a copy of the GNU General Public +.. * License along with this program. If not, see +.. * <http://www.gnu.org/licenses/gpl-3.0.html>. +.. * #L% +.. - Bienvenue sur le site de Say My Texts ##################################### Modified: trunk/src/site/fr/rst/user.rst =================================================================== --- trunk/src/site/fr/rst/user.rst 2014-03-28 21:42:08 UTC (rev 5) +++ trunk/src/site/fr/rst/user.rst 2014-03-29 11:23:32 UTC (rev 6) @@ -1,3 +1,26 @@ +.. - +.. * #%L +.. * Say My Texts +.. * $Id:$ +.. * $HeadURL:$ +.. * %% +.. * Copyright (C) 2014 Code Lutin +.. * %% +.. * This program is free software: you can redistribute it and/or modify +.. * it under the terms of the GNU General Public License as +.. * published by the Free Software Foundation, either version 3 of the +.. * License, or (at your option) any later version. +.. * +.. * This program is distributed in the hope that it will be useful, +.. * but WITHOUT ANY WARRANTY; without even the implied warranty of +.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.. * GNU General Public License for more details. +.. * +.. * You should have received a copy of the GNU General Public +.. * License along with this program. If not, see +.. * <http://www.gnu.org/licenses/gpl-3.0.html>. +.. * #L% +.. - Documentation utilisateur ######################### Modified: trunk/src/site/rst/dev.rst =================================================================== --- trunk/src/site/rst/dev.rst 2014-03-28 21:42:08 UTC (rev 5) +++ trunk/src/site/rst/dev.rst 2014-03-29 11:23:32 UTC (rev 6) @@ -1,3 +1,26 @@ +.. - +.. * #%L +.. * Say My Texts +.. * $Id:$ +.. * $HeadURL:$ +.. * %% +.. * Copyright (C) 2014 Code Lutin +.. * %% +.. * This program is free software: you can redistribute it and/or modify +.. * it under the terms of the GNU General Public License as +.. * published by the Free Software Foundation, either version 3 of the +.. * License, or (at your option) any later version. +.. * +.. * This program is distributed in the hope that it will be useful, +.. * but WITHOUT ANY WARRANTY; without even the implied warranty of +.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.. * GNU General Public License for more details. +.. * +.. * You should have received a copy of the GNU General Public +.. * License along with this program. If not, see +.. * <http://www.gnu.org/licenses/gpl-3.0.html>. +.. * #L% +.. - Developer documentation ####################### Modified: trunk/src/site/rst/index.rst =================================================================== --- trunk/src/site/rst/index.rst 2014-03-28 21:42:08 UTC (rev 5) +++ trunk/src/site/rst/index.rst 2014-03-29 11:23:32 UTC (rev 6) @@ -1,3 +1,26 @@ +.. - +.. * #%L +.. * Say My Texts +.. * $Id:$ +.. * $HeadURL:$ +.. * %% +.. * Copyright (C) 2014 Code Lutin +.. * %% +.. * This program is free software: you can redistribute it and/or modify +.. * it under the terms of the GNU General Public License as +.. * published by the Free Software Foundation, either version 3 of the +.. * License, or (at your option) any later version. +.. * +.. * This program is distributed in the hope that it will be useful, +.. * but WITHOUT ANY WARRANTY; without even the implied warranty of +.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.. * GNU General Public License for more details. +.. * +.. * You should have received a copy of the GNU General Public +.. * License along with this program. If not, see +.. * <http://www.gnu.org/licenses/gpl-3.0.html>. +.. * #L% +.. - Welcome to Say My Texts website ############################### Modified: trunk/src/site/rst/user.rst =================================================================== --- trunk/src/site/rst/user.rst 2014-03-28 21:42:08 UTC (rev 5) +++ trunk/src/site/rst/user.rst 2014-03-29 11:23:32 UTC (rev 6) @@ -1,3 +1,26 @@ +.. - +.. * #%L +.. * Say My Texts +.. * $Id:$ +.. * $HeadURL:$ +.. * %% +.. * Copyright (C) 2014 Code Lutin +.. * %% +.. * This program is free software: you can redistribute it and/or modify +.. * it under the terms of the GNU General Public License as +.. * published by the Free Software Foundation, either version 3 of the +.. * License, or (at your option) any later version. +.. * +.. * This program is distributed in the hope that it will be useful, +.. * but WITHOUT ANY WARRANTY; without even the implied warranty of +.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.. * GNU General Public License for more details. +.. * +.. * You should have received a copy of the GNU General Public +.. * License along with this program. If not, see +.. * <http://www.gnu.org/licenses/gpl-3.0.html>. +.. * #L% +.. - User documentation ################## Modified: trunk/src/site/site_en.xml =================================================================== --- trunk/src/site/site_en.xml 2014-03-28 21:42:08 UTC (rev 5) +++ trunk/src/site/site_en.xml 2014-03-29 11:23:32 UTC (rev 6) @@ -1,27 +1,29 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Pollen - $Id: site_en.xml 3671 2012-09-04 14:06:07Z tchemit $ - $HeadURL: http://forge.chorem.org/svn-private/pollen/trunk/src/site/site_en.xml $ + Say My Texts + $Id:$ + $HeadURL:$ %% - Copyright (C) 2009 - 2012 CodeLutin + Copyright (C) 2014 Code Lutin %% This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. #L% --> + <project name="${project.name}"> <bannerLeft> Modified: trunk/src/site/site_fr.xml =================================================================== --- trunk/src/site/site_fr.xml 2014-03-28 21:42:08 UTC (rev 5) +++ trunk/src/site/site_fr.xml 2014-03-29 11:23:32 UTC (rev 6) @@ -1,27 +1,29 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- #%L - Pollen - $Id: site_fr.xml 3671 2012-09-04 14:06:07Z tchemit $ - $HeadURL: http://forge.chorem.org/svn-private/pollen/trunk/src/site/site_fr.xml $ + Say My Texts + $Id:$ + $HeadURL:$ %% - Copyright (C) 2009 - 2012 CodeLutin + Copyright (C) 2014 Code Lutin %% This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. #L% --> + <project name="${project.name}"> <bannerLeft>