Add Material ShowcaseView

This commit is contained in:
David-Development 2015-09-20 03:41:53 +02:00
parent 3dd689a015
commit a3494eef6d
8 changed files with 55 additions and 12 deletions

3
.gitmodules vendored
View file

@ -7,3 +7,6 @@
[submodule "custom-tabs-client"]
path = custom-tabs-client
url = https://github.com/GoogleChrome/custom-tabs-client
[submodule "MaterialShowcaseView"]
path = MaterialShowcaseView
url = https://github.com/David-Development/MaterialShowcaseView.git

View file

@ -48,7 +48,6 @@ android {
dependencies {
// core android studio module
//compile project(':core')
// You must install or update the Google Repository through the SDK manager to use this dependency.
// The Google Repository (separate from the corresponding library) can be found in the Extras category.
// compile 'com.google.android.gms:play-services:4.2.42'
@ -69,14 +68,10 @@ dependencies {
compile 'de.greenrobot:greendao:2.0.0'
compile 'de.greenrobot:greendao-generator:2.0.0'
//compile 'org.freemarker:freemarker:2.3.23' //Required for DAO generation
compile 'org.apache.commons:commons-lang3:3.4'
testCompile 'org.robolectric:robolectric:3.0-rc3'
testCompile 'junit:junit:4.+'
androidTestCompile 'com.android.support:support-annotations:23.0.1'
androidTestCompile 'com.android.support.test:runner:0.3'
androidTestCompile 'com.android.support.test:rules:0.3'
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2'
@ -88,4 +83,5 @@ dependencies {
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'recyclerview-v7'
}
compile project(':MaterialShowcaseView:library')
}

View file

@ -34,6 +34,7 @@ import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
@ -83,6 +84,9 @@ import de.luhmer.owncloudnewsreader.services.DownloadImagesService;
import de.luhmer.owncloudnewsreader.services.IOwnCloudSyncService;
import de.luhmer.owncloudnewsreader.services.IOwnCloudSyncServiceCallback;
import de.luhmer.owncloudnewsreader.services.OwnCloudSyncService;
import uk.co.deanwild.materialshowcaseview.MaterialShowcaseSequence;
import uk.co.deanwild.materialshowcaseview.MaterialShowcaseView;
import uk.co.deanwild.materialshowcaseview.ShowcaseConfig;
/**
* An activity representing a list of NewsReader. This activity has different
@ -171,6 +175,8 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
reloadCountNumbersOfSlidingPaneAdapter();
syncState();
showTapLogoToSyncShowcaseView();
}
};
@ -211,6 +217,21 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
UpdateButtonLayout();
}
private void showTapLogoToSyncShowcaseView() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
NewsReaderListFragment nlf = getSlidingListFragment();
new MaterialShowcaseView.Builder(NewsReaderListActivity.this)
.setTarget(nlf.headerLogo)
.setDismissText("GOT IT")
.setContentText("Tap this logo to sync with ownCloud")
.setDelay(300) // optional but starting animations immediately in onCreate can make them choppy
.singleUse("LOGO_SYNC") // provide a unique ID used to ensure it is only shown once
.show();
}
}
View.OnClickListener mSnackbarListener = new View.OnClickListener()
{
@Override
@ -319,6 +340,11 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
super.onPostCreate(savedInstanceState);
if(drawerToggle != null)
drawerToggle.syncState();
boolean tabletSize = getResources().getBoolean(R.bool.isTablet);
if (tabletSize) {
showTapLogoToSyncShowcaseView();
}
}
@Override
@ -468,6 +494,19 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
* @return true if new items count was greater than 0
*/
private boolean syncFinishedHandler() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
ShowcaseConfig config = new ShowcaseConfig();
config.setDelay(300); // half second between each showcase view
MaterialShowcaseSequence sequence = new MaterialShowcaseSequence(this, "SWIPE_LEFT_RIGHT_AND_PTR");
sequence.setConfig(config);
sequence.addSequenceItem(getNewsReaderDetailFragment().pbLoading,
"Pull-to-Refresh to sync with ownCloud", "GOT IT");
sequence.addSequenceItem(getNewsReaderDetailFragment().pbLoading,
"Swipe Left/Right to mark article as read", "GOT IT");
sequence.start();
}
NewsReaderListFragment newsReaderListFragment = getSlidingListFragment();
newsReaderListFragment.ReloadAdapter();
UpdateItemList();

View file

@ -434,10 +434,8 @@ public class PodcastFragmentActivity extends AppCompatActivity implements IPlayP
if(sliding_layout.getPanelState().equals(SlidingUpPanelLayout.PanelState.EXPANDED)) { //On Tablets
animateToPosition(podcastMediaControlHeightDp);
} else if(isLeftSliderOpen)
} else if(isLeftSliderOpen) {
animateToPosition(0);
else if(sliding_layout.getPanelState().equals(SlidingUpPanelLayout.PanelState.EXPANDED)) {
animateToPosition(podcastMediaControlHeightDp);
} else {
animateToPosition(64);
}

View file

@ -39,8 +39,8 @@
android:ellipsize="end" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="48dp"
android:layout_height="48dp"
android:id="@+id/header_logo"
android:layout_alignBottom="@+id/urlTextView"
android:layout_alignParentLeft="true"

View file

@ -0,0 +1,3 @@
<resources>
<bool name="isTablet">true</bool>
</resources>

View file

@ -0,0 +1,3 @@
<resources>
<bool name="isTablet">false</bool>
</resources>

View file

@ -1,5 +1,6 @@
include ':News-Android-App', ':ownCloud-Account-Importer'
include ':Changeloglib:ChangeLogLibrary'
include ':MaterialShowcaseView:library'
include 'customtabs'
project(':customtabs').projectDir = new File(settingsDir, './custom-tabs-client/customtabs')
project(':customtabs').projectDir = new File(settingsDir, './custom-tabs-client/customtabs')