Android Open Source - allblue-all-in-one Global Activity






From Project

Back to project page allblue-all-in-one.

License

The source code is released under:

MIT License

If you think the Android project allblue-all-in-one listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.allblue.activity;
/*from  w w  w.  ja  va2  s . c  om*/
import android.content.Context;
import android.util.Log;
import com.j256.ormlite.android.apptools.OrmLiteBaseActivity;
import com.j256.ormlite.dao.*;
import org.allblue.database.DatabaseHelper;
import org.allblue.metadata.*;

import java.sql.SQLException;

public class GlobalActivity extends OrmLiteBaseActivity<DatabaseHelper> {

    private static GlobalActivity INSTANCE;
    private static Context context;

    private GlobalActivity() {
        context = getApplicationContext();
    }

    private Context getContext() {
        return context;
    }

    public static Context getGlobalContext() {
        if (INSTANCE == null) {
            synchronized (GlobalActivity.class) {
                if (INSTANCE == null) {
                    INSTANCE = new GlobalActivity();
                }
            }
        }
        return INSTANCE.getContext();
    }

    public static Dao<Account, Integer> getAccountDao() {
        try {
            return INSTANCE.getHelper().getAccountDao();
        } catch (SQLException e) {
            Log.i(GlobalActivity.class.getName(), "Failed to get account dao", e);
            return null;
        }
    }

    public static Dao<TweetItem, Integer> getTweetItemDao() {
        try {
            return INSTANCE.getHelper().getTweetItemDao();
        } catch (SQLException e) {
            Log.i(GlobalActivity.class.getName(), "Failed to get tweetItem dao", e);
            return null;
        }
    }
}




Java Source Code List

org.allblue.DashBoard.java
org.allblue.activity.GlobalActivity.java
org.allblue.activity.HomeActivity.java
org.allblue.activity.OAuthActivity.java
org.allblue.activity.SettingActivity.java
org.allblue.activity.SingleTabActivity.java
org.allblue.adapter.SettingAdapter.java
org.allblue.adapter.SingleTabCursorAdapter.java
org.allblue.database.DatabaseConfig.java
org.allblue.database.DatabaseHelper.java
org.allblue.metadata.AccountTypes.java
org.allblue.metadata.Account.java
org.allblue.metadata.SinaAccount.java
org.allblue.metadata.TweetItem.java
org.allblue.metadata.TwitterAccount.java
org.allblue.util.OAuthUtil.java
org.allblue.util.SharedOAuthToken.java
org.allblue.util.XMLUtil.java