cleanup after jackrabbit, releasing resources
[pub/Android/ownCloud.git] / src / eu / alefzero / owncloud / ui / activity / LandingActivity.java
index d4301d1..668f134 100644 (file)
@@ -17,6 +17,8 @@
  */\r
 package eu.alefzero.owncloud.ui.activity;\r
 \r
  */\r
 package eu.alefzero.owncloud.ui.activity;\r
 \r
+import com.actionbarsherlock.app.SherlockFragmentActivity;\r
+\r
 import android.accounts.Account;\r
 import android.accounts.AccountManager;\r
 import android.app.AlertDialog;\r
 import android.accounts.Account;\r
 import android.accounts.AccountManager;\r
 import android.app.AlertDialog;\r
@@ -25,7 +27,6 @@ import android.content.DialogInterface;
 import android.content.DialogInterface.OnClickListener;\r
 import android.content.Intent;\r
 import android.os.Bundle;\r
 import android.content.DialogInterface.OnClickListener;\r
 import android.content.Intent;\r
 import android.os.Bundle;\r
-import android.support.v4.app.FragmentActivity;\r
 import android.view.View;\r
 import android.widget.AdapterView;\r
 import android.widget.AdapterView.OnItemClickListener;\r
 import android.view.View;\r
 import android.widget.AdapterView;\r
 import android.widget.AdapterView.OnItemClickListener;\r
@@ -40,7 +41,7 @@ import eu.alefzero.owncloud.ui.adapter.LandingScreenAdapter;
  * @author Lennart Rosam\r
  * \r
  */\r
  * @author Lennart Rosam\r
  * \r
  */\r
-public class LandingActivity extends FragmentActivity implements OnClickListener, OnItemClickListener {\r
+public class LandingActivity extends SherlockFragmentActivity implements OnClickListener, OnItemClickListener {\r
 \r
        public static final int DIALOG_SETUP_ACCOUNT = 1;\r
        \r
 \r
        public static final int DIALOG_SETUP_ACCOUNT = 1;\r
        \r
@@ -49,19 +50,40 @@ public class LandingActivity extends FragmentActivity implements OnClickListener
                super.onCreate(savedInstanceState);\r
                setContentView(R.layout.main);\r
                \r
                super.onCreate(savedInstanceState);\r
                setContentView(R.layout.main);\r
                \r
-               // Fill the grid view that is only available in portrait mode\r
+               // Fill the grid view of the landing screen with icons\r
                GridView landingScreenItems = (GridView) findViewById(R.id.homeScreenGrid);\r
                GridView landingScreenItems = (GridView) findViewById(R.id.homeScreenGrid);\r
-               if(landingScreenItems != null){\r
-                       landingScreenItems.setAdapter(new LandingScreenAdapter(this));\r
-                       landingScreenItems.setOnItemClickListener(this);\r
-               }\r
+               landingScreenItems.setAdapter(new LandingScreenAdapter(this));\r
+               landingScreenItems.setOnItemClickListener(this);\r
                \r
                // Check, if there are ownCloud accounts\r
                if(!accountsAreSetup()){\r
                        showDialog(DIALOG_SETUP_ACCOUNT);\r
                \r
                // Check, if there are ownCloud accounts\r
                if(!accountsAreSetup()){\r
                        showDialog(DIALOG_SETUP_ACCOUNT);\r
+               } else {\r
+                       // Start device tracking service \r
+                       Intent locationServiceIntent = new Intent();\r
+                       locationServiceIntent.setAction("eu.alefzero.owncloud.location.LocationLauncher");\r
+                       sendBroadcast(locationServiceIntent);\r
                }\r
 \r
        }\r
                }\r
 \r
        }\r
+       \r
+       @Override\r
+       protected void onRestart() {\r
+               super.onRestart();\r
+               // Check, if there are ownCloud accounts\r
+               if(!accountsAreSetup()){\r
+                       showDialog(DIALOG_SETUP_ACCOUNT);\r
+               }\r
+       }\r
+\r
+       @Override\r
+       protected void onRestoreInstanceState(Bundle savedInstanceState) {\r
+               super.onRestoreInstanceState(savedInstanceState);\r
+               // Check, if there are ownCloud accounts\r
+               if(!accountsAreSetup()){\r
+                       showDialog(DIALOG_SETUP_ACCOUNT);\r
+               }\r
+       }\r
 \r
        @Override\r
        protected Dialog onCreateDialog(int id) {\r
 \r
        @Override\r
        protected Dialog onCreateDialog(int id) {\r
@@ -110,6 +132,7 @@ public class LandingActivity extends FragmentActivity implements OnClickListener
                if(intent != null ){\r
                        startActivity(intent);\r
                } else {\r
                if(intent != null ){\r
                        startActivity(intent);\r
                } else {\r
+                       // TODO: Implement all of this and make this text go away ;-)\r
                        Toast toast = Toast.makeText(this, "Not yet implemented!", Toast.LENGTH_SHORT);\r
                        toast.show();\r
                } \r
                        Toast toast = Toast.makeText(this, "Not yet implemented!", Toast.LENGTH_SHORT);\r
                        toast.show();\r
                } \r