pretty good

todo: toolbar
This commit is contained in:
adrienmalin 2018-08-15 20:54:09 +02:00
parent 0de1a4aa91
commit 4011b07887
38 changed files with 471 additions and 288 deletions

View File

@ -14,13 +14,68 @@
<option name="children"> <option name="children">
<map> <map>
<entry key="actionbar"> <entry key="actionbar">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="clipartAsset">
<value> <value>
<PersistentState> <PersistentState>
<option name="values"> <option name="values">
<map> <map>
<entry key="assetType" value="IMAGE" /> <entry key="url" value="jar:file:/C:/Program%20Files/Android/Android%20Studio/plugins/android/lib/android.jar!/images/material_design_icons/action/ic_info_outline_black_24dp.xml" />
</map>
</option>
</PersistentState>
</value>
</entry>
<entry key="textAsset">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="text" value="" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
<option name="values">
<map>
<entry key="assetType" value="TEXT" />
<entry key="imageAsset" value="C:\Users\adima\Downloads\ping-pong (2).png" /> <entry key="imageAsset" value="C:\Users\adima\Downloads\ping-pong (2).png" />
<entry key="outputName" value="ic_button" /> <entry key="outputName" value="not_server" />
<entry key="theme" value="HOLO_DARK" />
</map>
</option>
</PersistentState>
</value>
</entry>
<entry key="launcher">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="foregroundImage">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="trimmed" value="true" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
<option name="values">
<map>
<entry key="backgroundAssetType" value="COLOR" />
<entry key="backgroundColor" value="ffffff" />
<entry key="foregroundImage" value="C:\Users\adima\AndroidStudioProjects\PingPoints\app\src\main\res\drawable\icon.xml" />
</map> </map>
</option> </option>
</PersistentState> </PersistentState>
@ -41,11 +96,6 @@
</entry> </entry>
</map> </map>
</option> </option>
<option name="values">
<map>
<entry key="outputIconType" value="ACTIONBAR" />
</map>
</option>
</PersistentState> </PersistentState>
</value> </value>
</entry> </entry>
@ -56,7 +106,42 @@
</entry> </entry>
<entry key="vectorWizard"> <entry key="vectorWizard">
<value> <value>
<PersistentState /> <PersistentState>
<option name="children">
<map>
<entry key="vectorAssetStep">
<value>
<PersistentState>
<option name="children">
<map>
<entry key="clipartAsset">
<value>
<PersistentState>
<option name="values">
<map>
<entry key="url" value="jar:file:/C:/Program%20Files/Android/Android%20Studio/plugins/android/lib/android.jar!/images/material_design_icons/action/ic_info_outline_black_24dp.xml" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
<option name="values">
<map>
<entry key="assetSourceType" value="FILE" />
<entry key="autoMirrored" value="true" />
<entry key="color" value="ffffff" />
<entry key="outputName" value="server" />
<entry key="sourceFile" value="C:\Users\adima\Downloads\ping-pong (2).svg" />
</map>
</option>
</PersistentState>
</value>
</entry>
</map>
</option>
</PersistentState>
</value> </value>
</entry> </entry>
</map> </map>

Binary file not shown.

View File

@ -9,15 +9,19 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/PingPoints"> android:theme="@style/PingPoints">
<activity android:name=".MainActivity" <activity
android:name=".MainActivity"
android:screenOrientation="sensorLandscape" android:screenOrientation="sensorLandscape"
android:theme="@style/PingPoints"> android:theme="@style/PingPoints">
<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
android:name=".CreditsActivity"
android:theme="@style/PingPoints">
</activity>
</application> </application>
</manifest> </manifest>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 39 KiB

View File

@ -0,0 +1,12 @@
package adrienmalin.pingpoints
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
class CreditsActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_credits)
}
}

View File

@ -10,23 +10,31 @@ import android.support.v4.app.DialogFragment
class EndOfMatchDialog: DialogFragment() { class EndOfMatchDialog: DialogFragment() {
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val builder = AlertDialog.Builder(activity) var names: Array<String> = arrayOf("", "")
val player1Name = arguments?.getString("PLAYER_1_NAME") var winnerName = ""
val player2Name = arguments?.getString("PLAYER_2_NAME") var score = IntArray(2)
val winnerName = arguments?.getString("WINNER_NAME")
val winnerScore = arguments?.getInt("WINNER_SCORE")
val loserScore = arguments?.getInt("LOSER_SCORE")
builder.setTitle(getString(R.string.end_match_dialog_title, winnerName)) arguments?.apply {
.setMessage(getString(R.string.score, winnerScore, loserScore)) names = getStringArray("names")
.setPositiveButton( winnerName = getString("winnerName")
score = getIntArray("score")
}
return AlertDialog.Builder(activity).apply{
setTitle(getString(R.string.end_match_dialog_title, winnerName))
setMessage(getString(R.string.score, score[0], score[1]))
setPositiveButton(
R.string.new_match, R.string.new_match,
DialogInterface.OnClickListener {dialog, id -> DialogInterface.OnClickListener { dialog, id ->
startActivity(Intent(context, MainActivity::class.java)) startActivity(
Intent(context, MainActivity::class.java).apply {
putExtra("names", names)
}
)
activity?.finish() activity?.finish()
} }
) )
.setNeutralButton( setNeutralButton(
R.string.share_button, R.string.share_button,
DialogInterface.OnClickListener { dialog, id -> DialogInterface.OnClickListener { dialog, id ->
val sendIntent: Intent = Intent().apply { val sendIntent: Intent = Intent().apply {
@ -35,19 +43,18 @@ class EndOfMatchDialog: DialogFragment() {
Intent.EXTRA_SUBJECT, Intent.EXTRA_SUBJECT,
getString( getString(
R.string.share_subject, R.string.share_subject,
player1Name, names[Side.LEFT.value],
player2Name names[Side.RIGHT.value]
) )
) )
putExtra( putExtra(
Intent.EXTRA_TEXT, Intent.EXTRA_TEXT,
getString( getString(R.string.share_message,
R.string.share_message, names[Side.LEFT.value],
player1Name, names[Side.RIGHT.value],
player2Name,
winnerName, winnerName,
winnerScore, score[0],
loserScore score[1]
) )
) )
type = "text/plain" type = "text/plain"
@ -55,13 +62,12 @@ class EndOfMatchDialog: DialogFragment() {
startActivity(sendIntent) startActivity(sendIntent)
} }
) )
.setNegativeButton( setNegativeButton(
R.string.quit_button, R.string.quit_button,
DialogInterface.OnClickListener { dialog, id -> DialogInterface.OnClickListener { dialog, id ->
activity?.finish() activity?.finish()
} }
) )
}.create()
return builder.create()
} }
} }

View File

@ -3,37 +3,17 @@ package adrienmalin.pingpoints
import android.content.pm.ActivityInfo import android.content.pm.ActivityInfo
import android.support.v7.app.AppCompatActivity import android.support.v7.app.AppCompatActivity
import android.os.Bundle import android.os.Bundle
import android.text.Html
import android.view.View import android.view.View
import android.widget.Button import android.widget.Button
import android.os.Build import android.os.Build
import android.text.Spanned
import android.text.TextUtils.join import android.text.TextUtils.join
import kotlin.math.abs
import android.support.design.widget.Snackbar
import android.support.v4.app.DialogFragment
import android.widget.Toast import android.widget.Toast
@SuppressWarnings("deprecation")
fun fromHtml(html: String): Spanned {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY)
} else {
Html.fromHtml(html)
}
}
class MainActivity : AppCompatActivity(), StarterNameDialog.StarterNameDialogListener{ class MainActivity : AppCompatActivity(), StarterNameDialog.StarterNameDialogListener{
var players: Array<Player> = arrayOf( var players: Array<Player> = emptyArray()
Player(), var serviceSide: Side = Side.LEFT
Player() var relaunchSide: Side = Side.RIGHT
)
var server: Int = 0
var notServer: Int = 1
var textScore: android.widget.TextView? = null var textScore: android.widget.TextView? = null
var textService: android.widget.TextView? = null var textService: android.widget.TextView? = null
@ -43,114 +23,112 @@ class MainActivity : AppCompatActivity(), StarterNameDialog.StarterNameDialogLis
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main) setContentView(R.layout.activity_main)
//setSupportActionBar(findViewById(R.id.toolbar))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE; requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
} }
val defaultNames: Array<String> = resources.getStringArray(R.array.players_names) var names: Array<String> = intent.getStringArrayExtra("names") ?: resources.getStringArray(R.array.default_players_names)
for ((player, defaultName) in players.zip(defaultNames)) { players = arrayOf(
player.name = defaultName Player(names[Side.LEFT.value]),
} Player(names[Side.RIGHT.value])
)
textScore = findViewById(R.id.textScore) textScore = findViewById(R.id.textScore)
textService = findViewById(R.id.textService) textService = findViewById(R.id.textService)
buttons = arrayOf( buttons = arrayOf(
findViewById(R.id.buttonPlayer1), findViewById(R.id.buttonLeftPlayer),
findViewById(R.id.buttonPlayer2) findViewById(R.id.buttonRightPlayer)
) )
updateUI()
openStarterNameDialog() openStarterNameDialog()
update_ui()
Toast.makeText(applicationContext, R.string.info, Snackbar.LENGTH_LONG)
.show()
} }
fun openStarterNameDialog() { fun openStarterNameDialog() {
val (loser, winner) = players.sortedBy { it.score } StarterNameDialog().apply {
var starterNameDialog: EndOfMatchDialog = EndOfMatchDialog() val names = players.map{ it.name }.toTypedArray()
starterNameDialog.arguments = Bundle() arguments = Bundle().apply {
starterNameDialog.arguments?.putString("PLAYER_1_NAME", players[0].name) putStringArray("names", names)
starterNameDialog.arguments?.putString("PLAYER_2_NAME", players[1].name) }
starterNameDialog.show( show(
supportFragmentManager, supportFragmentManager,
join(" ", arrayOf(winner.name, winner.score.toString(), "-", loser.name, loser.score.toString())) "StarterNameDialog:" + join(" vs. ", names)
) )
} }
override fun onStaterNameDialogPositiveClick(dialog: DialogFragment) {
val inputPlayer1Name: android.widget.EditText? = findViewById(R.id.input_player_1_name)
players[0].name = inputPlayer1Name?.text.toString()
val inputPlayer2Name: android.widget.EditText? = findViewById(R.id.input_player_2_name)
players[1].name = inputPlayer2Name?.text.toString()
} }
fun update_ui() { override fun setStarterName(serviceSide: Side, names: Collection<String>) {
players.zip(names).forEach { (player, name) -> player.name = name}
this.serviceSide = serviceSide
relaunchSide = when(serviceSide) {
Side.LEFT -> Side.RIGHT
Side.RIGHT -> Side.LEFT
}
textScore?.text = getString(R.string.score, players[server].score, players[notServer].score) updateUI()
Toast.makeText(applicationContext, R.string.info, Toast.LENGTH_LONG).show()
}
textService?.text = getString(R.string.service, players[server].name) fun updateUI() {
textScore?.text = getString(R.string.score, players[serviceSide.value].score, players[relaunchSide.value].score)
textService?.text = getString(R.string.service, players[serviceSide.value].name)
for ((button, player) in buttons.zip(players)) { for ((button, player) in buttons.zip(players)) {
button.text = fromHtml(getString(R.string.button_text, player.name, player.score)) button.text = fromHtml(getString(R.string.button_text, player.name, player.score))
} }
if (server == 0) { when (serviceSide) {
buttons[0].setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_button, 0, 0, 0) Side.LEFT -> {
buttons[1].setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0) buttons[Side.LEFT.value].setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_service, 0, 0, 0)
} else { buttons[Side.RIGHT.value].setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_relaunch, 0, 0, 0)
buttons[0].setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0) }
buttons[1].setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_button, 0) Side.RIGHT -> {
buttons[Side.LEFT.value].setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_relaunch, 0)
buttons[Side.RIGHT.value].setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_service, 0)
}
} }
} }
fun onClickPlayer1(view: View) { fun onClickLeftPlayer(view: View) {
updateScore(players[0]) updateScore(players[Side.LEFT.value])
} }
fun onClickPlayer2(view: View) { fun onClickRightPlayer(view: View) {
updateScore(players[1]) updateScore(players[Side.RIGHT.value])
} }
fun finishedMatch() = (
(players.map { it -> it.score } .max() ?: 0 >= 11) or
(abs(players[0].score - players[1].score) >= 2)
)
fun updateScore(scoringPlayer: Player) { fun updateScore(scoringPlayer: Player) {
if ( !finishedMatch() ) { if ( !matchIsFinished() ) {
scoringPlayer.score++ scoringPlayer.score++
if (players.sumBy { it.score } % 2 == 0) { if (players.sumBy { it.score } % 2 == 0) {
server = notServer.also { notServer = server } serviceSide = relaunchSide.also { relaunchSide = serviceSide }
} }
} }
if ( finishedMatch() ) { if ( matchIsFinished() ) {
openEndOfMatchDialog() openEndOfMatchDialog()
} }
update_ui() updateUI()
}
fun matchIsFinished(): Boolean {
val (minScore, maxScore) = players.map { it.score }.sorted()
return (maxScore >= 11) and (maxScore - minScore >= 2)
} }
fun openEndOfMatchDialog() { fun openEndOfMatchDialog() {
var endOfMatchDialog: EndOfMatchDialog = EndOfMatchDialog() EndOfMatchDialog().apply {
val (loser, winner) = players.sortedBy { it.score } arguments = Bundle().apply {
endOfMatchDialog.arguments = Bundle() putStringArray("names", players.map{ it.name }.toTypedArray())
endOfMatchDialog.arguments?.putString("PLAYER_1_NAME", players[0].name) putString("winnerName", players.maxBy { it.score }?.name)
endOfMatchDialog.arguments?.putString("PLAYER_2_NAME", players[1].name) putIntArray("score", players.map{ it.score }.sortedDescending().toIntArray())
endOfMatchDialog.arguments?.putString("WINNER_NAME", winner.name) }
endOfMatchDialog.arguments?.putInt("WINNER_SCORE", winner.score) show(
endOfMatchDialog.arguments?.putInt("LOSER_SCORE", loser.score)
endOfMatchDialog.show(
supportFragmentManager, supportFragmentManager,
join(" ", arrayOf(winner.name, winner.score.toString(), "-", loser.name, loser.score.toString())) "EndOfMatchDialog"
) )
} }
}
} }
data class Player(
var name: String = "",
var score: Int = 0,
var serviceText: String = ""
)

View File

@ -4,53 +4,58 @@ import android.app.AlertDialog
import android.app.Dialog import android.app.Dialog
import android.os.Bundle import android.os.Bundle
import android.support.v4.app.DialogFragment import android.support.v4.app.DialogFragment
import java.util.ArrayList
import android.app.Activity import android.app.Activity
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.widget.EditText
import android.widget.RadioGroup
import android.widget.TextView
class StarterNameDialog : DialogFragment() { class StarterNameDialog : DialogFragment() {
interface StarterNameDialogListener { interface StarterNameDialogListener {
fun onStaterNameDialogPositiveClick(dialog: DialogFragment) fun setStarterName(serviceSide: Side, names: Collection<String>)
} }
var listener: StarterNameDialogListener? = null var mainActivity: StarterNameDialogListener? = null
override fun onAttach(activity: Activity?) { override fun onAttach(activity: Activity?) {
super.onAttach(activity) super.onAttach(activity)
try { try {
listener = activity as StarterNameDialogListener? mainActivity = activity as StarterNameDialogListener
} catch (e: ClassCastException) { } catch (e: ClassCastException) {
throw ClassCastException(activity!!.toString() + " must implement StarterNameDialogListener") throw ClassCastException(activity!!.toString() + " must implement StarterNameDialogListener")
} }
} }
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val inputPlayer1Name: android.widget.EditText? = findViewById(R.id.input_player_1_name) val inflater:LayoutInflater = context?.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
val player1Name = arguments?.getString("PLAYER_1_NAME") val namesView: View = inflater.inflate(R.layout.starter_name_dialog, null)
inputPlayer1Name?.setText(player1Name, TextView.BufferType.EDITABLE) val inputsPlayersNames: Array<EditText?> = arrayOf(
namesView.findViewById(R.id.inputLeftPlayerName),
val inputPlayer2Name: android.widget.EditText? = findViewById(R.id.input_player_2_name) namesView.findViewById(R.id.inputRightPlayerName)
val player2Name = arguments?.getString("PLAYER_2_NAME") )
inputPlayer2Name?.setText(player2Name, TextView.BufferType.EDITABLE) arguments?.getStringArray("names")?.apply{
zip(inputsPlayersNames).forEach {
val builder = AlertDialog.Builder(activity) (name, inputPlayerName) -> inputPlayerName?.setText(name, TextView.BufferType.EDITABLE)
// Set the dialog title
builder.setTitle(R.string.new_match)
// Specify the list array, the items to be selected by default (null for none),
// and the listener through which to receive callbacks when items are selected
.setMultiChoiceItems(0, null)
.setPositiveButton(R.string.go_button) { dialog, id ->
// User clicked OK, so save the mSelectedItems results somewhere
// or return them to the component that opened the dialog
//...
} }
.setNegativeButton(R.string.quit_button) { dialog, id ->
activity?.finish()
} }
return builder.create() return AlertDialog.Builder(activity).apply {
setTitle(R.string.starter_name_dialog_message)
setView(namesView)
setPositiveButton(R.string.go_button) { dialog, id ->
mainActivity?.setStarterName(
when ((namesView.findViewById(R.id.radioGroup) as RadioGroup)?.checkedRadioButtonId) {
R.id.radioLeftPlayer -> Side.LEFT
else -> Side.RIGHT
},
inputsPlayersNames.map{ it?.text.toString() }
)
dismiss()
}
setNegativeButton(R.string.quit_button) { dialog, id -> activity?.finish() }
}.create()
} }
} }

View File

@ -0,0 +1,28 @@
package adrienmalin.pingpoints
import android.os.Build
import android.text.Html
import android.text.Spanned
data class Player(
var name: String,
var score: Int = 0
)
enum class Side(val value:Int) {
LEFT(0),
RIGHT(1)
}
@SuppressWarnings("deprecation")
fun fromHtml(html: String): Spanned {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY)
} else {
Html.fromHtml(html)
}
}

View File

@ -1,44 +0,0 @@
package adrienmalin.pingpoints;
public class test {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mSelectedItems = new ArrayList(); // Where we track the selected items
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
// Set the dialog title
builder.setTitle(R.string.pick_toppings)
// Specify the list array, the items to be selected by default (null for none),
// and the listener through which to receive callbacks when items are selected
.setMultiChoiceItems(R.array.toppings, null,
new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface dialog, int which,
boolean isChecked) {
if (isChecked) {
// If the user checked the item, add it to the selected items
mSelectedItems.add(which);
} else if (mSelectedItems.contains(which)) {
// Else, if the item is already in the array, remove it
mSelectedItems.remove(Integer.valueOf(which));
}
}
})
// Set the action buttons
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
// User clicked OK, so save the mSelectedItems results somewhere
// or return them to the component that opened the dialog
...
}
})
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
...
}
});
return builder.create();
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1005 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFFFF" android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
</vector>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
<vector android:autoMirrored="true" android:height="512dp"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#888888" android:pathData="M449.921,62.145C394.726,6.951 313.935,-13.444 239.081,8.921c-5.292,1.581 -8.3,7.152 -6.719,12.444c1.58,5.292 7.158,8.3 12.443,6.719c67.806,-20.259 140.982,-1.788 190.973,48.203c74.886,74.886 74.886,196.734 0,271.62l-28.366,28.365c-29.027,29.027 -66.065,46.86 -104.838,52.817L82.772,209.284c2.887,-18.891 8.617,-37.443 17.277,-54.927c2.451,-4.949 0.427,-10.948 -4.522,-13.399c-4.948,-2.449 -10.947,-0.426 -13.399,4.522c-31.039,62.663 -28.32,137.72 6.701,197.839l-72.237,72.235c-22.034,22.034 -22.034,57.886 0,79.92c11.018,11.017 25.489,16.525 39.96,16.525c14.471,0 28.942,-5.509 39.959,-16.525l72.236,-72.236c31.851,18.552 68.385,28.332 105.32,28.33c7.155,0 14.334,-0.367 21.486,-1.109c47.455,-4.922 92.204,-26.246 126.002,-60.044l28.366,-28.365C532.603,279.365 532.603,144.829 449.921,62.145zM80.593,235.391l58.081,58.081l-35.162,35.163C87.838,299.874 80.141,267.621 80.593,235.391zM160.163,403.538l-77.794,77.795c-14.235,14.236 -37.398,14.237 -51.635,0c-14.236,-14.236 -14.236,-37.398 0,-51.635l77.794,-77.794l44.289,-44.289l51.634,51.634L160.163,403.538zM183.43,408.556l35.164,-35.165l57.895,57.895C244.564,431.8 212.418,424.352 183.43,408.556z"/>
<path android:fillColor="#888888" android:pathData="M215.907,40.427c-13.222,-13.221 -30.8,-20.502 -49.497,-20.502c-18.697,0 -36.276,7.281 -49.496,20.502c-13.221,13.222 -20.503,30.8 -20.503,49.497c0,18.697 7.282,36.276 20.503,49.496c13.221,13.221 30.8,20.503 49.496,20.503c18.698,0 36.276,-7.281 49.497,-20.502c13.221,-13.222 20.502,-30.8 20.502,-49.497S229.128,53.648 215.907,40.427zM201.764,125.278c-9.443,9.444 -22,14.645 -35.354,14.645s-25.911,-5.201 -35.354,-14.645c-19.495,-19.494 -19.495,-51.215 0,-70.71c9.443,-9.443 21.999,-14.644 35.354,-14.644s25.912,5.201 35.354,14.645c9.444,9.444 14.645,22 14.645,35.354S211.209,115.835 201.764,125.278z"/>
<path android:fillColor="#888888" android:pathData="M407.873,104.582l-0.227,-0.226c-3.921,-3.888 -10.254,-3.86 -14.142,0.063c-3.888,3.922 -3.859,10.254 0.063,14.142l0.1,0.099c1.957,1.973 4.53,2.961 7.104,2.961c2.544,0 5.089,-0.965 7.039,-2.897C411.733,114.836 411.761,108.505 407.873,104.582z"/>
<path android:fillColor="#888888" android:pathData="M431.236,134.748c-2.806,-4.756 -8.938,-6.337 -13.694,-3.53c-4.756,2.807 -6.337,8.938 -3.53,13.694c11.898,20.163 18.221,43.269 18.283,66.824c0.015,5.514 4.488,9.974 9.999,9.974c0.009,0 0.019,0 0.027,0c5.523,-0.015 9.988,-4.504 9.974,-10.027C452.223,184.575 444.941,157.971 431.236,134.748z"/>
</vector>

View File

@ -0,0 +1,8 @@
<vector android:autoMirrored="true" android:height="24dp"
android:viewportHeight="511.999" android:viewportWidth="511.999"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FFFFFF" android:pathData="M449.921,62.145C394.726,6.951 313.935,-13.444 239.081,8.921c-5.292,1.581 -8.3,7.152 -6.719,12.444c1.58,5.292 7.158,8.3 12.443,6.719c67.806,-20.259 140.982,-1.788 190.973,48.203c74.886,74.886 74.886,196.734 0,271.62l-28.366,28.365c-29.027,29.027 -66.065,46.86 -104.838,52.817L82.772,209.284c2.887,-18.891 8.617,-37.443 17.277,-54.927c2.451,-4.949 0.427,-10.948 -4.522,-13.399c-4.948,-2.449 -10.947,-0.426 -13.399,4.522c-31.039,62.663 -28.32,137.72 6.701,197.839l-72.237,72.235c-22.034,22.034 -22.034,57.886 0,79.92c11.018,11.017 25.489,16.525 39.96,16.525c14.471,0 28.942,-5.509 39.959,-16.525l72.236,-72.236c31.851,18.552 68.385,28.332 105.32,28.33c7.155,0 14.334,-0.367 21.486,-1.109c47.455,-4.922 92.204,-26.246 126.002,-60.044l28.366,-28.365C532.603,279.365 532.603,144.829 449.921,62.145zM80.593,235.391l58.081,58.081l-35.162,35.163C87.838,299.874 80.141,267.621 80.593,235.391zM160.163,403.538l-77.794,77.795c-14.235,14.236 -37.398,14.237 -51.635,0c-14.236,-14.236 -14.236,-37.398 0,-51.635l77.794,-77.794l44.289,-44.289l51.634,51.634L160.163,403.538zM183.43,408.556l35.164,-35.165l57.895,57.895C244.564,431.8 212.418,424.352 183.43,408.556z"/>
<path android:fillColor="#FFFFFF" android:pathData="M215.907,40.427c-13.222,-13.221 -30.8,-20.502 -49.497,-20.502c-18.697,0 -36.276,7.281 -49.496,20.502c-13.221,13.222 -20.503,30.8 -20.503,49.497c0,18.697 7.282,36.276 20.503,49.496c13.221,13.221 30.8,20.503 49.496,20.503c18.698,0 36.276,-7.281 49.497,-20.502c13.221,-13.222 20.502,-30.8 20.502,-49.497S229.128,53.648 215.907,40.427zM201.764,125.278c-9.443,9.444 -22,14.645 -35.354,14.645s-25.911,-5.201 -35.354,-14.645c-19.495,-19.494 -19.495,-51.215 0,-70.71c9.443,-9.443 21.999,-14.644 35.354,-14.644s25.912,5.201 35.354,14.645c9.444,9.444 14.645,22 14.645,35.354S211.209,115.835 201.764,125.278z"/>
<path android:fillColor="#FFFFFF" android:pathData="M407.873,104.582l-0.227,-0.226c-3.921,-3.888 -10.254,-3.86 -14.142,0.063c-3.888,3.922 -3.859,10.254 0.063,14.142l0.1,0.099c1.957,1.973 4.53,2.961 7.104,2.961c2.544,0 5.089,-0.965 7.039,-2.897C411.733,114.836 411.761,108.505 407.873,104.582z"/>
<path android:fillColor="#FFFFFF" android:pathData="M431.236,134.748c-2.806,-4.756 -8.938,-6.337 -13.694,-3.53c-4.756,2.807 -6.337,8.938 -3.53,13.694c11.898,20.163 18.221,43.269 18.283,66.824c0.015,5.514 4.488,9.974 9.999,9.974c0.009,0 0.019,0 0.027,0c5.523,-0.015 9.988,-4.504 9.974,-10.027C452.223,184.575 444.941,157.971 431.236,134.748z"/>
</vector>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout 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"
tools:context=".CreditsActivity">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:id="@+id/PingPointsCredit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/PingPointsCredits"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
tools:layout_editor_absoluteX="136dp"
tools:layout_editor_absoluteY="111dp" />
<TextView
android:id="@+id/iconsCredit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/iconCredits"
app:layout_constraintTop_toBottomOf="@+id/PingPointsCredit"
tools:layout_editor_absoluteX="106dp" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>

View File

@ -7,6 +7,8 @@
tools:context=".MainActivity" tools:context=".MainActivity"
tools:layout_editor_absoluteY="73dp"> tools:layout_editor_absoluteY="73dp">
<LinearLayout <LinearLayout
android:id="@+id/linearLayoutText" android:id="@+id/linearLayoutText"
android:layout_width="0dp" android:layout_width="0dp"
@ -30,7 +32,6 @@
android:layout_weight="1" android:layout_weight="1"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp" android:paddingRight="16dp"
android:text="@string/service"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintBottom_toTopOf="@+id/linearLayoutButtons" app:layout_constraintBottom_toTopOf="@+id/linearLayoutButtons"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@ -47,7 +48,6 @@
android:layout_weight="1" android:layout_weight="1"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp" android:paddingRight="16dp"
android:text="@string/score"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textAppearance="@style/TextAppearance.AppCompat.Large"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
@ -70,7 +70,7 @@
app:layout_constraintTop_toBottomOf="@+id/linearLayoutText"> app:layout_constraintTop_toBottomOf="@+id/linearLayoutText">
<Button <Button
android:id="@+id/buttonPlayer1" android:id="@+id/buttonLeftPlayer"
style="@style/Base.Widget.AppCompat.Button.Colored" style="@style/Base.Widget.AppCompat.Button.Colored"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -82,20 +82,20 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_weight="1" android:layout_weight="1"
android:bufferType="spannable" android:bufferType="spannable"
android:onClick="onClickPlayer1" android:drawableLeft="@drawable/ic_service"
android:onClick="onClickLeftPlayer"
android:textAllCaps="false" android:textAllCaps="false"
android:textAppearance="@style/TextAppearance.AppCompat.Button" android:textAppearance="@style/TextAppearance.AppCompat.Button"
android:textSize="24sp" android:textSize="24sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/textScore" app:layout_constraintBottom_toTopOf="@+id/textScore"
app:layout_constraintEnd_toStartOf="@+id/buttonPlayer2" app:layout_constraintEnd_toStartOf="@+id/buttonRightPlayer"
app:layout_constraintHorizontal_chainStyle="spread_inside" app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textService" app:layout_constraintTop_toBottomOf="@+id/textService" />
tools:text="@string/button_text" />
<Button <Button
android:id="@+id/buttonPlayer2" android:id="@+id/buttonRightPlayer"
style="@style/Widget.AppCompat.Button.Colored" style="@style/Widget.AppCompat.Button.Colored"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -107,16 +107,16 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_weight="1" android:layout_weight="1"
android:bufferType="spannable" android:bufferType="spannable"
android:onClick="onClickPlayer2" android:drawableRight="@drawable/ic_relaunch"
android:onClick="onClickRightPlayer"
android:textAllCaps="false" android:textAllCaps="false"
android:textAppearance="@style/TextAppearance.AppCompat.Button" android:textAppearance="@style/TextAppearance.AppCompat.Button"
android:textSize="24sp" android:textSize="24sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/textScore" app:layout_constraintBottom_toTopOf="@+id/textScore"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/buttonPlayer1" app:layout_constraintStart_toEndOf="@+id/buttonLeftPlayer"
app:layout_constraintTop_toBottomOf="@+id/textService" app:layout_constraintTop_toBottomOf="@+id/textService" />
tools:text="@string/button_text" />
</LinearLayout> </LinearLayout>
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>

View File

@ -2,50 +2,50 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
tools:context=".NomsJoueursEtPremierServeurDialog"> tools:context=".NomsJoueursEtPremierServeurDialog">
<!-- TODO: Update blank fragment layout --> <!-- TODO: Update blank fragment layout -->
<RadioGroup <RadioGroup
android:layout_width="match_parent" android:id="@+id/radioGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
<RadioButton <RadioButton
android:id="@+id/radioButtonJoueur1" android:id="@+id/radioLeftPlayer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_weight="1" /> android:layout_weight="1"
android:checked="true"
<android.support.design.widget.TextInputLayout android:inputType="text" />
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.TextInputEditText <android.support.design.widget.TextInputEditText
android:id="@+id/input_player_1_name" android:id="@+id/inputLeftPlayerName"
android:layout_width="match_parent" android:layout_width="100dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/name" /> android:layout_weight="1"
</android.support.design.widget.TextInputLayout> android:hint="@string/name"
android:selectAllOnFocus="true"
android:singleLine="true" />
<RadioButton <RadioButton
android:id="@+id/radioButton2" android:id="@+id/radioRightPlayer"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_weight="1" /> android:layout_weight="1"
android:inputType="none" />
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<android.support.design.widget.TextInputEditText <android.support.design.widget.TextInputEditText
android:id="@+id/input_player_2_name" android:id="@+id/inputRightPlayerName"
android:layout_width="match_parent" android:layout_width="100dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/name" /> android:layout_weight="1"
</android.support.design.widget.TextInputLayout> android:hint="@string/name"
android:selectAllOnFocus="true"
android:singleLine="true" />
</RadioGroup> </RadioGroup>
</FrameLayout> </FrameLayout>

View File

@ -0,0 +1,10 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_about"
android:icon="@drawable/ic_about"
android:title="@string/about"
app:showAsAction="ifRoom"/>
</menu>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" /> <background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground" /> <foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon> </adaptive-icon>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" /> <background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground" /> <foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon> </adaptive-icon>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -4,7 +4,7 @@
<string name="info">Cliquez sur le joueur qui a marqué</string> <string name="info">Cliquez sur le joueur qui a marqué</string>
<string name="service">Service : %1s</string> <string name="service">Service : %1s</string>
<string name="score">Score : %1d - %2d</string> <string name="score">Score : %1d - %2d</string>
<string-array name="players_names"> <string-array name="default_players_names">
<item>Joueur 1</item> <item>Joueur 1</item>
<item>Joueur 2</item> <item>Joueur 2</item>
</string-array> </string-array>
@ -16,5 +16,8 @@
<string name="starter_name_dialog_message">Qui commence ?</string> <string name="starter_name_dialog_message">Qui commence ?</string>
<string name="share_button">Partager</string> <string name="share_button">Partager</string>
<string name="share_subject">Match Ping Points : %1s contre %2s</string> <string name="share_subject">Match Ping Points : %1s contre %2s</string>
<string name="share_message">%1s vs. %2s\\nVainqueur : %3s\\nScore : %4d - %5d\\n\\n--\\nArbitré avec l\'application gratuite Ping Points disponible sur Google Play</string> <string name="share_message">%1s contre %2s:\n%3s a gagné par %4d à %5d\n\nPing Points est disponible sur Google Play</string>
<string name="PingPointsCredits">Ping Points par Adrien Malingrey</string>
<string name="iconCredits"><div>Icônes par <a href="http://www.freepik.com" title="Freepik">Freepik</a> chez <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> Licence <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div></string>
<string name="about">À propos</string>
</resources> </resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>

View File

@ -7,7 +7,7 @@
<string name="score">Score: %1d - %2d</string> <string name="score">Score: %1d - %2d</string>
<string name="button_text" translatable="false">%1s &lt;br /&gt; &lt;br /&gt; &lt;big&gt; &lt;big&gt; %2d &lt;/big&gt; &lt;/big&gt;</string> <string name="button_text" translatable="false">%1s &lt;br /&gt; &lt;br /&gt; &lt;big&gt; &lt;big&gt; %2d &lt;/big&gt; &lt;/big&gt;</string>
<string name="end_match_dialog_title">Congratulations, %1s!</string> <string name="end_match_dialog_title">Congratulations, %1s!</string>
<string-array name="players_names"> <string-array name="default_players_names">
<item>Player 1</item> <item>Player 1</item>
<item>Player 2</item> <item>Player 2</item>
</string-array> </string-array>
@ -16,5 +16,9 @@
<string name="name">Name</string> <string name="name">Name</string>
<string name="share_button">Share</string> <string name="share_button">Share</string>
<string name="share_subject">Ping Points Match: %1s vs. %2s</string> <string name="share_subject">Ping Points Match: %1s vs. %2s</string>
<string name="share_message">%1s vs. %2s\\nWinner: %3s\\nScore: %4d - %5d\\n\\n--\\nRefereed with Ping Points free Android app on Google Play</string> <string name="share_message">%1s vs. %2s:\n%3s won by %4d to %5d\n\nGet Ping Points on Google Play</string>
<string name="radioText" translatable="false"></string>
<string name="PingPointsCredits">Ping Points by Adrien Malingrey</string>
<string name="iconCredits"><div>Icons made by <a href="http://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div></string>
<string name="about">About</string>
</resources> </resources>

View File

@ -1,7 +1,7 @@
<resources> <resources>
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="PingPoints" parent="Theme.AppCompat"> <style name="PingPoints" parent="Theme.AppCompat.NoActionBar">
<!-- Customize your theme here. --> <!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item>