1
0
mirror of https://github.com/etesync/android synced 2025-01-11 00:01:12 +00:00

Main activity: Add a showcase for adding an account.

Turn it off by default if upgrading to this version, because this means
the user most likely already knows how to add an account.
This commit is contained in:
Tom Hacohen 2017-04-06 11:57:03 +01:00
parent f650d38435
commit cb140a3387
5 changed files with 53 additions and 1 deletions

View File

@ -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'

View File

@ -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 {

View File

@ -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

View File

@ -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;
}
}

View File

@ -16,6 +16,9 @@
<string name="please_wait">Please wait …</string>
<string name="send">Send</string>
<!-- tourguide -->
<string name="tourguide_title">Did you know?</string>
<!-- startup dialogs -->
<string name="startup_battery_optimization">Battery Optimization</string>
<string name="startup_battery_optimization_message">Android may disable/reduce EteSync synchronization after a few days. To prevent this, turn off battery optimization.</string>
@ -49,9 +52,10 @@
<string name="navigation_drawer_report_issue">Report issue</string>
<string name="navigation_drawer_contact">Contact developer</string>
<string name="account_list_empty">Welcome to EteSync!\n\nAdd an account to start.</string>
<string name="account_list_empty">Welcome to EteSync!</string>
<string name="accounts_global_sync_disabled">System-wide automatic synchronization is disabled</string>
<string name="accounts_global_sync_enable">Enable</string>
<string name="accounts_showcase_add">You need to add an account in order to use EteSync. Click here to add one...</string>
<!-- AccountUpdateService -->