Multilanguage for german English
First GUI samples
|
@ -5,7 +5,7 @@
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="distributionType" value="LOCAL" />
|
<option name="distributionType" value="LOCAL" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.4" />
|
<option name="gradleHome" value="D:\Program Files\Android\Android Studio\gradle\gradle-2.4" />
|
||||||
<option name="gradleJvm" value="1.8" />
|
<option name="gradleJvm" value="1.8" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="" vcs="" />
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -24,4 +24,5 @@ dependencies {
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
compile 'com.android.support:appcompat-v7:23.1.0'
|
compile 'com.android.support:appcompat-v7:23.1.0'
|
||||||
compile 'com.android.support:design:23.1.0'
|
compile 'com.android.support:design:23.1.0'
|
||||||
|
compile 'com.android.support:support-v4:23.1.0'
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,23 +8,26 @@
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme" >
|
android:theme="@style/AppTheme" >
|
||||||
<!--<activity
|
<activity android:name=".MainActivity" >
|
||||||
android:name=".MainMenu"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:theme="@style/AppTheme.NoActionBar" >
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>-->
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".GameView"
|
android:name=".SettingsActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/title_activity_settings"
|
||||||
|
android:parentActivityName=".MainActivity" >
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
|
android:value="tu_darmstadt.sudoku.view.MainActivity" />
|
||||||
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".GameActivity"
|
||||||
|
android:label="@string/title_activity_game_view"
|
||||||
android:theme="@style/AppTheme.NoActionBar" >
|
android:theme="@style/AppTheme.NoActionBar" >
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
package tu_darmstadt.sudoku.view;
|
||||||
|
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.PreferenceActivity;
|
||||||
|
import android.support.annotation.LayoutRes;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.app.AppCompatDelegate;
|
||||||
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls
|
||||||
|
* to be used with AppCompat.
|
||||||
|
*/
|
||||||
|
public abstract class AppCompatPreferenceActivity extends PreferenceActivity {
|
||||||
|
|
||||||
|
private AppCompatDelegate mDelegate;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
getDelegate().installViewFactory();
|
||||||
|
getDelegate().onCreate(savedInstanceState);
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostCreate(Bundle savedInstanceState) {
|
||||||
|
super.onPostCreate(savedInstanceState);
|
||||||
|
getDelegate().onPostCreate(savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionBar getSupportActionBar() {
|
||||||
|
return getDelegate().getSupportActionBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSupportActionBar(@Nullable Toolbar toolbar) {
|
||||||
|
getDelegate().setSupportActionBar(toolbar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public MenuInflater getMenuInflater() {
|
||||||
|
return getDelegate().getMenuInflater();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setContentView(@LayoutRes int layoutResID) {
|
||||||
|
getDelegate().setContentView(layoutResID);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setContentView(View view) {
|
||||||
|
getDelegate().setContentView(view);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setContentView(View view, ViewGroup.LayoutParams params) {
|
||||||
|
getDelegate().setContentView(view, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addContentView(View view, ViewGroup.LayoutParams params) {
|
||||||
|
getDelegate().addContentView(view, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onPostResume() {
|
||||||
|
super.onPostResume();
|
||||||
|
getDelegate().onPostResume();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onTitleChanged(CharSequence title, int color) {
|
||||||
|
super.onTitleChanged(title, color);
|
||||||
|
getDelegate().setTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
super.onConfigurationChanged(newConfig);
|
||||||
|
getDelegate().onConfigurationChanged(newConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
getDelegate().onStop();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
getDelegate().onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void invalidateOptionsMenu() {
|
||||||
|
getDelegate().invalidateOptionsMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
private AppCompatDelegate getDelegate() {
|
||||||
|
if (mDelegate == null) {
|
||||||
|
mDelegate = AppCompatDelegate.create(this, null);
|
||||||
|
}
|
||||||
|
return mDelegate;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,7 @@
|
||||||
package tu_darmstadt.sudoku.view;
|
package tu_darmstadt.sudoku.view;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.design.widget.FloatingActionButton;
|
|
||||||
import android.support.design.widget.Snackbar;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
|
||||||
import android.support.design.widget.NavigationView;
|
import android.support.design.widget.NavigationView;
|
||||||
import android.support.v4.view.GravityCompat;
|
import android.support.v4.view.GravityCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
|
@ -13,12 +10,16 @@ import android.support.v7.app.AppCompatActivity;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import tu_darmstadt.sudoku.controller.GameController;
|
import tu_darmstadt.sudoku.controller.GameController;
|
||||||
import tu_darmstadt.sudoku.game.*;
|
import tu_darmstadt.sudoku.game.*;
|
||||||
|
|
||||||
public class GameView extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
|
public class GameActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
|
||||||
|
|
||||||
GameController gameController = new GameController(GameType.Default_9x9);
|
GameController gameController = new GameController(GameType.Default_9x9);
|
||||||
|
SudokuFieldLayout layout;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
@ -26,18 +27,14 @@ public class GameView extends AppCompatActivity implements NavigationView.OnNavi
|
||||||
setContentView(R.layout.activity_game_view);
|
setContentView(R.layout.activity_game_view);
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
//TODO: set view for game
|
||||||
|
|
||||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
|
||||||
fab.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
/* DEBUG */
|
|
||||||
String debug = gameController.getFieldAsString();
|
|
||||||
Log.d("Sudoku", debug);
|
|
||||||
|
|
||||||
Snackbar.make(view, "Printed example Sudoku board in console.", Snackbar.LENGTH_LONG).setAction("Action", null).show();
|
/*
|
||||||
}
|
// DEBUG
|
||||||
});
|
String debug = gameController.getFieldAsString();
|
||||||
|
Log.d("Sudoku", debug);
|
||||||
|
*/
|
||||||
|
|
||||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
||||||
|
@ -49,6 +46,7 @@ public class GameView extends AppCompatActivity implements NavigationView.OnNavi
|
||||||
navigationView.setNavigationItemSelectedListener(this);
|
navigationView.setNavigationItemSelectedListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
|
||||||
|
@ -66,38 +64,34 @@ public class GameView extends AppCompatActivity implements NavigationView.OnNavi
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@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();
|
|
||||||
|
|
||||||
//noinspection SimplifiableIfStatement
|
|
||||||
if (id == R.id.action_settings) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("StatementWithEmptyBody")
|
@SuppressWarnings("StatementWithEmptyBody")
|
||||||
@Override
|
@Override
|
||||||
public boolean onNavigationItemSelected(MenuItem item) {
|
public boolean onNavigationItemSelected(MenuItem item) {
|
||||||
// Handle navigation view item clicks here.
|
// Handle navigation view item clicks here.
|
||||||
int id = item.getItemId();
|
int id = item.getItemId();
|
||||||
|
|
||||||
if (id == R.id.nav_camara) {
|
Intent intent;
|
||||||
// Handle the camera action
|
|
||||||
} else if (id == R.id.nav_gallery) {
|
|
||||||
|
|
||||||
} else if (id == R.id.nav_slideshow) {
|
if (id == R.id.nav_newgame) {
|
||||||
|
//create new game
|
||||||
|
} else if (id == R.id.nav_mainmenu) {
|
||||||
|
//new Game
|
||||||
|
intent = new Intent(this, MainActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
} else if (id == R.id.nav_manage) {
|
} else if (id == R.id.nav_settings) {
|
||||||
|
//open settings
|
||||||
|
intent = new Intent(this,SettingsActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
|
||||||
} else if (id == R.id.nav_share) {
|
|
||||||
|
|
||||||
} else if (id == R.id.nav_send) {
|
|
||||||
|
} else if (id == R.id.nav_highscore) {
|
||||||
|
//open highscore
|
||||||
|
|
||||||
|
// } else if (id == R.id.nav_share) {
|
||||||
|
|
||||||
|
// } else if (id == R.id.nav_send) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
23
app/src/main/java/tu_darmstadt/sudoku/view/MainActivity.java
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
package tu_darmstadt.sudoku.view;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public void onClicktext(View view) {
|
||||||
|
Intent i = new Intent(this, GameActivity.class);
|
||||||
|
startActivity(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,52 +0,0 @@
|
||||||
package tu_darmstadt.sudoku.view;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.design.widget.FloatingActionButton;
|
|
||||||
import android.support.design.widget.Snackbar;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
|
||||||
import android.support.v7.widget.Toolbar;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
|
|
||||||
public class MainMenu extends AppCompatActivity {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_main_menu);
|
|
||||||
//Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
|
||||||
//setSupportActionBar(toolbar);
|
|
||||||
|
|
||||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
|
||||||
fab.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
|
|
||||||
.setAction("Action", null).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@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_main_menu, menu);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@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();
|
|
||||||
|
|
||||||
//noinspection SimplifiableIfStatement
|
|
||||||
if (id == R.id.action_settings) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
}
|
|
297
app/src/main/java/tu_darmstadt/sudoku/view/SettingsActivity.java
Normal file
|
@ -0,0 +1,297 @@
|
||||||
|
package tu_darmstadt.sudoku.view;
|
||||||
|
|
||||||
|
|
||||||
|
import android.annotation.TargetApi;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.res.Configuration;
|
||||||
|
import android.media.Ringtone;
|
||||||
|
import android.media.RingtoneManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.preference.ListPreference;
|
||||||
|
import android.preference.Preference;
|
||||||
|
import android.preference.PreferenceActivity;
|
||||||
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.preference.PreferenceFragment;
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
import android.preference.RingtonePreference;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.support.v4.app.NavUtils;
|
||||||
|
|
||||||
|
import tu_darmstadt.sudoku.view.R;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link PreferenceActivity} that presents a set of application settings. On
|
||||||
|
* handset devices, settings are presented as a single list. On tablets,
|
||||||
|
* settings are split by category, with category headers shown to the left of
|
||||||
|
* the list of settings.
|
||||||
|
* <p>
|
||||||
|
* See <a href="http://developer.android.com/design/patterns/settings.html">
|
||||||
|
* Android Design: Settings</a> for design guidelines and the <a
|
||||||
|
* href="http://developer.android.com/guide/topics/ui/settings.html">Settings
|
||||||
|
* API Guide</a> for more information on developing a Settings UI.
|
||||||
|
*/
|
||||||
|
public class SettingsActivity extends AppCompatPreferenceActivity {
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setupActionBar();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up the {@link android.app.ActionBar}, if the API is available.
|
||||||
|
*/
|
||||||
|
private void setupActionBar() {
|
||||||
|
ActionBar actionBar = getSupportActionBar();
|
||||||
|
if (actionBar != null) {
|
||||||
|
// Show the Up button in the action bar.
|
||||||
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemSelected(int featureId, MenuItem item) {
|
||||||
|
int id = item.getItemId();
|
||||||
|
if (id == android.R.id.home) {
|
||||||
|
if (!super.onMenuItemSelected(featureId, item)) {
|
||||||
|
NavUtils.navigateUpFromSameTask(this);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onMenuItemSelected(featureId, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean onIsMultiPane() {
|
||||||
|
return isXLargeTablet(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper method to determine if the device has an extra-large screen. For
|
||||||
|
* example, 10" tablets are extra-large.
|
||||||
|
*/
|
||||||
|
private static boolean isXLargeTablet(Context context) {
|
||||||
|
return (context.getResources().getConfiguration().screenLayout
|
||||||
|
& Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
|
public void onBuildHeaders(List<Header> target) {
|
||||||
|
loadHeadersFromResource(R.xml.pref_headers, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A preference value change listener that updates the preference's summary
|
||||||
|
* to reflect its new value.
|
||||||
|
*/
|
||||||
|
private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onPreferenceChange(Preference preference, Object value) {
|
||||||
|
String stringValue = value.toString();
|
||||||
|
|
||||||
|
if (preference instanceof ListPreference) {
|
||||||
|
// For list preferences, look up the correct display value in
|
||||||
|
// the preference's 'entries' list.
|
||||||
|
ListPreference listPreference = (ListPreference) preference;
|
||||||
|
int index = listPreference.findIndexOfValue(stringValue);
|
||||||
|
|
||||||
|
// Set the summary to reflect the new value.
|
||||||
|
preference.setSummary(
|
||||||
|
index >= 0
|
||||||
|
? listPreference.getEntries()[index]
|
||||||
|
: null);
|
||||||
|
|
||||||
|
} else if (preference instanceof RingtonePreference) {
|
||||||
|
// For ringtone preferences, look up the correct display value
|
||||||
|
// using RingtoneManager.
|
||||||
|
if (TextUtils.isEmpty(stringValue)) {
|
||||||
|
// Empty values correspond to 'silent' (no ringtone).
|
||||||
|
preference.setSummary(R.string.pref_ringtone_silent);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Ringtone ringtone = RingtoneManager.getRingtone(
|
||||||
|
preference.getContext(), Uri.parse(stringValue));
|
||||||
|
|
||||||
|
if (ringtone == null) {
|
||||||
|
// Clear the summary if there was a lookup error.
|
||||||
|
preference.setSummary(null);
|
||||||
|
} else {
|
||||||
|
// Set the summary to reflect the new ringtone display
|
||||||
|
// name.
|
||||||
|
String name = ringtone.getTitle(preference.getContext());
|
||||||
|
preference.setSummary(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// For all other preferences, set the summary to the value's
|
||||||
|
// simple string representation.
|
||||||
|
preference.setSummary(stringValue);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Binds a preference's summary to its value. More specifically, when the
|
||||||
|
* preference's value is changed, its summary (line of text below the
|
||||||
|
* preference title) is updated to reflect the value. The summary is also
|
||||||
|
* immediately updated upon calling this method. The exact display format is
|
||||||
|
* dependent on the type of preference.
|
||||||
|
*
|
||||||
|
* @see #sBindPreferenceSummaryToValueListener
|
||||||
|
*/
|
||||||
|
private static void bindPreferenceSummaryToValue(Preference preference) {
|
||||||
|
// Set the listener to watch for value changes.
|
||||||
|
preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
|
||||||
|
|
||||||
|
// Trigger the listener immediately with the preference's
|
||||||
|
// current value.
|
||||||
|
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
|
||||||
|
PreferenceManager
|
||||||
|
.getDefaultSharedPreferences(preference.getContext())
|
||||||
|
.getString(preference.getKey(), ""));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method stops fragment injection in malicious applications.
|
||||||
|
* Make sure to deny any unknown fragments here.
|
||||||
|
*/
|
||||||
|
protected boolean isValidFragment(String fragmentName) {
|
||||||
|
return PreferenceFragment.class.getName().equals(fragmentName)
|
||||||
|
|| GeneralPreferenceFragment.class.getName().equals(fragmentName)
|
||||||
|
|| DataSyncPreferenceFragment.class.getName().equals(fragmentName)
|
||||||
|
|| NotificationPreferenceFragment.class.getName().equals(fragmentName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This fragment shows general preferences only. It is used when the
|
||||||
|
* activity is showing a two-pane settings UI.
|
||||||
|
*/
|
||||||
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
|
public static class GeneralPreferenceFragment extends PreferenceFragment {
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
addPreferencesFromResource(R.xml.pref_general);
|
||||||
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
|
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
||||||
|
// to their values. When their values change, their summaries are
|
||||||
|
// updated to reflect the new value, per the Android Design
|
||||||
|
// guidelines.
|
||||||
|
bindPreferenceSummaryToValue(findPreference("example_text"));
|
||||||
|
bindPreferenceSummaryToValue(findPreference("example_list"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
int id = item.getItemId();
|
||||||
|
if (id == android.R.id.home) {
|
||||||
|
startActivity(new Intent(getActivity(), SettingsActivity.class));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This fragment shows notification preferences only. It is used when the
|
||||||
|
* activity is showing a two-pane settings UI.
|
||||||
|
*/
|
||||||
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
|
public static class NotificationPreferenceFragment extends PreferenceFragment {
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
addPreferencesFromResource(R.xml.pref_notification);
|
||||||
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
|
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
||||||
|
// to their values. When their values change, their summaries are
|
||||||
|
// updated to reflect the new value, per the Android Design
|
||||||
|
// guidelines.
|
||||||
|
bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
int id = item.getItemId();
|
||||||
|
if (id == android.R.id.home) {
|
||||||
|
startActivity(new Intent(getActivity(), SettingsActivity.class));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This fragment shows data and sync preferences only. It is used when the
|
||||||
|
* activity is showing a two-pane settings UI.
|
||||||
|
*/
|
||||||
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
|
public static class DataSyncPreferenceFragment extends PreferenceFragment {
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
addPreferencesFromResource(R.xml.pref_data_sync);
|
||||||
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
|
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
||||||
|
// to their values. When their values change, their summaries are
|
||||||
|
// updated to reflect the new value, per the Android Design
|
||||||
|
// guidelines.
|
||||||
|
bindPreferenceSummaryToValue(findPreference("sync_frequency"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
int id = item.getItemId();
|
||||||
|
if (id == android.R.id.home) {
|
||||||
|
startActivity(new Intent(getActivity(), SettingsActivity.class));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||||
|
public static class TestFragment extends PreferenceFragment {
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState){
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
addPreferencesFromResource(R.xml.pref_highlighting);
|
||||||
|
setHasOptionsMenu(true);
|
||||||
|
|
||||||
|
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
||||||
|
// to their values. When their values change, their summaries are
|
||||||
|
// updated to reflect the new value, per the Android Design
|
||||||
|
// guidelines.
|
||||||
|
//bindPreferenceSummaryToValue(findPreference(""));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
int id = item.getItemId();
|
||||||
|
if (id == android.R.id.home) {
|
||||||
|
startActivity(new Intent(getActivity(), SettingsActivity.class));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
package tu_darmstadt.sudoku.view;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.provider.ContactsContract;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import java.util.jar.Attributes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by TMZ_LToP on 10.11.2015.
|
||||||
|
*/
|
||||||
|
public class SudokuCellView extends View {
|
||||||
|
|
||||||
|
public SudokuCellView(Context context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SudokuCellView(Context context, AttributeSet attrs){
|
||||||
|
super(context,attrs);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int pubx =0 ;
|
||||||
|
int puby =0 ;
|
||||||
|
|
||||||
|
public void setPos(int x,int y) {
|
||||||
|
//dpi = (width * 160)/density getRecourses().getDisplayMetrics().density
|
||||||
|
|
||||||
|
pubx = x;
|
||||||
|
puby = y;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDraw(Canvas canvas) {
|
||||||
|
super.onDraw(canvas);
|
||||||
|
|
||||||
|
int width = getWidth() - getPaddingRight();
|
||||||
|
int height = getHeight() - getPaddingBottom();
|
||||||
|
|
||||||
|
int paddingLeft = getPaddingLeft();
|
||||||
|
int paddingTop = getPaddingTop();
|
||||||
|
|
||||||
|
canvas.drawRect(pubx,puby,pubx+100,puby+100,new Paint());
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package tu_darmstadt.sudoku.view;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
|
import tu_darmstadt.sudoku.controller.GameController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Timm Lippert on 11.11.2015.
|
||||||
|
*/
|
||||||
|
public class SudokuFieldLayout extends RelativeLayout {
|
||||||
|
|
||||||
|
|
||||||
|
private GameController gamecont;
|
||||||
|
|
||||||
|
public SudokuCellView [][] gamecells;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public SudokuFieldLayout(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGame(GameController gc) {
|
||||||
|
if (gc == null) throw new IllegalArgumentException("GameController may not be null.");
|
||||||
|
gamecont = gc;
|
||||||
|
gamecells = new SudokuCellView[gc.getSize()][gc.getSize()];
|
||||||
|
int width = (Math.min(getWidth(),getHeight()))/gc.getSize();
|
||||||
|
|
||||||
|
for (int i = 0; i < gc.getSize(); i++) {
|
||||||
|
for (int j = 0; j < gc.getSize(); j++){
|
||||||
|
|
||||||
|
gamecells[i][j] = new SudokuCellView(getContext(), null);
|
||||||
|
//gamecells[i][j].setValues(i,j,width,field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
BIN
app/src/main/res/drawable-hdpi/ic_info_black_24dp.png
Normal file
After Width: | Height: | Size: 321 B |
BIN
app/src/main/res/drawable-hdpi/ic_notifications_black_24dp.png
Normal file
After Width: | Height: | Size: 233 B |
BIN
app/src/main/res/drawable-hdpi/ic_sync_black_24dp.png
Normal file
After Width: | Height: | Size: 368 B |
BIN
app/src/main/res/drawable-mdpi/ic_info_black_24dp.png
Normal file
After Width: | Height: | Size: 222 B |
BIN
app/src/main/res/drawable-mdpi/ic_notifications_black_24dp.png
Normal file
After Width: | Height: | Size: 182 B |
BIN
app/src/main/res/drawable-mdpi/ic_sync_black_24dp.png
Normal file
After Width: | Height: | Size: 250 B |
9
app/src/main/res/drawable-v21/ic_info_black_24dp.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zm1,15h-2v-6h2v6zm0,-8h-2V7h2v2z"/>
|
||||||
|
</vector>
|
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M11.5,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.9,2 2,2zm6.5,-6v-5.5c0,-3.07 -2.13,-5.64 -5,-6.32V3.5c0,-0.83 -0.67,-1.5 -1.5,-1.5S10,2.67 10,3.5v0.68c-2.87,0.68 -5,3.25 -5,6.32V16l-2,2v1h17v-1l-2,-2z"/>
|
||||||
|
</vector>
|
9
app/src/main/res/drawable-v21/ic_sync_black_24dp.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24.0dp"
|
||||||
|
android:height="24.0dp"
|
||||||
|
android:viewportWidth="24.0"
|
||||||
|
android:viewportHeight="24.0">
|
||||||
|
<path
|
||||||
|
android:fillColor="#FF000000"
|
||||||
|
android:pathData="M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01,-.25 1.97,-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0,-4.42,-3.58,-8,-8,-8zm0 14c-3.31 0,-6,-2.69,-6,-6 0,-1.01.25,-1.97.7,-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4,-4,-4,-4v3z"/>
|
||||||
|
</vector>
|
BIN
app/src/main/res/drawable-xhdpi/ic_info_black_24dp.png
Normal file
After Width: | Height: | Size: 412 B |
BIN
app/src/main/res/drawable-xhdpi/ic_notifications_black_24dp.png
Normal file
After Width: | Height: | Size: 278 B |
BIN
app/src/main/res/drawable-xhdpi/ic_sync_black_24dp.png
Normal file
After Width: | Height: | Size: 467 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_info_black_24dp.png
Normal file
After Width: | Height: | Size: 579 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_notifications_black_24dp.png
Normal file
After Width: | Height: | Size: 383 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_sync_black_24dp.png
Normal file
After Width: | Height: | Size: 669 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_info_black_24dp.png
Normal file
After Width: | Height: | Size: 766 B |
After Width: | Height: | Size: 497 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_sync_black_24dp.png
Normal file
After Width: | Height: | Size: 875 B |
18
app/src/main/res/layout/activity_main.xml
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<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: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.view.MainActivity">
|
||||||
|
|
||||||
|
<TextView android:id="@+id/testString"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:editable="true"
|
||||||
|
android:clickable="true"
|
||||||
|
android:onClick="onClicktext"
|
||||||
|
android:text="@string/app_name"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
|
@ -1,20 +0,0 @@
|
||||||
<?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:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context=".MainMenu">
|
|
||||||
|
|
||||||
<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>
|
|
||||||
|
|
||||||
<include layout="@layout/content_main_menu" />
|
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton android:id="@+id/fab"
|
|
||||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin"
|
|
||||||
android:src="@android:drawable/ic_dialog_email" />
|
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
|
|
@ -4,7 +4,7 @@
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" android:fitsSystemWindows="true"
|
android:layout_height="match_parent" android:fitsSystemWindows="true"
|
||||||
tools:context="tu_darmstadt.sudoku.view.GameView">
|
tools:context="tu_darmstadt.sudoku.view.GameActivity">
|
||||||
|
|
||||||
<android.support.design.widget.AppBarLayout android:layout_height="wrap_content"
|
<android.support.design.widget.AppBarLayout android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay">
|
android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
@ -17,9 +17,5 @@
|
||||||
|
|
||||||
<include layout="@layout/content_game_view" />
|
<include layout="@layout/content_game_view" />
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton android:id="@+id/fab"
|
|
||||||
android:layout_width="wrap_content" android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom|end" android:layout_margin="@dimen/fab_margin"
|
|
||||||
android:src="@android:drawable/ic_dialog_email" />
|
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||||
tools:showIn="@layout/app_bar_game_view" tools:context="tu_darmstadt.sudoku.view.GameView">
|
tools:showIn="@layout/app_bar_game_view" tools:context="tu_darmstadt.sudoku.view.GameActivity">
|
||||||
|
<tu_darmstadt.sudoku.view.SudokuFieldLayout
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
|
</tu_darmstadt.sudoku.view.SudokuFieldLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?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: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"
|
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
|
||||||
tools:showIn="@layout/activity_main_menu" tools:context=".MainMenu">
|
|
||||||
|
|
||||||
<TextView android:text="Hello World! :)" android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content" />
|
|
||||||
</RelativeLayout>
|
|
|
@ -2,22 +2,22 @@
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<group android:checkableBehavior="single">
|
<group android:checkableBehavior="single">
|
||||||
<item android:id="@+id/nav_camara" android:icon="@android:drawable/ic_menu_camera"
|
<item android:id="@+id/nav_newgame" android:icon="@android:drawable/ic_menu_camera"
|
||||||
android:title="Import" />
|
android:title="@string/new_game" />
|
||||||
<item android:id="@+id/nav_gallery" android:icon="@android:drawable/ic_menu_gallery"
|
<item android:id="@+id/nav_mainmenu" android:icon="@android:drawable/ic_menu_gallery"
|
||||||
android:title="Gallery" />
|
android:title="@string/mainmenu" />
|
||||||
<item android:id="@+id/nav_slideshow" android:icon="@android:drawable/ic_menu_slideshow"
|
<item android:id="@+id/nav_settings" android:icon="@android:drawable/ic_menu_slideshow"
|
||||||
android:title="Slideshow" />
|
android:title="@string/settings" />
|
||||||
<item android:id="@+id/nav_manage" android:icon="@android:drawable/ic_menu_manage"
|
<item android:id="@+id/nav_highscore" android:icon="@android:drawable/ic_menu_manage"
|
||||||
android:title="Tools" />
|
android:title="@string/highscore" />
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<item android:title="Communicate">
|
<item android:title="@string/group">
|
||||||
<menu>
|
<menu>
|
||||||
<item android:id="@+id/nav_share" android:icon="@android:drawable/ic_menu_share"
|
<item android:id="@+id/nav_share" android:icon="@android:drawable/ic_menu_share"
|
||||||
android:title="Share" />
|
android:title="@string/help" />
|
||||||
<item android:id="@+id/nav_send" android:icon="@android:drawable/ic_menu_send"
|
<item android:id="@+id/nav_send" android:icon="@android:drawable/ic_menu_send"
|
||||||
android:title="Send" />
|
android:title="@string/about" />
|
||||||
</menu>
|
</menu>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
|
||||||
android:orderInCategory="100" app:showAsAction="never" />
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<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=".MainMenu">
|
|
||||||
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
|
||||||
android:orderInCategory="100" app:showAsAction="never" />
|
|
||||||
</menu>
|
|
7
app/src/main/res/values-de/strings.xml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="new_game">Neues Spiel</string>
|
||||||
|
<string name="settings">Einstellungen</string>
|
||||||
|
<string name="highscore">Bestenliste</string>
|
||||||
|
<string name="mainmenu">Hauptmenü</string>
|
||||||
|
</resources>
|
|
@ -1,8 +1,81 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">Sudoku</string>
|
<string name="app_name">Sudoku</string>
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
<string name="title_activity_game_view">GameView</string>
|
<string name="title_activity_game_view">Sudoku</string>
|
||||||
|
|
||||||
|
<!-- Strings related to 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="navigation_drawer_open">Open navigation drawer</string>
|
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||||
|
<string name="title_activity_settings">Settings</string>
|
||||||
|
|
||||||
|
<!-- Strings related to Settings -->
|
||||||
|
|
||||||
|
<!-- Strings related to Highlight -->
|
||||||
|
<string name="pref_highlighting_selection">Selection</string>
|
||||||
|
<string name="pref_highlighting_selection_values">Values</string>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Example General settings -->
|
||||||
|
<string name="pref_header_general">General</string>
|
||||||
|
|
||||||
|
<string name="pref_title_social_recommendations">Enable social recommendations</string>
|
||||||
|
<string name="pref_description_social_recommendations">Recommendations for people to contact
|
||||||
|
based on your message history
|
||||||
|
</string>
|
||||||
|
|
||||||
|
<string name="pref_title_display_name">Display DeineMudda</string>
|
||||||
|
<string name="pref_default_display_name">Anonymous</string>
|
||||||
|
|
||||||
|
<string name="pref_title_add_friends_to_messages">Add friends to messages</string>
|
||||||
|
<string-array name="pref_example_list_titles">
|
||||||
|
<item>Always</item>
|
||||||
|
<item>When possible</item>
|
||||||
|
<item>Never</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="pref_example_list_values">
|
||||||
|
<item>1</item>
|
||||||
|
<item>0</item>
|
||||||
|
<item>-1</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<!-- Example settings for Data & Sync -->
|
||||||
|
<string name="pref_header_data_sync">Data & sync</string>
|
||||||
|
|
||||||
|
<string name="pref_title_sync_frequency">Sync frequency</string>
|
||||||
|
<string-array name="pref_sync_frequency_titles">
|
||||||
|
<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-array name="pref_sync_frequency_values">
|
||||||
|
<item>15</item>
|
||||||
|
<item>30</item>
|
||||||
|
<item>60</item>
|
||||||
|
<item>180</item>
|
||||||
|
<item>360</item>
|
||||||
|
<item>-1</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<string name="pref_title_system_sync_settings">System sync settings</string>
|
||||||
|
|
||||||
|
<!-- Example settings for Notifications -->
|
||||||
|
<string name="pref_header_notifications">Notifications</string>
|
||||||
|
|
||||||
|
<string name="pref_title_new_message_notifications">New message notifications</string>
|
||||||
|
|
||||||
|
<string name="pref_title_ringtone">Ringtone</string>
|
||||||
|
<string name="pref_ringtone_silent">Silent</string>
|
||||||
|
|
||||||
|
<string name="pref_title_vibrate">Vibrate</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
21
app/src/main/res/xml/pref_data_sync.xml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
|
||||||
|
dismiss it. -->
|
||||||
|
<!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
|
||||||
|
<ListPreference
|
||||||
|
android:key="sync_frequency"
|
||||||
|
android:title="@string/pref_title_sync_frequency"
|
||||||
|
android:entries="@array/pref_sync_frequency_titles"
|
||||||
|
android:entryValues="@array/pref_sync_frequency_values"
|
||||||
|
android:defaultValue="180"
|
||||||
|
android:negativeButtonText="@null"
|
||||||
|
android:positiveButtonText="@null" />
|
||||||
|
|
||||||
|
<!-- This preference simply launches an intent when selected. Use this UI sparingly, per
|
||||||
|
design guidelines. -->
|
||||||
|
<Preference android:title="@string/pref_title_system_sync_settings">
|
||||||
|
<intent android:action="android.settings.SYNC_SETTINGS" />
|
||||||
|
</Preference>
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
33
app/src/main/res/xml/pref_general.xml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="example_switch"
|
||||||
|
android:title="@string/pref_title_social_recommendations"
|
||||||
|
android:summary="@string/pref_description_social_recommendations"
|
||||||
|
android:defaultValue="true" />
|
||||||
|
|
||||||
|
<!-- NOTE: EditTextPreference accepts EditText attributes. -->
|
||||||
|
<!-- NOTE: EditTextPreference's summary should be set to its value by the activity code. -->
|
||||||
|
<EditTextPreference
|
||||||
|
android:key="example_text"
|
||||||
|
android:title="@string/pref_title_display_name"
|
||||||
|
android:defaultValue="@string/pref_default_display_name"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:inputType="textCapWords"
|
||||||
|
android:capitalize="words"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:maxLines="1" />
|
||||||
|
|
||||||
|
<!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
|
||||||
|
dismiss it. -->
|
||||||
|
<!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
|
||||||
|
<ListPreference
|
||||||
|
android:key="example_list"
|
||||||
|
android:title="@string/pref_title_add_friends_to_messages"
|
||||||
|
android:defaultValue="-1"
|
||||||
|
android:entries="@array/pref_example_list_titles"
|
||||||
|
android:entryValues="@array/pref_example_list_values"
|
||||||
|
android:negativeButtonText="@null"
|
||||||
|
android:positiveButtonText="@null" />
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
16
app/src/main/res/xml/pref_headers.xml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<!-- These settings headers are only used on tablets. -->
|
||||||
|
|
||||||
|
<header android:fragment="tu_darmstadt.sudoku.view.SettingsActivity$GeneralPreferenceFragment"
|
||||||
|
android:title="@string/pref_header_general" android:icon="@drawable/ic_info_black_24dp" />
|
||||||
|
|
||||||
|
<header
|
||||||
|
android:fragment="tu_darmstadt.sudoku.view.SettingsActivity$NotificationPreferenceFragment"
|
||||||
|
android:title="@string/pref_header_notifications"
|
||||||
|
android:icon="@drawable/ic_notifications_black_24dp" />
|
||||||
|
|
||||||
|
<header android:fragment="tu_darmstadt.sudoku.view.SettingsActivity$DataSyncPreferenceFragment"
|
||||||
|
android:title="@string/pref_header_data_sync" android:icon="@drawable/ic_sync_black_24dp" />
|
||||||
|
|
||||||
|
</preference-headers>
|
11
app/src/main/res/xml/pref_highlighting.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<PreferenceCategory android:title="@string/pref_highlighting_selection">
|
||||||
|
<SwitchPreference android:id="@+id/pref_highlighting_selection_values"
|
||||||
|
android:key="example_switch"
|
||||||
|
android:title="@string/pref_title_social_recommendations"
|
||||||
|
android:summary="@string/pref_description_social_recommendations"
|
||||||
|
android:defaultValue="true"/>
|
||||||
|
</PreferenceCategory>
|
||||||
|
</PreferenceScreen>
|
27
app/src/main/res/xml/pref_notification.xml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<!-- A 'parent' preference, which enables/disables child preferences (below)
|
||||||
|
when checked/unchecked. -->
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="notifications_new_message"
|
||||||
|
android:title="@string/pref_title_new_message_notifications"
|
||||||
|
android:defaultValue="true" />
|
||||||
|
|
||||||
|
<!-- Allows the user to choose a ringtone in the 'notification' category. -->
|
||||||
|
<!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
|
||||||
|
<!-- NOTE: RingtonePreference's summary should be set to its value by the activity code. -->
|
||||||
|
<RingtonePreference
|
||||||
|
android:dependency="notifications_new_message"
|
||||||
|
android:key="notifications_new_message_ringtone"
|
||||||
|
android:title="@string/pref_title_ringtone"
|
||||||
|
android:ringtoneType="notification"
|
||||||
|
android:defaultValue="content://settings/system/notification_sound" />
|
||||||
|
|
||||||
|
<!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
|
||||||
|
<SwitchPreference
|
||||||
|
android:dependency="notifications_new_message"
|
||||||
|
android:key="notifications_new_message_vibrate"
|
||||||
|
android:title="@string/pref_title_vibrate"
|
||||||
|
android:defaultValue="true" />
|
||||||
|
|
||||||
|
</PreferenceScreen>
|