Skip to content

Commit

Permalink
Merge pull request #5 from Ville2000/develop
Browse files Browse the repository at this point in the history
Merge develop branch to master for the final release
  • Loading branch information
Ville Haapavaara authored May 10, 2017
2 parents da2e135 + 8ab6131 commit b1e1b43
Show file tree
Hide file tree
Showing 31 changed files with 1,531 additions and 238 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/build
/captures
.externalNativeBuild
/app/app-release.apk
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ dependencies {
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:24.2.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
testCompile 'junit:junit:4.12'
}
8 changes: 5 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
package="ville.fi.hikemate">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<uses-feature android:name="android.hardware.location.gps" />

Expand All @@ -12,14 +14,14 @@
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".Activities.MainActivity">
<activity android:name=".Activities.MainActivity" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Activities.MapActivity" />
<activity android:name=".Activities.MapActivity" android:screenOrientation="portrait"/>

<meta-data
android:name="com.google.android.gms.version"
Expand All @@ -33,7 +35,7 @@
android:enabled="true"
android:exported="true" />

<activity android:name=".Activities.StoredMapActivity"></activity>
<activity android:name=".Activities.StoredMapActivity" android:screenOrientation="portrait"></activity>
</application>

</manifest>
66 changes: 46 additions & 20 deletions app/src/main/java/ville/fi/hikemate/Activities/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,54 @@
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.fasterxml.jackson.databind.ObjectMapper;

import java.util.ArrayList;
import java.util.zip.Inflater;

import ville.fi.hikemate.Fragments.HikePlansFragment;
import ville.fi.hikemate.Fragments.HikeListFragment;
import ville.fi.hikemate.Fragments.NewHikeFragment;
import ville.fi.hikemate.Fragments.ViewPagerAdapter;
import ville.fi.hikemate.R;
import ville.fi.hikemate.Resources.Hike;
import ville.fi.hikemate.Resources.HikeList;
import ville.fi.hikemate.Utils.Debug;
import ville.fi.hikemate.Utils.StorageHandler;

import static android.R.id.list;

/**
* MainActivity is the main view of the app.
*
* MainActivity consists of an action bar and a tab layout. Tab views are
* fragments and they are added to a view pager adapter. Each fragment has
* it's own class. User can also start tracking a new hike. This takes the
* user to a new activity.
*
* @author Ville Haapavaara
* @version 10.5.2017
* @since 1.8
*/
public class MainActivity extends AppCompatActivity {

/**
* Context of the class.
*/
Context host = this;

/**
* Toolbar of the activity.
*/
private Toolbar toolbar;

/**
* Tab layout of the activity.
*/
private TabLayout tabLayout;

/**
* Pager for the tab layout.
*/
private ViewPager viewPager;
private HikeList hikes;

/**
* Sets up the activity.
*
* Makes the initial load of the debug class and setups the tab view.
*
* @param savedInstanceState bundle for the activity
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -44,31 +64,37 @@ protected void onCreate(Bundle savedInstanceState) {
setupView();
}

/**
* Starts the map activity for user location tracking.
*
* @param v view of the activity
*/
public void startTracking(View v) {
System.out.println("startTracking");
Intent i = new Intent(host, MapActivity.class);
startActivity(i);
}

/**
* Sets up the tab view.
*/
private void setupView() {
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
getSupportActionBar().setHomeButtonEnabled(false);

viewPager = (ViewPager) findViewById(R.id.viewpager);

tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);

ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
ViewPagerAdapter adapter = new ViewPagerAdapter(
getSupportFragmentManager());
adapter.addFragment(new NewHikeFragment(), "New Hike");
adapter.addFragment(new HikeListFragment(), "Your Hikes");
adapter.addFragment(new HikePlansFragment(), "Hike Plans");
viewPager.setAdapter(adapter);
}

public HikeList getHikes() {
return hikes;
}
}
Loading

0 comments on commit b1e1b43

Please sign in to comment.