@@ -0,0 +1,126 @@
package com.projects.mocks.mocks;

import android.content.Intent;
import android.content.SharedPreferences;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import com.projects.mocks.fragments.ScreenSlidePageFragment;

public class FirstTimeRunActivity extends FragmentActivity
{

ViewPager mImageViewPager;
PagerAdapter mPagerAdapter;
private static final int NUM_PAGES =5;

SharedPreferences settings;
SharedPreferences.Editor editor;

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first_time_run);

mImageViewPager = (ViewPager)findViewById(R.id.pager);
mImageViewPager.setPageTransformer(true, new ZoomOutPageTransformer());
mPagerAdapter = new ScreenSlidePagerAdapter(getSupportFragmentManager());
mImageViewPager.setAdapter(mPagerAdapter);
TabLayout tabLayout = (TabLayout)findViewById(R.id.tabDots);
tabLayout.setupWithViewPager(mImageViewPager, true);

}

@Override
public void onBackPressed() {
if (mImageViewPager.getCurrentItem() == 0) {
// If the user is currently looking at the first step, allow the system to handle the
// Back button. This calls finish() on this activity and pops the back stack.
super.onBackPressed();
} else {
// Otherwise, select the previous step.
mImageViewPager.setCurrentItem(mImageViewPager.getCurrentItem() - 1);
}
}

public void onClickGo(View view)
{
//will have to do stuff like name checking and stuff here before we set the "firstRun" preference to false;

settings = getSharedPreferences("settings", CONTEXT_RESTRICTED);
editor = settings.edit();
editor.putBoolean("firstRun", false);
editor.commit();

Intent i = new Intent(this, MainActivity.class);
startActivity(i);
}

private class ScreenSlidePagerAdapter extends FragmentStatePagerAdapter
{
public ScreenSlidePagerAdapter(FragmentManager fm) {
super(fm);
}

@Override
public Fragment getItem(int position)
{
if(position < 4)
return new ScreenSlidePageFragment();
return new FinalIntroFragment();
}

@Override
public int getCount() {
return NUM_PAGES;
}
}

public class ZoomOutPageTransformer implements ViewPager.PageTransformer {
private static final float MIN_SCALE = 0.85f;
private static final float MIN_ALPHA = 0.5f;

public void transformPage(View view, float position) {
int pageWidth = view.getWidth();
int pageHeight = view.getHeight();

if (position < -1) { // [-Infinity,-1)
// This page is way off-screen to the left.
view.setAlpha(0);

} else if (position <= 1) { // [-1,1]
// Modify the default slide transition to shrink the page as well
float scaleFactor = Math.max(MIN_SCALE, 1 - Math.abs(position));
float vertMargin = pageHeight * (1 - scaleFactor) / 2;
float horzMargin = pageWidth * (1 - scaleFactor) / 2;
if (position < 0) {
view.setTranslationX(horzMargin - vertMargin / 2);
} else {
view.setTranslationX(-horzMargin + vertMargin / 2);
}

// Scale the page down (between MIN_SCALE and 1)
view.setScaleX(scaleFactor);
view.setScaleY(scaleFactor);

// Fade the page relative to its size.
view.setAlpha(MIN_ALPHA +
(scaleFactor - MIN_SCALE) /
(1 - MIN_SCALE) * (1 - MIN_ALPHA));

} else { // (1,+Infinity]
// This page is way off-screen to the right.
view.setAlpha(0);
}
}
}
}
@@ -3,6 +3,7 @@
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Bundle;
@@ -61,6 +62,7 @@ public class MainActivity extends AppCompatActivity
public static NavigationView navigationView;
//TODO: Make sure that when you move to a new fragment you stop certain fragments
SharedPreferences settings;
SharedPreferences.Editor editor;

//this might need to be static?
public static DBAdapter db;
@@ -69,6 +71,7 @@ protected void onCreate(Bundle savedInstanceState)
{

settings = getSharedPreferences("settings", CONTEXT_RESTRICTED);
editor = settings.edit();

if(settings.getBoolean("theme", false)){
setTheme(R.style.AppThemeDark);
@@ -81,12 +84,14 @@ protected void onCreate(Bundle savedInstanceState)
setContentView(R.layout.activity_main);


//if(settings.getBoolean("firstRun", true))
//{
if(settings.getBoolean("firstRun", true))
{
//do stuff if the application is running the first time, such as do the showy showy for the swipe activity, and get their name and poerty level and shit
//}
//else
//{
Intent i = new Intent(this, FirstTimeRunActivity.class);
startActivity(i);
}
else
{
//do database maintenance if needed.
db = new DBAdapter(this);

@@ -110,7 +115,7 @@ protected void onCreate(Bundle savedInstanceState)
Log.d("IO Excepton", e.getMessage());
}
//end of database maintenance
//}
}


fm = getFragmentManager();
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:innerRadius="0dp"
android:shape="ring"
android:thickness="3dp"
android:useLevel="false">
<solid android:color="@android:color/darker_gray"/>
</shape>
</item>
</layer-list>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
android:innerRadius="0dp"
android:shape="ring"
android:thickness="5dp"
android:useLevel="false">
<solid android:color="@color/colorAccent"/>
</shape>
</item>
</layer-list>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/tab_indicator_seleced"
android:state_selected="true"/>

<item android:drawable="@drawable/tab_indicator_default"/>
</selector>
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.projects.mocks.mocks.FirstTimeRunActivity"
android:background="#212121">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent">

</android.support.v4.view.ViewPager>

<android.support.design.widget.TabLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/tabDots"
android:layout_alignParentBottom="true"
app:tabBackground="@drawable/tab_selector"
app:tabGravity="center"
app:tabIndicatorHeight="0dp"
/>
</RelativeLayout>
@@ -44,7 +44,7 @@
<RadioGroup
android:id="@+id/rdogrp"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:layout_marginLeft="8dp"
@@ -53,16 +53,15 @@
android:layout_alignParentEnd="true">

<RadioButton
android:id="@+id/rtbnDay"
android:id="@+id/rbtnDay"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="match_parent"
android:layout_margin="0dp"
android:button="@null"
android:checked="true"
android:gravity="center"
android:text="Day"
android:onClick="onChangePeriod" />
/>

<RadioButton
android:id="@+id/rbtnWeek"
@@ -73,18 +72,18 @@
android:button="@null"
android:gravity="center"
android:text="Week"
android:onClick="onChangePeriod" />
/>

<RadioButton
android:id="@+id/rtbnMonth"
android:id="@+id/rbtnMonth"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="match_parent"
android:layout_margin="0dp"
android:button="@null"
android:gravity="center"
android:text="Month"
android:onClick="onChangePeriod" />
/>

<RadioButton
android:id="@+id/rbtnYear"
@@ -95,19 +94,18 @@
android:button="@null"
android:gravity="center"
android:text="Year"
android:onClick="onChangePeriod" />
/>

<RadioButton
android:id="@+id/rtbnFiveYear"
android:id="@+id/rbtnFiveYear"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="match_parent"
android:layout_margin="0dp"
android:button="@null"
android:checked="true"
android:gravity="center"
android:text="5 Years"
android:onClick="onChangePeriod" />
/>
</RadioGroup>

<TextView
@@ -140,7 +138,7 @@
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_below="@+id/DetailsCompany"
android:layout_alignParentStart="true"></com.github.mikephil.charting.charts.LineChart>
android:layout_alignParentStart="true"/>

<TextView
android:id="@+id/DetailsHigh"
@@ -169,7 +167,7 @@
android:layout_height="wrap_content"
android:id="@+id/DetailsInvest"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
android:layout_centerHorizontal="true"/>

</RelativeLayout>

@@ -0,0 +1,22 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.projects.mocks.mocks.FinalIntroFragment">

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:text="Start!"
android:backgroundTint="@color/colorPrimary"
android:textColor="@color/colorWhite"
android:background="@drawable/primary"
style="@style/FillButton"
android:onClick="onClickGo"
android:layout_marginBottom="49dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"/>

</RelativeLayout>
@@ -0,0 +1,17 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.projects.mocks.fragments.ScreenSlidePageFragment">

<!-- TODO: Update blank fragment layout -->
<TextView
style="?android:textAppearanceLarge"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="20dp"
android:paddingStart="20dp"
android:text="@string/hello_blank_fragment"
android:textColor="#fff"/>

</FrameLayout>