-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sample project is updated. Gravity and Focus example fragments are ad…
…ded.
- Loading branch information
Showing
16 changed files
with
404 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
sample/src/main/java/co/mobiwise/sample/fragment/FocusFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package co.mobiwise.sample.fragment; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.Button; | ||
|
||
import co.mobiwise.materialintro.animation.MaterialIntroListener; | ||
import co.mobiwise.materialintro.shape.Focus; | ||
import co.mobiwise.materialintro.shape.FocusGravity; | ||
import co.mobiwise.materialintro.view.MaterialIntroView; | ||
import co.mobiwise.sample.R; | ||
|
||
/** | ||
* Created by mertsimsek on 31/01/16. | ||
*/ | ||
public class FocusFragment extends Fragment implements MaterialIntroListener{ | ||
|
||
private static final String INTRO_FOCUS_1 = "intro_focus_1"; | ||
private static final String INTRO_FOCUS_2 = "intro_focus_2"; | ||
private static final String INTRO_FOCUS_3 = "intro_focus_3"; | ||
|
||
Button button1; | ||
Button button2; | ||
Button button3; | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
View view = inflater.inflate(R.layout.fragment_focus, container, false); | ||
|
||
button1 = (Button) view.findViewById(R.id.button_focus_1); | ||
button2 = (Button) view.findViewById(R.id.button_focus_2); | ||
button3 = (Button) view.findViewById(R.id.button_focus_3); | ||
|
||
showIntro(button1,INTRO_FOCUS_1,"This intro view focus on all target.", Focus.ALL); | ||
|
||
return view; | ||
} | ||
|
||
public void showIntro(View view, String id, String text, Focus focusType){ | ||
new MaterialIntroView.Builder(getActivity()) | ||
.enableDotAnimation(false) | ||
.setFocusGravity(FocusGravity.CENTER) | ||
.setFocusType(focusType) | ||
.setDelayMillis(200) | ||
.enableFadeAnimation(true) | ||
.setListener(this) | ||
.performClick(true) | ||
.setInfoText(text) | ||
.setTarget(view) | ||
.setUsageId(id) //THIS SHOULD BE UNIQUE ID | ||
.show(); | ||
} | ||
|
||
@Override | ||
public void onUserClicked(String materialIntroViewId) { | ||
if(materialIntroViewId == INTRO_FOCUS_1) | ||
showIntro(button2,INTRO_FOCUS_2,"This intro view focus on minimum size", Focus.MINIMUM); | ||
else if(materialIntroViewId == INTRO_FOCUS_2) | ||
showIntro(button3,INTRO_FOCUS_3,"This intro view focus on normal size (avarage of MIN and ALL)", Focus.NORMAL); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
sample/src/main/java/co/mobiwise/sample/fragment/GravityFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package co.mobiwise.sample.fragment; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v7.widget.CardView; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
import co.mobiwise.materialintro.animation.MaterialIntroListener; | ||
import co.mobiwise.materialintro.shape.Focus; | ||
import co.mobiwise.materialintro.shape.FocusGravity; | ||
import co.mobiwise.materialintro.view.MaterialIntroView; | ||
import co.mobiwise.sample.R; | ||
|
||
/** | ||
* Created by mertsimsek on 31/01/16. | ||
*/ | ||
public class GravityFragment extends Fragment implements MaterialIntroListener{ | ||
|
||
private static final String INTRO_CARD1 = "intro_card_1"; | ||
private static final String INTRO_CARD2 = "intro_card_2"; | ||
private static final String INTRO_CARD3 = "intro_card_3"; | ||
|
||
CardView cardView1; | ||
CardView cardView2; | ||
CardView cardView3; | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
View view = inflater.inflate(R.layout.fragment_gravity, container, false); | ||
|
||
cardView1 = (CardView) view.findViewById(R.id.my_card); | ||
cardView2 = (CardView) view.findViewById(R.id.my_card2); | ||
cardView3 = (CardView) view.findViewById(R.id.my_card3); | ||
|
||
showIntro(cardView1, INTRO_CARD1, "This intro focuses on RIGHT", FocusGravity.RIGHT); | ||
|
||
return view; | ||
} | ||
|
||
@Override | ||
public void onUserClicked(String materialIntroViewId) { | ||
if(materialIntroViewId == INTRO_CARD1) | ||
showIntro(cardView2, INTRO_CARD2, "This intro focuses on CENTER.", FocusGravity.CENTER); | ||
if(materialIntroViewId == INTRO_CARD2) | ||
showIntro(cardView3, INTRO_CARD3, "This intro focuses on LEFT.", FocusGravity.LEFT); | ||
} | ||
|
||
public void showIntro(View view, String id, String text, FocusGravity focusGravity){ | ||
new MaterialIntroView.Builder(getActivity()) | ||
.enableDotAnimation(true) | ||
.setFocusGravity(focusGravity) | ||
.setFocusType(Focus.MINIMUM) | ||
.setDelayMillis(200) | ||
.enableFadeAnimation(true) | ||
.performClick(true) | ||
.setInfoText(text) | ||
.setTarget(view) | ||
.setListener(this) | ||
.setUsageId(id) //THIS SHOULD BE UNIQUE ID | ||
.show(); | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
sample/src/main/java/co/mobiwise/sample/fragment/MainFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package co.mobiwise.sample.fragment; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v7.widget.CardView; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.Button; | ||
|
||
import co.mobiwise.materialintro.prefs.PreferencesManager; | ||
import co.mobiwise.materialintro.shape.Focus; | ||
import co.mobiwise.materialintro.shape.FocusGravity; | ||
import co.mobiwise.materialintro.view.MaterialIntroView; | ||
import co.mobiwise.sample.R; | ||
|
||
/** | ||
* Created by mertsimsek on 31/01/16. | ||
*/ | ||
public class MainFragment extends Fragment implements View.OnClickListener{ | ||
|
||
private static final String INTRO_CARD = "material_intro"; | ||
private static final String INTRO_RESET_BUTTON = "material_reset"; | ||
|
||
private CardView cardView; | ||
private Button button; | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
View view = inflater.inflate(R.layout.content_main, container, false); | ||
cardView = (CardView) view.findViewById(R.id.my_card); | ||
button = (Button) view.findViewById(R.id.button_reset_all); | ||
button.setOnClickListener(this); | ||
|
||
//Show intro | ||
showIntro(cardView, INTRO_CARD, "This is card! Hello There. You can set this text!"); | ||
|
||
return view; | ||
} | ||
|
||
@Override | ||
public void onClick(View v) { | ||
int id = v.getId(); | ||
|
||
if(id == R.id.button_reset_all) | ||
new PreferencesManager(getActivity().getApplicationContext()).resetAll(); | ||
} | ||
|
||
private void showIntro(View view, String usageId, String text){ | ||
new MaterialIntroView.Builder(getActivity()) | ||
.enableDotAnimation(true) | ||
.setFocusGravity(FocusGravity.CENTER) | ||
.setFocusType(Focus.MINIMUM) | ||
.setDelayMillis(200) | ||
.enableFadeAnimation(true) | ||
.performClick(true) | ||
.setInfoText(text) | ||
.setTarget(view) | ||
.setUsageId(usageId) //THIS SHOULD BE UNIQUE ID | ||
.show(); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout android:id="@+id/container" | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:layout_behavior="@string/appbar_scrolling_view_behavior"> | ||
|
||
</FrameLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.