Skip to content

Commit a8c85df

Browse files
committed
feature : added moodle to app, bug fixes
1 parent 5e4c514 commit a8c85df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+824
-1353
lines changed

.idea/assetWizardSettings.xml

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/caches/build_file_checksums.ser

0 Bytes
Binary file not shown.

.idea/misc.xml

Lines changed: 38 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ android {
2222
minSdkVersion 21
2323
targetSdkVersion 30
2424
multiDexEnabled true
25-
versionCode 14
26-
versionName "1.1.1"
25+
versionCode 15
26+
versionName "1.1.2"
2727
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
2828

2929
manifestPlaceholders = [
@@ -60,7 +60,7 @@ dependencies {
6060
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
6161

6262
//Firebase Crashlytics
63-
implementation 'com.google.firebase:firebase-crashlytics:17.2.2'
63+
implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
6464

6565
//Recycler View and CardView
6666
implementation 'androidx.recyclerview:recyclerview:1.1.0'
@@ -95,7 +95,7 @@ dependencies {
9595
implementation 'com.google.android.exoplayer:exoplayer:2.11.1'
9696

9797
//Firebase Remote Config
98-
implementation 'com.google.firebase:firebase-config:20.0.0'
98+
implementation 'com.google.firebase:firebase-config:20.0.1'
9999
implementation 'com.google.firebase:firebase-analytics:18.0.0'
100100

101101
//picasso
@@ -106,7 +106,7 @@ dependencies {
106106
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'
107107

108108
// Firebase Auth
109-
implementation 'com.google.firebase:firebase-auth:20.0.0'
109+
implementation 'com.google.firebase:firebase-auth:20.0.1'
110110

111111
//AdMob
112112
// implementation 'com.google.android.gms:play-services-ads:19.4.0'
@@ -116,5 +116,8 @@ dependencies {
116116

117117
//Check InternetConnectivity
118118
implementation 'com.treebo:internetavailabilitychecker:1.0.4'
119+
120+
// Chrome Custom Tabs
121+
implementation 'androidx.browser:browser:1.2.0'
119122
}
120123
apply plugin: 'com.google.gms.google-services'

app/proguard-rules.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919
# If you keep the line number information, uncomment this to
2020
# hide the original source file name.
2121
#-renamesourcefileattribute SourceFile
22+

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@
4747
android:label=""
4848
android:screenOrientation="portrait"
4949
tools:ignore="LockedOrientationActivity" />
50-
<activity
51-
android:name="codex.codex_iter.www.awol.activity.BunkActivity"
52-
android:configChanges="uiMode|orientation|screenLayout|screenSize"
53-
android:screenOrientation="portrait"
54-
android:windowSoftInputMode="adjustResize"
55-
tools:ignore="LockedOrientationActivity" />
5650
<activity
5751
android:name="codex.codex_iter.www.awol.activity.AboutActivity"
5852
android:configChanges="uiMode|orientation|screenLayout|screenSize"

app/src/main/java/codex/codex_iter/www/awol/MainActivity.java

Lines changed: 58 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@
1818
import android.util.Log;
1919
import android.view.LayoutInflater;
2020
import android.view.View;
21-
import android.widget.Button;
22-
import android.widget.EditText;
2321
import android.widget.ProgressBar;
2422
import android.widget.ScrollView;
25-
import android.widget.TextView;
2623
import android.widget.Toast;
2724

2825
import androidx.annotation.NonNull;
@@ -47,7 +44,9 @@
4744
import com.downloader.PRDownloaderConfig;
4845
import com.downloader.Status;
4946
import com.google.android.material.bottomsheet.BottomSheetBehavior;
47+
import com.google.android.material.button.MaterialButton;
5048
import com.google.android.material.snackbar.Snackbar;
49+
import com.google.android.material.textfield.TextInputEditText;
5150
import com.google.android.material.textfield.TextInputLayout;
5251
import com.google.android.material.textview.MaterialTextView;
5352
import com.google.firebase.auth.FirebaseAuth;
@@ -90,19 +89,19 @@ public class MainActivity extends AppCompatActivity implements InternetConnectiv
9089
@BindView(R.id.mainLayout)
9190
CoordinatorLayout mainLayout;
9291
@BindView(R.id.user)
93-
EditText user;
92+
TextInputEditText user;
9493
@BindView(R.id.pass)
95-
EditText pass;
94+
TextInputEditText pass;
9695
@BindView(R.id.login_button)
97-
Button login;
96+
MaterialButton login;
9897
@BindView(R.id.progress_bar)
9998
ProgressBar progressBar;
10099
@BindView(R.id.passordLayout)
101100
TextInputLayout passLayout;
102101
@BindView(R.id.bottomSheet_view)
103102
ScrollView bottomSheetView;
104103
@BindView(R.id.hello)
105-
TextView welcomeMessage;
104+
MaterialTextView welcomeMessage;
106105
@BindView(R.id.manual)
107106
MaterialTextView maual;
108107
@BindView(R.id.manaul_layout)
@@ -185,8 +184,8 @@ protected void onCreate(Bundle savedInstanceState) {
185184
editor.apply();
186185

187186
login.setOnClickListener(view -> {
188-
String u = user.getText().toString().trim();
189-
String p = pass.getText().toString().trim();
187+
String u = Objects.requireNonNull(user.getText()).toString().trim();
188+
String p = Objects.requireNonNull(pass.getText()).toString().trim();
190189

191190
if (u.equals("") || p.equals("")) {
192191
Snackbar snackbar = Snackbar.make(mainLayout, "Enter your Details", Snackbar.LENGTH_SHORT);
@@ -218,54 +217,63 @@ protected void onCreate(Bundle savedInstanceState) {
218217
}
219218

220219
public void fetchDetails() {
221-
CollectionReference apiCollection = FirebaseFirestore.getInstance().collection(DETAILS);
222-
apiCollection.addSnapshotListener((queryDocumentSnapshots, e) -> {
223-
if (queryDocumentSnapshots != null) {
224-
for (DocumentChange documentChange : queryDocumentSnapshots.getDocumentChanges()) {
225-
api = documentChange.getDocument().getString(API);
226-
updated_version = Integer.parseInt(Objects.requireNonNull(documentChange.getDocument().getString("update_available")));
227-
int check = Integer.parseInt(Objects.requireNonNull(documentChange.getDocument().getString("under_maintenance")));
228-
fileSize = Long.parseLong(Objects.requireNonNull(documentChange.getDocument().getString("update_file_size")));
229-
appLink = documentChange.getDocument().getString("appLink");
230-
isQueried = true;
231-
new_message = documentChange.getDocument().getString("what's_new");
232-
updatedAppID = documentChange.getDocument().getString("download_id");
233-
edit = apiUrl.edit();
234-
edit.putString(API, api);
235-
edit.putInt("CHECK", check);
236-
edit.apply();
237-
238-
if (check == 1) {
239-
Intent intent = new Intent(MainActivity.this, UnderMaintenance.class);
240-
startActivity(intent);
241-
finish();
242-
return;
243-
}
244-
if (updated_version > current_version && current_version > 0 && Utils.isNetworkAvailable(MainActivity.this)) {
245-
downloadUpdatedApp(updatedAppID, this.new_message, appLink);
246-
} else {
247-
autoFill();
248-
try {
249-
if (awolAppUpdateFile.exists() && Utils.isNetworkAvailable(MainActivity.this)) {
250-
if (awolAppUpdateFile.delete()) {
251-
Log.d("fileDeleted", "True");
252-
} else {
253-
Log.d("fileDeleted", "False");
220+
try {
221+
CollectionReference apiCollection = FirebaseFirestore.getInstance().collection(DETAILS);
222+
apiCollection.addSnapshotListener((queryDocumentSnapshots, e) -> {
223+
if (queryDocumentSnapshots != null) {
224+
for (DocumentChange documentChange : queryDocumentSnapshots.getDocumentChanges()) {
225+
api = documentChange.getDocument().getString(API);
226+
updated_version = Integer.parseInt(Objects.requireNonNull(documentChange.getDocument().getString("update_available")));
227+
int check = Integer.parseInt(Objects.requireNonNull(documentChange.getDocument().getString("under_maintenance")));
228+
fileSize = Long.parseLong(Objects.requireNonNull(documentChange.getDocument().getString("update_file_size")));
229+
appLink = documentChange.getDocument().getString("appLink");
230+
isQueried = true;
231+
new_message = documentChange.getDocument().getString("what's_new");
232+
updatedAppID = documentChange.getDocument().getString("download_id");
233+
edit = apiUrl.edit();
234+
edit.putString(API, api);
235+
edit.putInt("CHECK", check);
236+
edit.apply();
237+
238+
if (check == 1) {
239+
Intent intent = new Intent(MainActivity.this, UnderMaintenance.class);
240+
startActivity(intent);
241+
finish();
242+
return;
243+
}
244+
if (updated_version > current_version && current_version > 0 && Utils.isNetworkAvailable(MainActivity.this)) {
245+
downloadUpdatedApp(updatedAppID, this.new_message, appLink);
246+
} else {
247+
autoFill();
248+
try {
249+
if (awolAppUpdateFile.exists() && Utils.isNetworkAvailable(MainActivity.this)) {
250+
if (awolAppUpdateFile.delete()) {
251+
Log.d("fileDeleted", "True");
252+
} else {
253+
Log.d("fileDeleted", "False");
254+
}
254255
}
256+
} catch (Exception e1) {
257+
Log.d("fileDeleted", "False");
255258
}
256-
} catch (Exception e1) {
257-
Log.d("fileDeleted", "False");
258259
}
259-
}
260260

261+
}
261262
}
262-
}
263-
});
263+
});
264+
} catch (Exception e) {
265+
266+
Snackbar snackbar = Snackbar.make(mainLayout, "Invalid firebase response", Snackbar.LENGTH_SHORT);
267+
snackbar.show();
268+
}
264269
}
265270

266271
@Override
267272
protected void onResume() {
268273
super.onResume();
274+
if (mAuth == null) {
275+
mAuth = FirebaseAuth.getInstance();
276+
}
269277
if (mAuth.getCurrentUser() != null) {
270278
fetchDetails();
271279
} else {
@@ -319,7 +327,7 @@ private void getData(final String... param) {
319327
} else if (response.equals("390")) {
320328
//Attendance not present
321329
Intent intent = new Intent(MainActivity.this, AttendanceActivity.class);
322-
intent.putExtra(REGISTRATION_NUMBER, user.getText().toString());
330+
intent.putExtra(REGISTRATION_NUMBER, Objects.requireNonNull(user.getText()).toString());
323331
intent.putExtra(NO_ATTENDANCE, true);
324332
intent.putExtra(LOGIN, true);
325333
intent.putExtra(API, api);
@@ -343,7 +351,7 @@ private void getData(final String... param) {
343351
Intent intent = new Intent(MainActivity.this, AttendanceActivity.class);
344352
response += "kkk" + param[1];
345353
intent.putExtra(RESULTS, response);
346-
intent.putExtra(REGISTRATION_NUMBER, user.getText().toString());
354+
intent.putExtra(REGISTRATION_NUMBER, Objects.requireNonNull(user.getText()).toString());
347355
intent.putExtra(LOGIN, true);
348356
intent.putExtra(STUDENT_NAME, studentName);
349357
intent.putExtra(API, api);
@@ -741,7 +749,7 @@ public void FileDownloader(String fileID, String new_message, String appLink) {
741749
.setOnPauseListener(() -> Toast.makeText(MainActivity.this, "Download Paused", Toast.LENGTH_SHORT).show())
742750
.setOnCancelListener(() -> Toast.makeText(MainActivity.this, "Download Cancelled", Toast.LENGTH_SHORT).show())
743751
.setOnProgressListener(progress -> {
744-
long progressPercent = progress.currentBytes * 100 / fileSize;
752+
long progressPercent = progress.currentBytes * 100 / progress.totalBytes;
745753
update.setText((int) progressPercent + "%");
746754
update_out_of_100.setText((int) progressPercent + "/100");
747755
progressBar.setProgress((int) progressPercent);

app/src/main/java/codex/codex_iter/www/awol/activity/AboutActivity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
import androidx.appcompat.widget.Toolbar;
1111

12+
import com.google.android.material.appbar.MaterialToolbar;
13+
1214
import java.util.Objects;
1315

1416
import codex.codex_iter.www.awol.R;
@@ -20,7 +22,7 @@ protected void onCreate(Bundle savedInstanceState) {
2022
super.onCreate(savedInstanceState);
2123
setContentView(R.layout.activity_about);
2224

23-
Toolbar toolbar = findViewById(R.id.toolbar);
25+
MaterialToolbar toolbar = findViewById(R.id.toolbar);
2426
setSupportActionBar(toolbar);
2527
Objects.requireNonNull(getSupportActionBar()).setTitle("About");
2628
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);

0 commit comments

Comments
 (0)