Skip to content

Commit

Permalink
Integrated the Introduction activity in the app.
Browse files Browse the repository at this point in the history
  • Loading branch information
octacode committed Jul 6, 2017
1 parent 02f8ce3 commit 4475c17
Show file tree
Hide file tree
Showing 10 changed files with 235 additions and 2 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ dependencies {
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
maven { url 'http://dl.bintray.com/megabitdragon/maven' }
maven { url 'https://jitpack.io' }
}

def SUPPORT_LIBRARY_VERSION = "25.3.1"
Expand All @@ -116,6 +117,7 @@ dependencies {
compile 'com.jakewharton.timber:timber:4.5.1'
compile 'com.squareup.dagger:dagger:1.2.5'
compile 'com.squareup:otto:1.3.8'
compile 'com.github.apl-devs:appintro:v4.2.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.squareup.retrofit2:retrofit:2.2.0'
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
Expand All @@ -128,6 +130,7 @@ dependencies {
androidTestCompile 'com.android.support.test:runner:0.5'
androidTestCompile 'com.android.support:support-annotations:25.3.1'
provided 'com.squareup.dagger:dagger-compiler:1.2.5'
compile 'com.android.support:cardview-v7:25.3.1'
}

task generateWrapper(type: Wrapper) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@
<activity
android:name=".activity.SettingsActivity"
android:label="@string/title_settings"/>
<activity android:name=".activity.IntroductionActivity"
android:label="@string/intro_desc_phone_1"
android:theme="@style/Theme.AppCompat.NoActionBar"/>
<activity
android:name=".activity.AuthenticationActivity"
android:theme="@style/Theme.Amahi.Authentication"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2014 Amahi
*
* This file is part of Amahi.
*
* Amahi is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Amahi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Amahi. If not, see <http ://www.gnu.org/licenses/>.
*/

package org.amahi.anywhere.activity;

import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;

import com.github.paolorotolo.appintro.AppIntro;
import com.github.paolorotolo.appintro.AppIntroFragment;

import org.amahi.anywhere.R;
import org.amahi.anywhere.util.SampleSlide;

public class IntroductionActivity extends AppIntro {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addSlide(SampleSlide.newInstance(R.layout.intro_first_layout));
addSlide(AppIntroFragment.newInstance(getString(R.string.intro_title_2), getString(R.string.intro_desc_phone_2), R.drawable.network, ContextCompat.getColor(this, R.color.intro_2)));
addSlide(AppIntroFragment.newInstance(getString(R.string.intro_title_3), getString(R.string.intro_desc_phone_3), R.drawable.photos, Color.DKGRAY));
addSlide(AppIntroFragment.newInstance(getString(R.string.intro_title_4), getString(R.string.intro_desc_phone_4), R.drawable.music, ContextCompat.getColor(this, R.color.intro_4)));
addSlide(AppIntroFragment.newInstance(getString(R.string.intro_title_5), getString(R.string.intro_desc_phone_5), R.drawable.movies, ContextCompat.getColor(this, R.color.intro_5)));
addSlide(AppIntroFragment.newInstance(getString(R.string.intro_title_6), getString(R.string.intro_desc_6), R.drawable.tick, ContextCompat.getColor(this, R.color.intro_6)));
setFlowAnimation();
}

@Override
public void onDonePressed(Fragment currentFragment) {
super.onDonePressed(currentFragment);
launchTv();
}

@Override
public void onSkipPressed(Fragment currentFragment) {
super.onSkipPressed(currentFragment);
launchTv();
}

private void launchTv() {
startActivity(new Intent(this, NavigationActivity.class));
}
}
10 changes: 10 additions & 0 deletions src/main/java/org/amahi/anywhere/fragment/NavigationFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.amahi.anywhere.AmahiApplication;
import org.amahi.anywhere.R;
import org.amahi.anywhere.account.AmahiAccount;
import org.amahi.anywhere.activity.IntroductionActivity;
import org.amahi.anywhere.adapter.NavigationDrawerAdapter;
import org.amahi.anywhere.adapter.ServersAdapter;
import org.amahi.anywhere.bus.AppsSelectedEvent;
Expand Down Expand Up @@ -108,6 +109,8 @@ public View onCreateView(LayoutInflater layoutInflater, ViewGroup container, Bun
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);

launchIntro();

setUpInjections();

setUpSettingsMenu();
Expand All @@ -119,6 +122,13 @@ public void onActivityCreated(Bundle savedInstanceState) {
setUpServers(savedInstanceState);
}

private void launchIntro(){
if(Preferences.getFirstRun(getContext()) && !CheckTV.isATV(getContext())){
Preferences.setFirstRun(getContext());
startActivity(new Intent(getContext(), IntroductionActivity.class));
}
}

private void setUpInjections() {
AmahiApplication.from(getActivity()).inject(this);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
* Copyright (c) 2014 Amahi
*
* This file is part of Amahi.
*
* Amahi is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Amahi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Amahi. If not, see <http ://www.gnu.org/licenses/>.
*/

package org.amahi.anywhere.util;

/**
Expand Down
78 changes: 78 additions & 0 deletions src/main/java/org/amahi/anywhere/util/SampleSlide.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright (c) 2014 Amahi
*
* This file is part of Amahi.
*
* Amahi is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Amahi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Amahi. If not, see <http ://www.gnu.org/licenses/>.
*/

package org.amahi.anywhere.util;

import android.os.Bundle;
import android.support.annotation.ColorInt;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.github.paolorotolo.appintro.ISlideBackgroundColorHolder;

import org.amahi.anywhere.R;

public class SampleSlide extends Fragment implements ISlideBackgroundColorHolder {

private static final String ARG_LAYOUT_RES_ID = "layoutResId";
ViewGroup mContainer;
private int layoutResId;

public static SampleSlide newInstance(int layoutResId) {
SampleSlide sampleSlide = new SampleSlide();

Bundle args = new Bundle();
args.putInt(ARG_LAYOUT_RES_ID, layoutResId);
sampleSlide.setArguments(args);

return sampleSlide;
}

@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

if (getArguments() != null && getArguments().containsKey(ARG_LAYOUT_RES_ID)) {
layoutResId = getArguments().getInt(ARG_LAYOUT_RES_ID);
}
}

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
mContainer = container;
return inflater.inflate(layoutResId, container, false);
}

@Override
public int getDefaultBackgroundColor() {
return ContextCompat.getColor(getContext(), R.color.intro_1);
}

@Override
public void setBackgroundColor(@ColorInt int i) {
if (mContainer != null)
mContainer.setBackgroundColor(i);
}
}
Binary file added src/main/res/drawable-hdpi/photos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/main/res/drawable/photos.png
Binary file not shown.
50 changes: 50 additions & 0 deletions src/main/res/layout/intro_first_layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="90dp"
app:srcCompat="@drawable/ic_banner"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />

<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/imageView"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp"
android:layout_marginStart="40dp"
android:layout_marginEnd="40dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:padding="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/text_title"
android:gravity="center"
android:textSize="20sp"
android:textColor="@android:color/white"
android:text="@string/intro_phone_1"/>

<TextView
android:layout_below="@id/text_title"
android:padding="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="15sp"
android:text="@string/intro_desc_phone_1"/>
</RelativeLayout>
</android.support.v7.widget.CardView>


</RelativeLayout>
11 changes: 9 additions & 2 deletions src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,27 @@
<string name="row_apps">Apps</string>
<string name="row_preferences">Preferences</string>

<!--Introduction activity strings-->
<string name="intro_desc_1">Welcome to Amahi TV.</string>
<!--Introduction TV activity strings-->
<string name="intro_desc_1">Welcome to Amahi TV</string>
<string name="intro_phone_1">Welcome to Amahi</string>
<string name="intro_desc_phone_1">An android app that lets you access your files present in your HDA.</string>

<string name="intro_title_2">Access your HDA</string>
<string name="intro_desc_2">Amahi TV lets you access your HDA. Play your Videos, Listen to your music and yes! View your photos</string>
<string name="intro_desc_phone_2">Amahi lets you access your HDA. Play your Videos, Listen to your music and yes! View your photos</string>


<string name="intro_title_3">Watch your photos</string>
<string name="intro_desc_3">View all your photos backed in your HDA directly in your Android TV.</string>
<string name="intro_desc_phone_3">View all your photos backed in your HDA directly in your Android phone.</string>

<string name="intro_title_4">Listen to your music</string>
<string name="intro_desc_4">Listen to all of your songs backed in your HDA directly in your Android TV.</string>
<string name="intro_desc_phone_4">Listen to all of your songs backed in your HDA directly in your Android phone.</string>

<string name="intro_title_5">Play your videos</string>
<string name="intro_desc_5">Play Videos directly on your Android TV</string>
<string name="intro_desc_phone_5">Play Videos directly on your Android phone</string>

<string name="intro_title_6">Ready</string>
<string name="intro_desc_6">You\'re all set to go. Thanks for using Amahi.</string>
Expand Down

0 comments on commit 4475c17

Please sign in to comment.