Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
therealsujitk committed Dec 17, 2020
1 parent 6b32695 commit 8206e5b
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void signOut(View view) {

private void openUpdate() {
WebView webView = new WebView(this);
webView.loadUrl("http://vtopchennai.therealsuji.tk/download");
webView.loadUrl("http://vtopchennai.therealsuji.tk");
}

@SuppressLint("ClickableViewAccessibility")
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/tk/therealsuji/vtopchennai/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

Expand Down Expand Up @@ -83,5 +84,15 @@ public boolean onTouch(View view, MotionEvent motionEvent) {
return false;
}
});

/*
Check for a new version
*/
int versionCode = BuildConfig.VERSION_CODE;
String latestVersion = sharedPreferences.getString("versionCode", Integer.toString(versionCode));

if (versionCode <= Integer.parseInt(latestVersion)) {
Toast.makeText(this, "Please download the latest version from http://bit.ly/vtopchn", Toast.LENGTH_LONG).show();
}
}
}
47 changes: 36 additions & 11 deletions app/src/main/java/tk/therealsuji/vtopchennai/TimetableActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class TimetableActivity extends AppCompatActivity {
int day;

public void setTimetable(View view) {
timetable.scrollTo(0, 0);
timetable.removeAllViews();

if (view != null) {
Expand Down Expand Up @@ -154,6 +155,11 @@ protected void onCreate(Bundle savedInstanceState) {
saturday.setPadding(0, (int) (65 * pixelDensity), 0, (int) (15 * pixelDensity));
saturday.setOrientation(LinearLayout.VERTICAL);

Calendar c = Calendar.getInstance();
day = c.get(Calendar.DAY_OF_WEEK) - 1;

setTimetable(null);

new Thread(new Runnable() {
@Override
public void run() {
Expand Down Expand Up @@ -311,14 +317,26 @@ The outer block for theory (Initialized later to make the code faster)
/*
Finally adding block to the main sections
*/
final LinearLayout day = days[j];
final LinearLayout dayBlock = days[j];
runOnUiThread(new Runnable() {
@Override
public void run() {
day.addView(block);
dayBlock.addView(block);
}
});
hasClasses[j] = true; //Telling everyone that there is something on this day

if (!hasClasses[j]) {
hasClasses[j] = true; //Telling everyone that there is something on this day

if (day == j) {
runOnUiThread(new Runnable() {
@Override
public void run() {
findViewById(R.id.noData).setVisibility(View.INVISIBLE);
}
});
}
}
}

/*
Expand Down Expand Up @@ -428,14 +446,26 @@ The outer block for lab (Initialized later to make the code faster)
/*
Finally adding block to the main sections
*/
final LinearLayout day = days[j];
final LinearLayout dayBlock = days[j];
runOnUiThread(new Runnable() {
@Override
public void run() {
day.addView(block);
dayBlock.addView(block);
}
});
hasClasses[j] = true;

if (!hasClasses[j]) {
hasClasses[j] = true; //Telling everyone that there is something on this day

if (day == j) {
runOnUiThread(new Runnable() {
@Override
public void run() {
findViewById(R.id.noData).setVisibility(View.INVISIBLE);
}
});
}
}
}
}
}
Expand All @@ -445,10 +475,5 @@ public void run() {
myDatabase.close();
}
}).start();

Calendar c = Calendar.getInstance();
day = c.get(Calendar.DAY_OF_WEEK) - 1;

setTimetable(null);
}
}
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/background_spinner.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/colorBlue02">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/colorDefault" />
</shape>
</item>
</ripple>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/style_spinner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorDefault"
android:background="@drawable/background_spinner"
android:padding="10dp"
android:textColor="@color/colorText"
android:textSize="16sp" />
2 changes: 1 addition & 1 deletion app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
<color name="colorBlue03">#8DBDFF</color>
<color name="colorBlue04">#BFD6F6</color>
<color name="colorBlue05">#D6E7FF</color>
<color name="colorBlue06">#E6D6E7FF</color>
<color name="colorBlue06">#BFD6E7FF</color>
</resources>

0 comments on commit 8206e5b

Please sign in to comment.