Skip to content

Commit

Permalink
auto switche user to settings pg if no record made
Browse files Browse the repository at this point in the history
  • Loading branch information
pmarciniak2000 committed Mar 1, 2021
1 parent 939f9a9 commit d35a099
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions .idea/SDP2021Robopump.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Robopump2/.idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,13 @@ public void onStopTrackingTouch(SeekBar seekBar) {
fuelButtons.get(i).setAlpha(sharedPreferences.getFloat((String) fuelButtons.get(i).getText(),1));
}

// if no user data found automatically switch user to settings page
DatabaseReader x = new DatabaseReader();
if (x.numberOfRecords(getApplicationContext()) < 2){
Intent intent = new Intent(this, SettingsActivity.class);
startActivity(intent);
}

}

//opens the settings page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ protected void onCreate(Bundle savedInstanceState) {
returnButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
returnToMainPage();
if (numberOfRecords() < 2) {
Toast.makeText(getApplicationContext(), "Must create a user", Toast.LENGTH_SHORT).show();
} else {
returnToMainPage();
}
}
});

Expand Down
2 changes: 1 addition & 1 deletion Robopump2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0-beta04'
classpath 'com.android.tools.build:gradle:4.2.0-beta05'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions Robopump2/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Feb 02 12:19:39 GMT 2021
#Sat Feb 27 17:56:44 GMT 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip

0 comments on commit d35a099

Please sign in to comment.