diff --git a/app/build.gradle b/app/build.gradle index c3e5e23..34ae911 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,11 +1,11 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 30 + compileSdkVersion 34 defaultConfig { applicationId "com.rhinemann.project" - minSdkVersion 19 + minSdkVersion 28 targetSdkVersion 30 versionCode 1 versionName "1.0" @@ -29,13 +29,13 @@ android { dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'androidx.constraintlayout:constraintlayout:1.1.3' - implementation 'com.jjoe64:graphview:4.2.2' - implementation 'com.google.android.material:material:1.2.1' - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + implementation 'androidx.appcompat:appcompat:1.6.1' + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' +// implementation 'com.jjoe64:graphview:4.2.2' + implementation 'com.google.android.material:material:1.11.0' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.5' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' def multidex_version = "2.0.1" implementation "androidx.multidex:multidex:$multidex_version" diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index a4fa439..12be92e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,37 +7,47 @@ android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" - android:theme="@style/AppTheme"> + android:theme="@style/AppTheme" + > + + android:exported="false" + android:screenOrientation="portrait" /> + android:exported="false" + android:screenOrientation="portrait" /> + android:exported="false" + android:screenOrientation="portrait" /> + android:exported="false" + android:screenOrientation="portrait" /> + android:exported="false" + android:screenOrientation="portrait" /> + android:exported="true" + android:screenOrientation="portrait" /> + android:exported="false" + android:screenOrientation="portrait" /> + android:exported="true" + android:screenOrientation="portrait" > diff --git a/app/src/main/java/com/rhinemann/project/Calculator.java b/app/src/main/java/com/rhinemann/project/Calculator.java index 3ae40cf..f0f3755 100644 --- a/app/src/main/java/com/rhinemann/project/Calculator.java +++ b/app/src/main/java/com/rhinemann/project/Calculator.java @@ -109,9 +109,17 @@ public class Calculator extends AppCompatActivity { checkBox_Tech = findViewById(R.id.checkBox_Tech); checkBox_Art = findViewById(R.id.checkBox_Art); - IT.clearCheck(); - Tech.clearCheck(); - Art.clearCheck(); + for (int i = 0; i < IT.getChildCount(); i++) { + IT.getChildAt(i).setEnabled(false); + } + + for (int i = 0; i < IT.getChildCount(); i++) { + Tech.getChildAt(i).setEnabled(false); + } + + for (int i = 0; i < IT.getChildCount(); i++) { + Art.getChildAt(i).setEnabled(false); + } UALan.setOnCheckedChangeListener((radioGroup, checkedId) -> { if (checkedId == R.id.UALanSt) UALan_Hours = 2f; @@ -250,8 +258,13 @@ public class Calculator extends AppCompatActivity { }); checkBox_IT.setOnCheckedChangeListener((buttonView, isChecked) -> { + for (int i = 0; i < IT.getChildCount(); i++) { + IT.getChildAt(i).setEnabled(isChecked); + } + if (checkBox_IT.isChecked()) { IT_Hours = 3f; + IT.check(R.id.ITSt); IT.setOnCheckedChangeListener((radioGroup, checkedId) -> { if (checkBox_IT.isChecked()) { @@ -268,8 +281,13 @@ public class Calculator extends AppCompatActivity { }); checkBox_Tech.setOnCheckedChangeListener((buttonView, isChecked) -> { + for (int i = 0; i < Tech.getChildCount(); i++) { + Tech.getChildAt(i).setEnabled(isChecked); + } + if (checkBox_Tech.isChecked()) { Tech_Hours = 3f; + Tech.check(R.id.TechSt); Tech.setOnCheckedChangeListener((radioGroup, checkedId) -> { if (checkBox_Tech.isChecked()) { @@ -286,13 +304,19 @@ public class Calculator extends AppCompatActivity { }); checkBox_Art.setOnCheckedChangeListener((buttonView, isChecked) -> { + for (int i = 0; i < Art.getChildCount(); i++) { + Art.getChildAt(i).setEnabled(isChecked); + } + if (checkBox_Art.isChecked()) { Art_Hours = 3f; + Art.check(R.id.ArtSt); Art.setOnCheckedChangeListener((radioGroup, checkedId) -> { if (checkBox_Art.isChecked()) { if (checkedId == R.id.ArtSt) Art_Hours = 3f; else if (checkedId == R.id.ArtPro) Art_Hours = 5f; + Final(); } else Art_Hours = 0f; }); } else { diff --git a/app/src/main/java/com/rhinemann/project/Graph.java b/app/src/main/java/com/rhinemann/project/Graph.java index 5ba16a0..7b85597 100644 --- a/app/src/main/java/com/rhinemann/project/Graph.java +++ b/app/src/main/java/com/rhinemann/project/Graph.java @@ -1,81 +1,87 @@ package com.rhinemann.project; import android.content.Intent; +import android.graphics.Color; import android.os.Bundle; import android.widget.Button; import androidx.appcompat.app.AppCompatActivity; -import com.jjoe64.graphview.series.BarGraphSeries; -import com.jjoe64.graphview.GraphView; -import com.jjoe64.graphview.series.DataPoint; -import com.jjoe64.graphview.DefaultLabelFormatter; +import com.github.mikephil.charting.charts.BarChart; +import com.github.mikephil.charting.components.XAxis; +import com.github.mikephil.charting.data.BarData; +import com.github.mikephil.charting.data.BarDataSet; +import com.github.mikephil.charting.data.BarEntry; +import com.github.mikephil.charting.formatter.IndexAxisValueFormatter; +import com.github.mikephil.charting.utils.ColorTemplate; + +import java.util.ArrayList; public class Graph extends AppCompatActivity { Button Home; -// BarChart Chart; + BarChart chart; + int[] Data; + String[] labels = { + "Фізика", "", + "Математика", "", + "Електро- та радіотехніка", "", + "Техніка", "", + "Хімія", "", + "Біологія", "", + "Медицина", "", + "Географія", "", + "Історія", "", + "Філологія", "", + "Мистецтво", "", + "Педагогіка", "", + "Психологія, філософія", "", + "Бізнес", "", + "Сфера обслуговувуння", "", + "Військова справа", "", + "Спорт", "", + }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_graph); - GraphView Graph = findViewById(R.id.Graph); + chart = findViewById(R.id.Graph); - final String[] XAxis = {"Фізика", "Математика", "Електро- та \nрадіотехніка", "Техніка", "Хімія", "Біологія", "Медицина", "Географія", "Історія", "Філологія", "Мистецтво", "Педагогіка", "Психологія, \nфілософія", "Бізнес", "Сфера \nобслуговувуння", "Військова \nсправа", "Спорт"}; + ArrayList barEntries = new ArrayList<>(); - int[] Data = getIntent().getIntArrayExtra("profileAnswers"); - - BarGraphSeries series = new BarGraphSeries<>(); - - for (int i=0; i<17; i++){ - assert Data != null; - series.appendData(new DataPoint(i*2, Data[i]),true,18); + Data = getIntent().getIntArrayExtra("profileAnswers"); + for (int i = 0; i < (Data != null ? Data.length : 0); i++) { + barEntries.add(new BarEntry(i*2, Data[i])); } - series.appendData(new DataPoint(17*2, 0),true,18); + BarDataSet barDataSet = new BarDataSet(barEntries, "profileAnswers"); + barDataSet.setColors(ColorTemplate.MATERIAL_COLORS); + barDataSet.setValueTextColor(Color.BLACK); + barDataSet.setDrawValues(false); - series.setColor(R.color.colorPrimary); - series.setSpacing(20);//Spacing - series.setDrawValuesOnTop(true);// draw values on top + BarData barData = new BarData(barDataSet); - Graph.addSeries(series); + XAxis xAxis = chart.getXAxis(); - Graph.setTitle("Орієнтовний графік"); - Graph.setTitleTextSize(50); - Graph.setTitleColor(R.color.colorAccent); + xAxis.setYOffset(0f); + xAxis.setXOffset(0f); + xAxis.setPosition(XAxis.XAxisPosition.BOTTOM); + xAxis.setDrawGridLines(false); + xAxis.setTextSize(16f); + xAxis.setValueFormatter(new IndexAxisValueFormatter(labels)); - Graph.getLegendRenderer().setVisible(false); - - - // set manual Y bounds - Graph.getViewport().setYAxisBoundsManual(true); - Graph.getViewport().setMinY(0); - Graph.getViewport().setMaxY(15); - - // set manual X bounds - Graph.getViewport().setXAxisBoundsManual(true); - Graph.getViewport().setMinX(0); - Graph.getViewport().setMaxX(7); - - //set horizontal scrolling - Graph.getViewport().setScrollable(true); - - Graph.getGridLabelRenderer().setTextSize(30); - Graph.getGridLabelRenderer().reloadStyles(); - Graph.getGridLabelRenderer().setPadding(10); - - Graph.getGridLabelRenderer().setLabelFormatter(new DefaultLabelFormatter(){ - @Override - public String formatLabel(double value, boolean isValueX) { - if (isValueX){ - return (XAxis[(int) (value/2)]); - } else { - return super.formatLabel(value, false); - } - } - }); + chart.setFitBars(true); + chart.setDrawBarShadow(false); + chart.setData(barData); + chart.getDescription().setEnabled(false); + chart.getLegend().setEnabled(false); + chart.setVisibleXRangeMaximum(3.8f); + chart.setScaleY(1f); + chart.getAxisRight().setEnabled(false); + chart.getAxisLeft().setEnabled(false); + chart.setDrawGridBackground(false); Home = findViewById(R.id.home); diff --git a/app/src/main/java/com/rhinemann/project/MBTI.java b/app/src/main/java/com/rhinemann/project/MBTI.java index 561c132..c8ed6ec 100644 --- a/app/src/main/java/com/rhinemann/project/MBTI.java +++ b/app/src/main/java/com/rhinemann/project/MBTI.java @@ -10,7 +10,7 @@ import android.widget.TextView; public class MBTI extends AppCompatActivity { Integer questionId; - TextView MBTIQuestion, MBTIAnswer; + TextView MBTIQuestion, MBTIAnswer, QuestionTracker; String[] MBTIQuestions, MBTIAnswers; String Result; char[] ResultChar; @@ -25,6 +25,7 @@ public class MBTI extends AppCompatActivity { MBTIQuestion = findViewById(R.id.MBTI_Question); MBTIAnswer = findViewById(R.id.MBTI_Answer); + QuestionTracker = findViewById(R.id.tracker); MBTIQuestions = getResources().getStringArray(R.array.MBTI_Questions); MBTIAnswers = getResources().getStringArray(R.array.MBTI_Answers); @@ -39,6 +40,8 @@ public class MBTI extends AppCompatActivity { MBTIQuestion.setText(MBTIQuestions[questionId]); MBTIAnswer.setText(MBTIAnswers[questionId]); + QuestionTracker.setText(String.format("%s/%s", questionId + 1, MBTIQuestions.length)); + aButton.setOnClickListener(v -> { switch (questionId) { case 0: @@ -63,6 +66,7 @@ public class MBTI extends AppCompatActivity { MBTIQuestion.setText(MBTIQuestions[questionId]); MBTIAnswer.setText(MBTIAnswers[questionId]); } else { MBTIResult(); } + QuestionTracker.setText(String.format("%s/%s", questionId + 1, MBTIQuestions.length)); }); bButton.setOnClickListener(v -> { @@ -84,11 +88,12 @@ public class MBTI extends AppCompatActivity { Result = String.valueOf(ResultChar); - if (questionId < 3) { + if (questionId < MBTIQuestions.length - 1) { questionId++; MBTIQuestion.setText(MBTIQuestions[questionId]); MBTIAnswer.setText(MBTIAnswers[questionId]); } else { MBTIResult(); } + QuestionTracker.setText(String.format("%s/%s", questionId + 1, MBTIQuestions.length)); }); Home = findViewById(R.id.home); diff --git a/app/src/main/java/com/rhinemann/project/MBTIResult.java b/app/src/main/java/com/rhinemann/project/MBTIResult.java index 0c7030f..814f9e7 100644 --- a/app/src/main/java/com/rhinemann/project/MBTIResult.java +++ b/app/src/main/java/com/rhinemann/project/MBTIResult.java @@ -15,7 +15,7 @@ public class MBTIResult extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_mbtiresult); + setContentView(R.layout.activity_mbti_result); Result = findViewById(R.id.Result); Explanation = findViewById(R.id.Explanation); diff --git a/app/src/main/java/com/rhinemann/project/Profile.java b/app/src/main/java/com/rhinemann/project/Profile.java index 1584b68..eb42767 100644 --- a/app/src/main/java/com/rhinemann/project/Profile.java +++ b/app/src/main/java/com/rhinemann/project/Profile.java @@ -11,7 +11,7 @@ public class Profile extends AppCompatActivity { Integer questionId, discipline; int[] profileAnswers; - TextView profileQuestion; + TextView profileQuestion, QuestionTracker; String[] profileQuestions; @Override @@ -21,13 +21,14 @@ public class Profile extends AppCompatActivity { profileQuestions = getResources().getStringArray(R.array.Profile_Questions); profileQuestion = findViewById(R.id.Profile_Question); + QuestionTracker = findViewById(R.id.tracker); + questionId = 0; discipline = 0; profileAnswers = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; profileQuestion.setText(profileQuestions[questionId]); - - + QuestionTracker.setText(String.format("%s/%s", questionId + 1, profileQuestions.length)); //Кнопка плюс Button plusButton = findViewById(R.id.Button_Plus); @@ -64,7 +65,7 @@ public class Profile extends AppCompatActivity { } public void Test(int amount) { - if (questionId < 102){ + if (questionId < profileQuestions.length - 1){ questionId ++; profileQuestion.setText(profileQuestions[questionId]); } else { @@ -78,6 +79,7 @@ public class Profile extends AppCompatActivity { } else { discipline ++; } + QuestionTracker.setText(String.format("%s/%s", questionId + 1, profileQuestions.length)); } public void graphResult() { diff --git a/app/src/main/java/com/rhinemann/project/Temper.java b/app/src/main/java/com/rhinemann/project/Temper.java index b18e84a..0a813fc 100644 --- a/app/src/main/java/com/rhinemann/project/Temper.java +++ b/app/src/main/java/com/rhinemann/project/Temper.java @@ -11,7 +11,7 @@ public class Temper extends AppCompatActivity { Integer questionId, temper; int[] temperAnswers; - TextView temperQuestion; + TextView temperQuestion, QuestionTracker; String[] temperQuestions; @Override @@ -21,11 +21,14 @@ public class Temper extends AppCompatActivity { temperQuestions = getResources().getStringArray(R.array.Temper_Questions); temperQuestion = findViewById(R.id.Temper_Question); + QuestionTracker = findViewById(R.id.tracker); + questionId = 0; temper = 0; temperAnswers = new int[]{0, 0, 0, 0}; temperQuestion.setText(temperQuestions[questionId]); + QuestionTracker.setText(String.format("%s/%s", questionId + 1, temperQuestions.length)); Button yesButton = findViewById(R.id.Button_Yes); @@ -57,12 +60,13 @@ public class Temper extends AppCompatActivity { temperAnswers[temper] += amount; - if (questionId < 79) { + if (questionId < temperQuestions.length - 1) { questionId ++; temperQuestion.setText(temperQuestions[questionId]); } else { graphResult(); } + QuestionTracker.setText(String.format("%s/%s", questionId + 1, temperQuestions.length)); } public void graphResult(){ diff --git a/app/src/main/java/com/rhinemann/project/TemperResult.java b/app/src/main/java/com/rhinemann/project/TemperResult.java index 1202184..a93fbec 100644 --- a/app/src/main/java/com/rhinemann/project/TemperResult.java +++ b/app/src/main/java/com/rhinemann/project/TemperResult.java @@ -8,6 +8,7 @@ import android.os.Bundle; import android.widget.Button; import com.github.mikephil.charting.charts.RadarChart; +import android.graphics.Color; import com.github.mikephil.charting.components.XAxis; import com.github.mikephil.charting.data.RadarData; import com.github.mikephil.charting.data.RadarDataSet; @@ -20,9 +21,8 @@ public class TemperResult extends AppCompatActivity { RadarChart radarChart; Button homeButton; - int[] Data; - String[] labels = {"Choleric", "Sanguine", "Phlegmatic", "Melancholic"}; + String[] labels = {"Холерик", "Сангвінік", "Флегматик", "Меланхолік"}; @Override protected void onCreate(Bundle savedInstanceState) { @@ -33,30 +33,29 @@ public class TemperResult extends AppCompatActivity { radarChart = findViewById(R.id.Graph); + RadarDataSet dataSet = new RadarDataSet(dataValues(), "Tempers"); dataSet.setColor(R.color.colorPrimary); dataSet.setFillColor(R.color.colorAccent); dataSet.setLineWidth(2f); dataSet.setDrawFilled(true); + dataSet.setFillAlpha(200); RadarData data = new RadarData(); data.addDataSet(dataSet); - data.setDrawValues(false); XAxis xAxis = radarChart.getXAxis(); + xAxis.setYOffset(0f); + xAxis.setXOffset(0f); xAxis.setValueFormatter(new IndexAxisValueFormatter(labels)); radarChart.setData(data); radarChart.getDescription().setEnabled(false); radarChart.getLegend().setEnabled(false); - radarChart.setRotationEnabled(false); - radarChart.getXAxis().setTextSize(15f); - radarChart.getXAxis().setAxisMaximum(20f); - radarChart.getXAxis().setAxisMinimum(-20f); - radarChart.getYAxis().setAxisMaximum(20f); - radarChart.getYAxis().setAxisMinimum(-20f); + radarChart.getXAxis().setTextSize(16f); + radarChart.getYAxis().setEnabled(false); homeButton = findViewById(R.id.home); homeButton.setOnClickListener(v -> { @@ -66,12 +65,15 @@ public class TemperResult extends AppCompatActivity { } @NonNull - private ArrayListdataValues(){ + private ArrayList dataValues(){ ArrayList Tempers = new ArrayList<>(); - Tempers.add(new RadarEntry(Data[0])); - Tempers.add(new RadarEntry(Data[1])); - Tempers.add(new RadarEntry(Data[2])); - Tempers.add(new RadarEntry(Data[3])); + for (int i : Data) { + if (i < 2) { + Tempers.add(new RadarEntry(1)); + } else { + Tempers.add(new RadarEntry(i)); + } + } return Tempers; } diff --git a/app/src/main/res/drawable/hexagon1.xml b/app/src/main/res/drawable/hexagon1.xml index 227102a..d65400f 100644 --- a/app/src/main/res/drawable/hexagon1.xml +++ b/app/src/main/res/drawable/hexagon1.xml @@ -3,7 +3,8 @@ android:width="170dp" android:height="170dp" android:viewportWidth="512" - android:viewportHeight="512"> + android:viewportHeight="512" + > + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_about.xml b/app/src/main/res/layout/activity_about.xml index 6b8b23a..1d4a61f 100644 --- a/app/src/main/res/layout/activity_about.xml +++ b/app/src/main/res/layout/activity_about.xml @@ -5,17 +5,46 @@ android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".About" - android:background="@drawable/background_light"> + android:background="@drawable/background_very_light" + >