[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r176150019 --- Diff: app/src/main/res/layout/tutorial_slide3.xml --- @@ -0,0 +1,50 @@ + + + +http://schemas.android.com/apk/res/android; +android:layout_width="match_parent" +android:layout_height="match_parent" +android:background="@color/bg_screen3"> + + + + + +
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r176149524 --- Diff: app/src/main/res/layout/activity_tutorial.xml --- @@ -0,0 +1,66 @@ + + +http://schemas.android.com/apk/res/android; +xmlns:app="http://schemas.android.com/apk/res-auto; +xmlns:tools="http://schemas.android.com/tools; +android:layout_width="match_parent" +android:layout_height="match_parent" +tools:showIn="@layout/activity_tutorial"> + + + + + + + +
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r176149784 --- Diff: app/src/main/res/layout/tutorial_slide1.xml --- @@ -0,0 +1,48 @@ + + +http://schemas.android.com/apk/res/android; +android:layout_width="match_parent" +android:layout_height="match_parent" +android:background="@color/bg_screen1"> + + + + + +
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r176149908 --- Diff: app/src/main/res/layout/tutorial_slide2.xml --- @@ -0,0 +1,50 @@ + + +http://schemas.android.com/apk/res/android; +android:layout_width="match_parent" +android:layout_height="match_parent" +android:background="@color/bg_screen2"> + + + + + +
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r176150157 --- Diff: app/src/main/res/layout/tutorial_slide4.xml --- @@ -0,0 +1,50 @@ + + + +http://schemas.android.com/apk/res/android; +android:layout_width="match_parent" +android:layout_height="match_parent" +android:background="@color/bg_screen4"> + + + + + +
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173862548 --- Diff: app/src/main/AndroidManifest.xml --- @@ -37,14 +37,18 @@ limitations under the License. android:label="@string/app_name"> +android:name=".ui.tutorial.TutorialActivity" --- End diff -- But first show flash screen then tutorial. And manage first time launch in flash screen. ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user saketkumar95 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173773510 --- Diff: app/src/main/AndroidManifest.xml --- @@ -37,14 +37,18 @@ limitations under the License. android:label="@string/app_name"> +android:name=".ui.tutorial.TutorialActivity" --- End diff -- I have used the preference which checks if the app is first time launched or not. ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user saketkumar95 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173773226 --- Diff: app/src/main/AndroidManifest.xml --- @@ -37,14 +37,18 @@ limitations under the License. android:label="@string/app_name"> +android:name=".ui.tutorial.TutorialActivity" --- End diff -- I have used the preference which checks if the app is first time launched or not. ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173696290 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/tutorial/TutorialActivity.java --- @@ -0,0 +1,161 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.taverna.mobile.ui.tutorial; + +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.View; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.data.local.PreferencesHelper; +import org.apache.taverna.mobile.ui.FlashScreenActivity; +import org.apache.taverna.mobile.ui.adapter.TutorialSliderAdapter; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + + +public class TutorialActivity extends AppCompatActivity implements ViewPager.OnPageChangeListener { + +@BindView(R.id.slide_pager) +ViewPager slidePager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + +int[] layouts; +private PreferencesHelper preferencesHelper; + +@Override +protected void onCreate(Bundle savedInstanceState) { +super.onCreate(savedInstanceState); +preferencesHelper = new PreferencesHelper(this); +if (!preferencesHelper.isFirstTimeLaunch()) { +launchFlashScreen(); +finish(); +} + +setContentView(R.layout.activity_tutorial); + +ButterKnife.bind(this); + + +if (Build.VERSION.SDK_INT >= 21) { +getWindow().getDecorView() + .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE +| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); +} + +layouts = new int[]{ --- End diff -- use `TutorialSliderEnum` ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173696061 --- Diff: app/src/main/AndroidManifest.xml --- @@ -37,14 +37,18 @@ limitations under the License. android:label="@string/app_name"> +android:name=".ui.tutorial.TutorialActivity" --- End diff -- Launcher activity should be `FlashScreenActivity`. ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user saketkumar95 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173668561 --- Diff: app/src/main/AndroidManifest.xml --- @@ -19,63 +19,67 @@ See the License for the specific language governing permissions and limitations under the License. --> http://schemas.android.com/apk/res/android; - package="org.apache.taverna.mobile"> --- End diff -- Done! ð ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173627247 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/tutorial/TutorialActivity.java --- @@ -0,0 +1,200 @@ +package org.apache.taverna.mobile.ui.tutorial; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import android.content.Context; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.data.local.PreferencesHelper; +import org.apache.taverna.mobile.ui.FlashScreenActivity; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + + +public class TutorialActivity extends AppCompatActivity implements ViewPager.OnPageChangeListener { + +@BindView(R.id.slide_pager) +ViewPager slidePager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + +int[] layouts; +private PreferencesHelper preferencesHelper; + +@Override +protected void onCreate(Bundle savedInstanceState) { +super.onCreate(savedInstanceState); +preferencesHelper = new PreferencesHelper(this); +if (!preferencesHelper.isFirstTimeLaunch()) { +launchFlashScreen(); +finish(); +} + +setContentView(R.layout.activity_tutorial); + +ButterKnife.bind(this); + + +if (Build.VERSION.SDK_INT >= 21) { +getWindow().getDecorView() + .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE +| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); +} + +layouts = new int[]{ +R.layout.tutorial_slide1, +R.layout.tutorial_slide2, +R.layout.tutorial_slide3, +R.layout.tutorial_slide4}; + +addBottomDots(0); + +TutorialSliderAdapter tutorialSliderAdapter = new TutorialSliderAdapter(); +slidePager.setAdapter(tutorialSliderAdapter); +slidePager.addOnPageChangeListener(this); + +} + +@OnClick(R.id.btn_skip) +public void skipClick(View v) { +launchFlashScreen(); +} + +@OnClick(R.id.btn_next) +public void nextClick(View v) { +int current = getItem(+1); +if (current < layouts.length) { +slidePager.setCurrentItem(current); +} else { +launchFlashScreen(); +} +} + +public void addBottomDots(int currentPage) { +TextView[] dots = new TextView[layouts.length]; + +int[] colorsActive = getResources().getIntArray(R.array.array_dot_active); +int[] colorsInactive = getResources().getIntArray(R.array.array_dot_inactive); + +dotsLayout.removeAllViews(); +for (int i = 0; i < dots.length; i++) { +dots[i] = new TextView(this); +dots[i].setText(Html.fromHtml("")); +dots[i].setTextSize(35); +dots[i].setTextColor(colorsInactive[currentPage]); +dotsLayout.addView(dots[i]); +} + +if (dots.length > 0) +
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173627149 --- Diff: app/src/main/AndroidManifest.xml --- @@ -19,63 +19,67 @@ See the License for the specific language governing permissions and limitations under the License. --> http://schemas.android.com/apk/res/android; - package="org.apache.taverna.mobile"> --- End diff -- Revert all unwanted changes. Change only that line which is required ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173627173 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/tutorial/TutorialActivity.java --- @@ -0,0 +1,200 @@ +package org.apache.taverna.mobile.ui.tutorial; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import android.content.Context; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.data.local.PreferencesHelper; +import org.apache.taverna.mobile.ui.FlashScreenActivity; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + + +public class TutorialActivity extends AppCompatActivity implements ViewPager.OnPageChangeListener { + +@BindView(R.id.slide_pager) +ViewPager slidePager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + +int[] layouts; +private PreferencesHelper preferencesHelper; + +@Override +protected void onCreate(Bundle savedInstanceState) { +super.onCreate(savedInstanceState); +preferencesHelper = new PreferencesHelper(this); +if (!preferencesHelper.isFirstTimeLaunch()) { +launchFlashScreen(); +finish(); +} + +setContentView(R.layout.activity_tutorial); + +ButterKnife.bind(this); + + +if (Build.VERSION.SDK_INT >= 21) { +getWindow().getDecorView() + .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE +| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); +} + +layouts = new int[]{ +R.layout.tutorial_slide1, +R.layout.tutorial_slide2, +R.layout.tutorial_slide3, +R.layout.tutorial_slide4}; + +addBottomDots(0); + +TutorialSliderAdapter tutorialSliderAdapter = new TutorialSliderAdapter(); +slidePager.setAdapter(tutorialSliderAdapter); +slidePager.addOnPageChangeListener(this); + +} + +@OnClick(R.id.btn_skip) +public void skipClick(View v) { +launchFlashScreen(); +} + +@OnClick(R.id.btn_next) +public void nextClick(View v) { +int current = getItem(+1); +if (current < layouts.length) { +slidePager.setCurrentItem(current); +} else { +launchFlashScreen(); +} +} + +public void addBottomDots(int currentPage) { +TextView[] dots = new TextView[layouts.length]; + +int[] colorsActive = getResources().getIntArray(R.array.array_dot_active); +int[] colorsInactive = getResources().getIntArray(R.array.array_dot_inactive); + +dotsLayout.removeAllViews(); +for (int i = 0; i < dots.length; i++) { +dots[i] = new TextView(this); +dots[i].setText(Html.fromHtml("")); +dots[i].setTextSize(35); +dots[i].setTextColor(colorsInactive[currentPage]); +dotsLayout.addView(dots[i]); +} + +if (dots.length > 0) +
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173626750 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/tutorial/TutorialActivity.java --- @@ -0,0 +1,204 @@ +package org.apache.taverna.mobile.ui.tutorial; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import android.content.Context; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.data.local.PreferencesHelper; +import org.apache.taverna.mobile.ui.FlashScreenActivity; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + + +public class TutorialActivity extends AppCompatActivity { + +@BindView(R.id.view_pager) +ViewPager viewPager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + + +ViewPagerAdapter viewPagerAdapter; +TextView[] dots; +int[] layouts; +PreferencesHelper preferencesHelper; + +@Override +protected void onCreate(Bundle savedInstanceState) { +super.onCreate(savedInstanceState); +preferencesHelper = new PreferencesHelper(this); +if (!preferencesHelper.isFirstTimeLaunch()) { +launchFlashScreen(); +finish(); +} + +setContentView(R.layout.activity_tutorial); + +ButterKnife.bind(this); + + +if (Build.VERSION.SDK_INT >= 21) { +getWindow().getDecorView() + .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE +| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); +} + +layouts = new int[]{ +R.layout.tutorial_slide1, +R.layout.tutorial_slide2, +R.layout.tutorial_slide3, +R.layout.tutorial_slide4}; + +addBottomDots(0); + +viewPagerAdapter = new ViewPagerAdapter(); +viewPager.setAdapter(viewPagerAdapter); +viewPager.addOnPageChangeListener(viewPagerPageChangeListener); + +} + +@OnClick(R.id.btn_skip) +public void skipClick(View v) { +launchFlashScreen(); +} + +@OnClick(R.id.btn_next) +public void nextClick(View v) { +int current = getItem(+1); +if (current < layouts.length) { +viewPager.setCurrentItem(current); +} else { +launchFlashScreen(); +} +} + +public void addBottomDots(int currentPage) { +dots = new TextView[layouts.length]; + +int[] colorsActive = getResources().getIntArray(R.array.array_dot_active); +int[] colorsInactive = getResources().getIntArray(R.array.array_dot_inactive); + +dotsLayout.removeAllViews(); +for (int i = 0; i < dots.length; i++) { +dots[i] = new TextView(this); +dots[i].setText(Html.fromHtml("")); +dots[i].setTextSize(35); +dots[i].setTextColor(colorsInactive[currentPage]); +dotsLayout.addView(dots[i]); +} + +if (dots.length > 0) +dots[currentPage].setTextColor(colorsActive[currentPage]); +} + +
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173626652 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/tutorial/TutorialActivity.java --- @@ -0,0 +1,203 @@ +package org.apache.taverna.mobile.ui.tutorial; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import android.content.Context; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.data.local.PreferencesHelper; +import org.apache.taverna.mobile.ui.FlashScreenActivity; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + + +public class TutorialActivity extends AppCompatActivity { + +@BindView(R.id.slide_pager) +ViewPager slidePager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + +private TutorialSliderAdapter tutorialSliderAdapter; +int[] layouts; +private PreferencesHelper preferencesHelper; + +@Override +protected void onCreate(Bundle savedInstanceState) { +super.onCreate(savedInstanceState); +preferencesHelper = new PreferencesHelper(this); +if (!preferencesHelper.isFirstTimeLaunch()) { +launchFlashScreen(); +finish(); +} + +setContentView(R.layout.activity_tutorial); + +ButterKnife.bind(this); + + +if (Build.VERSION.SDK_INT >= 21) { +getWindow().getDecorView() + .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE +| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); +} + +layouts = new int[]{ +R.layout.tutorial_slide1, +R.layout.tutorial_slide2, +R.layout.tutorial_slide3, +R.layout.tutorial_slide4}; + +addBottomDots(0); + +tutorialSliderAdapter = new TutorialSliderAdapter(); +slidePager.setAdapter(tutorialSliderAdapter); +slidePager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { +@Override +public void onPageScrolled(int position, float positionOffset, + int positionOffsetPixels) { + +} + +@Override +public void onPageSelected(int position) { +addBottomDots(position); + +if (position == layouts.length - 1) { +bNext.setText(getString(R.string.start)); +bSkip.setVisibility(View.GONE); +} else { +bNext.setText(getString(R.string.next)); +bSkip.setVisibility(View.VISIBLE); +} + +} + +@Override +public void onPageScrollStateChanged(int state) { + +} +}); + +} + +@OnClick(R.id.btn_skip) +public void skipClick(View v) { +launchFlashScreen(); +} + +@OnClick(R.id.btn_next) +public void nextClick(View v) { +int current = getItem(+1); +if (current < layouts.length) {
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user saketkumar95 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173622568 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/tutorial/TutorialActivity.java --- @@ -0,0 +1,204 @@ +package org.apache.taverna.mobile.ui.tutorial; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import android.content.Context; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.data.local.PreferencesHelper; +import org.apache.taverna.mobile.ui.FlashScreenActivity; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + + +public class TutorialActivity extends AppCompatActivity { + +@BindView(R.id.view_pager) +ViewPager viewPager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + + +ViewPagerAdapter viewPagerAdapter; +TextView[] dots; +int[] layouts; +PreferencesHelper preferencesHelper; + +@Override +protected void onCreate(Bundle savedInstanceState) { +super.onCreate(savedInstanceState); +preferencesHelper = new PreferencesHelper(this); +if (!preferencesHelper.isFirstTimeLaunch()) { +launchFlashScreen(); +finish(); +} + +setContentView(R.layout.activity_tutorial); + +ButterKnife.bind(this); + + +if (Build.VERSION.SDK_INT >= 21) { +getWindow().getDecorView() + .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE +| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); +} + +layouts = new int[]{ +R.layout.tutorial_slide1, +R.layout.tutorial_slide2, +R.layout.tutorial_slide3, +R.layout.tutorial_slide4}; + +addBottomDots(0); + +viewPagerAdapter = new ViewPagerAdapter(); +viewPager.setAdapter(viewPagerAdapter); +viewPager.addOnPageChangeListener(viewPagerPageChangeListener); + +} + +@OnClick(R.id.btn_skip) +public void skipClick(View v) { +launchFlashScreen(); +} + +@OnClick(R.id.btn_next) +public void nextClick(View v) { +int current = getItem(+1); +if (current < layouts.length) { +viewPager.setCurrentItem(current); +} else { +launchFlashScreen(); +} +} + +public void addBottomDots(int currentPage) { +dots = new TextView[layouts.length]; + +int[] colorsActive = getResources().getIntArray(R.array.array_dot_active); +int[] colorsInactive = getResources().getIntArray(R.array.array_dot_inactive); + +dotsLayout.removeAllViews(); +for (int i = 0; i < dots.length; i++) { +dots[i] = new TextView(this); +dots[i].setText(Html.fromHtml("")); +dots[i].setTextSize(35); +dots[i].setTextColor(colorsInactive[currentPage]); +dotsLayout.addView(dots[i]); +} + +if (dots.length > 0) +dots[currentPage].setTextColor(colorsActive[currentPage]); +} + +
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user saketkumar95 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173622525 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/tutorial/TutorialActivity.java --- @@ -0,0 +1,204 @@ +package org.apache.taverna.mobile.ui.tutorial; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import android.content.Context; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.data.local.PreferencesHelper; +import org.apache.taverna.mobile.ui.FlashScreenActivity; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + + +public class TutorialActivity extends AppCompatActivity { + +@BindView(R.id.view_pager) +ViewPager viewPager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + + +ViewPagerAdapter viewPagerAdapter; +TextView[] dots; +int[] layouts; +PreferencesHelper preferencesHelper; + +@Override +protected void onCreate(Bundle savedInstanceState) { +super.onCreate(savedInstanceState); +preferencesHelper = new PreferencesHelper(this); +if (!preferencesHelper.isFirstTimeLaunch()) { +launchFlashScreen(); +finish(); +} + +setContentView(R.layout.activity_tutorial); + +ButterKnife.bind(this); + + +if (Build.VERSION.SDK_INT >= 21) { +getWindow().getDecorView() + .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE +| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); +} + +layouts = new int[]{ +R.layout.tutorial_slide1, +R.layout.tutorial_slide2, +R.layout.tutorial_slide3, +R.layout.tutorial_slide4}; + +addBottomDots(0); + +viewPagerAdapter = new ViewPagerAdapter(); +viewPager.setAdapter(viewPagerAdapter); +viewPager.addOnPageChangeListener(viewPagerPageChangeListener); + +} + +@OnClick(R.id.btn_skip) +public void skipClick(View v) { +launchFlashScreen(); +} + +@OnClick(R.id.btn_next) +public void nextClick(View v) { +int current = getItem(+1); +if (current < layouts.length) { +viewPager.setCurrentItem(current); +} else { +launchFlashScreen(); +} +} + +public void addBottomDots(int currentPage) { +dots = new TextView[layouts.length]; + +int[] colorsActive = getResources().getIntArray(R.array.array_dot_active); +int[] colorsInactive = getResources().getIntArray(R.array.array_dot_inactive); + +dotsLayout.removeAllViews(); +for (int i = 0; i < dots.length; i++) { +dots[i] = new TextView(this); +dots[i].setText(Html.fromHtml("")); +dots[i].setTextSize(35); +dots[i].setTextColor(colorsInactive[currentPage]); +dotsLayout.addView(dots[i]); +} + +if (dots.length > 0) +dots[currentPage].setTextColor(colorsActive[currentPage]); +} + +
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173370036 --- Diff: app/src/main/java/org/apache/taverna/mobile/data/local/PreferencesHelper.java --- @@ -65,10 +65,14 @@ private final SharedPreferences sharedPref; private Context mContext; +private SharedPreferences.Editor editor; --- End diff -- This variable is not needed ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173370197 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/tutorial/TutorialActivity.java --- @@ -0,0 +1,204 @@ +package org.apache.taverna.mobile.ui.tutorial; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import android.content.Context; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.data.local.PreferencesHelper; +import org.apache.taverna.mobile.ui.FlashScreenActivity; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + + +public class TutorialActivity extends AppCompatActivity { + +@BindView(R.id.view_pager) +ViewPager viewPager; --- End diff -- make it more meaningful. ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173370470 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/tutorial/TutorialActivity.java --- @@ -0,0 +1,204 @@ +package org.apache.taverna.mobile.ui.tutorial; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import android.content.Context; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.data.local.PreferencesHelper; +import org.apache.taverna.mobile.ui.FlashScreenActivity; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + + +public class TutorialActivity extends AppCompatActivity { + +@BindView(R.id.view_pager) +ViewPager viewPager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + + +ViewPagerAdapter viewPagerAdapter; +TextView[] dots; +int[] layouts; +PreferencesHelper preferencesHelper; --- End diff -- make it private. ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173370457 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/tutorial/TutorialActivity.java --- @@ -0,0 +1,204 @@ +package org.apache.taverna.mobile.ui.tutorial; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import android.content.Context; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.data.local.PreferencesHelper; +import org.apache.taverna.mobile.ui.FlashScreenActivity; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + + +public class TutorialActivity extends AppCompatActivity { + +@BindView(R.id.view_pager) +ViewPager viewPager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + + +ViewPagerAdapter viewPagerAdapter; +TextView[] dots; +int[] layouts; --- End diff -- make it private. ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173370869 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/tutorial/TutorialActivity.java --- @@ -0,0 +1,204 @@ +package org.apache.taverna.mobile.ui.tutorial; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import android.content.Context; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.data.local.PreferencesHelper; +import org.apache.taverna.mobile.ui.FlashScreenActivity; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + + +public class TutorialActivity extends AppCompatActivity { + +@BindView(R.id.view_pager) +ViewPager viewPager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + + +ViewPagerAdapter viewPagerAdapter; +TextView[] dots; +int[] layouts; +PreferencesHelper preferencesHelper; + +@Override +protected void onCreate(Bundle savedInstanceState) { +super.onCreate(savedInstanceState); +preferencesHelper = new PreferencesHelper(this); +if (!preferencesHelper.isFirstTimeLaunch()) { +launchFlashScreen(); +finish(); +} + +setContentView(R.layout.activity_tutorial); + +ButterKnife.bind(this); + + +if (Build.VERSION.SDK_INT >= 21) { +getWindow().getDecorView() + .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE +| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); +} + +layouts = new int[]{ +R.layout.tutorial_slide1, +R.layout.tutorial_slide2, +R.layout.tutorial_slide3, +R.layout.tutorial_slide4}; + +addBottomDots(0); + +viewPagerAdapter = new ViewPagerAdapter(); +viewPager.setAdapter(viewPagerAdapter); +viewPager.addOnPageChangeListener(viewPagerPageChangeListener); + +} + +@OnClick(R.id.btn_skip) +public void skipClick(View v) { +launchFlashScreen(); +} + +@OnClick(R.id.btn_next) +public void nextClick(View v) { +int current = getItem(+1); +if (current < layouts.length) { +viewPager.setCurrentItem(current); +} else { +launchFlashScreen(); +} +} + +public void addBottomDots(int currentPage) { +dots = new TextView[layouts.length]; + +int[] colorsActive = getResources().getIntArray(R.array.array_dot_active); +int[] colorsInactive = getResources().getIntArray(R.array.array_dot_inactive); + +dotsLayout.removeAllViews(); +for (int i = 0; i < dots.length; i++) { +dots[i] = new TextView(this); +dots[i].setText(Html.fromHtml("")); +dots[i].setTextSize(35); +dots[i].setTextColor(colorsInactive[currentPage]); +dotsLayout.addView(dots[i]); +} + +if (dots.length > 0) +dots[currentPage].setTextColor(colorsActive[currentPage]); +} + +
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173370231 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/tutorial/TutorialActivity.java --- @@ -0,0 +1,204 @@ +package org.apache.taverna.mobile.ui.tutorial; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import android.content.Context; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.data.local.PreferencesHelper; +import org.apache.taverna.mobile.ui.FlashScreenActivity; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + + +public class TutorialActivity extends AppCompatActivity { + +@BindView(R.id.view_pager) +ViewPager viewPager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + + +ViewPagerAdapter viewPagerAdapter; --- End diff -- make it Private and meaningful name. ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173370010 --- Diff: app/src/main/java/org/apache/taverna/mobile/data/local/PreferencesHelper.java --- @@ -157,6 +161,15 @@ private void setUserAvatar(String userAvatar) { sharedPref.edit().putString(PREF_KEY_USER_AVATAR, userAvatar).apply(); } +public void setFirstTimeLaunch(boolean isFirstTime) { +editor.putBoolean(IS_FIRST_TIME_LAUNCH, isFirstTime); --- End diff -- replace `editor` with `sharedPref.edit()` ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173370978 --- Diff: app/src/main/res/layout/activity_tutorial.xml --- @@ -0,0 +1,66 @@ + + +http://schemas.android.com/apk/res/android; +xmlns:app="http://schemas.android.com/apk/res-auto; +xmlns:tools="http://schemas.android.com/tools; +android:layout_width="match_parent" +android:layout_height="match_parent" +tools:showIn="@layout/activity_tutorial"> + + +
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173370378 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/tutorial/TutorialActivity.java --- @@ -0,0 +1,204 @@ +package org.apache.taverna.mobile.ui.tutorial; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import android.content.Context; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.data.local.PreferencesHelper; +import org.apache.taverna.mobile.ui.FlashScreenActivity; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + + +public class TutorialActivity extends AppCompatActivity { + +@BindView(R.id.view_pager) +ViewPager viewPager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + + +ViewPagerAdapter viewPagerAdapter; +TextView[] dots; --- End diff -- Can we make it local variable? ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173370826 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/tutorial/TutorialActivity.java --- @@ -0,0 +1,204 @@ +package org.apache.taverna.mobile.ui.tutorial; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import android.content.Context; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.data.local.PreferencesHelper; +import org.apache.taverna.mobile.ui.FlashScreenActivity; + +import butterknife.BindView; +import butterknife.ButterKnife; +import butterknife.OnClick; + + +public class TutorialActivity extends AppCompatActivity { + +@BindView(R.id.view_pager) +ViewPager viewPager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + + +ViewPagerAdapter viewPagerAdapter; +TextView[] dots; +int[] layouts; +PreferencesHelper preferencesHelper; + +@Override +protected void onCreate(Bundle savedInstanceState) { +super.onCreate(savedInstanceState); +preferencesHelper = new PreferencesHelper(this); +if (!preferencesHelper.isFirstTimeLaunch()) { +launchFlashScreen(); +finish(); +} + +setContentView(R.layout.activity_tutorial); + +ButterKnife.bind(this); + + +if (Build.VERSION.SDK_INT >= 21) { +getWindow().getDecorView() + .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE +| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); +} + +layouts = new int[]{ +R.layout.tutorial_slide1, +R.layout.tutorial_slide2, +R.layout.tutorial_slide3, +R.layout.tutorial_slide4}; + +addBottomDots(0); + +viewPagerAdapter = new ViewPagerAdapter(); +viewPager.setAdapter(viewPagerAdapter); +viewPager.addOnPageChangeListener(viewPagerPageChangeListener); + +} + +@OnClick(R.id.btn_skip) +public void skipClick(View v) { +launchFlashScreen(); +} + +@OnClick(R.id.btn_next) +public void nextClick(View v) { +int current = getItem(+1); +if (current < layouts.length) { +viewPager.setCurrentItem(current); +} else { +launchFlashScreen(); +} +} + +public void addBottomDots(int currentPage) { +dots = new TextView[layouts.length]; + +int[] colorsActive = getResources().getIntArray(R.array.array_dot_active); +int[] colorsInactive = getResources().getIntArray(R.array.array_dot_inactive); + +dotsLayout.removeAllViews(); +for (int i = 0; i < dots.length; i++) { +dots[i] = new TextView(this); +dots[i].setText(Html.fromHtml("")); +dots[i].setTextSize(35); +dots[i].setTextColor(colorsInactive[currentPage]); +dotsLayout.addView(dots[i]); +} + +if (dots.length > 0) +dots[currentPage].setTextColor(colorsActive[currentPage]); +} + +
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r173370104 --- Diff: app/src/main/java/org/apache/taverna/mobile/data/local/PreferencesHelper.java --- @@ -65,10 +65,14 @@ private final SharedPreferences sharedPref; private Context mContext; +private SharedPreferences.Editor editor; + +private static final String IS_FIRST_TIME_LAUNCH = "IsFirstTimeLaunch"; public PreferencesHelper(Context context) { sharedPref = PreferenceManager.getDefaultSharedPreferences(context); mContext = context; +editor = sharedPref.edit(); --- End diff -- remove and call it when it's needed ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r172019875 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/TutorialActivity.java --- @@ -0,0 +1,218 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.taverna.mobile.ui; + +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.utils.PreferencesManager; + +import butterknife.BindView; +import butterknife.ButterKnife; + +public class TutorialActivity extends AppCompatActivity { + +@BindView(R.id.view_pager) +ViewPager viewPager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + + +ViewPagerAdapter viewPagerAdapter; +TextView[] dots; +int[] layouts; +PreferencesManager preferencesManager; + +@Override +protected void onCreate(Bundle savedInstanceState) { +super.onCreate(savedInstanceState); +preferencesManager = new PreferencesManager(this); +if (!preferencesManager.isFirstTimeLaunch()) { +launchFlashScreen(); +finish(); +} + +setContentView(R.layout.activity_tutorial); + +ButterKnife.bind(this); + +if (Build.VERSION.SDK_INT >= 21) { +getWindow().getDecorView() + .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE +| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); +} + + +// layouts of all tutorial sliders +layouts = new int[]{ +R.layout.tutorial_slide1, +R.layout.tutorial_slide2, +R.layout.tutorial_slide3, +R.layout.tutorial_slide4}; + +addBottomDots(0); + +changeStatusBarColor(); + +viewPagerAdapter = new ViewPagerAdapter(); +viewPager.setAdapter(viewPagerAdapter); +viewPager.addOnPageChangeListener(viewPagerPageChangeListener); + +bSkip.setOnClickListener(new View.OnClickListener() { +@Override +public void onClick(View v) { +launchFlashScreen(); +} +}); + +bNext.setOnClickListener(new View.OnClickListener() { +@Override +public void onClick(View v) { +int current = getItem(+1); +if (current < layouts.length) { +viewPager.setCurrentItem(current); +} else { +launchFlashScreen(); +} +} +}); +} + +private void addBottomDots(int currentPage) { +dots = new TextView[layouts.length]; + +int[] colorsActive = getResources().getIntArray(R.array.array_dot_active); +int[] colorsInactive = getResources().getIntArray(R.array.array_dot_inactive); + +dotsLayout.removeAllViews(); +for (int i = 0; i < dots.length; i++) { +dots[i] = new TextView(this); +
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r172019762 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/TutorialActivity.java --- @@ -0,0 +1,218 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.taverna.mobile.ui; + +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.utils.PreferencesManager; + +import butterknife.BindView; +import butterknife.ButterKnife; + +public class TutorialActivity extends AppCompatActivity { + +@BindView(R.id.view_pager) +ViewPager viewPager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + + +ViewPagerAdapter viewPagerAdapter; +TextView[] dots; +int[] layouts; +PreferencesManager preferencesManager; + +@Override +protected void onCreate(Bundle savedInstanceState) { +super.onCreate(savedInstanceState); +preferencesManager = new PreferencesManager(this); +if (!preferencesManager.isFirstTimeLaunch()) { +launchFlashScreen(); +finish(); +} + +setContentView(R.layout.activity_tutorial); + +ButterKnife.bind(this); + +if (Build.VERSION.SDK_INT >= 21) { +getWindow().getDecorView() + .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE +| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); +} + + +// layouts of all tutorial sliders +layouts = new int[]{ +R.layout.tutorial_slide1, +R.layout.tutorial_slide2, +R.layout.tutorial_slide3, +R.layout.tutorial_slide4}; + +addBottomDots(0); + +changeStatusBarColor(); + +viewPagerAdapter = new ViewPagerAdapter(); +viewPager.setAdapter(viewPagerAdapter); +viewPager.addOnPageChangeListener(viewPagerPageChangeListener); + +bSkip.setOnClickListener(new View.OnClickListener() { +@Override +public void onClick(View v) { +launchFlashScreen(); +} +}); + +bNext.setOnClickListener(new View.OnClickListener() { --- End diff -- use '@OnClick' butterknife function ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r172019744 --- Diff: app/src/main/java/org/apache/taverna/mobile/ui/TutorialActivity.java --- @@ -0,0 +1,218 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.taverna.mobile.ui; + +import android.content.Context; +import android.content.Intent; +import android.graphics.Color; +import android.os.Build; +import android.os.Bundle; +import android.support.v4.view.PagerAdapter; +import android.support.v4.view.ViewPager; +import android.support.v7.app.AppCompatActivity; +import android.text.Html; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; +import android.widget.Button; +import android.widget.LinearLayout; +import android.widget.TextView; + +import org.apache.taverna.mobile.R; +import org.apache.taverna.mobile.utils.PreferencesManager; + +import butterknife.BindView; +import butterknife.ButterKnife; + +public class TutorialActivity extends AppCompatActivity { + +@BindView(R.id.view_pager) +ViewPager viewPager; + +@BindView(R.id.layoutDots) +LinearLayout dotsLayout; + +@BindView(R.id.btn_skip) +Button bSkip; + +@BindView(R.id.btn_next) +Button bNext; + + +ViewPagerAdapter viewPagerAdapter; +TextView[] dots; +int[] layouts; +PreferencesManager preferencesManager; + +@Override +protected void onCreate(Bundle savedInstanceState) { +super.onCreate(savedInstanceState); +preferencesManager = new PreferencesManager(this); +if (!preferencesManager.isFirstTimeLaunch()) { +launchFlashScreen(); +finish(); +} + +setContentView(R.layout.activity_tutorial); + +ButterKnife.bind(this); + +if (Build.VERSION.SDK_INT >= 21) { +getWindow().getDecorView() + .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE +| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); +} + + +// layouts of all tutorial sliders +layouts = new int[]{ +R.layout.tutorial_slide1, +R.layout.tutorial_slide2, +R.layout.tutorial_slide3, +R.layout.tutorial_slide4}; + +addBottomDots(0); + +changeStatusBarColor(); + +viewPagerAdapter = new ViewPagerAdapter(); +viewPager.setAdapter(viewPagerAdapter); +viewPager.addOnPageChangeListener(viewPagerPageChangeListener); + +bSkip.setOnClickListener(new View.OnClickListener() { --- End diff -- use `@OnClick` butterknife function. ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
Github user sagar15795 commented on a diff in the pull request: https://github.com/apache/incubator-taverna-mobile/pull/66#discussion_r172019667 --- Diff: app/src/main/java/org/apache/taverna/mobile/utils/PreferencesManager.java --- @@ -0,0 +1,50 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.taverna.mobile.utils; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.content.SharedPreferences; + + +public class PreferencesManager { --- End diff -- We are using `PreferencesHelper` to manage all shared preferences. Please use it only. ---
[GitHub] incubator-taverna-mobile pull request #66: Adds tutorial screens on first st...
GitHub user saketkumar95 opened a pull request: https://github.com/apache/incubator-taverna-mobile/pull/66 Adds tutorial screens on first start of the app This PR adds tutorial screens on first start of the app. - [x] Apply the `AndroidStyle.xml` style template to your code in Android Studio. - [x] Run the checks with `./gradlew check` to make sure you didn't break anything - [x] If you have multiple commits please combine them into one commit by squashing them. Here is the screenshots of all the slides. https://user-images.githubusercontent.com/21558765/36878077-5433d300-1de3-11e8-80ae-0ae7e379a483.png;> https://user-images.githubusercontent.com/21558765/36878079-54b405a2-1de3-11e8-9a0f-7501ba45da7f.png;> https://user-images.githubusercontent.com/21558765/36878080-54e790c0-1de3-11e8-926c-9eff65f92432.png;> https://user-images.githubusercontent.com/21558765/36878081-551c676e-1de3-11e8-960a-12beaa19001c.png;> You can merge this pull request into a Git repository by running: $ git pull https://github.com/saketkumar95/incubator-taverna-mobile tutorials Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-taverna-mobile/pull/66.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #66 commit e8e62cd9ccbcef29efff8597db551a23f4cfddd0 Author: saketkumar95Date: 2018-03-01T08:28:10Z Adds tutorial screens on first start of the app ---