diff --git a/app/build.gradle b/app/build.gradle
index 31c19d0..778061f 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -15,9 +15,9 @@ android {
applicationId "com.blackboxindia.PostIt"
minSdkVersion 21
targetSdkVersion 26
- versionName '2.3'
+ versionName '2.32'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
- versionCode 4
+ versionCode 6
}
buildTypes {
release {
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index c31d4dc..dceea11 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -6,6 +6,7 @@
+
() {
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ if(directory==null){
+ if(swipeRefreshLayout.isRefreshing())
+ swipeRefreshLayout.setRefreshing(false);
+ directory = Paper.book().read("Root", null);
+ if(directory!=null) {
+ if (recyclerView.getAdapter() != null)
+ ((DocumentAdapter) recyclerView.getAdapter()).changeRoot(directory);
+ else
+ setUpRecycler();
+ }
+ }
+ }
+ }, 1500);
+
+ new NetworkMethods(context).getAllFiles(college, new onCompleteListener() {
@Override
public void onSuccess(Directory dir) {
+ ((MainActivity) context).offlineMode = false;
- Paper.init(context);
Paper.book().write("Root",dir);
directory = dir;
@@ -101,7 +164,17 @@ public void onSuccess(Directory dir) {
@Override
public void onFailure(Exception e) {
- //Log.e(TAG, "onFailure: getDir", e);
+ Log.e(TAG, "onFailure: getDir", e);
+ if(swipeRefreshLayout.isRefreshing())
+ swipeRefreshLayout.setRefreshing(false);
+ directory = Paper.book().read("Root", null);
+ if(directory!=null) {
+ ((MainActivity) context).createSnackbar("Viewing Documents offline");
+ if (recyclerView.getAdapter() != null)
+ ((DocumentAdapter) recyclerView.getAdapter()).changeRoot(directory);
+ else
+ setUpRecycler();
+ }
}
});
diff --git a/app/src/main/java/com/blackboxindia/PostIT/Fragments/Frag_Main.java b/app/src/main/java/com/blackboxindia/PostIT/Fragments/Frag_Main.java
index 2a0b0e8..c8fa43d 100644
--- a/app/src/main/java/com/blackboxindia/PostIT/Fragments/Frag_Main.java
+++ b/app/src/main/java/com/blackboxindia/PostIT/Fragments/Frag_Main.java
@@ -5,7 +5,6 @@
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.CardView;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -13,7 +12,6 @@
import com.blackboxindia.PostIT.R;
import com.blackboxindia.PostIT.activities.MainActivity;
import com.blackboxindia.PostIT.dataModels.AdTypes;
-import com.blackboxindia.PostIT.dataModels.UserInfo;
public class Frag_Main extends Fragment {
@@ -105,22 +103,6 @@ public void onClick(View v) {
mainActivity.launchOtherFragment(new Frag_Docs(),MainActivity.DOCS_TAG, true);
}
else {
-// mainActivity.createSnackbar("Please Login to view Documents", Snackbar.LENGTH_INDEFINITE, true, "Login", new View.OnClickListener() {
-// @Override
-// public void onClick(View v) {
-// ((MainActivity)context).launchOtherFragment(new Frag_LoginPage(),MainActivity.LOGIN_PAGE_TAG, true);
-// }
-// });
- UserInfo userInfo = new UserInfo();
- userInfo.setCollegeName("IIT Indore");
- userInfo.setName("Anonymous");
- userInfo.setEmail("login@iiti.ac.in");
- userInfo.setHostel("");
- userInfo.setuID("");
- userInfo.setPhone("");
- userInfo.setRoomNumber("");
- userInfo.setHasProfileIMG(false);
- ((MainActivity)context).AnonLogin(userInfo);
mainActivity.launchOtherFragment(new Frag_Docs(),MainActivity.DOCS_TAG, true);
}
diff --git a/app/src/main/java/com/blackboxindia/PostIT/Fragments/Frag_newEvent.java b/app/src/main/java/com/blackboxindia/PostIT/Fragments/Frag_newEvent.java
index 601c868..2e2b1f0 100644
--- a/app/src/main/java/com/blackboxindia/PostIT/Fragments/Frag_newEvent.java
+++ b/app/src/main/java/com/blackboxindia/PostIT/Fragments/Frag_newEvent.java
@@ -14,7 +14,6 @@
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -242,8 +241,8 @@ private void prepareAndCreateAd() {
networkMethods = new NetworkMethods(context);
- Bitmap major = adapter.getMajor();
- if(major==null)
+// Bitmap major = adapter.getMajor();
+// if(major==null)
//Log.e(TAG, "prepareAndCreateAd: major null");
createAd(event);
diff --git a/app/src/main/java/com/blackboxindia/PostIT/Network/CloudStorageMethods.java b/app/src/main/java/com/blackboxindia/PostIT/Network/CloudStorageMethods.java
index 7183426..e590b45 100644
--- a/app/src/main/java/com/blackboxindia/PostIT/Network/CloudStorageMethods.java
+++ b/app/src/main/java/com/blackboxindia/PostIT/Network/CloudStorageMethods.java
@@ -447,30 +447,33 @@ public String toString() {
public void downloadFile(String name, String college, final onCompleteListener listener) {
final File file = new File(context.getExternalFilesDir(DIRECTORY_DOCUMENTS), name + ".pdf");
- if (!file.exists()) {
- FirebaseStorage.getInstance().getReference().child(DIRECTORY_DATA).child(college).child(name + ".pdf")
- .getFile(file)
- .addOnCompleteListener(new OnCompleteListener() {
- @Override
- public void onComplete(@NonNull Task task) {
- if (task.isSuccessful()) {
+ final boolean downloaded = file.exists();
+
+ FirebaseStorage.getInstance().getReference().child(DIRECTORY_DATA).child(college).child(name + ".pdf")
+ .getFile(file)
+ .addOnCompleteListener(new OnCompleteListener() {
+ @Override
+ public void onComplete(@NonNull Task task) {
+ if (task.isSuccessful()) {
+ listener.onSuccess(file);
+ } else {
+ Log.e(TAG, "onComplete: failure", task.getException());
+ if(downloaded) {
listener.onSuccess(file);
- } else {
- //Log.e(TAG, "onComplete: failure", task.getException());
+ }
+ else {
listener.onFailure(task.getException());
}
}
- })
- .addOnProgressListener(new OnProgressListener() {
- @Override
- public void onProgress(FileDownloadTask.TaskSnapshot taskSnapshot) {
- float p = (taskSnapshot.getBytesTransferred() / taskSnapshot.getTotalByteCount()) * 100;
- //Log.i(TAG, "onProgress downloadFile percentage: " + p);
- }
- });
- }else {
- listener.onSuccess(file);
- }
+ }
+ })
+ .addOnProgressListener(new OnProgressListener() {
+ @Override
+ public void onProgress(FileDownloadTask.TaskSnapshot taskSnapshot) {
+ float p = (taskSnapshot.getBytesTransferred() / taskSnapshot.getTotalByteCount()) * 100;
+ //Log.i(TAG, "onProgress downloadFile percentage: " + p);
+ }
+ });
}
public void getDownloadedFile(String name, String college, final onCompleteListener listener) {
diff --git a/app/src/main/java/com/blackboxindia/PostIT/Network/ConnectionDetector.java b/app/src/main/java/com/blackboxindia/PostIT/Network/ConnectionDetector.java
new file mode 100644
index 0000000..c91973e
--- /dev/null
+++ b/app/src/main/java/com/blackboxindia/PostIT/Network/ConnectionDetector.java
@@ -0,0 +1,15 @@
+package com.blackboxindia.PostIT.Network;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+
+public class ConnectionDetector {
+ public static boolean isNetworkAvailable(Context context) {
+ ConnectivityManager connectivityManager
+ = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
+
+ return activeNetworkInfo != null && activeNetworkInfo.isConnected();
+ }
+}
diff --git a/app/src/main/java/com/blackboxindia/PostIT/activities/MainActivity.java b/app/src/main/java/com/blackboxindia/PostIT/activities/MainActivity.java
index 0e2113e..d355bbb 100644
--- a/app/src/main/java/com/blackboxindia/PostIT/activities/MainActivity.java
+++ b/app/src/main/java/com/blackboxindia/PostIT/activities/MainActivity.java
@@ -34,6 +34,7 @@
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
+import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
@@ -59,6 +60,7 @@
import com.blackboxindia.PostIT.Fragments.Frag_newEvent;
import com.blackboxindia.PostIT.HelperClasses.GlideApp;
import com.blackboxindia.PostIT.Network.CloudStorageMethods;
+import com.blackboxindia.PostIT.Network.ConnectionDetector;
import com.blackboxindia.PostIT.Network.Interfaces.onCompleteListener;
import com.blackboxindia.PostIT.Network.Interfaces.onLoginListener;
import com.blackboxindia.PostIT.Network.NetworkMethods;
@@ -72,15 +74,12 @@
import com.google.firebase.auth.FirebaseUser;
import static com.blackboxindia.PostIT.activities.OnboardingActivity.PREFERENCES_FILE;
-import static com.blackboxindia.PostIT.activities.SplashScreen.ARG_IsCached;
-import static com.blackboxindia.PostIT.activities.SplashScreen.ARG_User;
import static com.blackboxindia.PostIT.dataModels.AdTypes.TYPE_EVENT;
import static com.blackboxindia.PostIT.dataModels.AdTypes.TYPE_INFO;
import static com.blackboxindia.PostIT.dataModels.AdTypes.TYPE_LOSTFOUND;
import static com.blackboxindia.PostIT.dataModels.AdTypes.TYPE_SELL;
import static com.blackboxindia.PostIT.dataModels.AdTypes.TYPE_TEACH;
-
public class MainActivity extends AppCompatActivity {
//region Static Variables
@@ -190,107 +189,122 @@ protected void onCreate(Bundle savedInstanceState) {
}
private void setUpUser(){
- Bundle extras = getIntent().getExtras();
- final boolean isCached = extras.getBoolean(ARG_IsCached);
+ Log.i(TAG, "setUpUser: ");
+
+ UserInfo userInfo = UserInfo.readCachedUserDetails(context);
+
+ final boolean isCached = userInfo!=null;
+
+ offlineMode = !ConnectionDetector.isNetworkAvailable(context);
+
if(isCached){
- UserInfo info = extras.getParcelable(ARG_User);
- UpdateUI(info,false);
- offlineMode = true;
+ UpdateUI(userInfo,false);
}
final UserCred userCred = new UserCred();
- if(userCred.load_Cred(context)) {
- networkMethods.Login(userCred.getEmail(), userCred.getpwd(),
- new onLoginListener() {
- @Override
- public void onSuccess(UserInfo userInfo) {
- UpdateUI(userInfo,false);
- Toast.makeText(context, "Logged In!", Toast.LENGTH_SHORT).show();
- userInfo.cacheUserDetails(context);
- }
-
- @Override
- public void onFailure(Exception e) {
- if(e!=null) {
- if (e.getMessage().contains("network")) {
- offlineMode = true;
- createSnackbar("Network Error. Retry login?", Snackbar.LENGTH_INDEFINITE, true, "Retry", new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- @SuppressWarnings("deprecation")
- final ProgressDialog dialog = ProgressDialog.show(context, "Logging you in...", "", true, false);
- networkMethods.Login(userCred.getEmail(), userCred.getpwd(), new onLoginListener() {
- @Override
- public void onSuccess(UserInfo userInfo) {
- offlineMode = false;
- UpdateUI(userInfo, false);
- userInfo.cacheUserDetails(context);
- dialog.cancel();
- Toast.makeText(context, "Logged In!", Toast.LENGTH_SHORT).show();
- }
+ if(!offlineMode){
+ if(userCred.load_Cred(context)) {
+ networkMethods.Login(userCred.getEmail(), userCred.getpwd(),
+ new onLoginListener() {
+ @Override
+ public void onSuccess(UserInfo userInfo) {
+ UpdateUI(userInfo,false);
+ Toast.makeText(context, "Logged In!", Toast.LENGTH_SHORT).show();
+ userInfo.cacheUserDetails(context);
+ }
- @Override
- public void onFailure(Exception e) {
- if (e.getMessage().contains("network")) {
+ @Override
+ public void onFailure(Exception e) {
+ if(e!=null) {
+ if (e.getMessage().contains("network")) {
+ offlineMode = true;
+ createSnackbar("Network Error. Retry login?", Snackbar.LENGTH_INDEFINITE, true, "Retry", new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ @SuppressWarnings("deprecation")
+ final ProgressDialog dialog = ProgressDialog.show(context, "Logging you in...", "", true, false);
+ networkMethods.Login(userCred.getEmail(), userCred.getpwd(), new onLoginListener() {
+ @Override
+ public void onSuccess(UserInfo userInfo) {
+ offlineMode = false;
+ UpdateUI(userInfo, false);
+ userInfo.cacheUserDetails(context);
dialog.cancel();
- createSnackbar("Network Error, Please try again later.");
- } else {
- dialog.cancel();
- createSnackbar("Session Expired. Please login again.");
- UserCred.clear_cred(context);
- if(isCached) {
- UserInfo.clearCache(context);
- UpdateUIonLogout(false, false);
+ Toast.makeText(context, "Logged In!", Toast.LENGTH_SHORT).show();
+ }
+
+ @Override
+ public void onFailure(Exception e) {
+ if (e.getMessage().contains("network")) {
+ dialog.cancel();
+ createSnackbar("Network Error, Please try again later.");
+ } else {
+ dialog.cancel();
+ createSnackbar("Session Expired. Please login again.");
+ UserCred.clear_cred(context);
+ if(isCached) {
+ UserInfo.clearCache(context);
+ UpdateUIonLogout(false, false);
+ }
}
}
- }
- });
+ });
+ }
+ });
+ } else {
+ createSnackbar("Session Expired. Please login again.");
+ UserCred.clear_cred(context);
+ if(isCached) {
+ UserInfo.clearCache(context);
+ UpdateUIonLogout(false, false);
}
- });
- } else {
- createSnackbar("Session Expired. Please login again.");
- UserCred.clear_cred(context);
- if(isCached) {
- UserInfo.clearCache(context);
- UpdateUIonLogout(false, false);
}
}
+ else {
+ createSnackbar("Please Login to continue", Snackbar.LENGTH_INDEFINITE, true, "Login", new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ launchOtherFragment(new Frag_LoginPage(), LOGIN_PAGE_TAG, true);
+ }
+ });
+ }
}
- else {
- createSnackbar("Please Login to continue", Snackbar.LENGTH_INDEFINITE, true, "Login", new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- launchOtherFragment(new Frag_LoginPage(), LOGIN_PAGE_TAG, true);
- }
- });
- }
- }
- });
- } else {
+ });
+ } else {
- if(isCached) {
- UserInfo.clearCache(context);
- UpdateUIonLogout(false, false);
- }
+ if(isCached) {
+ UserInfo.clearCache(context);
+ UpdateUIonLogout(false, false);
+ }
+
+ createSnackbar("Please login to get started", Snackbar.LENGTH_INDEFINITE, true, "Login", new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ launchOtherFragment(new Frag_LoginPage(),LOGIN_PAGE_TAG, true);
+ }
+ });
- createSnackbar("Please login to get started", Snackbar.LENGTH_INDEFINITE, true, "Login", new View.OnClickListener() {
+ }
+ }else {
+ if(userCred.load_Cred(context))
+ createSnackbar("No Network!", Snackbar.LENGTH_INDEFINITE, true, "Retry?", new View.OnClickListener() {
@Override
- public void onClick(View view) {
- launchOtherFragment(new Frag_LoginPage(),LOGIN_PAGE_TAG, true);
+ public void onClick(View v) {
+ setUpUser();
}
});
-
}
}
- public void goOnline() {
+ public void goOnline(final boolean prompt) {
final UserCred userCred = new UserCred();
if(userCred.load_Cred(context)) {
networkMethods.Login(userCred.getEmail(), userCred.getpwd(),
new onLoginListener() {
@Override
public void onSuccess(UserInfo userInfo) {
+ offlineMode = false;
UpdateUI(userInfo,false);
Toast.makeText(context, "Logged In!", Toast.LENGTH_SHORT).show();
userInfo.cacheUserDetails(context);
@@ -335,16 +349,18 @@ public void onFailure(Exception e) {
}
}
else {
- createSnackbar("Please Login to continue", Snackbar.LENGTH_INDEFINITE, true, "Login", new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- launchOtherFragment(new Frag_LoginPage(), LOGIN_PAGE_TAG, true);
- }
- });
+ if(prompt) {
+ createSnackbar("Please Login to continue", Snackbar.LENGTH_INDEFINITE, true, "Login", new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ launchOtherFragment(new Frag_LoginPage(), LOGIN_PAGE_TAG, true);
+ }
+ });
+ }
}
}
});
- } else {
+ } else if (prompt) {
createSnackbar("Please Login to continue", Snackbar.LENGTH_INDEFINITE, true, "Login", new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -528,6 +544,13 @@ protected void onStop() {
super.onStop();
cloudStorageMethods.saveCache();
}
+
+ @Override
+ protected void onResume() {
+ offlineMode = !ConnectionDetector.isNetworkAvailable(context);
+ super.onResume();
+ }
+
//endregion
//region Movement
@@ -823,6 +846,7 @@ public void UpdateUI(UserInfo userInfo, Boolean redirect) {
String notVerified = " (Not Verified)";
if(FirebaseAuth.getInstance().getCurrentUser()!=null) {
FirebaseAuth.getInstance().getCurrentUser().reload();
+ offlineMode = false;
if (FirebaseAuth.getInstance().getCurrentUser().isEmailVerified())
notVerified = "";
}
@@ -917,11 +941,11 @@ public void clearBackStack(){
}
public void createSnackbar(String msg) {
- createSnackbar(msg,false);
+ createSnackbar(msg,Snackbar.LENGTH_SHORT, false);
}
public void createSnackbar(String msg, boolean removeOnTouch) {
- createSnackbar(msg,Snackbar.LENGTH_SHORT, removeOnTouch);
+ createSnackbar(msg,Snackbar.LENGTH_INDEFINITE, removeOnTouch);
}
public void createSnackbar(String msg, int length, boolean removeOnTouch) {
diff --git a/app/src/main/java/com/blackboxindia/PostIT/activities/OnboardingActivity.java b/app/src/main/java/com/blackboxindia/PostIT/activities/OnboardingActivity.java
index 50b5f3f..3ebfab0 100644
--- a/app/src/main/java/com/blackboxindia/PostIT/activities/OnboardingActivity.java
+++ b/app/src/main/java/com/blackboxindia/PostIT/activities/OnboardingActivity.java
@@ -47,7 +47,7 @@ public class OnboardingActivity extends AppCompatActivity {
R.drawable.page3_event,
R.drawable.page4_teach,
R.drawable.page5_docs,
- R.drawable.app_icon_wo_title };
+ R.drawable.app_icon };
int colors[] = {
R.color.cyan,
diff --git a/app/src/main/java/com/blackboxindia/PostIT/activities/SplashScreen.java b/app/src/main/java/com/blackboxindia/PostIT/activities/SplashScreen.java
index a0dea5e..7bc8d69 100644
--- a/app/src/main/java/com/blackboxindia/PostIT/activities/SplashScreen.java
+++ b/app/src/main/java/com/blackboxindia/PostIT/activities/SplashScreen.java
@@ -7,14 +7,11 @@
import android.support.v7.app.AppCompatActivity;
import com.blackboxindia.PostIT.R;
-import com.blackboxindia.PostIT.dataModels.UserInfo;
public class SplashScreen extends AppCompatActivity {
private static final String TAG = SplashScreen.class.getSimpleName()+" YOYO";
public static int SPLASH_DELAY = 1000;
- public static final String ARG_IsCached = "ARG_IsCached";
- public static final String ARG_User = "ARG_user";
Context context;
@@ -24,30 +21,14 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_splash_screen);
context = SplashScreen.this;
- final UserInfo userInfo = UserInfo.readCachedUserDetails(context);
-
- if(userInfo!=null) {
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- Intent i = new Intent(context, MainActivity.class);
- i.putExtra(ARG_User, userInfo);
- i.putExtra(ARG_IsCached, true);
- startActivity(i);
- finish();
- }
- }, SPLASH_DELAY);
- }else {
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- Intent i = new Intent(context, MainActivity.class);
- i.putExtra(ARG_IsCached, false);
- startActivity(i);
- finish();
- }
- }, SPLASH_DELAY);
- }
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ Intent i = new Intent(context, MainActivity.class);
+ startActivity(i);
+ finish();
+ }
+ }, SPLASH_DELAY);
}
diff --git a/app/src/main/java/com/blackboxindia/PostIT/adapters/DocumentAdapter.java b/app/src/main/java/com/blackboxindia/PostIT/adapters/DocumentAdapter.java
index 9fda5f3..1b6a4d7 100644
--- a/app/src/main/java/com/blackboxindia/PostIT/adapters/DocumentAdapter.java
+++ b/app/src/main/java/com/blackboxindia/PostIT/adapters/DocumentAdapter.java
@@ -15,6 +15,7 @@
import com.blackboxindia.PostIT.HelperClasses.FileOpener;
import com.blackboxindia.PostIT.Network.CloudStorageMethods;
+import com.blackboxindia.PostIT.Network.ConnectionDetector;
import com.blackboxindia.PostIT.Network.Interfaces.onCompleteListener;
import com.blackboxindia.PostIT.R;
import com.blackboxindia.PostIT.activities.MainActivity;
@@ -39,7 +40,7 @@ public class DocumentAdapter extends RecyclerView.Adapter path;
-
+ private String collegeName;
public DocumentAdapter(Context context, Directory dir){
this.context = context;
@@ -53,6 +54,10 @@ public boolean doneSomething() {
return goBack();
}
};
+ if(((MainActivity) context).userInfo!=null)
+ collegeName = ((MainActivity) context).userInfo.getCollegeName();
+ else
+ collegeName = "IIT Indore";
}
@Override
@@ -78,7 +83,13 @@ public void changeRoot(Directory dir) {
root = dir;
Directory d = root;
for (Integer integer : path) {
- d = d.folders.get(integer);
+ if(d.folders.size()() {
+ @Override
+ public void onSuccess(File data) {
+ doneIcon.setVisibility(View.VISIBLE);
+ }
+
+ @Override
+ public void onFailure(Exception e) {
+ doneIcon.setVisibility(View.INVISIBLE);
+ }
+ });
+ }else
+ doneIcon.setVisibility(View.INVISIBLE);
+
card.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(((MainActivity)context).offlineMode) {
- new CloudStorageMethods(context).getDownloadedFile(name, ((MainActivity) context).userInfo.getCollegeName(), new onCompleteListener() {
+ new CloudStorageMethods(context).getDownloadedFile(name, collegeName, new onCompleteListener() {
@Override
public void onSuccess(File file) {
try {
@@ -149,10 +178,16 @@ public void onSuccess(File file) {
@Override
public void onFailure(Exception e) {
- ((MainActivity) context).createSnackbar("Cannot download file in offline mode", Snackbar.LENGTH_INDEFINITE, true, "Go Online", new View.OnClickListener() {
+ ((MainActivity) context).createSnackbar("Offline!", Snackbar.LENGTH_INDEFINITE, true, "Go Online", new View.OnClickListener() {
@Override
public void onClick(View view) {
- ((MainActivity) context).goOnline();
+ ((MainActivity) context).offlineMode = !ConnectionDetector.isNetworkAvailable(context);
+ if(((MainActivity) context).offlineMode){
+ ((MainActivity) context).createSnackbar("No Network!");
+ }else {
+ ((MainActivity) context).createSnackbar("Online!");
+ ((MainActivity) context).goOnline(false);
+ }
}
});
}
@@ -167,7 +202,7 @@ public void onCancel(DialogInterface dialog) {
}
}
});
- new CloudStorageMethods(context).downloadFile(name, ((MainActivity) context).userInfo.getCollegeName(), new onCompleteListener() {
+ new CloudStorageMethods(context).downloadFile(name, collegeName, new onCompleteListener() {
@Override
public void onSuccess(File file) {
dialog.cancel();
diff --git a/app/src/main/res/drawable-hdpi/app_icon_wo_title.png b/app/src/main/res/drawable-hdpi/app_icon_wo_title.png
deleted file mode 100644
index d3ad48b..0000000
Binary files a/app/src/main/res/drawable-hdpi/app_icon_wo_title.png and /dev/null differ
diff --git a/app/src/main/res/drawable-ldpi/app_icon_wo_title.png b/app/src/main/res/drawable-ldpi/app_icon_wo_title.png
deleted file mode 100644
index 1522646..0000000
Binary files a/app/src/main/res/drawable-ldpi/app_icon_wo_title.png and /dev/null differ
diff --git a/app/src/main/res/drawable-mdpi/app_icon_wo_title.png b/app/src/main/res/drawable-mdpi/app_icon_wo_title.png
deleted file mode 100644
index 283259b..0000000
Binary files a/app/src/main/res/drawable-mdpi/app_icon_wo_title.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xhdpi/app_icon_wo_title.png b/app/src/main/res/drawable-xhdpi/app_icon_wo_title.png
deleted file mode 100644
index 82a17a1..0000000
Binary files a/app/src/main/res/drawable-xhdpi/app_icon_wo_title.png and /dev/null differ
diff --git a/app/src/main/res/drawable-xxhdpi/app_icon_wo_title.png b/app/src/main/res/drawable-xxhdpi/app_icon_wo_title.png
deleted file mode 100644
index c612c40..0000000
Binary files a/app/src/main/res/drawable-xxhdpi/app_icon_wo_title.png and /dev/null differ
diff --git a/app/src/main/res/drawable/ic_done.xml b/app/src/main/res/drawable/ic_done.xml
new file mode 100644
index 0000000..7affe9b
--- /dev/null
+++ b/app/src/main/res/drawable/ic_done.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/app/src/main/res/layout/activity_splash_screen.xml b/app/src/main/res/layout/activity_splash_screen.xml
index f13cbe4..a60f6a2 100644
--- a/app/src/main/res/layout/activity_splash_screen.xml
+++ b/app/src/main/res/layout/activity_splash_screen.xml
@@ -33,7 +33,7 @@
android:layout_marginTop="8dp"
android:text="@string/app_name"
android:textColor="@color/grey"
- android:textSize="42sp"/>
+ android:textSize="36sp"/>
-
-
+ app:layout_constraintHorizontal_bias="1">
+
+
+
+
+
+
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/frag_main.xml b/app/src/main/res/layout/frag_main.xml
index 097cc4c..d3fd53f 100644
--- a/app/src/main/res/layout/frag_main.xml
+++ b/app/src/main/res/layout/frag_main.xml
@@ -1,27 +1,41 @@
-
-
-
+
+
-
+
-
-
+
-
-
+
-
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ app:layout_constraintLeft_toRightOf="@id/centre_guideline"
+ app:layout_constraintRight_toRightOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/mainCard0"
+ android:layout_marginTop="@dimen/card_margin_top"
+ android:layout_marginStart="@dimen/card_margin_centre"
+ android:layout_marginEnd="@dimen/card_margin_side"
+ >
-
+
-
-
+
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index a164246..32fecd8 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -29,10 +29,11 @@
24dp
240dp
-
-
36dp
48dp
- 36dp
+
+ 2dp
+ 3dp
+ 1dp