Permalink
Browse files

Twitter done

  • Loading branch information...
Codeskraps
Codeskraps committed Mar 17, 2013
1 parent 88bb1b8 commit ce95ca390429dfe7dba2fa011ecce78110069f69
View
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.codeskraps.lolo"
- android:versionCode="22"
- android:versionName="2.1.1" >
+ android:versionCode="23"
+ android:versionName="2.2" >
<!-- Remember to update the info code version -->
View
@@ -4,7 +4,7 @@
* <b>Git:</b> https://github.com/091labs/lo-lo
* <b>Author:</b> 091 Labs members
* <b>License:</b> GNU GPL v3
-* <b>Latest Version:</b> 2.0
+* <b>Latest Version:</b> 2.2
* <b>Release Date:</b> 2013
== General Infromation
@@ -31,6 +31,9 @@ Install from Google Play
* http://play.google.com/store/apps/details?id=com.codeskraps.lolo
== ChangeLog
+<b>v2.2</b>
+* New Twitter feed
+
<b>v2.1.1</b>
* Bug Fix
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
@@ -10,29 +10,55 @@
android:layout_height="40dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
- android:layout_marginRight="5dp"
- android:layout_marginTop="5dp"
+ android:layout_marginRight="10dp"
+ android:layout_marginTop="10dp"
android:contentDescription="@string/contentDescription" />
<LinearLayout
- android:layout_width="wrap_content"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="1dp"
+ android:layout_marginRight="10dp"
+ android:layout_marginTop="4dp"
+ android:orientation="horizontal" >
+
+ <TextView
+ android:id="@+id/tws_row_txt_user"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="5dp"
+ android:textIsSelectable="false" />
+
+ <TextView
+ android:id="@+id/tws_row_txt_screen_name"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textIsSelectable="false" />
+ </LinearLayout>
+
<TextView
- android:id="@+id/tws_row_txt_user"
+ android:id="@+id/tws_row_txt_created"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="5dp"
+ android:layout_marginBottom="1dp"
android:layout_marginRight="10dp"
+ android:layout_marginTop="1dp"
+ android:gravity="right"
android:textIsSelectable="false" />
- <TextView
+ <WebView
android:id="@+id/tws_row_txt_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_marginBottom="6dp"
android:layout_marginRight="10dp"
- android:textIsSelectable="false" />
+ android:background="#dcdcdc"
+ android:textIsSelectable="true" />
</LinearLayout>
</LinearLayout>
View
@@ -10,14 +10,25 @@
android:layout_height="1dp"
android:background="#FF0000" />
+ <TextView
+ android:id="@+id/twe_txt_count"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_marginRight="10dp"
+ android:layout_marginTop="10dp"
+ android:gravity="right"
+ android:textIsSelectable="false" />
+
<EditText
android:id="@+id/twe_etxt_data"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_margin="10dp"
android:gravity="top"
android:hint="@string/twe_enter"
- android:inputType="text" />
+ android:inputType="textMultiLine"
+ android:lines="10"
+ android:singleLine="false" />
<TextView
android:id="@+id/twe_txt_feedback"
View
@@ -12,6 +12,7 @@
<ListView
android:id="@+id/tws_lst"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ android:divider="@android:color/transparent" />
</LinearLayout>
@@ -1,5 +1,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
+ <item
+ android:id="@+id/men_refresh"
+ android:icon="@drawable/navigation_refresh"
+ android:showAsAction="always"
+ android:title="@string/men_refresh"/>
<item
android:id="@+id/men_tweet"
android:icon="@drawable/social_send_now"
@@ -8,7 +13,8 @@
<item
android:id="@+id/men_settings"
android:icon="@drawable/action_settings"
- android:showAsAction="always"
+ android:orderInCategory="100"
+ android:showAsAction="ifRoom"
android:title="@string/men_setting"/>
</menu>
View
@@ -89,6 +89,7 @@
<!-- 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>
@@ -0,0 +1,88 @@
+package com.codeskraps.lolo.home;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+import android.util.Log;
+
+public class DataBase {
+ private static final String TAG = DataBase.class.getSimpleName();
+
+ public static final String DB_TABLE_TWITTER = "twitter";
+ public static final String DB_TABLE_TABS = "tabs";
+
+ public static final String C_TWEET_ID = "tweet_id";
+ public static final String C_TWEET_CREATED = "tweet_created";
+ public static final String C_TWEET_IMAGE = "tweet_image";
+ public static final String C_TWEET_NAME = "tweet_name";
+ public static final String C_TWEET_SCREEN = "tweet_screen";
+ public static final String C_TWEET_TEXT = "tweet_text";
+
+ private Context context;
+ private DbHelper dbHelper;
+
+ public DataBase(Context context) {
+ this.context = context;
+ dbHelper = new DbHelper();
+ }
+
+ public void close() {
+ dbHelper.close();
+ }
+
+ public void insert(String table, TweetItem tweetItem) {
+
+ ContentValues values = new ContentValues();
+ values.put(C_TWEET_ID, tweetItem.getId());
+ values.put(C_TWEET_CREATED, tweetItem.getCreated());
+ values.put(C_TWEET_IMAGE, tweetItem.getImgUser());
+ values.put(C_TWEET_NAME, tweetItem.getTxtUser());
+ values.put(C_TWEET_SCREEN, tweetItem.getTxtScreenName());
+ values.put(C_TWEET_TEXT, tweetItem.getText());
+
+ SQLiteDatabase db = dbHelper.getWritableDatabase();
+ db.insertWithOnConflict(table, null, values, SQLiteDatabase.CONFLICT_IGNORE);
+ db.close();
+ }
+
+ public Cursor query(String table) {
+ SQLiteDatabase db = dbHelper.getReadableDatabase();
+
+ return db.query(table, null, null, null, null, null, C_TWEET_CREATED + " DESC", "500");
+ }
+
+ public void deleteTable(String table) {
+ SQLiteDatabase db = dbHelper.getWritableDatabase();
+ db.delete(table, null, null);
+ db.close();
+ }
+
+ private class DbHelper extends SQLiteOpenHelper {
+ public static final String DB_NAME = "sBrowserDB.db";
+ public static final int DB_VERSION = 2;
+
+ public DbHelper() {
+ super(context, DB_NAME, null, DB_VERSION);
+ }
+
+ @Override
+ public void onCreate(SQLiteDatabase db) {
+ String sql = String
+ .format("create table %s (%s VARCHAR(18) primary key, %s text, %s text, %s text, %s text, %s text)",
+ DB_TABLE_TWITTER, C_TWEET_ID, C_TWEET_CREATED, C_TWEET_IMAGE,
+ C_TWEET_NAME, C_TWEET_SCREEN, C_TWEET_TEXT);
+ db.execSQL(sql);
+ }
+
+ @Override
+ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+ db.execSQL("drop table if exists " + DB_TABLE_TWITTER);
+ Log.d(TAG, "onUpdate dropped tables " + DB_TABLE_TWITTER);
+
+ this.onCreate(db);
+ }
+ }
+
+}
@@ -3,20 +3,41 @@
import org.acra.ACRA;
import org.acra.annotation.ReportsCrashes;
-import com.codeskraps.lolo.twitter.TwitterService;
-
+import android.app.Activity;
+import android.app.AlarmManager;
import android.app.Application;
+import android.app.PendingIntent;
import android.content.Intent;
+import com.codeskraps.lolo.twitter.TwitterService;
+
@ReportsCrashes(formKey = "dC1lU3BVVGh4ejlQSTJta05pNXBPQVE6MQ")
public class LoloApp extends Application {
+ private DataBase data = null;
+
@Override
public void onCreate() {
// The following line triggers the initialization of ACRA
ACRA.init(this);
super.onCreate();
- startService(new Intent(this, TwitterService.class));
+ data = new DataBase(this);
+
+ 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);
+ }
+
+ public DataBase getDataBase() {
+ return data;
+ }
+
+ @Override
+ public void onTerminate() {
+ super.onTerminate();
+ data.close();
}
}
@@ -0,0 +1,78 @@
+package com.codeskraps.lolo.home;
+
+public class TweetItem {
+
+ private String id;
+ private String created;
+ private String ImgUser;
+ private String text;
+ private String txtUser;
+ private String txtScreenName;
+
+ public TweetItem(String created, String ImgUser, String text, String txtUser,
+ String txtScreenName) {
+ this.created = created;
+ this.ImgUser = ImgUser;
+ this.text = text;
+ this.txtUser = txtUser;
+ this.txtScreenName = txtScreenName;
+ }
+
+ public TweetItem(String id, String created, String ImgUser, String text, String txtUser,
+ String txtScreenName) {
+ this.created = created;
+ this.id = id;
+ this.ImgUser = ImgUser;
+ this.text = text;
+ this.txtUser = txtUser;
+ this.txtScreenName = txtScreenName;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getCreated() {
+ return created;
+ }
+
+ public void setCreated(String created) {
+ this.created = created;
+ }
+
+ public String getImgUser() {
+ return ImgUser;
+ }
+
+ public void setImgUser(String imgUser) {
+ ImgUser = imgUser;
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public String getTxtUser() {
+ return txtUser;
+ }
+
+ public void setTxtUser(String txtUser) {
+ this.txtUser = txtUser;
+ }
+
+ public String getTxtScreenName() {
+ return txtScreenName;
+ }
+
+ public void setTxtScreenName(String txtScreenName) {
+ this.txtScreenName = txtScreenName;
+ }
+}
@@ -10,6 +10,7 @@ private Constants() {}
public static final String FORCE_WIDGET_UPDATE = "com.codeskraps.lolo.FORCE_WIDGET_UPDATE";
public static final String BROADCAST_RECEIVER = "com.codeskraps.lolo.BROADCAST_RECEIVER";
public static final String CONFIGURE_ACTION = "android.appwidget.action.APPWIDGET_CONFIGURE";
+ public static final String ACTION_REFRESH = "com.codeskraps.lolo.action.REFRESH";
public static final String ONCLICK = "lstOnClick";
public static final String EURL = "eURL";
Oops, something went wrong.

0 comments on commit ce95ca3

Please sign in to comment.