Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Commit

Permalink
feat(walkthrough): add dot steps on walkthrough screen
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelje authored and ajsb85 committed Aug 18, 2017
1 parent d82c91d commit 011413c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 33 deletions.
Expand Up @@ -2,20 +2,22 @@

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import org.flyve.mdm.agent.core.walkthrough.WalkthroughModel;

/*
* Copyright © 2017 Teclib. All rights reserved.
*
* This file is part of flyve-mdm-android
* This file is part of flyve-mdm-android-agent
*
* flyve-mdm-android is a subproject of Flyve MDM. Flyve MDM is a mobile
* flyve-mdm-android-agent is a subproject of Flyve MDM. Flyve MDM is a mobile
* device management software.
*
* Flyve MDM is free software: you can redistribute it and/or
Expand All @@ -28,20 +30,24 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* ------------------------------------------------------------------------------
* @author rafaelhernandez
* @author Rafael Hernandez
* @date 17/8/17
* @copyright Copyright © 2017 Teclib. All rights reserved.
* @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
* @link https://github.com/flyve-mdm/flyve-mdm-android
* @link https://github.com/flyve-mdm/flyve-mdm-android-agent
* @link https://flyve-mdm.com
* ------------------------------------------------------------------------------
*/
public class FragmentSlideWalkthrough extends Fragment {

private WalkthroughModel walkthroughModel;
private int slides;
private int position;

public void config(WalkthroughModel walkthroughModel) {
public void config(WalkthroughModel walkthroughModel, int slides, int position) {
this.walkthroughModel = walkthroughModel;
this.slides = slides;
this.position = position;
}


Expand All @@ -52,13 +58,33 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
R.layout.fragment_walkthrough_step, container, false);

TextView txtMessage = (TextView) v.findViewById(R.id.txtMessage);
txtMessage.setText(walkthroughModel.getMessage());
txtMessage.setText(Html.fromHtml(walkthroughModel.getMessage()));

ImageView imgStep = (ImageView) v.findViewById(R.id.imgStep);
imgStep.setImageResource(walkthroughModel.getImage());

slideDots(v);

return v;
}

private void slideDots(ViewGroup v) {

LinearLayout ln = (LinearLayout) v.findViewById(R.id.lnSliders);

for(int i=0; i<this.slides; i++) {

ImageView img = new ImageView(FragmentSlideWalkthrough.this.getContext());
img.setPadding(7,0,7,0);
if(i==this.position) {
img.setImageResource(R.drawable.ic_dot_selected);
} else {
img.setImageResource(R.drawable.ic_dot);
}
ln.addView(img);
}

}


}
2 changes: 1 addition & 1 deletion app/src/main/java/org/flyve/mdm/agent/SplashActivity.java
Expand Up @@ -136,7 +136,7 @@ public ScreenSlidePagerAdapter(FragmentManager fm) {
@Override
public Fragment getItem(int position) {
FragmentSlideWalkthrough f = new FragmentSlideWalkthrough();
f.config(walkthrough.get(position));
f.config(walkthrough.get(position), walkthrough.size(), position);
return f;
}

Expand Down
29 changes: 3 additions & 26 deletions app/src/main/res/layout/fragment_walkthrough_step.xml
Expand Up @@ -43,46 +43,23 @@
android:gravity="center"
style="@style/regularText"
android:layout_below="@+id/imgBackground"
android:layout_above="@+id/sliders"
android:layout_above="@+id/lnSliders"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:textColor="@color/white"
/>


<LinearLayout
android:id="@+id/sliders"
android:id="@+id/lnSliders"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:padding="10dp"
android:orientation="horizontal"
>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_dot_selected"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
/>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_dot"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
/>

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_dot"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
/>

</LinearLayout>


Expand Down

0 comments on commit 011413c

Please sign in to comment.