Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ android {

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:28.0.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:support-v4:28.0.0'
compile 'com.android.support:appcompat-v7:28.+'
compile 'com.squareup.okhttp3:okhttp:3.10.0'
compile 'com.google.code.gson:gson:2.8.5'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:28.+'
testCompile 'junit:junit:4.12'
}
4 changes: 4 additions & 0 deletions src/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".views.game_menu.GameMenuActivity"
android:label="@string/title_activity_game_menu"
android:theme="@style/AppTheme.NoActionBar"></activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ public interface Presenter<T extends View>{
void subscribe(T view);
void unsubscribe();
}

public interface Navigator {
void navigate(Class clazz);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
package com.games.mkvs.interstellarmanager.views.game_menu;
import android.support.v7.app.AppCompatActivity;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.os.Bundle;
import android.view.Menu;
import android.view.Window;
import android.view.WindowManager;

import com.games.mkvs.interstellarmanager.R;
import com.games.mkvs.interstellarmanager.views.game_menu.overview.OverviewFragment;

public class GameMenuActivity extends AppCompatActivity {

/**
* The {@link android.support.v4.view.PagerAdapter} that will provide
* fragments for each of the sections. We use a
* {@link FragmentPagerAdapter} derivative, which will keep every
* loaded fragment in memory. If this becomes too memory intensive, it
* may be best to switch to a
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
*/
private SectionsPagerAdapter mSectionsPagerAdapter;

/**
* The {@link ViewPager} that will host the section contents.
*/
private ViewPager mViewPager;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_game_menu);
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

// Set up the ViewPager with the sections adapter.
mViewPager = findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_game_menu, menu);
return true;
}

/**
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
* one of the sections/tabs/pages.
*/
public class SectionsPagerAdapter extends FragmentPagerAdapter {

public SectionsPagerAdapter(FragmentManager fm) {
super(fm);
}

@Override
public Fragment getItem(int position) {
Fragment fragment;
switch (position) {
case 0:
fragment = new OverviewFragment();
break;
default:
fragment = new OverviewFragment();
break;
}
return fragment;
}

@Override
public int getCount() {
return 4;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.games.mkvs.interstellarmanager.views.game_menu.overview;

import com.games.mkvs.interstellarmanager.base.contracts.BaseContracts;

/**
* Created by Martin on 3.1.2019 г..
*/

public class OverviewContracts {
public interface IOverviewView extends BaseContracts.View {

}

public interface IOverviewPresenter extends BaseContracts.Presenter {

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.games.mkvs.interstellarmanager.views.game_menu.overview;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.games.mkvs.interstellarmanager.R;
import com.games.mkvs.interstellarmanager.base.contracts.BaseContracts;

/**
* A simple {@link Fragment} subclass.
*/
public class OverviewFragment extends Fragment implements OverviewContracts.IOverviewView {
private View root;
private OverviewContracts.IOverviewPresenter mPresenter;

public OverviewFragment() {
// Required empty public constructor
}


@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
root = inflater.inflate(R.layout.fragment_overview, container, false);
return root;
}

@Override
public void setPresenter(BaseContracts.Presenter presenter) {
this.mPresenter = (OverviewContracts.IOverviewPresenter) presenter;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.games.mkvs.interstellarmanager.views.game_menu.overview;

import com.games.mkvs.interstellarmanager.base.contracts.BaseContracts;
import com.games.mkvs.interstellarmanager.web.repositories.base.CompanyRepository;

/**
* Created by Martin on 3.1.2019 г..
*/

public class OverviewPresenter implements OverviewContracts.IOverviewPresenter {
private final CompanyRepository companyRepository;
private OverviewContracts.IOverviewView mView;
public OverviewPresenter(CompanyRepository companyRepository) {
this.companyRepository = companyRepository;
}
@Override
public void subscribe(BaseContracts.View view) {
this.mView = (OverviewContracts.IOverviewView) view;
}

@Override
public void unsubscribe() {
this.mView = null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@

public class StartContracts{

public interface IStartPresenter extends BaseContracts.Presenter{
public interface IStartPresenter extends BaseContracts.Presenter {

}

public interface IStartView extends BaseContracts.View{
public interface IStartView extends BaseContracts.View, BaseContracts.Navigator {
void addBackground();

void addButtonListeners();

void startGameBtnClicked();
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package com.games.mkvs.interstellarmanager.views.start;


import android.content.Intent;
import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.games.mkvs.interstellarmanager.R;
import com.games.mkvs.interstellarmanager.base.contracts.BaseContracts;
Expand All @@ -17,13 +18,14 @@
import com.games.mkvs.interstellarmanager.engine.models.menu_background.StarsBackgroundPanel;
import com.games.mkvs.interstellarmanager.engine.services.DrawingService;
import com.games.mkvs.interstellarmanager.engine.services.SortingService;
import com.games.mkvs.interstellarmanager.views.game_menu.GameMenuActivity;

import java.util.ArrayList;

/**
* A simple {@link Fragment} subclass.
*/
public class StartFragment extends Fragment implements StartContracts.IStartView {
public class StartFragment extends Fragment implements StartContracts.IStartView, View.OnClickListener {
private View root;
private StartContracts.IStartPresenter mPresenter;
private RelativeLayout mMainContainer;
Expand All @@ -43,6 +45,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
mContentContainer = root.findViewById(R.id.content_container);
addBackground();
mContentContainer.bringToFront();
addButtonListeners();
return root;
}

Expand All @@ -60,4 +63,34 @@ public void addBackground() {
objects);
mMainContainer.addView(panel);
}

@Override
public void addButtonListeners() {
Button startGameBtn = root.findViewById(R.id.start_game_btn);
startGameBtn.setOnClickListener(this);
}

@Override
public void startGameBtnClicked() {
this.navigate(GameMenuActivity.class);
}

@Override
public void navigate(Class clazz) {
Intent intent;
if(clazz == GameMenuActivity.class) {
intent = new Intent(getActivity(), clazz);
startActivity(intent);
getActivity().finish();
}
}

@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.start_game_btn:
startGameBtnClicked();
break;
}
}
}
17 changes: 17 additions & 0 deletions src/app/src/main/res/layout/activity_game_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.games.mkvs.interstellarmanager.views.game_menu.GameMenuActivity">

<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</android.support.design.widget.CoordinatorLayout>
16 changes: 16 additions & 0 deletions src/app/src/main/res/layout/fragment_game_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.games.mkvs.interstellarmanager.views.game_menu.GameMenuActivity">

<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

</RelativeLayout>
39 changes: 39 additions & 0 deletions src/app/src/main/res/layout/fragment_overview.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<LinearLayout 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.games.mkvs.interstellarmanager.views.game_menu.overview.OverviewFragment"
android:orientation="vertical">

<LinearLayout
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="name"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/loader"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerInParent="true">
<ProgressBar
android:layout_width="50dp"
android:layout_height="50dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/loading_text"/>
</LinearLayout>

</RelativeLayout>

</LinearLayout>
10 changes: 10 additions & 0 deletions src/app/src/main/res/menu/menu_game_menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.games.mkvs.interstellarmanager.views.game_menu.GameMenuActivity">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />
</menu>
6 changes: 6 additions & 0 deletions src/app/src/main/res/values-w820dp/dimens.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
Loading