Skip to content
Browse files

v2.3 final changes

  • Loading branch information...
1 parent 7cd7eb5 commit fb7cc4ec16830a8b6150c71899c676ae282ab11a Codeskraps committed Mar 18, 2013
View
3 README.rdoc
@@ -33,6 +33,9 @@ Install from Google Play
== ChangeLog
<b>v2.3</b>
* Redesign twitter feed
+* Update interval twitter setting
+* About welcome page on first launch moved to default launcher
+* Message to sign in to twitter
* Tweets are now save into database
* Character count in send tweet activity
View
9 res/layout/tweets.xml
@@ -9,6 +9,15 @@
android:layout_height="1dp"
android:background="#FF0000" />
+ <TextView
+ android:id="@+id/tws_signin"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical|center_horizontal"
+ android:text="@string/twi_signin"
+ android:textAppearance="@android:style/TextAppearance.Holo.Large"
+ android:textIsSelectable="false" />
+
<ListView
android:id="@+id/tws_lst"
android:layout_width="match_parent"
View
43 res/values/arrays.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string-array name="OnClick_entries">
+ <item>Do nothing</item>
+ <item>Open tweets feed</item>
+ <item>Update lo-lo status</item>
+ <item>Open widget settings</item>
+ <item>Open URL</item>
+ </string-array>
+ <string-array name="OnClick_values">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ </string-array>
+ <string-array name="interval_entries">
+ <item>5 minutes</item>
+ <item>15 minutes</item>
+ <item>Half hour</item>
+ <item>An hour</item>
+ </string-array>
+ <string-array name="interval_values">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ </string-array>
+ <string-array name="twitter_interval_entries">
+ <item>15 minutes</item>
+ <item>Half hour</item>
+ <item>An hour</item>
+ <item>2 hours</item>
+ </string-array>
+ <string-array name="twitter_interval_values">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ </string-array>
+
+</resources>
View
42 res/values/strings.xml
@@ -13,42 +13,11 @@
<string name="prefs24_summaryTwo">13:00</string>
<string name="prefsOnClick_title">On touch action</string>
<string name="prefsOnClick_dialogTitle">On touch action</string>
- <string name="prefsOnClick_summary">Choose what should be done when you touch the widget -</string>
-
- <string-array name="OnClick_entries">
- <item>Do nothing</item>
- <item>Open tweets feed</item>
- <item>Update lo-lo status</item>
- <item>Open widget settings</item>
- <item>Open URL</item>
- </string-array>
- <string-array name="OnClick_values">
- <item>0</item>
- <item>1</item>
- <item>2</item>
- <item>3</item>
- <item>4</item>
- </string-array>
-
<string name="prefsURL_title">URL</string>
<string name="prefsURL_summary">Set a Custom URL -</string>
<string name="prefsURL_default">091labs.com</string>
<string name="prefsInterval_title">Interval update</string>
- <string name="prefsInterval_dialogTitle">Interval update</string>
-
- <string-array name="interval_entries">
- <item>5 minutes</item>
- <item>15 minutes</item>
- <item>Half hour</item>
- <item>An hour</item>
- </string-array>
- <string-array name="interval_values">
- <item>0</item>
- <item>1</item>
- <item>2</item>
- <item>3</item>
- </string-array>
-
+ <string name="prefsTwitterInterval_title">Twitter interval update</string>
<string name="prefsCat_Info">Information</string>
<string name="prefsInfo_Title">091 Labs lo-lo v2.3</string>
<string name="prefsInfo_summary">GNU GPL License v3 &#8211; 2013</string>
@@ -63,7 +32,6 @@
<string name="no_network_title">No network available</string>
<string name="no_network_message">There is no network available. Please connect to a network and try again.</string>
<string name="required_fields">Required Fields</string>
- <string name="required_field">Required Field</string>
<string name="url_username_password_required">Please fill in all of the fields before submitting.</string>
<string name="error">Error</string>
<string name="no_site_error">Sorry, could not connect to the WordPress site. Please try again later.</string>
@@ -78,21 +46,15 @@
<string name="twi_dia_title">Error!</string>
<string name="twi_dia_ok">OK</string>
<string name="twi_dia_message">Something has gone wrong&#8230;</string>
-
- <!-- Tweet -->
<string name="twe_enter">Enter tweet here</string>
-
- <!-- Facebook -->
- <string name="fac_help">You got to sign in to Facebook using OAth and allow access to 091 Labs lo-lo app. Once you do it will give a code, come here and enter the code you are given.</string>
- <string name="fac_goto">Go to Facebook</string>
+ <string name="twi_signin">Sign in to Twitter</string>
<!-- Menu -->
<string name="men_setting">Settings</string>
<string name="men_tweet">Tweet</string>
<string name="men_refresh">Refresh</string>
<!-- About -->
- <string name="about_title">091 Labs lo-lo</string>
<string name="about_summary">About</string>
</resources>
View
10 res/xml/preferences.xml
@@ -26,7 +26,7 @@
<ListPreference
android:defaultValue="1"
- android:dialogTitle="@string/prefsInterval_dialogTitle"
+ android:dialogTitle="@string/prefsInterval_title"
android:entries="@array/interval_entries"
android:entryValues="@array/interval_values"
android:key="lstInterval"
@@ -41,6 +41,14 @@
<Preference
android:key="prefTwitterAccount"
android:title="Twitter account" />
+
+ <ListPreference
+ android:defaultValue="2"
+ android:dialogTitle="@string/prefsTwitterInterval_title"
+ android:entries="@array/twitter_interval_entries"
+ android:entryValues="@array/twitter_interval_values"
+ android:key="lstTwitterInterval"
+ android:title="@string/prefsTwitterInterval_title" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/prefsCat_Info" >
<Preference
View
1 src/com/codeskraps/lolo/home/AboutActivity.java
@@ -26,6 +26,7 @@ protected void onCreate(Bundle savedInstanceState) {
sb.append("091 Labs is a collaborative community space based in Galway City, Ireland. It is a shared physical space for any and all creative projects: art, woodwork, software, photography and electronics – to name but a few. Our aim is to provide Galway with a place for people to work and collaborate on creative projects, to learn and to share their knowledge. We welcome all skill levels and all creative ideas.<br /><br />");
sb.append("<h2><font color='red'>lo-lo</font></h2>");
sb.append("This is a way for members and the general public to know when the Labs are open or close. Labs on, labs off.<br /><br />");
+ sb.append("Now members can sign in to Twitter to see tweets and can also tweet from within the app.<br /><br />");
sb.append("<font color='#AAAAAA'>Website:</font> 091labs.com<br />");
sb.append("<font color='#AAAAAA'>Email:</font> info@091labs.com<br />");
String version = getString(R.string.prefsInfo_Title);
View
23 src/com/codeskraps/lolo/home/LoloApp.java
@@ -8,7 +8,10 @@
import android.app.Application;
import android.app.PendingIntent;
import android.content.Intent;
+import android.content.SharedPreferences;
+import android.preference.PreferenceManager;
+import com.codeskraps.lolo.misc.Constants;
import com.codeskraps.lolo.twitter.TwitterService;
@ReportsCrashes(formKey = "dC1lU3BVVGh4ejlQSTJta05pNXBPQVE6MQ")
@@ -24,11 +27,29 @@ public void onCreate() {
data = new DataBase(this);
+ setTwitterAlarm();
+ }
+
+ public void setTwitterAlarm() {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ String intervalTwitter = prefs.getString(Constants.TWITTER_INTERVAL, "2");
+ int intTwitter = Integer.parseInt(intervalTwitter);
+
+ long interval = 0;
+ // @formatter:off
+ switch(intTwitter){
+ case 0: interval = AlarmManager.INTERVAL_HALF_HOUR / 2; break;
+ case 1: interval = AlarmManager.INTERVAL_HALF_HOUR; break;
+ case 2: interval = AlarmManager.INTERVAL_HOUR; break;
+ case 3: interval = AlarmManager.INTERVAL_HOUR * 2; break;
+ }
+ // @formatter:on
+
Intent intent = new Intent(this, TwitterService.class);
PendingIntent pendingIntent = PendingIntent.getService(this, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager am = (AlarmManager) getSystemService(Activity.ALARM_SERVICE);
- am.setInexactRepeating(AlarmManager.RTC, 0, AlarmManager.INTERVAL_HALF_HOUR, pendingIntent);
+ am.setInexactRepeating(AlarmManager.RTC, 0, interval, pendingIntent);
}
public DataBase getDataBase() {
View
22 src/com/codeskraps/lolo/home/PrefsActivity.java
@@ -114,9 +114,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
private CheckBoxPreference chkSync = null;
private CheckBoxPreference chk24 = null;
private ListPreference lstInterval = null;
+ private ListPreference lstTwitterInterval = null;
private String[] entries_OnClick = null;
private String[] entries_Interval = null;
+ private String[] entries_TwitterInterval = null;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -130,6 +132,8 @@ public void onCreate(Bundle savedInstanceState) {
entries_OnClick = getResources().getStringArray(R.array.OnClick_entries);
entries_Interval = getResources().getStringArray(R.array.interval_entries);
+ entries_TwitterInterval = getResources().getStringArray(
+ R.array.twitter_interval_entries);
lstOnClick = (ListPreference) findPreference(Constants.ONCLICK);
eURL = (EditTextPreference) findPreference(Constants.EURL);
@@ -140,6 +144,7 @@ public void onCreate(Bundle savedInstanceState) {
// .setOnPreferenceClickListener(this);
((Preference) findPreference(Constants.TWITTER_ACCOUNT))
.setOnPreferenceClickListener(this);
+ lstTwitterInterval = (ListPreference) findPreference(Constants.TWITTER_INTERVAL);
((Preference) findPreference(Constants.ABOUT)).setOnPreferenceClickListener(this);
}
@@ -171,12 +176,9 @@ public void onResume() {
if (action != 3) eURL.setEnabled(false);
- if (prefs.getBoolean(Constants.FIRST_LAUNCH, true)) {
- startActivity(new Intent(getActivity(), AboutActivity.class));
- SharedPreferences.Editor editor = prefs.edit();
- editor.putBoolean(Constants.FIRST_LAUNCH, false);
- editor.commit();
- }
+ String intervalTwitter = prefs.getString(Constants.TWITTER_INTERVAL, "2");
+ int intTwitter = Integer.parseInt(intervalTwitter);
+ lstTwitterInterval.setSummary(entries_TwitterInterval[intTwitter]);
}
@Override
@@ -213,6 +215,14 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin
String intervalString = prefs.getString(Constants.INTERVAL, "1");
int interval = Integer.parseInt(intervalString);
lstInterval.setSummary(entries_Interval[interval]);
+
+ } else if (key.equals(Constants.TWITTER_INTERVAL)) {
+ String intervalTwitter = prefs.getString(Constants.TWITTER_INTERVAL, "2");
+ int intTwitter = Integer.parseInt(intervalTwitter);
+ lstTwitterInterval.setSummary(entries_TwitterInterval[intTwitter]);
+
+ LoloApp app = (LoloApp) getActivity().getApplication();
+ app.setTwitterAlarm();
}
}
View
1 src/com/codeskraps/lolo/misc/Constants.java
@@ -20,6 +20,7 @@ private Constants() {}
public static final String INTERVAL = "lstInterval";
public static final String WORDPRESS_ACOUNT = "prefWordPressAccount";
public static final String TWITTER_ACCOUNT = "prefTwitterAccount";
+ public static final String TWITTER_INTERVAL = "lstTwitterInterval";
public static final String ABOUT = "prefAbout";
public static final String FIRST_LAUNCH = "firstLaunch";
public static final String RSS_TITLE = "rsstitle";
View
14 src/com/codeskraps/lolo/twitter/TweetsFeedActivity.java
@@ -11,10 +11,12 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.SharedPreferences;
import android.database.Cursor;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
+import android.preference.PreferenceManager;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@@ -29,6 +31,7 @@
import android.widget.TextView;
import com.codeskraps.lolo.R;
+import com.codeskraps.lolo.home.AboutActivity;
import com.codeskraps.lolo.home.DataBase;
import com.codeskraps.lolo.home.LoloApp;
import com.codeskraps.lolo.home.PrefsActivity;
@@ -62,6 +65,17 @@ protected void onResume() {
IntentFilter filter = new IntentFilter(Constants.ACTION_REFRESH);
registerReceiver(refreshReceiver, filter);
+
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+ if (prefs.getBoolean(Constants.FIRST_LAUNCH, true)) {
+ startActivity(new Intent(this, AboutActivity.class));
+ SharedPreferences.Editor editor = prefs.edit();
+ editor.putBoolean(Constants.FIRST_LAUNCH, false);
+ editor.commit();
+ }
+
+ String token = prefs.getString(Constants.ACCESS_TOKEN, null);
+ if (token != null) ((TextView) findViewById(R.id.tws_signin)).setVisibility(View.GONE);
}
@Override

0 comments on commit fb7cc4e

Please sign in to comment.
Something went wrong with that request. Please try again.