dataActivity counter basics done
This commit is contained in:
parent
03750feaf0
commit
7b4d0433ba
@ -0,0 +1,33 @@
|
|||||||
|
package com.example.assignment1;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
|
public class CountSharedPreferenceHelper {
|
||||||
|
|
||||||
|
private SharedPreferences sharedPreferences;
|
||||||
|
|
||||||
|
public CountSharedPreferenceHelper(Context context) {
|
||||||
|
sharedPreferences = context.getSharedPreferences("Count", Context.MODE_PRIVATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveMaxCount(int max_count) {
|
||||||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
|
editor.putInt("MaximumCount", max_count);
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxCount() {
|
||||||
|
return sharedPreferences.getInt("MaximumCount", 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveCurrentCount(int current_count) {
|
||||||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
|
editor.putInt("CurrentCount", current_count);
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCurrentCount() {
|
||||||
|
return sharedPreferences.getInt("CurrentCount", 0);
|
||||||
|
}
|
||||||
|
}
|
@ -9,8 +9,8 @@ public class CounterButtonSharedPreferenceHelper {
|
|||||||
|
|
||||||
private SharedPreferences sharedPreferences;
|
private SharedPreferences sharedPreferences;
|
||||||
|
|
||||||
public CounterButtonSharedPreferenceHelper(Context context, CounterButton counterButton) {
|
public CounterButtonSharedPreferenceHelper(Context context) {
|
||||||
sharedPreferences = context.getSharedPreferences(counterButton.getCounterButton(), Context.MODE_PRIVATE);
|
sharedPreferences = context.getSharedPreferences("counter_button", Context.MODE_PRIVATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveCounterButtonName(CounterButton counterButton, String eventButtonName) {
|
public void saveCounterButtonName(CounterButton counterButton, String eventButtonName) {
|
||||||
@ -22,4 +22,15 @@ public class CounterButtonSharedPreferenceHelper {
|
|||||||
public String getCounterButtonName(CounterButton counterButton) {
|
public String getCounterButtonName(CounterButton counterButton) {
|
||||||
return sharedPreferences.getString(counterButton.getCounterButton(), null);
|
return sharedPreferences.getString(counterButton.getCounterButton(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void saveCounterButtonCount(CounterButton counterButton, String eventButtonName){
|
||||||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
|
editor.putString(counterButton.getCounterButton() + "_count", eventButtonName);
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCounterButtonCount(CounterButton counterButton) {
|
||||||
|
return sharedPreferences.getInt(counterButton.getCounterButton() + "_count", -1);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -11,15 +11,15 @@ import androidx.appcompat.app.AppCompatActivity;
|
|||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
protected CounterButtonSharedPreferenceHelper firstCounterButtonSharedPrefHelper;
|
protected CounterButtonSharedPreferenceHelper counterButtonSharedPrefHelper;
|
||||||
protected CounterButtonSharedPreferenceHelper secondCounterButtonSharedPrefHelper;
|
|
||||||
protected CounterButtonSharedPreferenceHelper thirdCounterButtonSharedPrefHelper;
|
|
||||||
|
|
||||||
protected TextView counter;
|
protected TextView counter;
|
||||||
|
|
||||||
protected MaxCountSharedPreferenceHelper maxCountSharedPreferenceHelper;
|
protected CountSharedPreferenceHelper countSharedPreferenceHelper;
|
||||||
|
|
||||||
protected Button settingsButton = null;
|
protected Button settingsButton;
|
||||||
|
|
||||||
|
protected Button showCountsButton;
|
||||||
|
|
||||||
protected Button firstCounterButton;
|
protected Button firstCounterButton;
|
||||||
protected Button secondCounterButton;
|
protected Button secondCounterButton;
|
||||||
@ -31,6 +31,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
settingsButton = findViewById(R.id.settings_button);
|
settingsButton = findViewById(R.id.settings_button);
|
||||||
|
showCountsButton = findViewById(R.id.show_counts_button);
|
||||||
|
|
||||||
firstCounterButton = findViewById(R.id.FirstEventButton);
|
firstCounterButton = findViewById(R.id.FirstEventButton);
|
||||||
secondCounterButton = findViewById(R.id.SecondEventButton);
|
secondCounterButton = findViewById(R.id.SecondEventButton);
|
||||||
@ -38,10 +39,8 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
counter = findViewById(R.id.counter);
|
counter = findViewById(R.id.counter);
|
||||||
|
|
||||||
firstCounterButtonSharedPrefHelper = new CounterButtonSharedPreferenceHelper(MainActivity.this, CounterButton.FIRST);
|
counterButtonSharedPrefHelper = new CounterButtonSharedPreferenceHelper(MainActivity.this);
|
||||||
secondCounterButtonSharedPrefHelper = new CounterButtonSharedPreferenceHelper(MainActivity.this, CounterButton.SECOND);
|
countSharedPreferenceHelper = new CountSharedPreferenceHelper(MainActivity.this);
|
||||||
thirdCounterButtonSharedPrefHelper = new CounterButtonSharedPreferenceHelper(MainActivity.this, CounterButton.THIRD);
|
|
||||||
maxCountSharedPreferenceHelper = new MaxCountSharedPreferenceHelper(MainActivity.this);
|
|
||||||
|
|
||||||
|
|
||||||
settingsButton.setOnClickListener(new View.OnClickListener() {
|
settingsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@ -52,6 +51,14 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
showCountsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
// Create an Intent to start the SettingsActivity
|
||||||
|
goToDataActivity();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
firstCounterButton.setOnClickListener(new View.OnClickListener() {
|
firstCounterButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
@ -80,16 +87,17 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
if(
|
if(
|
||||||
firstCounterButtonSharedPrefHelper.getCounterButtonName(CounterButton.FIRST) == null ||
|
counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.FIRST) == null ||
|
||||||
secondCounterButtonSharedPrefHelper.getCounterButtonName(CounterButton.SECOND) == null ||
|
counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.SECOND) == null ||
|
||||||
thirdCounterButtonSharedPrefHelper.getCounterButtonName(CounterButton.THIRD) == null) {
|
counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.THIRD) == null) {
|
||||||
|
|
||||||
goToSettingsActivity();
|
goToSettingsActivity();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
firstCounterButton.setText(firstCounterButtonSharedPrefHelper.getCounterButtonName(CounterButton.FIRST));
|
firstCounterButton.setText(counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.FIRST));
|
||||||
secondCounterButton.setText(secondCounterButtonSharedPrefHelper.getCounterButtonName(CounterButton.SECOND));
|
secondCounterButton.setText(counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.SECOND));
|
||||||
thirdCounterButton.setText(thirdCounterButtonSharedPrefHelper.getCounterButtonName(CounterButton.THIRD));
|
thirdCounterButton.setText(counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.THIRD));
|
||||||
|
counter.setText(String.format(Integer.toString(countSharedPreferenceHelper.getCurrentCount())));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -99,13 +107,20 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void goToDataActivity() {
|
||||||
|
Intent intent = new Intent(MainActivity.this, dataActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
private void incrementCounter(){
|
private void incrementCounter(){
|
||||||
try{
|
try{
|
||||||
if (Integer.parseInt(counter.getText().toString()) < Integer.parseInt(maxCountSharedPreferenceHelper.getMaxCount())){
|
if (Integer.parseInt(counter.getText().toString()) < countSharedPreferenceHelper.getMaxCount()){
|
||||||
String currentValue = counter.getText().toString();
|
String currentValue = counter.getText().toString();
|
||||||
int intValue = Integer.parseInt(currentValue);
|
int intValue = Integer.parseInt(currentValue);
|
||||||
int newValue = intValue + 1;
|
int newValue = intValue + 1;
|
||||||
counter.setText(String.valueOf(newValue));
|
counter.setText(String.valueOf(newValue));
|
||||||
|
|
||||||
|
countSharedPreferenceHelper.saveCurrentCount(newValue);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Toast.makeText(getApplicationContext(), "Maximum count has been reached", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), "Maximum count has been reached", Toast.LENGTH_SHORT).show();
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
package com.example.assignment1;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
|
|
||||||
public class MaxCountSharedPreferenceHelper {
|
|
||||||
|
|
||||||
private SharedPreferences sharedPreferences;
|
|
||||||
|
|
||||||
public MaxCountSharedPreferenceHelper(Context context) {
|
|
||||||
sharedPreferences = context.getSharedPreferences("MaximumCount", Context.MODE_PRIVATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveMaxCount(String max_count) {
|
|
||||||
SharedPreferences.Editor editor = sharedPreferences.edit();
|
|
||||||
editor.putString("MaximumCount", max_count);
|
|
||||||
editor.apply();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMaxCount() {
|
|
||||||
return sharedPreferences.getString("MaximumCount", null);
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,11 +19,9 @@ public class SettingsActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
protected int maxLength = 16;
|
protected int maxLength = 16;
|
||||||
|
|
||||||
protected CounterButtonSharedPreferenceHelper firstCounterButtonSharedPrefHelper;
|
protected CounterButtonSharedPreferenceHelper counterButtonSharedPrefHelper;
|
||||||
protected CounterButtonSharedPreferenceHelper secondCounterButtonSharedPrefHelper;
|
|
||||||
protected CounterButtonSharedPreferenceHelper thirdCounterButtonSharedPrefHelper;
|
|
||||||
|
|
||||||
protected MaxCountSharedPreferenceHelper maxCountSharedPrefHelper;
|
protected CountSharedPreferenceHelper countSharedPrefHelper;
|
||||||
|
|
||||||
protected EditText counter_1_name_edit_text;
|
protected EditText counter_1_name_edit_text;
|
||||||
protected EditText counter_2_name_edit_text;
|
protected EditText counter_2_name_edit_text;
|
||||||
@ -48,10 +46,8 @@ public class SettingsActivity extends AppCompatActivity {
|
|||||||
counter_2_name_edit_text.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)});
|
counter_2_name_edit_text.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)});
|
||||||
counter_3_name_edit_text.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)});
|
counter_3_name_edit_text.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxLength)});
|
||||||
|
|
||||||
firstCounterButtonSharedPrefHelper = new CounterButtonSharedPreferenceHelper(SettingsActivity.this, CounterButton.FIRST);
|
counterButtonSharedPrefHelper = new CounterButtonSharedPreferenceHelper(SettingsActivity.this);
|
||||||
secondCounterButtonSharedPrefHelper = new CounterButtonSharedPreferenceHelper(SettingsActivity.this, CounterButton.SECOND);
|
countSharedPrefHelper = new CountSharedPreferenceHelper(SettingsActivity.this);
|
||||||
thirdCounterButtonSharedPrefHelper = new CounterButtonSharedPreferenceHelper(SettingsActivity.this, CounterButton.THIRD);
|
|
||||||
maxCountSharedPrefHelper = new MaxCountSharedPreferenceHelper(SettingsActivity.this);
|
|
||||||
|
|
||||||
// enable toolbar/actionbar
|
// enable toolbar/actionbar
|
||||||
setSupportActionBar(myToolbar);
|
setSupportActionBar(myToolbar);
|
||||||
@ -68,18 +64,18 @@ public class SettingsActivity extends AppCompatActivity {
|
|||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
if(
|
if(
|
||||||
firstCounterButtonSharedPrefHelper.getCounterButtonName(CounterButton.FIRST) == null ||
|
counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.FIRST) == null ||
|
||||||
secondCounterButtonSharedPrefHelper.getCounterButtonName(CounterButton.SECOND) == null ||
|
counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.SECOND) == null ||
|
||||||
thirdCounterButtonSharedPrefHelper.getCounterButtonName(CounterButton.THIRD) == null ||
|
counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.THIRD) == null ||
|
||||||
maxCountSharedPrefHelper.getMaxCount() == null) {
|
countSharedPrefHelper.getMaxCount() == -1) {
|
||||||
|
|
||||||
goToSettingsActivityEditMode();
|
goToSettingsActivityEditMode();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
counter_1_name_edit_text.setHint(firstCounterButtonSharedPrefHelper.getCounterButtonName(CounterButton.FIRST));
|
counter_1_name_edit_text.setHint(counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.FIRST));
|
||||||
counter_2_name_edit_text.setHint(secondCounterButtonSharedPrefHelper.getCounterButtonName(CounterButton.SECOND));
|
counter_2_name_edit_text.setHint(counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.SECOND));
|
||||||
counter_3_name_edit_text.setHint(thirdCounterButtonSharedPrefHelper.getCounterButtonName(CounterButton.THIRD));
|
counter_3_name_edit_text.setHint(counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.THIRD));
|
||||||
maximum_counts_edit_text.setHint(maxCountSharedPrefHelper.getMaxCount());
|
maximum_counts_edit_text.setHint(String.format(Integer.toString(countSharedPrefHelper.getCurrentCount())));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -124,10 +120,10 @@ public class SettingsActivity extends AppCompatActivity {
|
|||||||
counter_3_name_edit_text.setEnabled(true);
|
counter_3_name_edit_text.setEnabled(true);
|
||||||
maximum_counts_edit_text.setEnabled(true);
|
maximum_counts_edit_text.setEnabled(true);
|
||||||
|
|
||||||
counter_1_name_edit_text.setText(firstCounterButtonSharedPrefHelper.getCounterButtonName(CounterButton.FIRST));
|
counter_1_name_edit_text.setText(counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.FIRST));
|
||||||
counter_2_name_edit_text.setText(secondCounterButtonSharedPrefHelper.getCounterButtonName(CounterButton.SECOND));
|
counter_2_name_edit_text.setText(counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.SECOND));
|
||||||
counter_3_name_edit_text.setText(thirdCounterButtonSharedPrefHelper.getCounterButtonName(CounterButton.THIRD));
|
counter_3_name_edit_text.setText(counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.THIRD));
|
||||||
maximum_counts_edit_text.setText(maxCountSharedPrefHelper.getMaxCount());
|
maximum_counts_edit_text.setText(String.format(Integer.toString(countSharedPrefHelper.getMaxCount())));
|
||||||
|
|
||||||
saveButton.setOnClickListener(new View.OnClickListener() {
|
saveButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -138,12 +134,12 @@ public class SettingsActivity extends AppCompatActivity {
|
|||||||
String text1 = counter_1_name_edit_text.getText().toString();
|
String text1 = counter_1_name_edit_text.getText().toString();
|
||||||
String text2 = counter_2_name_edit_text.getText().toString();
|
String text2 = counter_2_name_edit_text.getText().toString();
|
||||||
String text3 = counter_3_name_edit_text.getText().toString();
|
String text3 = counter_3_name_edit_text.getText().toString();
|
||||||
String maximum_count = maximum_counts_edit_text.getText().toString();
|
int maximum_count = Integer.parseInt(maximum_counts_edit_text.getText().toString());
|
||||||
|
|
||||||
firstCounterButtonSharedPrefHelper.saveCounterButtonName(CounterButton.FIRST, text1);
|
counterButtonSharedPrefHelper.saveCounterButtonName(CounterButton.FIRST, text1);
|
||||||
secondCounterButtonSharedPrefHelper.saveCounterButtonName(CounterButton.SECOND, text2);
|
counterButtonSharedPrefHelper.saveCounterButtonName(CounterButton.SECOND, text2);
|
||||||
thirdCounterButtonSharedPrefHelper.saveCounterButtonName(CounterButton.THIRD, text3);
|
counterButtonSharedPrefHelper.saveCounterButtonName(CounterButton.THIRD, text3);
|
||||||
maxCountSharedPrefHelper.saveMaxCount(maximum_count);
|
countSharedPrefHelper.saveMaxCount(maximum_count);
|
||||||
|
|
||||||
goToSettingsActivityDisplayMode();
|
goToSettingsActivityDisplayMode();
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,57 @@
|
|||||||
package com.example.assignment1;
|
package com.example.assignment1;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class dataActivity extends AppCompatActivity {
|
public class dataActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
protected Toolbar myToolbar;
|
||||||
|
|
||||||
|
protected TextView firstCounter;
|
||||||
|
protected TextView secondCounter;
|
||||||
|
protected TextView thirdCounter;
|
||||||
|
|
||||||
|
protected TextView currentCounter;
|
||||||
|
protected CounterButtonSharedPreferenceHelper counterButtonSharedPrefHelper;
|
||||||
|
|
||||||
|
protected CountSharedPreferenceHelper countSharedPrefHelper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_data);
|
setContentView(R.layout.activity_data);
|
||||||
|
|
||||||
|
myToolbar = (Toolbar) findViewById(R.id.data_toolbar);
|
||||||
|
firstCounter = findViewById(R.id.counter_1_data_name);
|
||||||
|
secondCounter = findViewById(R.id.counter_2_data_name);
|
||||||
|
thirdCounter = findViewById(R.id.counter_3_data_name);
|
||||||
|
currentCounter = findViewById(R.id.allCounter);
|
||||||
|
|
||||||
|
counterButtonSharedPrefHelper = new CounterButtonSharedPreferenceHelper(dataActivity.this);
|
||||||
|
countSharedPrefHelper = new CountSharedPreferenceHelper(dataActivity.this);
|
||||||
|
|
||||||
|
setSupportActionBar(myToolbar);
|
||||||
|
|
||||||
|
assert getSupportActionBar() != null;
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true); //show back button
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart(){
|
||||||
|
super.onStart();
|
||||||
|
|
||||||
|
firstCounter.setText(counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.FIRST));
|
||||||
|
secondCounter.setText(counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.SECOND));
|
||||||
|
thirdCounter.setText(counterButtonSharedPrefHelper.getCounterButtonName(CounterButton.THIRD));
|
||||||
|
currentCounter.setText(String.format(Integer.toString(countSharedPrefHelper.getCurrentCount())));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
getMenuInflater().inflate(R.menu.data_activity_menu, menu);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,9 +1,141 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout 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"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context=".dataActivity">
|
tools:context=".SettingsActivity">
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
<!-- Action Bar -->
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/data_toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
android:elevation="4dp"
|
||||||
|
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"/>
|
||||||
|
|
||||||
|
<!-- Content Layout -->
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="75dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_gravity="center">
|
||||||
|
|
||||||
|
<!--events counts-->
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/counter_1_data_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/colon"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/firstEventCounter"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/events"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/counter_2_data_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/colon"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/secondEventCounter"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/events"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/counter_3_data_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/colon"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/thirdEventCounter"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/events"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- total counts-->
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_gravity="start"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/total_events"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/allCounter"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/events"/>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- Events List View-->
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
@ -80,6 +80,7 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
android:id="@+id/show_counts_button"
|
||||||
android:layout_width="200dp"
|
android:layout_width="200dp"
|
||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:text="@string/show_my_counts_btn_string"
|
android:text="@string/show_my_counts_btn_string"
|
||||||
|
6
app/src/main/res/menu/data_activity_menu.xml
Normal file
6
app/src/main/res/menu/data_activity_menu.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:id="@+id/toggle_event_names"
|
||||||
|
android:title="@string/toggle_event_names" />
|
||||||
|
</menu>
|
@ -14,4 +14,8 @@
|
|||||||
<string name="save_button_string">Save</string>
|
<string name="save_button_string">Save</string>
|
||||||
<string name="maximum_counts_text">Maximum Counts</string>
|
<string name="maximum_counts_text">Maximum Counts</string>
|
||||||
<string name="maximum_counts"/>
|
<string name="maximum_counts"/>
|
||||||
|
<string name="toggle_event_names">Toggle Event Names</string>
|
||||||
|
<string name="colon">:</string>
|
||||||
|
<string name="events">" events"</string>
|
||||||
|
<string name="total_events">"Total events: "</string>
|
||||||
</resources>
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user