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