diff --git a/app/build.gradle b/app/build.gradle index 17269820..5e7533dd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -126,6 +126,9 @@ dependencies { compile 'com.android.support:preference-v14:25.+' compile 'com.github.yukuku:ambilwarna:2.0.1' + compile ('com.github.worker8:tourguide:1.0.17-SNAPSHOT@aar'){ + transitive=true + } compile 'io.requery:requery:1.2.0' compile 'io.requery:requery-android:1.2.0' diff --git a/app/src/main/java/com/etesync/syncadapter/App.java b/app/src/main/java/com/etesync/syncadapter/App.java index 3c23658f..1bb9f6c7 100644 --- a/app/src/main/java/com/etesync/syncadapter/App.java +++ b/app/src/main/java/com/etesync/syncadapter/App.java @@ -44,6 +44,8 @@ import com.etesync.syncadapter.model.ServiceDB; import com.etesync.syncadapter.model.Settings; import com.etesync.syncadapter.resource.LocalAddressBook; import com.etesync.syncadapter.resource.LocalCalendar; +import com.etesync.syncadapter.ui.AccountsActivity; +import com.etesync.syncadapter.utils.HintManager; import net.fortuna.ical4j.util.UidGenerator; @@ -289,6 +291,10 @@ public class App extends Application { } } } + + if (fromVersion < 10) { + HintManager.setHintSeen(this, AccountsActivity.HINT_ACCOUNT_ADD, true); + } } public static class AppUpdatedReceiver extends BroadcastReceiver { diff --git a/app/src/main/java/com/etesync/syncadapter/ui/AccountsActivity.java b/app/src/main/java/com/etesync/syncadapter/ui/AccountsActivity.java index 6b8a34bf..6d5ac4a1 100644 --- a/app/src/main/java/com/etesync/syncadapter/ui/AccountsActivity.java +++ b/app/src/main/java/com/etesync/syncadapter/ui/AccountsActivity.java @@ -21,6 +21,7 @@ import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; +import android.view.Gravity; import android.view.MenuItem; import android.view.View; import android.widget.Toast; @@ -28,12 +29,20 @@ import android.widget.Toast; import com.etesync.syncadapter.Constants; import com.etesync.syncadapter.R; import com.etesync.syncadapter.ui.setup.LoginActivity; +import com.etesync.syncadapter.utils.HintManager; +import com.etesync.syncadapter.utils.ShowcaseBuilder; + +import tourguide.tourguide.Overlay; +import tourguide.tourguide.Pointer; +import tourguide.tourguide.ToolTip; +import tourguide.tourguide.TourGuide; import static android.content.ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS; import static com.etesync.syncadapter.BuildConfig.DEBUG; import static com.etesync.syncadapter.Constants.serviceUrl; public class AccountsActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, SyncStatusObserver { + public static final HintManager.Hint HINT_ACCOUNT_ADD = HintManager.registerHint("AddAccount"); private Snackbar syncStatusSnackbar; private Object syncStatusObserver; @@ -77,6 +86,13 @@ public class AccountsActivity extends AppCompatActivity implements NavigationVie } PermissionsActivity.requestAllPermissions(this); + + if (!HintManager.getHintSeen(this, HINT_ACCOUNT_ADD)) { + ShowcaseBuilder.getBuilder(this) + .setToolTip(new ToolTip().setTitle(getString(R.string.tourguide_title)).setDescription(getString(R.string.accounts_showcase_add)).setGravity(Gravity.TOP | Gravity.LEFT)) + .playOn(fab); + HintManager.setHintSeen(this, HINT_ACCOUNT_ADD, true); + } } @Override diff --git a/app/src/main/java/com/etesync/syncadapter/utils/ShowcaseBuilder.java b/app/src/main/java/com/etesync/syncadapter/utils/ShowcaseBuilder.java new file mode 100644 index 00000000..3f47b499 --- /dev/null +++ b/app/src/main/java/com/etesync/syncadapter/utils/ShowcaseBuilder.java @@ -0,0 +1,23 @@ +package com.etesync.syncadapter.utils; + +import android.app.Activity; +import android.view.View; + +import tourguide.tourguide.Overlay; +import tourguide.tourguide.Pointer; +import tourguide.tourguide.TourGuide; + +public class ShowcaseBuilder { + public static TourGuide getBuilder(Activity activity) { + final TourGuide ret = TourGuide.init(activity).with(TourGuide.Technique.Click) + .setPointer(new Pointer()); + ret.setOverlay(new Overlay().setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + ret.cleanUp(); + } + })); + + return ret; + } +} diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0a3d2488..b181b505 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -16,6 +16,9 @@ Please wait … Send + + Did you know? + Battery Optimization Android may disable/reduce EteSync synchronization after a few days. To prevent this, turn off battery optimization. @@ -49,9 +52,10 @@ Report issue Contact developer - Welcome to EteSync!\n\nAdd an account to start. + Welcome to EteSync! System-wide automatic synchronization is disabled Enable + You need to add an account in order to use EteSync. Click here to add one...