Skip to content

Commit fbe2b61

Browse files
committed
Solved the activity issue.
1 parent ce91dc6 commit fbe2b61

File tree

5 files changed

+12
-44
lines changed

5 files changed

+12
-44
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
android:roundIcon="@mipmap/ic_launcher_round"
1212
android:supportsRtl="true"
1313
android:theme="@style/AppTheme">
14+
15+
<activity android:name=".BaseActivity"></activity>
16+
<activity android:name=".MapActivity"></activity>
1417
<activity android:name=".WebActivity"></activity>
1518
<activity android:name=".GoogleSignInActivity">
1619
<intent-filter>
@@ -19,7 +22,6 @@
1922
<category android:name="android.intent.category.LAUNCHER" />
2023
</intent-filter>
2124
</activity>
22-
<activity android:name=".BaseActivity" />
2325
</application>
2426

2527
</manifest>
Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,14 @@
11
package com.example.firebase01;
22

3-
import android.content.Context;
4-
import android.view.View;
5-
import android.view.inputmethod.InputMethodManager;
6-
import android.widget.ProgressBar;
3+
import android.os.Bundle;
74

8-
import androidx.annotation.VisibleForTesting;
95
import androidx.appcompat.app.AppCompatActivity;
106

117
public class BaseActivity extends AppCompatActivity {
128

13-
@VisibleForTesting
14-
public ProgressBar mProgressBar;
15-
16-
public void setProgressBar(ProgressBar progressBar) {
17-
mProgressBar = progressBar;
18-
}
19-
20-
public void showProgressBar() {
21-
if (mProgressBar != null) {
22-
mProgressBar.setVisibility(View.VISIBLE);
23-
}
24-
}
25-
26-
public void hideProgressBar() {
27-
if (mProgressBar != null) {
28-
mProgressBar.setVisibility(View.INVISIBLE);
29-
}
30-
}
31-
32-
public void hideKeyboard(View view) {
33-
final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
34-
if (imm != null) {
35-
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
36-
}
37-
}
38-
399
@Override
40-
public void onStop() {
41-
super.onStop();
42-
hideProgressBar();
10+
protected void onCreate(Bundle savedInstanceState) {
11+
super.onCreate(savedInstanceState);
12+
setContentView(R.layout.activity_base);
4313
}
44-
45-
}
14+
}

app/src/main/java/com/example/firebase01/GoogleSignInActivity.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
149149

150150
// [START auth_with_google]
151151
private void firebaseAuthWithGoogle(String idToken) {
152-
// [START_EXCLUDE silent]
153-
showProgressBar();
152+
// [START_EXCLUDE silent];
154153
// [END_EXCLUDE]
155154
AuthCredential credential = GoogleAuthProvider.getCredential(idToken, null);
156155
mAuth.signInWithCredential(credential)
@@ -170,7 +169,6 @@ public void onComplete(@NonNull Task<AuthResult> task) {
170169
}
171170

172171
// [START_EXCLUDE]
173-
hideProgressBar();
174172
// [END_EXCLUDE]
175173
}
176174
});
@@ -213,7 +211,6 @@ public void onComplete(@NonNull Task<Void> task) {
213211
}
214212

215213
private void updateUI(FirebaseUser user) {
216-
hideProgressBar();
217214
if (user != null) {
218215
mStatusTextView.setText(getString(R.string.google_status_fmt, user.getEmail()));
219216
mDetailTextView.setText(getString(R.string.firebase_status_fmt, user.getUid()));

app/src/main/res/layout/activity_base.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
xmlns:tools="http://schemas.android.com/tools"
55
android:layout_width="match_parent"
66
android:layout_height="match_parent"
7-
tools:context=".WebActivity">
7+
tools:context=".BaseActivity">
88

99
<TextView
1010
android:id="@+id/textView2"
1111
android:layout_width="wrap_content"
1212
android:layout_height="wrap_content"
13-
android:text="WELCOME TO DATA"
13+
android:text="Welcome to Data"
1414
android:textSize="24sp"
1515
app:layout_constraintBottom_toBottomOf="parent"
1616
app:layout_constraintEnd_toEndOf="parent"

app/src/main/res/layout/activity_map.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
xmlns:tools="http://schemas.android.com/tools"
55
android:layout_width="match_parent"
66
android:layout_height="match_parent"
7-
tools:context=".WebActivity">
7+
tools:context=".MapActivity">
88

99
<TextView
1010
android:id="@+id/textView3"

0 commit comments

Comments
 (0)