Reworked Main menu.
This commit is contained in:
parent
7feef3cf65
commit
1e482e68f5
28 changed files with 513 additions and 224 deletions
|
@ -8,13 +8,6 @@
|
|||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme" >
|
||||
<activity android:name="tu_darmstadt.sudoku.ui.MainActivity" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name="tu_darmstadt.sudoku.ui.SettingsActivity"
|
||||
android:label="@string/title_activity_settings"
|
||||
|
@ -28,7 +21,15 @@
|
|||
</activity>
|
||||
<activity android:name="tu_darmstadt.sudoku.ui.AboutActivity" >
|
||||
</activity>
|
||||
<activity android:name="tu_darmstadt.sudoku.ui.NewGameActivity" >
|
||||
<activity
|
||||
android:name="tu_darmstadt.sudoku.ui.MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme.NoActionBar" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package tu_darmstadt.sudoku.controller;
|
||||
|
||||
import java.io.File;
|
||||
/**
|
||||
* Created by Chris on 16.11.2015.
|
||||
*/
|
||||
public class FileManager {
|
||||
|
||||
FileManager() {}
|
||||
|
||||
void doSomething() {
|
||||
//File f = new File("./level/sudoku.txt");
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -49,18 +49,14 @@ public class GameController {
|
|||
|
||||
public void loadNewLevel(GameType type, int difficulty) {
|
||||
switch(type) {
|
||||
case Default_9x9:
|
||||
loadLevel(GameType.Default_9x9,
|
||||
new int[]{5, 0, 1, 9, 0, 0, 0, 0, 0,
|
||||
2, 0, 0, 0, 0, 4, 9, 5, 0,
|
||||
3, 9, 0, 7, 0, 0, 0, 2, 6,
|
||||
0, 3, 0, 0, 0, 1, 0, 7, 2,
|
||||
0, 0, 6, 0, 5, 7, 0, 0, 0,
|
||||
0, 7, 2, 0, 0, 9, 0, 4, 1,
|
||||
0, 0, 0, 0, 7, 0, 4, 0, 9,
|
||||
6, 4, 0, 0, 0, 0, 0, 0, 0,
|
||||
7, 0, 0, 0, 1, 0, 3, 0, 5}
|
||||
, null, null);
|
||||
case Default_6x6:
|
||||
loadLevel(GameType.Default_6x6,
|
||||
new int[]{1,0,0,0,0,6,
|
||||
4,0,6,1,0,0,
|
||||
0,0,2,3,0,5,
|
||||
0,4,0,0,1,0,
|
||||
0,6,0,2,0,0,
|
||||
0,3,0,5,0,1}, null,null);
|
||||
break;
|
||||
case Default_12x12:
|
||||
loadLevel(GameType.Default_12x12,
|
||||
|
@ -78,6 +74,7 @@ public class GameController {
|
|||
0, 6,10, 0, 0, 0, 8, 0, 0, 1,12, 0}
|
||||
,null, null);
|
||||
break;
|
||||
case Default_9x9:
|
||||
case Unspecified:
|
||||
default:
|
||||
loadLevel(GameType.Default_9x9,
|
||||
|
@ -94,7 +91,7 @@ public class GameController {
|
|||
}
|
||||
}
|
||||
|
||||
public void loadLevel(GameType type, int[] fixedValues, int[] setValues, int[][] setNotes) {
|
||||
public void loadLevel(GameType type, int[] fixedValues, int[] setValues, boolean[][] setNotes) {
|
||||
setGameType(type);
|
||||
this.gameBoard = new GameBoard(size, sectionHeight, sectionWidth);
|
||||
|
||||
|
@ -111,8 +108,17 @@ public class GameController {
|
|||
}
|
||||
}
|
||||
|
||||
if(setNotes != null) {
|
||||
// set notes.
|
||||
if(setNotes != null) {
|
||||
for(int i = 0; i < size * size; i++) {
|
||||
int row = (int) Math.floor(i / size);
|
||||
int col = i % size;
|
||||
for(int k = 0 ; k < size; k++) {
|
||||
if(setNotes[i][k]) {
|
||||
setNote(row, col, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public class GameBoard implements Cloneable {
|
|||
if(level[i] != 0) count++;
|
||||
field[row][col] = new GameCell(row,col,size,level[i]);
|
||||
}
|
||||
if(count < 17) throw new IllegalArgumentException("There must be at least 17 fixed values.");
|
||||
//if(count < 17) throw new IllegalArgumentException("There must be at least 17 fixed values.");
|
||||
}
|
||||
|
||||
public GameCell getCell(int row, int col) {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package tu_darmstadt.sudoku.game;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Chris on 09.11.2015.
|
||||
*/
|
||||
|
@ -7,7 +10,15 @@ public enum GameType {
|
|||
Unspecified,
|
||||
Default_9x9,
|
||||
Default_12x12,
|
||||
Default_6x6
|
||||
Default_6x6;
|
||||
|
||||
public static List<GameType> getValidGameTypes() {
|
||||
LinkedList<GameType> result = new LinkedList<>();
|
||||
result.add(Default_6x6);
|
||||
result.add(Default_9x9);
|
||||
result.add(Default_12x12);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ public class AboutActivity extends AppCompatActivity {
|
|||
setContentView(R.layout.activity_about);
|
||||
|
||||
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
|
||||
actionBar.setTitle(R.string.about);
|
||||
actionBar.setTitle(R.string.menu_about);
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#024265")));
|
||||
}
|
||||
|
|
|
@ -11,9 +11,7 @@ import android.support.v4.widget.DrawerLayout;
|
|||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.GridLayout;
|
||||
|
||||
import tu_darmstadt.sudoku.controller.GameController;
|
||||
import tu_darmstadt.sudoku.game.GameType;
|
||||
|
@ -46,11 +44,22 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
|||
|
||||
}
|
||||
|
||||
// TODO: DEBUG START
|
||||
/*if(gameDifficulty == 0) {
|
||||
gameType = GameType.Default_6x6;
|
||||
} else if(gameDifficulty == 5) {
|
||||
gameType = GameType.Default_12x12;
|
||||
} else {
|
||||
gameType = GameType.Default_9x9;
|
||||
}*/
|
||||
// TODO: DEBUG END
|
||||
|
||||
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
||||
setContentView(R.layout.activity_game_view);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
//toolbar.addView();
|
||||
|
||||
//Create new GameField
|
||||
layout = (SudokuFieldLayout)findViewById(R.id.sudokuLayout);
|
||||
|
@ -98,12 +107,12 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
// Inflate the menu; this adds items to the action bar if it is present.
|
||||
getMenuInflater().inflate(R.menu.game_view, menu);
|
||||
return true;
|
||||
}
|
||||
}*/
|
||||
|
||||
@SuppressWarnings("StatementWithEmptyBody")
|
||||
@Override
|
||||
|
@ -115,14 +124,14 @@ public class GameActivity extends AppCompatActivity implements NavigationView.On
|
|||
|
||||
if (id == R.id.nav_newgame) {
|
||||
//create new game
|
||||
intent = new Intent(this, NewGameActivity.class);
|
||||
startActivity(intent);
|
||||
|
||||
} else if (id == R.id.nav_mainmenu) {
|
||||
//go to main menu
|
||||
intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
|
||||
/*} else if (id == R.id.nav_mainmenu) {
|
||||
//go to main menu
|
||||
intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);*/
|
||||
|
||||
} else if (id == R.id.nav_settings) {
|
||||
//open settings
|
||||
intent = new Intent(this,SettingsActivity.class);
|
||||
|
|
|
@ -2,23 +2,181 @@ package tu_darmstadt.sudoku.ui;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
|
||||
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.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import android.widget.Button;
|
||||
import android.widget.RatingBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import tu_darmstadt.sudoku.game.GameType;
|
||||
import tu_darmstadt.sudoku.ui.view.R;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
GameType gameType = GameType.Default_9x9;
|
||||
int gameDifficulty = 1;
|
||||
|
||||
/**
|
||||
* 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);
|
||||
setContentView(R.layout.activity_main);
|
||||
setContentView(R.layout.activity_main_menu);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
// 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 = (ViewPager) findViewById(R.id.scroller);
|
||||
mViewPager.setAdapter(mSectionsPagerAdapter);
|
||||
|
||||
mViewPager.setCurrentItem(1);
|
||||
|
||||
Button continueButton = (Button)findViewById(R.id.continueButton);
|
||||
continueButton.setEnabled(false);
|
||||
|
||||
}
|
||||
public void onClicktext(View view) {
|
||||
Intent i = new Intent(this, NewGameActivity.class);
|
||||
|
||||
public void onClick(View view) {
|
||||
|
||||
Intent i = null;
|
||||
|
||||
if(view instanceof Button) {
|
||||
Button b = (Button)view;
|
||||
switch(b.getId()) {
|
||||
case R.id.aboutButton:
|
||||
i = new Intent(this, AboutActivity.class);
|
||||
break;
|
||||
case R.id.continueButton:
|
||||
// TODO continue from file.
|
||||
i = new Intent(this, GameActivity.class);
|
||||
int levelNr = 0;
|
||||
i.putExtra("loadLevel", levelNr);
|
||||
break;
|
||||
case R.id.highscoreButton:
|
||||
// TODO: create highscore screen
|
||||
break;
|
||||
case R.id.settingsButton:
|
||||
i = new Intent(this, SettingsActivity.class);
|
||||
break;
|
||||
case R.id.helpButton:
|
||||
// TODO: create help page.. what is supposed to be in there?!
|
||||
break;
|
||||
case R.id.playButton:
|
||||
gameType = GameType.getValidGameTypes().get(mViewPager.getCurrentItem());
|
||||
RatingBar difficultyBar = (RatingBar)findViewById(R.id.difficultyBar);
|
||||
gameDifficulty = difficultyBar.getProgress();
|
||||
|
||||
// send everything to game activity
|
||||
i = new Intent(this, GameActivity.class);
|
||||
i.putExtra("gameType", gameType);
|
||||
i.putExtra("gameDifficulty", gameDifficulty);
|
||||
break;
|
||||
default:
|
||||
i = getIntent();
|
||||
}
|
||||
}
|
||||
if(i == null) {
|
||||
i = getIntent();
|
||||
}
|
||||
startActivity(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
// getItem is called to instantiate the fragment for the given page.
|
||||
// Return a GameTypeFragment (defined as a static inner class below).
|
||||
return GameTypeFragment.newInstance(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
// Show 3 total pages.
|
||||
return GameType.getValidGameTypes().size();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A placeholder fragment containing a simple view.
|
||||
*/
|
||||
public static class GameTypeFragment extends Fragment {
|
||||
/**
|
||||
* The fragment argument representing the section number for this
|
||||
* fragment.
|
||||
*/
|
||||
private static final String ARG_SECTION_NUMBER = "section_number";
|
||||
|
||||
/**
|
||||
* Returns a new instance of this fragment for the given section
|
||||
* number.
|
||||
*/
|
||||
public static GameTypeFragment newInstance(int sectionNumber) {
|
||||
GameTypeFragment fragment = new GameTypeFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
public GameTypeFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_main_menu, container, false);
|
||||
|
||||
TextView textView = (TextView) rootView.findViewById(R.id.section_label);
|
||||
textView.setText(GameType.getValidGameTypes().get(getArguments().getInt(ARG_SECTION_NUMBER)).name());
|
||||
return rootView;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
package tu_darmstadt.sudoku.ui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import tu_darmstadt.sudoku.controller.GameController;
|
||||
import tu_darmstadt.sudoku.game.GameType;
|
||||
import tu_darmstadt.sudoku.ui.view.R;
|
||||
|
||||
public class NewGameActivity extends AppCompatActivity {
|
||||
|
||||
GameType gameType = GameType.Default_9x9;
|
||||
int gameDifficulty = 1;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_new_game);
|
||||
}
|
||||
|
||||
public void onPlayClick(View view) {
|
||||
|
||||
// TODO get settings from GUI
|
||||
|
||||
Intent i = new Intent(this, GameActivity.class);
|
||||
|
||||
i.putExtra("gameType", gameType);
|
||||
i.putExtra("gameDifficulty", gameDifficulty);
|
||||
|
||||
startActivity(i);
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package tu_darmstadt.sudoku.ui.view;
|
|||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.Button;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
/**
|
||||
* Created by TMZ_LToP on 12.11.2015.
|
||||
|
|
|
@ -45,7 +45,7 @@ public class SudokuKeyboardLayout extends GridLayout {
|
|||
break;
|
||||
case NoteToggle:
|
||||
notesEnabled = !notesEnabled;
|
||||
btn.setText(String.valueOf(notesEnabled));
|
||||
btn.setText(notesEnabled ? "ON" : "OFF");
|
||||
break;
|
||||
case Do:
|
||||
// TODO: not implemented
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 74 KiB |
BIN
app/src/main/res/drawable/privacyfriendlyappslogo.png
Normal file
BIN
app/src/main/res/drawable/privacyfriendlyappslogo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
app/src/main/res/drawable/sudoku9x9.png
Normal file
BIN
app/src/main/res/drawable/sudoku9x9.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
|
@ -12,11 +12,6 @@
|
|||
tools:context=".AboutActivity"
|
||||
android:weightSum="1">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="85dp"
|
||||
android:layout_weight="0.36">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/barcodeLogo"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -24,8 +19,6 @@
|
|||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/privacyfriendlyappslogo" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/appName"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -50,6 +43,14 @@
|
|||
android:layout_marginTop="10dp"
|
||||
android:text="@string/about_author" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFieldAuthorNames"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="0dp"
|
||||
android:text="@string/about_author_names" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textFieldAffiliation"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -12,6 +12,6 @@
|
|||
android:layout_width="wrap_content" android:layout_height="match_parent"
|
||||
android:layout_gravity="start" android:fitsSystemWindows="true"
|
||||
app:headerLayout="@layout/nav_header_game_view"
|
||||
app:menu="@menu/activity_game_view_drawer" />
|
||||
app:menu="@menu/menu_drawer" />
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:orientation="vertical"
|
||||
tools:context="tu_darmstadt.sudoku.activity.MainActivity"
|
||||
android:weightSum="10"
|
||||
android:divider="#000">
|
||||
|
||||
<!-- TODO .. add menu -->
|
||||
|
||||
<!--<android.support.design.widget.NavigationView android:id="@+id/nav_view"
|
||||
android:layout_width="wrap_content" android:layout_height="match_parent"
|
||||
android:layout_gravity="start" android:fitsSystemWindows="true" >
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<group android:checkableBehavior="single">
|
||||
<item android:id="@+id/nav_newgame" android:icon="@android:drawable/ic_menu_today"
|
||||
android:title="@string/new_game" />
|
||||
<item android:id="@+id/nav_mainmenu" android:icon="@android:drawable/ic_menu_gallery"
|
||||
android:title="@string/mainmenu" />
|
||||
<item android:id="@+id/nav_highscore" android:icon="@android:drawable/ic_menu_myplaces"
|
||||
android:title="@string/highscore" />
|
||||
</group>
|
||||
<group android:menuCategory="container" android:title="">
|
||||
<menu>
|
||||
<item android:id="@+id/nav_settings" android:icon="@android:drawable/ic_menu_manage"
|
||||
android:title="@string/settings" />
|
||||
<item android:id="@+id/nav_help" android:icon="@android:drawable/ic_menu_help"
|
||||
android:title="@string/help" />
|
||||
<item android:id="@+id/nav_about" android:icon="@android:drawable/ic_menu_info_details"
|
||||
android:title="@string/about" />
|
||||
</menu>
|
||||
</group>
|
||||
|
||||
</menu>
|
||||
</android.support.design.widget.NavigationView>-->
|
||||
|
||||
<TextView android:id="@+id/testString"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:editable="true"
|
||||
android:clickable="true"
|
||||
android:onClick="onClicktext"
|
||||
android:text="@string/app_name"/>
|
||||
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
171
app/src/main/res/layout/activity_main_menu.xml
Normal file
171
app/src/main/res/layout/activity_main_menu.xml
Normal file
|
@ -0,0 +1,171 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
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/main_content"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="tu_darmstadt.sudoku.ui.MainActivity"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/appbar_padding_top"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay">
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="10"
|
||||
android:layout_marginTop="?attr/actionBarSize">
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/scroller"
|
||||
android:layout_weight="4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
<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="0dp"
|
||||
android:layout_below="@+id/scroller"
|
||||
android:layout_weight="6"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
tools:context="tu_darmstadt.sudoku.ui.MainActivity"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="8"
|
||||
android:divider="#000"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
|
||||
<RatingBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/difficultyBar"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:clickable="true"
|
||||
android:numStars="4"
|
||||
android:rating="1"
|
||||
android:stepSize="1" />
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:text="@string/menu_new_game"
|
||||
android:textStyle="normal"
|
||||
android:id="@+id/playButton"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="2"
|
||||
android:onClick="onClick"
|
||||
android:capitalize="none"
|
||||
android:clickable="false"
|
||||
android:elevation="10dp"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:text="@string/menu_continue_game"
|
||||
android:textStyle="normal"
|
||||
android:id="@+id/continueButton"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="2"
|
||||
android:onClick="onClick"
|
||||
android:capitalize="none"
|
||||
android:clickable="false" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:weightSum="2">
|
||||
<Button
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginRight="1dp"
|
||||
android:text="@string/menu_highscore"
|
||||
android:textStyle="normal"
|
||||
android:id="@+id/highscoreButton"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:onClick="onClick"
|
||||
android:capitalize="none"
|
||||
android:clickable="false" />
|
||||
<Button
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:text="@string/menu_settings"
|
||||
android:textStyle="normal"
|
||||
android:id="@+id/settingsButton"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:onClick="onClick"
|
||||
android:capitalize="none"
|
||||
android:clickable="false" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="2"
|
||||
android:weightSum="2">
|
||||
<Button
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginRight="1dp"
|
||||
android:text="@string/menu_about"
|
||||
android:textStyle="normal"
|
||||
android:id="@+id/aboutButton"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:onClick="onClick"
|
||||
android:capitalize="none"
|
||||
android:clickable="false" />
|
||||
<Button
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="1dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:text="@string/menu_help"
|
||||
android:textStyle="normal"
|
||||
android:id="@+id/helpButton"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:onClick="onClick"
|
||||
android:capitalize="none"
|
||||
android:clickable="false" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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" android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
tools:context="tu_darmstadt.sudoku.ui.NewGameActivity"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:orientation="vertical"
|
||||
android:weightSum="10"
|
||||
android:divider="#000"
|
||||
android:baselineAligned="false"
|
||||
android:gravity="center_vertical|center_horizontal">
|
||||
|
||||
<RatingBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/ratingBar"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:clickable="true"
|
||||
android:numStars="5"
|
||||
android:rating="1"
|
||||
android:stepSize="1" />
|
||||
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:text="@string/start_game"
|
||||
android:textStyle="normal"
|
||||
android:id="@+id/button"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_weight="1"
|
||||
android:onClick="onPlayClick"
|
||||
android:capitalize="none"
|
||||
android:clickable="false" />
|
||||
|
||||
</LinearLayout>
|
|
@ -2,16 +2,22 @@
|
|||
<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:layout_width="match_parent"
|
||||
android:layout_height="match_parent" android:fitsSystemWindows="true"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="tu_darmstadt.sudoku.activity.GameActivity">
|
||||
|
||||
<android.support.design.widget.AppBarLayout android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay">
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:theme="@style/AppTheme.AppBarOverlay">
|
||||
|
||||
<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent" android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
app:popupTheme="@style/AppTheme.PopupOverlay" />
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
|
|
27
app/src/main/res/layout/fragment_main_menu.xml
Normal file
27
app/src/main/res/layout/fragment_main_menu.xml
Normal file
|
@ -0,0 +1,27 @@
|
|||
<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"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:gravity="center_horizontal|center_vertical"
|
||||
android:orientation="vertical"
|
||||
tools:context="tu_darmstadt.sudoku.ui.MainActivity$GameTypeFragment">
|
||||
|
||||
<TextView android:id="@+id/section_label"
|
||||
android:text="Label"
|
||||
android:textStyle="bold"
|
||||
android:textSize="20dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/sudoku9x9"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
</menu>
|
|
@ -5,18 +5,18 @@
|
|||
<item android:id="@+id/nav_newgame" android:icon="@android:drawable/ic_menu_today"
|
||||
android:title="@string/new_game" />
|
||||
<item android:id="@+id/nav_mainmenu" android:icon="@android:drawable/ic_menu_gallery"
|
||||
android:title="@string/mainmenu" />
|
||||
android:title="@string/menu_main" />
|
||||
<item android:id="@+id/nav_highscore" android:icon="@android:drawable/ic_menu_myplaces"
|
||||
android:title="@string/highscore" />
|
||||
android:title="@string/menu_highscore" />
|
||||
</group>
|
||||
<group android:menuCategory="container" android:title="">
|
||||
<menu>
|
||||
<item android:id="@+id/nav_settings" android:icon="@android:drawable/ic_menu_manage"
|
||||
android:title="@string/settings" />
|
||||
android:title="@string/menu_settings" />
|
||||
<item android:id="@+id/nav_help" android:icon="@android:drawable/ic_menu_help"
|
||||
android:title="@string/help" />
|
||||
android:title="@string/menu_help" />
|
||||
<item android:id="@+id/nav_about" android:icon="@android:drawable/ic_menu_info_details"
|
||||
android:title="@string/about" />
|
||||
android:title="@string/menu_about" />
|
||||
</menu>
|
||||
</group>
|
||||
|
7
app/src/main/res/menu/menu_test.xml
Normal file
7
app/src/main/res/menu/menu_test.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<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="tu_darmstadt.sudoku.ui.testActivity">
|
||||
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
||||
android:orderInCategory="100" app:showAsAction="never" />
|
||||
</menu>
|
|
@ -5,12 +5,12 @@
|
|||
|
||||
<!-- Strings related to Menu -->
|
||||
<string name="new_game">Neues Spiel</string>
|
||||
<string name="settings">Einstellungen</string>
|
||||
<string name="highscore">Bestenliste</string>
|
||||
<string name="mainmenu">Hauptmenü</string>
|
||||
<string name="group">Gruppe</string>
|
||||
<string name="help">Hilfe</string>
|
||||
<string name="about">Über</string>
|
||||
<string name="menu_settings">Einstellungen</string>
|
||||
<string name="menu_highscore">Bestenliste</string>
|
||||
<string name="menu_main">Hauptmenü</string>
|
||||
<string name="menu_group">Gruppe</string>
|
||||
<string name="menu_help">Hilfe</string>
|
||||
<string name="menu_about">Über</string>
|
||||
|
||||
<!-- Strings related to Settings -->
|
||||
<string name="title_activity_settings">Einstellungen</string>
|
||||
|
@ -24,7 +24,7 @@
|
|||
<string name="privacy_friendly">Diese App gehört zur Gruppe der Privacy Friendly Apps.</string>
|
||||
<string name="more_info">Mehr Informationen unter:</string>
|
||||
<string name="about_affiliation">In Zusammenarbeit mit:</string>
|
||||
<string name="about_author">Autor: \nChristopher Beckmann, Timm Lippert</string>
|
||||
<string name="about_author">Autor:</string>
|
||||
|
||||
<!-- New Game -->
|
||||
<string name="start_game">Spiel starten</string>
|
||||
|
|
|
@ -2,5 +2,5 @@
|
|||
<resources>
|
||||
<color name="colorPrimary">#024265</color>
|
||||
<color name="colorPrimaryDark">#024265</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
<color name="colorAccent">#FFFF00</color>
|
||||
</resources>
|
||||
|
|
|
@ -6,4 +6,5 @@
|
|||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="nav_header_vertical_spacing">13dp</dimen>
|
||||
<dimen name="nav_header_height">160dp</dimen>
|
||||
<dimen name="appbar_padding_top">8dp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -3,13 +3,14 @@
|
|||
<string name="title_activity_game_view">Sudoku</string>
|
||||
|
||||
<!-- ###MAIN MENU### -->
|
||||
<string name="new_game">New Game</string>
|
||||
<string name="settings">Settings</string>
|
||||
<string name="highscore">Highscore</string>
|
||||
<string name="mainmenu">Main Menu</string>
|
||||
<string name="group">Group</string>
|
||||
<string name="help">Help</string>
|
||||
<string name="about">About</string>
|
||||
<string name="menu_new_game">New Game</string>
|
||||
<string name="menu_settings">Settings</string>
|
||||
<string name="menu_highscore">Highscore</string>
|
||||
<string name="menu_main">Main Menu</string>
|
||||
<string name="menu_group">Group</string>
|
||||
<string name="menu_help">Help</string>
|
||||
<string name="menu_about">About</string>
|
||||
<string name="menu_continue_game">continue game</string>
|
||||
|
||||
<string name="description">a privacy friendly logic puzzle</string>
|
||||
|
||||
|
@ -42,16 +43,26 @@
|
|||
|
||||
<!-- ###ABOUT### -->
|
||||
<string name="app_name_long">Privacy friendly Sudoku</string>
|
||||
<string name="version_number">v0.1</string>
|
||||
<string name="about_author">Author: Christopher Beckmann, Timm Lippert</string>
|
||||
<string name="version_number">v0.8</string>
|
||||
<string name="about_author">Author:</string>
|
||||
<string name="about_author_names">Christopher Beckmann, Timm Lippert</string>
|
||||
<string name="about_affiliation">In affiliation with:</string>
|
||||
<string name="privacy_friendly">This application belongs to the Privacy Friendly Apps.</string>
|
||||
<string name="more_info">More information can be found on:</string>
|
||||
<string name="url"><a href="https://www.secuso.informatik.tu-darmstadt.de/en/research/results/">https://www.secuso.org</a></string>
|
||||
|
||||
<!-- ###New Game### -->
|
||||
<string name="start_game">start game</string>
|
||||
|
||||
<string-array name="testarray">
|
||||
<item>15 minutes</item>
|
||||
<item>30 minutes</item>
|
||||
<item>1 hour</item>
|
||||
<item>3 hours</item>
|
||||
<item>6 hours</item>
|
||||
<item>Never</item>
|
||||
</string-array>
|
||||
<string name="test">Test String</string>
|
||||
<string name="title_activity_main_menu">MainMenuActivity</string>
|
||||
<string name="section_format">Hello World from section: %1$d</string>
|
||||
<string name="title_activity_test">testActivity</string>
|
||||
|
||||
<!-- end of valid settings -->
|
||||
|
||||
|
|
Loading…
Reference in a new issue