├── app
├── .gitignore
├── release
│ ├── app-release.apk
│ └── output.json
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── styles.xml
│ │ │ │ └── colors.xml
│ │ │ ├── drawable
│ │ │ │ ├── about.png
│ │ │ │ ├── admin.png
│ │ │ │ ├── close.png
│ │ │ │ ├── users.png
│ │ │ │ ├── username.png
│ │ │ │ ├── nonactive_dot.xml
│ │ │ │ ├── active_dot.xml
│ │ │ │ ├── imagebg.xml
│ │ │ │ └── edit_text_style.xml
│ │ │ ├── drawable-hdpi
│ │ │ │ ├── menu.png
│ │ │ │ ├── ic_pass.png
│ │ │ │ ├── ic_user.png
│ │ │ │ ├── ic_view.png
│ │ │ │ ├── ic_logout.png
│ │ │ │ ├── ic_upload.png
│ │ │ │ ├── broderview.xml
│ │ │ │ ├── broderviewmax.xml
│ │ │ │ └── btn_style.xml
│ │ │ ├── drawable-mdpi
│ │ │ │ ├── down.png
│ │ │ │ ├── ic_pass.png
│ │ │ │ ├── ic_user.png
│ │ │ │ ├── ic_view.png
│ │ │ │ ├── loading.png
│ │ │ │ ├── bdbanner.png
│ │ │ │ ├── ic_logout.png
│ │ │ │ ├── ic_upload.png
│ │ │ │ ├── mainlogo.png
│ │ │ │ ├── slid_one.png
│ │ │ │ ├── slid_two.png
│ │ │ │ ├── slid_three.png
│ │ │ │ └── custom_spinner_background.xml
│ │ │ ├── drawable-xhdpi
│ │ │ │ ├── ic_pass.png
│ │ │ │ ├── ic_user.png
│ │ │ │ ├── ic_view.png
│ │ │ │ ├── ic_logout.png
│ │ │ │ └── ic_upload.png
│ │ │ ├── drawable-xxhdpi
│ │ │ │ ├── ic_pass.png
│ │ │ │ ├── ic_user.png
│ │ │ │ ├── ic_view.png
│ │ │ │ ├── ic_logout.png
│ │ │ │ └── ic_upload.png
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── anim
│ │ │ │ ├── downtoup.xml
│ │ │ │ ├── uptodown.xml
│ │ │ │ └── animation_fade_in.xml
│ │ │ ├── layout
│ │ │ │ ├── spinner_item.xml
│ │ │ │ ├── custom_layout.xml
│ │ │ │ ├── activity_admin_view.xml
│ │ │ │ ├── activity_slash.xml
│ │ │ │ ├── activity_admin.xml
│ │ │ │ ├── activity_users.xml
│ │ │ │ ├── activity_admin_profile.xml
│ │ │ │ ├── activity_about.xml
│ │ │ │ ├── image_item.xml
│ │ │ │ ├── activity_upload.xml
│ │ │ │ └── activity_main.xml
│ │ │ └── menu
│ │ │ │ └── main.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── digitalclassroom15
│ │ │ │ └── digitalclassroom
│ │ │ │ ├── navActivity
│ │ │ │ ├── AboutActivity.java
│ │ │ │ ├── UsersActivity.java
│ │ │ │ └── AdminActivity.java
│ │ │ │ ├── adapter
│ │ │ │ ├── ViewPagerAdapter.java
│ │ │ │ ├── UserAdapter.java
│ │ │ │ └── ImageAdapter.java
│ │ │ │ ├── SlashActivity.java
│ │ │ │ ├── model
│ │ │ │ └── Upload.java
│ │ │ │ ├── adminPanel
│ │ │ │ ├── AdminProfileActivity.java
│ │ │ │ ├── AdminViewActivity.java
│ │ │ │ └── UploadActivity.java
│ │ │ │ ├── userSession
│ │ │ │ ├── UserSessionManager.java
│ │ │ │ └── UserSessionManager2.java
│ │ │ │ ├── userPanel
│ │ │ │ └── UserViewActivity.java
│ │ │ │ └── MainActivity.java
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── digitalclassroom15
│ │ │ └── digitalclassroom
│ │ │ └── ExampleUnitTest.java
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── digitalclassroom15
│ │ └── digitalclassroom
│ │ └── ExampleInstrumentedTest.java
├── proguard-rules.pro
├── google-services.json
└── build.gradle
├── settings.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── .idea
├── modules.xml
├── gradle.xml
├── runConfigurations.xml
├── codeStyles
│ └── Project.xml
└── misc.xml
├── gradle.properties
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/app/release/app-release.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/release/app-release.apk
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Digital Classroom
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable/about.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable/about.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/admin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable/admin.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable/close.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/users.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable/users.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-hdpi/menu.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-mdpi/down.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/username.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable/username.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_pass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-hdpi/ic_pass.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-hdpi/ic_user.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-hdpi/ic_view.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_pass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-mdpi/ic_pass.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-mdpi/ic_user.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-mdpi/ic_view.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/loading.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-mdpi/loading.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_logout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-hdpi/ic_logout.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_upload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-hdpi/ic_upload.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/bdbanner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-mdpi/bdbanner.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_logout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-mdpi/ic_logout.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_upload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-mdpi/ic_upload.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/mainlogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-mdpi/mainlogo.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/slid_one.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-mdpi/slid_one.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/slid_two.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-mdpi/slid_two.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_pass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-xhdpi/ic_pass.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-xhdpi/ic_user.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-xhdpi/ic_view.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_pass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-xxhdpi/ic_pass.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_user.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-xxhdpi/ic_user.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_view.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-xxhdpi/ic_view.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/slid_three.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-mdpi/slid_three.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_logout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-xhdpi/ic_logout.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_upload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-xhdpi/ic_upload.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_logout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-xxhdpi/ic_logout.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_upload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/drawable-xxhdpi/ic_upload.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mhasancse15/DigitalClassroom/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/app/release/output.json:
--------------------------------------------------------------------------------
1 | [{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":2},"path":"app-release.apk","properties":{"packageId":"com.digitalclassroom15.digitalclassroom","split":"","minSdkVersion":"18"}}]
--------------------------------------------------------------------------------
/app/src/main/res/anim/downtoup.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/uptodown.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/animation_fade_in.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat May 12 20:51:24 BDT 2018
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
7 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/spinner_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/nonactive_dot.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/active_dot.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/custom_spinner_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/imagebg.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
9 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/broderview.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
9 |
14 |
--------------------------------------------------------------------------------
/app/src/test/java/com/digitalclassroom15/digitalclassroom/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable/edit_text_style.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/broderviewmax.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/btn_style.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
12 |
13 |
22 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/custom_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #607D8B
4 | #455A64
5 | #FF5E5F
6 |
7 |
8 | #fbffffff
9 | #000000
10 | #3D454B
11 | #EEEEEE
12 |
13 |
14 | #E0E0E0
15 | #a30100
16 | #fe5600
17 | #a30100
18 |
19 |
20 | #F8B551
21 | #4BCA88
22 | #58D7DF
23 | #FF5E5F
24 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_admin_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
13 |
14 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/digitalclassroom15/digitalclassroom/navActivity/AboutActivity.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom.navActivity;
2 |
3 | import android.support.v7.app.AppCompatActivity;
4 | import android.os.Bundle;
5 |
6 | import com.digitalclassroom15.digitalclassroom.R;
7 |
8 | public class AboutActivity extends AppCompatActivity {
9 |
10 | @Override
11 | protected void onCreate(Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | setContentView(R.layout.activity_about);
14 |
15 |
16 | getSupportActionBar().setTitle("About Us");
17 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
18 | }
19 |
20 | // Back Button Work
21 | @Override
22 | public boolean onSupportNavigateUp() {
23 | finish();
24 | return true;
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/digitalclassroom15/digitalclassroom/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.digitalclassroom15.digitalclassroom", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Users\mahmu\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "543180076621",
4 | "firebase_url": "https://digitalclassroom-7220b.firebaseio.com",
5 | "project_id": "digitalclassroom-7220b",
6 | "storage_bucket": "digitalclassroom-7220b.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:543180076621:android:0e06649ffadb7dac",
12 | "android_client_info": {
13 | "package_name": "com.digitalclassroom15.digitalclassroom"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "543180076621-ibojn54jkgrpi8sfpfv5j9pioklek4pb.apps.googleusercontent.com",
19 | "client_type": 1,
20 | "android_info": {
21 | "package_name": "com.digitalclassroom15.digitalclassroom",
22 | "certificate_hash": "17e7c39730b52ee1d1a2acd46bc0d3c3c1c32b3e"
23 | }
24 | },
25 | {
26 | "client_id": "543180076621-2ipp02q4huq9a9hjf33grnqf3klisivk.apps.googleusercontent.com",
27 | "client_type": 3
28 | }
29 | ],
30 | "api_key": [
31 | {
32 | "current_key": "AIzaSyBYxwWK9ICEkv72jyu5Fhdk0gxBtfRfOBU"
33 | }
34 | ],
35 | "services": {
36 | "analytics_service": {
37 | "status": 1
38 | },
39 | "appinvite_service": {
40 | "status": 2,
41 | "other_platform_oauth_client": [
42 | {
43 | "client_id": "543180076621-2ipp02q4huq9a9hjf33grnqf3klisivk.apps.googleusercontent.com",
44 | "client_type": 3
45 | }
46 | ]
47 | },
48 | "ads_service": {
49 | "status": 2
50 | }
51 | }
52 | }
53 | ],
54 | "configuration_version": "1"
55 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
26 |
29 |
32 |
35 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 27
5 | defaultConfig {
6 | multiDexEnabled true
7 | applicationId "com.digitalclassroom15.digitalclassroom"
8 | minSdkVersion 18
9 | targetSdkVersion 27
10 | versionCode 2
11 | versionName "2"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | implementation fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 |
28 | //noinspection GradleCompatible,GradleDynamicVersion
29 | implementation 'com.android.support:appcompat-v7:27.1.1'
30 | implementation 'com.android.support.constraint:constraint-layout:1.0.2'
31 | implementation 'com.android.support:cardview-v7:27.1.1'
32 | implementation 'com.android.support:design:27.1.1'
33 | implementation 'com.android.support:recyclerview-v7:27.1.1'
34 | implementation 'com.android.support:support-v4:27.1.1'
35 | implementation 'com.android.support:multidex:1.0.0'
36 | implementation 'de.hdodenhof:circleimageview:1.3.0'
37 | implementation 'com.squareup.picasso:picasso:2.5.2'
38 | implementation 'com.google.firebase:firebase-database:10.0.1'
39 | implementation 'com.google.firebase:firebase-storage:10.0.1'
40 | implementation 'com.google.firebase:firebase-auth:10.0.1'
41 | implementation 'com.google.firebase:firebase-core:10.0.1'
42 | testImplementation 'junit:junit:4.12'
43 | }
44 |
45 | apply plugin: 'com.google.gms.google-services'
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_slash.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
15 |
16 |
17 |
18 |
25 |
26 |
32 |
43 |
44 |
45 |
46 |
47 |
51 |
52 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/app/src/main/java/com/digitalclassroom15/digitalclassroom/adapter/ViewPagerAdapter.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom.adapter;
2 |
3 | import android.content.Context;
4 | import android.support.v4.view.PagerAdapter;
5 | import android.support.v4.view.ViewPager;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.ImageView;
10 |
11 | import com.digitalclassroom15.digitalclassroom.R;
12 |
13 |
14 | public class ViewPagerAdapter extends PagerAdapter {
15 |
16 | private Context context;
17 | private LayoutInflater layoutInflater;
18 | private Integer[] images = {R.drawable.slid_three, R.drawable.slid_two, R.drawable.slid_three};
19 |
20 | public ViewPagerAdapter(Context context) {
21 | this.context = context;
22 | }
23 |
24 | @Override
25 | public int getCount() {
26 | return images.length;
27 | }
28 |
29 | @Override
30 | public boolean isViewFromObject(View view, Object object) {
31 | return view == object;
32 | }
33 |
34 | @Override
35 | public Object instantiateItem(ViewGroup container, final int position) {
36 |
37 | layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
38 | View view = layoutInflater.inflate(R.layout.custom_layout, null);
39 | ImageView imageView = view.findViewById(R.id.imageView);
40 | imageView.setImageResource(images[position]);
41 |
42 | view.setOnClickListener(new View.OnClickListener() {
43 | @Override
44 | public void onClick(View v) {
45 |
46 | if (position == 0) {
47 | /*Toast.makeText(context, "Slide 1 Clicked", Toast.LENGTH_SHORT).show();*/
48 | } else if (position == 1) {
49 | /* Toast.makeText(context, "Slide 2 Clicked", Toast.LENGTH_SHORT).show();*/
50 | } else {
51 | /* Toast.makeText(context, "Slide 3 Clicked", Toast.LENGTH_SHORT).show();*/
52 | }
53 |
54 | }
55 | });
56 |
57 | ViewPager vp = (ViewPager) container;
58 | vp.addView(view, 0);
59 | return view;
60 |
61 | }
62 |
63 | @Override
64 | public void destroyItem(ViewGroup container, int position, Object object) {
65 |
66 | ViewPager vp = (ViewPager) container;
67 | View view = (View) object;
68 | vp.removeView(view);
69 |
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/app/src/main/java/com/digitalclassroom15/digitalclassroom/SlashActivity.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Build;
6 | import android.os.Bundle;
7 | import android.view.View;
8 | import android.view.WindowManager;
9 | import android.view.animation.Animation;
10 | import android.view.animation.AnimationUtils;
11 | import android.widget.LinearLayout;
12 |
13 | public class SlashActivity extends Activity implements Animation.AnimationListener {
14 | Animation animFadeIn;
15 | LinearLayout linearLayout;
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | setContentView(R.layout.activity_slash);
21 |
22 | if (Build.VERSION.SDK_INT < 16) {
23 | getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
24 | WindowManager.LayoutParams.FLAG_FULLSCREEN);
25 |
26 | } else {
27 | View decorView = getWindow().getDecorView();
28 | // Hide the status bar.
29 | int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
30 | decorView.setSystemUiVisibility(uiOptions);
31 | // Remember that you should never show the action bar if the
32 | // status bar is hidden, so hide that too if necessary.
33 | }
34 | // load the animation
35 | animFadeIn = AnimationUtils.loadAnimation(getApplicationContext(),
36 | R.anim.animation_fade_in);
37 | // set animation listener
38 | animFadeIn.setAnimationListener(this);
39 | // animation for image
40 | linearLayout = (LinearLayout) findViewById(R.id.layout_linear);
41 | // start the animation
42 | linearLayout.setVisibility(View.VISIBLE);
43 | linearLayout.startAnimation(animFadeIn);
44 |
45 | }
46 |
47 | @Override
48 | public void onBackPressed() {
49 | this.finish();
50 | super.onBackPressed();
51 | }
52 |
53 | @Override
54 | public void onAnimationStart(Animation animation) {
55 | //under Implementation
56 | }
57 |
58 | public void onAnimationEnd(Animation animation) {
59 | // Start Main Screen
60 | Intent i = new Intent(SlashActivity.this, MainActivity.class);
61 | startActivity(i);
62 | this.finish();
63 | }
64 |
65 | @Override
66 | public void onAnimationRepeat(Animation animation) {
67 | //under Implementation
68 | }
69 |
70 | }
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/app/src/main/java/com/digitalclassroom15/digitalclassroom/model/Upload.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom.model;
2 |
3 | import com.google.firebase.database.Exclude;
4 |
5 | /**
6 | * Created by mahmu on 3/5/2018.
7 | */
8 |
9 | public class Upload {
10 | private String mtitle;
11 | private String mImageUrl;
12 | private String className;
13 | private String subjectName;
14 | private String lastDate;
15 | private String sectionName;
16 | private String key;
17 |
18 | public Upload() {
19 | //empty constructor needed
20 | }
21 |
22 | public Upload(String title, String imageUrl) {
23 | if (title.trim().equals("")) {
24 | title = "No Title";
25 | }
26 |
27 | mtitle = title;
28 | mImageUrl = imageUrl;
29 | }
30 |
31 | public Upload(String className, String title, String imageUrl) {
32 |
33 | if (title.trim().equals("")) {
34 | title = "No Title";
35 | }
36 | this.mtitle = title;
37 | this.mImageUrl = imageUrl;
38 | this.className = className;
39 | }
40 |
41 | public Upload(String className, String sectionName, String subjectName, String mtitle, String mImageUrl, String lastDate) {
42 |
43 | if (mtitle.trim().equals("")) {
44 | mtitle = "Null";
45 | }
46 | if (className.trim().equals("")) {
47 | className = "Null";
48 | }
49 |
50 | this.className = className;
51 | this.sectionName = sectionName;
52 | this.subjectName = subjectName;
53 | this.mtitle = mtitle;
54 | this.mImageUrl = mImageUrl;
55 | this.lastDate = lastDate;
56 | }
57 |
58 | public String getName() {
59 | return mtitle;
60 | }
61 |
62 | public void setName(String title) {
63 | mtitle = title;
64 | }
65 |
66 | public String getImageUrl() {
67 | return mImageUrl;
68 | }
69 |
70 | public void setImageUrl(String imageUrl) {
71 | mImageUrl = imageUrl;
72 | }
73 |
74 |
75 | public String getClassName() {
76 | return className;
77 | }
78 |
79 | public void setClassName(String className) {
80 | this.className = className;
81 | }
82 |
83 | public String getSubjectName() {
84 | return subjectName;
85 | }
86 |
87 | public void setSubjectName(String subjectName) {
88 | this.subjectName = subjectName;
89 | }
90 |
91 | public String getLastDate() {
92 | return lastDate;
93 | }
94 |
95 | public void setLastDate(String lastDate) {
96 | this.lastDate = lastDate;
97 | }
98 |
99 | public String getSectionName() {
100 | return sectionName;
101 | }
102 |
103 | public void setSectionName(String sectionName) {
104 | this.sectionName = sectionName;
105 | }
106 |
107 |
108 | @Exclude
109 | public String getMkey() {
110 | return key;
111 | }
112 |
113 | @Exclude
114 | public void setMkey(String key) {
115 | this.key = key;
116 | }
117 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/digitalclassroom15/digitalclassroom/adminPanel/AdminProfileActivity.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom.adminPanel;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.view.View;
7 | import android.widget.Button;
8 |
9 | import com.digitalclassroom15.digitalclassroom.R;
10 | import com.digitalclassroom15.digitalclassroom.userSession.UserSessionManager;
11 |
12 | public class AdminProfileActivity extends AppCompatActivity {
13 |
14 | // User Session Manager Class
15 | UserSessionManager session;
16 | // Button Logout
17 | Button btnLogout;
18 |
19 | @Override
20 | public void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | setContentView(R.layout.activity_admin_profile);
23 |
24 | // Get Type user name
25 | getSupportActionBar().setTitle("Admin Panel");
26 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
27 |
28 | // Session class instance
29 | session = new UserSessionManager(getApplicationContext());
30 | /*
31 | TextView lblName = (TextView) findViewById(R.id.lblName);
32 | TextView lblEmail = (TextView) findViewById(R.id.lblEmail);*/
33 |
34 | // Button logout
35 | btnLogout = (Button) findViewById(R.id.logoutBtn);
36 |
37 | // Toast.makeText(getApplicationContext(),"User Login Status: " + session.isUserLoggedIn(), Toast.LENGTH_LONG).show();
38 |
39 | // Check user login (this is the important point)
40 | // If User is not logged in , This will redirect user to AdminActivity
41 | // and finish current activity from activity stack.
42 | if(session.checkLogin())
43 | finish();
44 |
45 | /* // get user data from session
46 | HashMap user = session.getUserDetails();
47 |
48 | // get name
49 | String name = user.get(UserSessionManager.KEY_NAME);
50 |
51 | // get email
52 | String email = user.get(UserSessionManager.KEY_EMAIL);
53 |
54 | // Show user data on activity
55 | lblName.setText(Html.fromHtml("Name: " + name + ""));
56 | lblEmail.setText(Html.fromHtml("Email: " + email + ""));*/
57 |
58 | btnLogout.setOnClickListener(new View.OnClickListener() {
59 |
60 | @Override
61 | public void onClick(View arg0) {
62 |
63 | // Clear the User session data
64 | // and redirect user to AdminActivity
65 | session.logoutUser();
66 | finish();
67 | }
68 | });
69 | }
70 |
71 | public void goToUpload(View view) {
72 | Intent i=new Intent(AdminProfileActivity.this,UploadActivity.class);
73 | startActivity(i);
74 | }
75 |
76 | public void goToView(View view) {
77 | Intent i=new Intent(AdminProfileActivity.this,AdminViewActivity.class);
78 | startActivity(i);
79 | }
80 |
81 | // Back Button Work
82 | @Override
83 | public boolean onSupportNavigateUp() {
84 | finish();
85 | return true;
86 | }
87 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/digitalclassroom15/digitalclassroom/navActivity/UsersActivity.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom.navActivity;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.view.View;
7 | import android.widget.Button;
8 | import android.widget.EditText;
9 | import android.widget.Toast;
10 |
11 | import com.digitalclassroom15.digitalclassroom.R;
12 | import com.digitalclassroom15.digitalclassroom.userPanel.UserViewActivity;
13 | import com.digitalclassroom15.digitalclassroom.userSession.UserSessionManager2;
14 |
15 | public class UsersActivity extends AppCompatActivity {
16 | Button btnLogin;
17 |
18 | EditText txtUsername, txtPassword;
19 |
20 | // User Session Manager Class
21 | UserSessionManager2 session;
22 |
23 | @Override
24 | public void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | setContentView(R.layout.activity_users);
27 |
28 |
29 | getSupportActionBar().setTitle("Users Login");
30 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
31 |
32 |
33 | // User Session Manager
34 | session = new UserSessionManager2(getApplicationContext());
35 |
36 | // get Email, Password input text
37 | txtUsername = (EditText) findViewById(R.id.userNameET);
38 | txtPassword = (EditText) findViewById(R.id.passwordET);
39 |
40 | // Toast.makeText(getApplicationContext(), "User Login Status: " + session.isUserLoggedIn(), Toast.LENGTH_LONG).show();
41 |
42 |
43 | // User Login button
44 | btnLogin = (Button) findViewById(R.id.loginBtn);
45 |
46 |
47 | // Login button click event
48 | btnLogin.setOnClickListener(new View.OnClickListener() {
49 |
50 | @Override
51 | public void onClick(View arg0) {
52 |
53 | // Get username, password from EditText
54 | String username = txtUsername.getText().toString();
55 | String password = txtPassword.getText().toString();
56 |
57 | // Validate if username, password is filled
58 | if (username.trim().length() > 0 && password.trim().length() > 0) {
59 |
60 | // For testing puspose username, password is checked with static data
61 | // username = admin
62 | // password = admin
63 |
64 | if (username.equals("user") && password.equals("user")) {
65 |
66 | // Creating user login session
67 | // Statically storing name="Android Example"
68 | // and email="androidexample84@gmail.com"
69 | session.createUserLoginSession("Developed By:",
70 | "Md. Mahmudul Hasan");
71 |
72 | // Starting AdminProfileActivity
73 | Intent i = new Intent(getApplicationContext(), UserViewActivity.class);
74 | i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
75 |
76 | // Add new Flag to start new Activity
77 | i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
78 | startActivity(i);
79 |
80 | finish();
81 |
82 | } else {
83 |
84 | // username / password doesn't match&
85 | Toast.makeText(getApplicationContext(),
86 | "Username/Password is incorrect",
87 | Toast.LENGTH_LONG).show();
88 |
89 | }
90 | } else {
91 |
92 | // user didn't entered username or password
93 | Toast.makeText(getApplicationContext(),
94 | "Please enter username and password",
95 | Toast.LENGTH_LONG).show();
96 |
97 | }
98 |
99 | }
100 | });
101 | }
102 |
103 | // Back Button Work
104 | @Override
105 | public boolean onSupportNavigateUp() {
106 | finish();
107 | return true;
108 | }
109 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/digitalclassroom15/digitalclassroom/navActivity/AdminActivity.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom.navActivity;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.view.View;
7 | import android.widget.Button;
8 | import android.widget.EditText;
9 | import android.widget.Toast;
10 |
11 | import com.digitalclassroom15.digitalclassroom.R;
12 | import com.digitalclassroom15.digitalclassroom.adminPanel.AdminProfileActivity;
13 | import com.digitalclassroom15.digitalclassroom.userSession.UserSessionManager;
14 |
15 | public class AdminActivity extends AppCompatActivity {
16 | Button btnLogin;
17 |
18 | EditText txtUsername, txtPassword;
19 |
20 | // User Session Manager Class
21 | UserSessionManager session;
22 |
23 | @Override
24 | public void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | setContentView(R.layout.activity_admin);
27 |
28 |
29 | getSupportActionBar().setTitle("Admin Login");
30 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
31 |
32 |
33 | // User Session Manager
34 | session = new UserSessionManager(getApplicationContext());
35 |
36 | // get Email, Password input text
37 | txtUsername = (EditText) findViewById(R.id.userNameET);
38 | txtPassword = (EditText) findViewById(R.id.passwordET);
39 |
40 | // Toast.makeText(getApplicationContext(), "User Login Status: " + session.isUserLoggedIn(), Toast.LENGTH_LONG).show();
41 |
42 |
43 | // User Login button
44 | btnLogin = (Button) findViewById(R.id.loginBtn);
45 |
46 |
47 | // Login button click event
48 | btnLogin.setOnClickListener(new View.OnClickListener() {
49 |
50 | @Override
51 | public void onClick(View arg0) {
52 |
53 | // Get username, password from EditText
54 | String username = txtUsername.getText().toString();
55 | String password = txtPassword.getText().toString();
56 |
57 | // Validate if username, password is filled
58 | if (username.trim().length() > 0 && password.trim().length() > 0) {
59 |
60 | // For testing puspose username, password is checked with static data
61 | // username = admin
62 | // password = admin
63 |
64 | if (username.equals("digitaladmin") && password.equals("digital@2k18")) {
65 |
66 | // Creating user login session
67 | // Statically storing name="Android Example"
68 | // and email="androidexample84@gmail.com"
69 | session.createUserLoginSession("Developed By:",
70 | "Md. Mahmudul Hasan");
71 |
72 | // Starting AdminProfileActivity
73 | Intent i = new Intent(getApplicationContext(), AdminProfileActivity.class);
74 | i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
75 |
76 | // Add new Flag to start new Activity
77 | i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
78 | startActivity(i);
79 |
80 | finish();
81 |
82 | } else {
83 |
84 | // username / password doesn't match&
85 | Toast.makeText(getApplicationContext(),
86 | "Username/Password is incorrect",
87 | Toast.LENGTH_LONG).show();
88 |
89 | }
90 | } else {
91 |
92 | // user didn't entered username or password
93 | Toast.makeText(getApplicationContext(),
94 | "Please enter username and password",
95 | Toast.LENGTH_LONG).show();
96 |
97 | }
98 |
99 | }
100 | });
101 | }
102 |
103 | // Back Button Work
104 | @Override
105 | public boolean onSupportNavigateUp() {
106 | finish();
107 | return true;
108 | }
109 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/digitalclassroom15/digitalclassroom/userSession/UserSessionManager.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom.userSession;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.content.SharedPreferences;
6 |
7 | import com.digitalclassroom15.digitalclassroom.adminPanel.AdminProfileActivity;
8 | import com.digitalclassroom15.digitalclassroom.navActivity.AdminActivity;
9 |
10 | import java.util.HashMap;
11 |
12 | /**
13 | * Created by mahmu on 3/4/2018.
14 | */
15 |
16 | public class UserSessionManager {// Shared Preferences reference
17 | SharedPreferences pref;
18 |
19 | // Editor reference for Shared preferences
20 | SharedPreferences.Editor editor;
21 |
22 | // Context
23 | Context _context;
24 |
25 | // Shared pref mode
26 | int PRIVATE_MODE = 0;
27 |
28 | // Sharedpref file name
29 | private static final String PREFER_NAME = "AndroidExamplePref";
30 |
31 | // All Shared Preferences Keys
32 | private static final String IS_USER_LOGIN = "IsUserLoggedIn";
33 |
34 | // User name (make variable public to access from outside)
35 | public static final String KEY_NAME = "name";
36 |
37 | // Email address (make variable public to access from outside)
38 | public static final String KEY_EMAIL = "email";
39 |
40 | // Constructor
41 | public UserSessionManager(Context context){
42 | this._context = context;
43 | pref = _context.getSharedPreferences(PREFER_NAME, PRIVATE_MODE);
44 | editor = pref.edit();
45 | }
46 |
47 | //Create login session
48 | public void createUserLoginSession(String name, String email){
49 | // Storing login value as TRUE
50 | editor.putBoolean(IS_USER_LOGIN, true);
51 |
52 | // Storing name in pref
53 | editor.putString(KEY_NAME, name);
54 |
55 | // Storing email in pref
56 | editor.putString(KEY_EMAIL, email);
57 |
58 | // commit changes
59 | editor.commit();
60 | }
61 |
62 | /**
63 | * Check login method will check user login status
64 | * If false it will redirect user to login page
65 | * Else do anything
66 | * */
67 | public boolean checkLogin(){
68 | // Check login status
69 | if(!this.isUserLoggedIn()){
70 |
71 | // user is not logged in redirect him to Login Activity
72 | Intent i = new Intent(_context, AdminActivity.class);
73 |
74 | // Closing all the Activities from stack
75 | i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
76 |
77 | // Add new Flag to start new Activity
78 | i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
79 |
80 | // Staring Login Activity
81 | _context.startActivity(i);
82 |
83 | return true;
84 | }
85 | else{
86 | // user is not logged in redirect him to Login Activity
87 | Intent i = new Intent(_context, AdminProfileActivity.class);
88 |
89 | }
90 | return false;
91 | }
92 |
93 |
94 |
95 | /**
96 | * Get stored session data
97 | * */
98 | public HashMap getUserDetails(){
99 |
100 | //Use hashmap to store user credentials
101 | HashMap user = new HashMap();
102 |
103 | // user name
104 | user.put(KEY_NAME, pref.getString(KEY_NAME, null));
105 |
106 | // user email id
107 | user.put(KEY_EMAIL, pref.getString(KEY_EMAIL, null));
108 |
109 | // return user
110 | return user;
111 | }
112 |
113 | /**
114 | * Clear session details
115 | * */
116 | public void logoutUser(){
117 |
118 | // Clearing all user data from Shared Preferences
119 | editor.clear();
120 | editor.commit();
121 |
122 | // After logout redirect user to Login Activity
123 | Intent i = new Intent(_context, AdminActivity.class);
124 |
125 | // Closing all the Activities
126 | i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
127 |
128 | // Add new Flag to start new Activity
129 | i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
130 |
131 | // Staring Login Activity
132 | _context.startActivity(i);
133 | }
134 |
135 |
136 | // Check for login
137 | public boolean isUserLoggedIn(){
138 | return pref.getBoolean(IS_USER_LOGIN, false);
139 | }
140 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/digitalclassroom15/digitalclassroom/userSession/UserSessionManager2.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom.userSession;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.content.SharedPreferences;
6 |
7 | import com.digitalclassroom15.digitalclassroom.adminPanel.AdminProfileActivity;
8 | import com.digitalclassroom15.digitalclassroom.navActivity.UsersActivity;
9 |
10 | import java.util.HashMap;
11 |
12 | /**
13 | * Created by mahmu on 3/4/2018.
14 | */
15 |
16 | public class UserSessionManager2 {
17 | // Shared Preferences reference
18 | SharedPreferences pref;
19 |
20 | // Editor reference for Shared preferences
21 | SharedPreferences.Editor editor;
22 |
23 | // Context
24 | Context _context;
25 |
26 | // Shared pref mode
27 | int PRIVATE_MODE = 0;
28 |
29 | // Sharedpref file name
30 | private static final String PREFER_NAME = "AndroidExamplePref1";
31 |
32 | // All Shared Preferences Keys
33 | private static final String IS_USER_LOGIN = "IsUserLoggedIn1";
34 |
35 | // User name (make variable public to access from outside)
36 | public static final String KEY_USERNAME = "user_Name";
37 |
38 | // Email address (make variable public to access from outside)
39 | public static final String KEY_USEREMAIL = "user_Email";
40 |
41 | // Constructor
42 | public UserSessionManager2(Context context){
43 | this._context = context;
44 | pref = _context.getSharedPreferences(PREFER_NAME, PRIVATE_MODE);
45 | editor = pref.edit();
46 | }
47 |
48 | //Create login session
49 | public void createUserLoginSession(String user_name, String user_email){
50 | // Storing login value as TRUE
51 | editor.putBoolean(IS_USER_LOGIN, true);
52 |
53 | // Storing name in pref
54 | editor.putString(KEY_USERNAME, user_name);
55 |
56 | // Storing email in pref
57 | editor.putString(KEY_USEREMAIL, user_email);
58 |
59 | // commit changes
60 | editor.commit();
61 | }
62 |
63 | /**
64 | * Check login method will check user login status
65 | * If false it will redirect user to login page
66 | * Else do anything
67 | * */
68 | public boolean checkLogin(){
69 | // Check login status
70 | if(!this.isUserLoggedIn()){
71 |
72 | // user is not logged in redirect him to Login Activity
73 | Intent i = new Intent(_context, UsersActivity.class);
74 |
75 | // Closing all the Activities from stack
76 | i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
77 |
78 | // Add new Flag to start new Activity
79 | i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
80 |
81 | // Staring Login Activity
82 | _context.startActivity(i);
83 |
84 | return true;
85 | }
86 | else{
87 | // user is not logged in redirect him to Login Activity
88 | Intent i = new Intent(_context, AdminProfileActivity.class);
89 |
90 | }
91 | return false;
92 | }
93 |
94 |
95 |
96 | /**
97 | * Get stored session data
98 | * */
99 | public HashMap getUserDetails(){
100 |
101 | //Use hashmap to store user credentials
102 | HashMap user_name = new HashMap();
103 |
104 | // user name
105 | user_name.put(KEY_USERNAME, pref.getString(KEY_USERNAME, null));
106 |
107 | // user email id
108 | user_name.put(KEY_USEREMAIL, pref.getString(KEY_USEREMAIL, null));
109 |
110 | // return user
111 | return user_name;
112 | }
113 |
114 | /**
115 | * Clear session details
116 | * */
117 | public void logoutUser(){
118 |
119 | // Clearing all user data from Shared Preferences
120 | editor.clear();
121 | editor.commit();
122 |
123 | // After logout redirect user to Login Activity
124 | Intent i = new Intent(_context, UsersActivity.class);
125 |
126 | // Closing all the Activities
127 | i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
128 |
129 | // Add new Flag to start new Activity
130 | i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
131 |
132 | // Staring Login Activity
133 | _context.startActivity(i);
134 | }
135 |
136 |
137 | // Check for login
138 | public boolean isUserLoggedIn(){
139 | return pref.getBoolean(IS_USER_LOGIN, false);
140 | }
141 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/digitalclassroom15/digitalclassroom/adapter/UserAdapter.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom.adapter;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.ContextMenu;
6 | import android.view.LayoutInflater;
7 | import android.view.Menu;
8 | import android.view.MenuItem;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.ImageView;
12 | import android.widget.TextView;
13 |
14 | import com.digitalclassroom15.digitalclassroom.R;
15 | import com.digitalclassroom15.digitalclassroom.model.Upload;
16 | import com.squareup.picasso.Picasso;
17 |
18 | import java.util.List;
19 |
20 |
21 | public class UserAdapter extends RecyclerView.Adapter {
22 | private Context mContext;
23 | private List mUploads;
24 | private OnItemClickListener mListener;
25 |
26 | public UserAdapter(Context context, List uploads) {
27 | mContext = context;
28 | mUploads = uploads;
29 | }
30 |
31 | @Override
32 | public ImageViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
33 | View v = LayoutInflater.from(mContext).inflate(R.layout.image_item, parent, false);
34 | return new ImageViewHolder(v);
35 | }
36 |
37 | @Override
38 | public void onBindViewHolder(ImageViewHolder holder, int position) {
39 | Upload uploadCurrent = mUploads.get(position);
40 | holder.textViewName.setText(uploadCurrent.getName());
41 | holder.textSection.setText(uploadCurrent.getSectionName());
42 | holder.textClassName.setText(uploadCurrent.getClassName());
43 | holder.textSubjectName.setText(uploadCurrent.getSubjectName());
44 | holder.textsubdate.setText(uploadCurrent.getLastDate());
45 |
46 | Picasso.with(mContext)
47 | .load(uploadCurrent.getImageUrl())
48 | .fit()
49 | // .centerCrop()
50 | .into(holder.imageView);
51 | }
52 |
53 | @Override
54 | public int getItemCount() {
55 | return mUploads.size();
56 | }
57 |
58 | public class ImageViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener,
59 | View.OnCreateContextMenuListener, MenuItem.OnMenuItemClickListener {
60 | public TextView textViewName,textClassName,textSection,textSubjectName,textsubdate;
61 | public ImageView imageView;
62 |
63 | public ImageViewHolder(View itemView) {
64 | super(itemView);
65 |
66 | textViewName = itemView.findViewById(R.id.titleTV);
67 | imageView = itemView.findViewById(R.id.imageIV);
68 | textSection=itemView.findViewById(R.id.sectionNameTV);
69 | textClassName=itemView.findViewById(R.id.classNameTV);
70 | textSubjectName=itemView.findViewById(R.id.subjectNameTV);
71 | textsubdate=itemView.findViewById(R.id.lastDateTV);
72 |
73 | itemView.setOnClickListener(this);
74 | itemView.setOnCreateContextMenuListener(this);
75 | }
76 |
77 | @Override
78 | public void onClick(View v) {
79 | if (mListener != null) {
80 | int position = getAdapterPosition();
81 | if (position != RecyclerView.NO_POSITION) {
82 | mListener.onItemClick(position);
83 | }
84 | }
85 | }
86 |
87 | @Override
88 | public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
89 | menu.setHeaderTitle("Select Action");
90 | MenuItem doWhatever = menu.add(Menu.NONE, 1, 1, "Download");
91 | doWhatever.setOnMenuItemClickListener(this);
92 | }
93 |
94 | @Override
95 | public boolean onMenuItemClick(MenuItem item) {
96 | if (mListener != null) {
97 | int position = getAdapterPosition();
98 | if (position != RecyclerView.NO_POSITION) {
99 |
100 | switch (item.getItemId()) {
101 | case 1:
102 | mListener.onWhatEverClick(position);
103 | return true;
104 | }
105 | }
106 | }
107 | return false;
108 | }
109 | }
110 |
111 | public interface OnItemClickListener {
112 | void onItemClick(int position);
113 |
114 | void onWhatEverClick(int position);
115 | }
116 |
117 | public void setOnItemClickListener(OnItemClickListener listener) {
118 | mListener = listener;
119 | }
120 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_admin.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
23 |
24 |
36 |
37 |
44 |
45 |
46 |
51 |
52 |
64 |
65 |
77 |
78 |
79 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
111 |
112 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_users.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
23 |
24 |
36 |
37 |
44 |
45 |
46 |
51 |
52 |
64 |
65 |
77 |
78 |
79 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/app/src/main/java/com/digitalclassroom15/digitalclassroom/adapter/ImageAdapter.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom.adapter;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.ContextMenu;
6 | import android.view.LayoutInflater;
7 | import android.view.Menu;
8 | import android.view.MenuItem;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 | import android.widget.ImageView;
12 | import android.widget.TextView;
13 |
14 | import com.digitalclassroom15.digitalclassroom.R;
15 | import com.digitalclassroom15.digitalclassroom.model.Upload;
16 | import com.squareup.picasso.Picasso;
17 |
18 | import java.util.List;
19 |
20 |
21 | public class ImageAdapter extends RecyclerView.Adapter {
22 | private Context mContext;
23 | private List mUploads;
24 | private OnItemClickListener mListener;
25 |
26 | public ImageAdapter(Context context, List uploads) {
27 | mContext = context;
28 | mUploads = uploads;
29 | }
30 |
31 | @Override
32 | public ImageViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
33 | View v = LayoutInflater.from(mContext).inflate(R.layout.image_item, parent, false);
34 | return new ImageViewHolder(v);
35 | }
36 |
37 | @Override
38 | public void onBindViewHolder(ImageViewHolder holder, int position) {
39 | Upload uploadCurrent = mUploads.get(position);
40 | holder.textViewName.setText(uploadCurrent.getName());
41 | holder.textSection.setText(uploadCurrent.getSectionName());
42 | holder.textClassName.setText(uploadCurrent.getClassName());
43 | holder.textSubjectName.setText(uploadCurrent.getSubjectName());
44 | holder.textsubdate.setText(uploadCurrent.getLastDate());
45 |
46 | Picasso.with(mContext)
47 | .load(uploadCurrent.getImageUrl())
48 | .fit()
49 | // .centerCrop()
50 | .into(holder.imageView);
51 | }
52 |
53 | @Override
54 | public int getItemCount() {
55 | return mUploads.size();
56 | }
57 |
58 | public class ImageViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener,
59 | View.OnCreateContextMenuListener, MenuItem.OnMenuItemClickListener {
60 | public TextView textViewName,textClassName,textSection,textSubjectName,textsubdate;
61 | public ImageView imageView;
62 |
63 | public ImageViewHolder(View itemView) {
64 | super(itemView);
65 |
66 | textViewName = itemView.findViewById(R.id.titleTV);
67 | imageView = itemView.findViewById(R.id.imageIV);
68 | textSection=itemView.findViewById(R.id.sectionNameTV);
69 | textClassName=itemView.findViewById(R.id.classNameTV);
70 | textSubjectName=itemView.findViewById(R.id.subjectNameTV);
71 | textsubdate=itemView.findViewById(R.id.lastDateTV);
72 |
73 | itemView.setOnClickListener(this);
74 | itemView.setOnCreateContextMenuListener(this);
75 | }
76 |
77 | @Override
78 | public void onClick(View v) {
79 | if (mListener != null) {
80 | int position = getAdapterPosition();
81 | if (position != RecyclerView.NO_POSITION) {
82 | mListener.onItemClick(position);
83 | }
84 | }
85 | }
86 |
87 | @Override
88 | public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
89 | menu.setHeaderTitle("Select Action");
90 | MenuItem doWhatever = menu.add(Menu.NONE, 1, 1, "Download");
91 | MenuItem delete = menu.add(Menu.NONE, 2, 2, "Delete");
92 |
93 | doWhatever.setOnMenuItemClickListener(this);
94 | delete.setOnMenuItemClickListener(this);
95 | }
96 |
97 | @Override
98 | public boolean onMenuItemClick(MenuItem item) {
99 | if (mListener != null) {
100 | int position = getAdapterPosition();
101 | if (position != RecyclerView.NO_POSITION) {
102 |
103 | switch (item.getItemId()) {
104 | case 1:
105 | mListener.onWhatEverClick(position);
106 | return true;
107 | case 2:
108 | mListener.onDeleteClick(position);
109 | return true;
110 | }
111 | }
112 | }
113 | return false;
114 | }
115 | }
116 |
117 | public interface OnItemClickListener {
118 | void onItemClick(int position);
119 |
120 | void onWhatEverClick(int position);
121 |
122 | void onDeleteClick(int position);
123 | }
124 |
125 | public void setOnItemClickListener(OnItemClickListener listener) {
126 | mListener = listener;
127 | }
128 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_admin_profile.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
24 |
25 |
32 |
33 |
34 |
46 |
47 |
51 |
52 |
67 |
68 |
82 |
83 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/app/src/main/java/com/digitalclassroom15/digitalclassroom/adminPanel/AdminViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom.adminPanel;
2 |
3 | import android.app.DownloadManager;
4 | import android.content.Context;
5 | import android.net.Uri;
6 | import android.os.Bundle;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.support.v7.widget.LinearLayoutManager;
9 | import android.support.v7.widget.RecyclerView;
10 | import android.util.Log;
11 | import android.view.View;
12 | import android.widget.ProgressBar;
13 | import android.widget.Toast;
14 |
15 | import com.digitalclassroom15.digitalclassroom.R;
16 | import com.digitalclassroom15.digitalclassroom.adapter.ImageAdapter;
17 | import com.digitalclassroom15.digitalclassroom.model.Upload;
18 | import com.google.android.gms.tasks.OnSuccessListener;
19 | import com.google.firebase.database.DataSnapshot;
20 | import com.google.firebase.database.DatabaseError;
21 | import com.google.firebase.database.DatabaseReference;
22 | import com.google.firebase.database.FirebaseDatabase;
23 | import com.google.firebase.database.ValueEventListener;
24 | import com.google.firebase.storage.FirebaseStorage;
25 | import com.google.firebase.storage.StorageReference;
26 |
27 | import java.util.ArrayList;
28 | import java.util.List;
29 |
30 | public class AdminViewActivity extends AppCompatActivity implements ImageAdapter.OnItemClickListener {
31 | private RecyclerView mRecyclerView;
32 | private ImageAdapter mAdapter;
33 |
34 | private ProgressBar mProgressCircle;
35 |
36 | private FirebaseStorage mStorage;
37 | private DatabaseReference mDatabaseRef;
38 | private ValueEventListener mDBListener;
39 |
40 | private List mUploads;
41 |
42 | private String imageUrl;
43 | private DownloadManager downloadManager;
44 |
45 | @Override
46 | protected void onCreate(Bundle savedInstanceState) {
47 | super.onCreate(savedInstanceState);
48 | setContentView(R.layout.activity_admin_view);
49 | getSupportActionBar().setTitle("Home Work View");
50 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
51 |
52 | mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
53 | mRecyclerView.setHasFixedSize(true);
54 | mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
55 |
56 | mProgressCircle = (ProgressBar) findViewById(R.id.progress_circle);
57 |
58 | mUploads = new ArrayList<>();
59 |
60 | mAdapter = new ImageAdapter(AdminViewActivity.this, mUploads);
61 |
62 | mRecyclerView.setAdapter(mAdapter);
63 |
64 | mAdapter.setOnItemClickListener(AdminViewActivity.this);
65 |
66 | mStorage = FirebaseStorage.getInstance();
67 | mDatabaseRef = FirebaseDatabase.getInstance().getReference("uploads");
68 |
69 | mDBListener = mDatabaseRef.addValueEventListener(new ValueEventListener() {
70 | @Override
71 | public void onDataChange(DataSnapshot dataSnapshot) {
72 |
73 | mUploads.clear();
74 |
75 | for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
76 | Upload upload = postSnapshot.getValue(Upload.class);
77 | upload.setMkey(postSnapshot.getKey());
78 | mUploads.add(upload);
79 | }
80 |
81 | mAdapter.notifyDataSetChanged();
82 |
83 | mProgressCircle.setVisibility(View.INVISIBLE);
84 | }
85 |
86 | @Override
87 | public void onCancelled(DatabaseError databaseError) {
88 | Toast.makeText(AdminViewActivity.this, databaseError.getMessage(), Toast.LENGTH_SHORT).show();
89 | mProgressCircle.setVisibility(View.INVISIBLE);
90 | }
91 | });
92 | }
93 |
94 | @Override
95 | public void onItemClick(int position) {
96 | //Toast.makeText(this, "Normal click at position: " + position, Toast.LENGTH_SHORT).show();
97 | }
98 |
99 | @Override
100 | public void onWhatEverClick(int position) {
101 | Upload selectedItem = mUploads.get(position);
102 | final String selectedKey = selectedItem.getMkey();
103 |
104 | StorageReference imageRef = mStorage.getReferenceFromUrl(selectedItem.getImageUrl());
105 | imageRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener() {
106 | @Override
107 | public void onSuccess(Uri uri) {
108 | Log.e("Tuts+", "uri: " + uri.toString());
109 | imageUrl = uri.toString();
110 |
111 | downloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
112 | Uri downlodLink = Uri.parse(imageUrl);
113 | DownloadManager.Request request = new DownloadManager.Request(downlodLink);
114 | request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
115 | Long reference = downloadManager.enqueue(request);
116 |
117 | // Execute DownloadImage AsyncTask
118 |
119 | }
120 | });
121 |
122 | }
123 |
124 |
125 | @Override
126 | public void onDeleteClick(int position) {
127 | Upload selectedItem = mUploads.get(position);
128 | final String selectedKey = selectedItem.getMkey();
129 |
130 | StorageReference imageRef = mStorage.getReferenceFromUrl(selectedItem.getImageUrl());
131 | imageRef.delete().addOnSuccessListener(new OnSuccessListener() {
132 | @Override
133 | public void onSuccess(Void aVoid) {
134 | mDatabaseRef.child(selectedKey).removeValue();
135 | Toast.makeText(AdminViewActivity.this, "Item deleted", Toast.LENGTH_SHORT).show();
136 | }
137 | });
138 | }
139 |
140 | @Override
141 | protected void onDestroy() {
142 | super.onDestroy();
143 | mDatabaseRef.removeEventListener(mDBListener);
144 | }
145 |
146 |
147 | // Back Button Work
148 | @Override
149 | public boolean onSupportNavigateUp() {
150 | finish();
151 | return true;
152 | }
153 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/digitalclassroom15/digitalclassroom/userPanel/UserViewActivity.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom.userPanel;
2 |
3 | import android.app.DownloadManager;
4 | import android.content.Context;
5 | import android.net.Uri;
6 | import android.os.Bundle;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.support.v7.widget.LinearLayoutManager;
9 | import android.support.v7.widget.RecyclerView;
10 | import android.util.Log;
11 | import android.view.Menu;
12 | import android.view.MenuItem;
13 | import android.view.View;
14 | import android.widget.ProgressBar;
15 | import android.widget.Toast;
16 |
17 | import com.digitalclassroom15.digitalclassroom.R;
18 | import com.digitalclassroom15.digitalclassroom.adapter.UserAdapter;
19 | import com.digitalclassroom15.digitalclassroom.model.Upload;
20 | import com.digitalclassroom15.digitalclassroom.userSession.UserSessionManager2;
21 | import com.google.android.gms.tasks.OnSuccessListener;
22 | import com.google.firebase.database.DataSnapshot;
23 | import com.google.firebase.database.DatabaseError;
24 | import com.google.firebase.database.DatabaseReference;
25 | import com.google.firebase.database.FirebaseDatabase;
26 | import com.google.firebase.database.ValueEventListener;
27 | import com.google.firebase.storage.FirebaseStorage;
28 | import com.google.firebase.storage.StorageReference;
29 |
30 | import java.util.ArrayList;
31 | import java.util.List;
32 |
33 | public class UserViewActivity extends AppCompatActivity implements UserAdapter.OnItemClickListener {
34 | private RecyclerView mRecyclerView;
35 | private UserAdapter mAdapter;
36 |
37 | private ProgressBar mProgressCircle;
38 |
39 | private FirebaseStorage mStorage;
40 | private DatabaseReference mDatabaseRef;
41 | private ValueEventListener mDBListener;
42 |
43 | private List mUploads;
44 |
45 | private String imageUrl;
46 | private DownloadManager downloadManager;
47 |
48 | UserSessionManager2 session;
49 |
50 | @Override
51 | protected void onCreate(Bundle savedInstanceState) {
52 | super.onCreate(savedInstanceState);
53 | setContentView(R.layout.activity_admin_view);
54 | getSupportActionBar().setTitle("Home Work View");
55 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
56 |
57 |
58 | //SESSION MANAGER
59 | session = new UserSessionManager2(getApplicationContext());
60 | if (session.checkLogin())
61 | finish();
62 |
63 |
64 | mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view);
65 | mRecyclerView.setHasFixedSize(true);
66 | mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
67 |
68 | mProgressCircle = (ProgressBar) findViewById(R.id.progress_circle);
69 |
70 | mUploads = new ArrayList<>();
71 |
72 | mAdapter = new UserAdapter(UserViewActivity.this, mUploads);
73 |
74 | mRecyclerView.setAdapter(mAdapter);
75 |
76 | mAdapter.setOnItemClickListener(UserViewActivity.this);
77 |
78 | mStorage = FirebaseStorage.getInstance();
79 | mDatabaseRef = FirebaseDatabase.getInstance().getReference("uploads");
80 |
81 | mDBListener = mDatabaseRef.addValueEventListener(new ValueEventListener() {
82 | @Override
83 | public void onDataChange(DataSnapshot dataSnapshot) {
84 |
85 | mUploads.clear();
86 |
87 | for (DataSnapshot postSnapshot : dataSnapshot.getChildren()) {
88 | Upload upload = postSnapshot.getValue(Upload.class);
89 | upload.setMkey(postSnapshot.getKey());
90 | mUploads.add(upload);
91 | }
92 |
93 | mAdapter.notifyDataSetChanged();
94 |
95 | mProgressCircle.setVisibility(View.INVISIBLE);
96 | }
97 |
98 | @Override
99 | public void onCancelled(DatabaseError databaseError) {
100 | Toast.makeText(UserViewActivity.this, databaseError.getMessage(), Toast.LENGTH_SHORT).show();
101 | mProgressCircle.setVisibility(View.INVISIBLE);
102 | }
103 | });
104 | }
105 |
106 |
107 | /// Menu Item
108 | @Override
109 | public boolean onCreateOptionsMenu(Menu menu) {
110 | getMenuInflater().inflate(R.menu.main, menu);
111 | return true;
112 | }
113 |
114 | @Override
115 | public boolean onOptionsItemSelected(MenuItem item) {
116 | int id = item.getItemId();
117 | if (id == R.id.action_logout) {
118 | session.logoutUser();
119 | finish();
120 |
121 | return true;
122 | }
123 | return super.onOptionsItemSelected(item);
124 | }
125 | /// MAIN MENU OPTION
126 |
127 | @Override
128 | public void onItemClick(int position) {
129 | //Toast.makeText(this, "Normal click at position: " + position, Toast.LENGTH_SHORT).show();
130 | }
131 |
132 | @Override
133 | public void onWhatEverClick(int position) {
134 | Upload selectedItem = mUploads.get(position);
135 | final String selectedKey = selectedItem.getMkey();
136 |
137 | StorageReference imageRef = mStorage.getReferenceFromUrl(selectedItem.getImageUrl());
138 | imageRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener() {
139 | @Override
140 | public void onSuccess(Uri uri) {
141 | Log.e("Tuts+", "uri: " + uri.toString());
142 | imageUrl = uri.toString();
143 |
144 | downloadManager = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
145 | Uri downlodLink = Uri.parse(imageUrl);
146 | DownloadManager.Request request = new DownloadManager.Request(downlodLink);
147 | request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
148 | Long reference = downloadManager.enqueue(request);
149 |
150 | // Execute DownloadImage AsyncTask
151 |
152 | }
153 | });
154 | }
155 |
156 | @Override
157 | protected void onDestroy() {
158 | super.onDestroy();
159 | mDatabaseRef.removeEventListener(mDBListener);
160 | }
161 |
162 |
163 | // Back Button Work
164 | @Override
165 | public boolean onSupportNavigateUp() {
166 | finish();
167 | return true;
168 | }
169 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_about.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
20 |
21 |
26 |
27 |
30 |
31 |
32 |
33 |
34 |
40 |
41 |
48 |
49 |
59 |
60 |
70 |
71 |
81 |
82 |
93 |
94 |
95 |
96 |
97 |
107 |
113 |
114 |
122 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/app/src/main/java/com/digitalclassroom15/digitalclassroom/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom;
2 |
3 | import android.content.ActivityNotFoundException;
4 | import android.content.Context;
5 | import android.content.DialogInterface;
6 | import android.content.Intent;
7 | import android.net.Uri;
8 | import android.os.Bundle;
9 | import android.support.v4.content.ContextCompat;
10 | import android.support.v4.view.ViewPager;
11 | import android.support.v7.app.AlertDialog;
12 | import android.support.v7.app.AppCompatActivity;
13 | import android.view.View;
14 | import android.widget.ImageView;
15 | import android.widget.LinearLayout;
16 |
17 | import com.digitalclassroom15.digitalclassroom.adapter.ViewPagerAdapter;
18 | import com.digitalclassroom15.digitalclassroom.adminPanel.AdminProfileActivity;
19 | import com.digitalclassroom15.digitalclassroom.navActivity.AboutActivity;
20 | import com.digitalclassroom15.digitalclassroom.userPanel.UserViewActivity;
21 | import com.digitalclassroom15.digitalclassroom.userSession.UserSessionManager;
22 |
23 | import java.util.Timer;
24 | import java.util.TimerTask;
25 |
26 | public class MainActivity extends AppCompatActivity {
27 | private static final String TAG = "MainActivity";
28 | ViewPager viewPager;
29 | LinearLayout sliderDotspanel;
30 | Context context;
31 | private int dotscount;
32 | private ImageView[] dots;
33 |
34 |
35 | // User Session Manager Class
36 | UserSessionManager session;
37 |
38 |
39 | @Override
40 | protected void onCreate(Bundle savedInstanceState) {
41 | super.onCreate(savedInstanceState);
42 | setContentView(R.layout.activity_main);
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | /*View Image page code*/
51 | viewPager = (ViewPager) findViewById(R.id.viewPager);
52 |
53 | sliderDotspanel = (LinearLayout) findViewById(R.id.SliderDots);
54 |
55 | ViewPagerAdapter viewPagerAdapter = new ViewPagerAdapter(this);
56 |
57 | viewPager.setAdapter(viewPagerAdapter);
58 |
59 | dotscount = viewPagerAdapter.getCount();
60 | dots = new ImageView[dotscount];
61 |
62 | for (int i = 0; i < dotscount; i++) {
63 |
64 | dots[i] = new ImageView(this);
65 | dots[i].setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.nonactive_dot));
66 |
67 | LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
68 |
69 | params.setMargins(8, 0, 8, 0);
70 |
71 | sliderDotspanel.addView(dots[i], params);
72 |
73 | }
74 |
75 | dots[0].setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.active_dot));
76 |
77 | viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
78 | @Override
79 | public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
80 |
81 | }
82 |
83 | @Override
84 | public void onPageSelected(int position) {
85 |
86 | for (int i = 0; i < dotscount; i++) {
87 | dots[i].setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.nonactive_dot));
88 | }
89 |
90 | dots[position].setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), R.drawable.active_dot));
91 |
92 | }
93 |
94 | @Override
95 | public void onPageScrollStateChanged(int state) {
96 |
97 | }
98 | });
99 |
100 | Timer timer = new Timer();
101 | timer.scheduleAtFixedRate(new MyTimerTask(), 2000, 4000);
102 |
103 | }
104 |
105 | @Override
106 | public void onBackPressed() {
107 |
108 | exit();
109 | /*super.onBackPressed();*/
110 |
111 | }
112 |
113 | public class MyTimerTask extends TimerTask {
114 |
115 | @Override
116 | public void run() {
117 |
118 | MainActivity.this.runOnUiThread(new Runnable() {
119 | @Override
120 | public void run() {
121 |
122 | if (viewPager.getCurrentItem() == 0) {
123 | viewPager.setCurrentItem(1);
124 | } else if (viewPager.getCurrentItem() == 1) {
125 | viewPager.setCurrentItem(2);
126 | } else {
127 | viewPager.setCurrentItem(0);
128 | }
129 |
130 | }
131 | });
132 |
133 | }
134 | }
135 |
136 |
137 | public void exit() {
138 | AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
139 | // Setting Alert Dialog Title
140 | alertDialogBuilder.setTitle("Confirm Exit..!!!");
141 | // Icon Of Alert Dialog
142 | alertDialogBuilder.setIcon(R.drawable.admin);
143 | // Setting Alert Dialog Message
144 | alertDialogBuilder.setMessage("Are you sure,You want to exit");
145 | alertDialogBuilder.setCancelable(false);
146 |
147 | alertDialogBuilder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
148 |
149 | @Override
150 | public void onClick(DialogInterface arg0, int arg1) {
151 | finish();
152 | }
153 | });
154 |
155 | alertDialogBuilder.setNegativeButton("No", new DialogInterface.OnClickListener() {
156 | @Override
157 | public void onClick(DialogInterface dialog, int which) {
158 |
159 | }
160 | });
161 | alertDialogBuilder.setNeutralButton("More Apps", new DialogInterface.OnClickListener() {
162 | @Override
163 | public void onClick(DialogInterface dialog, int which) {
164 | Uri uri = Uri.parse("https://play.google.com/store/apps/developer?id=Smart%20Soft%20Studio&hl=en");
165 | Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
166 | goToMarket.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY |
167 | Intent.FLAG_ACTIVITY_NEW_DOCUMENT |
168 | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
169 | try {
170 | startActivity(goToMarket);
171 | } catch (ActivityNotFoundException e) {
172 | startActivity(new Intent(Intent.ACTION_VIEW,
173 | Uri.parse("http://play.google.com/store/apps/details?id=" + context.getPackageName())));
174 | }
175 | }
176 | });
177 |
178 | AlertDialog alertDialog = alertDialogBuilder.create();
179 | alertDialog.show();
180 | }
181 |
182 | public void goToAdmin(View view) {
183 |
184 | Intent i = new Intent(MainActivity.this, AdminProfileActivity.class);
185 | startActivity(i);
186 | }
187 |
188 | public void goToUsers(View view) {
189 | /* Intent i=new Intent(MainActivity.this, UserViewActivity.class);
190 | startActivity(i);*/
191 | Intent i = new Intent(MainActivity.this, UserViewActivity.class);
192 | startActivity(i);
193 | }
194 |
195 | public void goToAbout(View view) {
196 | Intent i = new Intent(MainActivity.this, AboutActivity.class);
197 | startActivity(i);
198 | }
199 |
200 | public void goToExit(View view) {
201 | exit();
202 | }
203 |
204 |
205 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/image_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
18 |
19 |
30 |
31 |
41 |
42 |
54 |
55 |
65 |
66 |
78 |
79 |
90 |
91 |
92 |
93 |
94 |
97 |
98 |
112 |
113 |
123 |
124 |
129 |
130 |
131 |
132 |
133 |
134 |
142 |
143 |
148 |
149 |
150 |
151 |
154 |
155 |
166 |
167 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_upload.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
16 |
17 |
30 |
31 |
37 |
38 |
51 |
52 |
60 |
61 |
71 |
72 |
73 |
86 |
87 |
99 |
100 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
125 |
126 |
129 |
130 |
140 |
141 |
148 |
149 |
163 |
164 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
--------------------------------------------------------------------------------
/app/src/main/java/com/digitalclassroom15/digitalclassroom/adminPanel/UploadActivity.java:
--------------------------------------------------------------------------------
1 | package com.digitalclassroom15.digitalclassroom.adminPanel;
2 |
3 | import android.content.ContentResolver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.graphics.Color;
7 | import android.net.Uri;
8 | import android.os.Bundle;
9 | import android.os.Handler;
10 | import android.support.annotation.NonNull;
11 | import android.support.v7.app.AppCompatActivity;
12 | import android.view.Gravity;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 | import android.webkit.MimeTypeMap;
16 | import android.widget.AdapterView;
17 | import android.widget.BaseAdapter;
18 | import android.widget.Button;
19 | import android.widget.EditText;
20 | import android.widget.ImageView;
21 | import android.widget.ProgressBar;
22 | import android.widget.Spinner;
23 | import android.widget.SpinnerAdapter;
24 | import android.widget.TextView;
25 | import android.widget.Toast;
26 |
27 | import com.digitalclassroom15.digitalclassroom.R;
28 | import com.digitalclassroom15.digitalclassroom.model.Upload;
29 | import com.google.android.gms.tasks.OnFailureListener;
30 | import com.google.android.gms.tasks.OnSuccessListener;
31 | import com.google.firebase.database.DatabaseReference;
32 | import com.google.firebase.database.FirebaseDatabase;
33 | import com.google.firebase.storage.FirebaseStorage;
34 | import com.google.firebase.storage.OnProgressListener;
35 | import com.google.firebase.storage.StorageReference;
36 | import com.google.firebase.storage.StorageTask;
37 | import com.google.firebase.storage.UploadTask;
38 | import com.squareup.picasso.Picasso;
39 |
40 | import java.util.ArrayList;
41 |
42 | public class UploadActivity extends AppCompatActivity {
43 |
44 | private static final int PICK_IMAGE_REQUEST = 1;
45 |
46 | private Button mButtonChooseImage;
47 | private Button mButtonUpload;
48 | private EditText mEditTextFileName,sectionName,subjectName,lastDate;
49 | private ImageView mImageView;
50 | private ProgressBar mProgressBar;
51 | private Spinner spinner;
52 | private String selectedItemText;
53 |
54 | private Uri mImageUri;
55 |
56 | private StorageReference mStorageRef;
57 | private DatabaseReference mDatabaseRef;
58 |
59 | private StorageTask mUploadTask;
60 |
61 | @Override
62 | protected void onCreate(Bundle savedInstanceState) {
63 | super.onCreate(savedInstanceState);
64 | setContentView(R.layout.activity_upload);
65 |
66 | mButtonChooseImage = (Button) findViewById(R.id.button_choose_image);
67 | mButtonUpload = (Button) findViewById(R.id.button_upload);
68 |
69 | mEditTextFileName = (EditText) findViewById(R.id.edit_text_file_name);
70 | sectionName = (EditText) findViewById(R.id.sectionET);
71 |
72 | subjectName = (EditText) findViewById(R.id.subjectSelectTV);
73 | lastDate = (EditText) findViewById(R.id.lastdateTV);
74 |
75 | getSupportActionBar().setTitle("Upload Document");
76 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
77 |
78 | //Medium Spinner Method
79 | initClassSpinner();
80 |
81 | mImageView = (ImageView) findViewById(R.id.image_view);
82 | mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
83 |
84 | mStorageRef = FirebaseStorage.getInstance().getReference("uploads");
85 | mDatabaseRef = FirebaseDatabase.getInstance().getReference("uploads");
86 |
87 | mButtonChooseImage.setOnClickListener(new View.OnClickListener() {
88 | @Override
89 | public void onClick(View v) {
90 | openFileChooser();
91 | }
92 | });
93 |
94 | mButtonUpload.setOnClickListener(new View.OnClickListener() {
95 | @Override
96 | public void onClick(View v) {
97 | if (mUploadTask != null && mUploadTask.isInProgress()) {
98 | Toast.makeText(UploadActivity.this, "Upload in progress", Toast.LENGTH_SHORT).show();
99 | } else {
100 | uploadFile();
101 | }
102 | }
103 | });
104 |
105 | }
106 |
107 | private void openFileChooser() {
108 | Intent intent = new Intent();
109 | intent.setType("image/*");
110 | intent.setAction(Intent.ACTION_GET_CONTENT);
111 | startActivityForResult(intent, PICK_IMAGE_REQUEST);
112 | }
113 |
114 | @Override
115 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
116 | super.onActivityResult(requestCode, resultCode, data);
117 |
118 | if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK
119 | && data != null && data.getData() != null) {
120 | mImageUri = data.getData();
121 |
122 | Picasso.with(this).load(mImageUri).into(mImageView);
123 | }
124 | }
125 |
126 | private String getFileExtension(Uri uri) {
127 | ContentResolver cR = getContentResolver();
128 | MimeTypeMap mime = MimeTypeMap.getSingleton();
129 | return mime.getExtensionFromMimeType(cR.getType(uri));
130 | }
131 |
132 | private void uploadFile() {
133 | if (mImageUri != null) {
134 | StorageReference fileReference = mStorageRef.child(System.currentTimeMillis()
135 | + "." + getFileExtension(mImageUri));
136 |
137 | mUploadTask = fileReference.putFile(mImageUri)
138 | .addOnSuccessListener(new OnSuccessListener() {
139 | @Override
140 | public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
141 | Handler handler = new Handler();
142 | handler.postDelayed(new Runnable() {
143 | @Override
144 | public void run() {
145 | mProgressBar.setProgress(0);
146 | }
147 | }, 500);
148 |
149 | Toast.makeText(UploadActivity.this, "Upload successful", Toast.LENGTH_LONG).show();
150 | // Upload upload = new Upload(mEditTextFileName.getText().toString().trim(), taskSnapshot.getDownloadUrl().toString());
151 | // Upload upload=new Upload(className.getText().toString().trim(),mEditTextFileName.getText().toString().trim(), taskSnapshot.getDownloadUrl().toString());
152 |
153 | Upload upload=new Upload(
154 |
155 | selectedItemText.toString().trim(),
156 | sectionName.getText().toString().trim(),
157 | subjectName.getText().toString().trim(),
158 | mEditTextFileName.getText().toString().trim(),
159 | taskSnapshot.getDownloadUrl().toString(),
160 | lastDate.getText().toString().trim());
161 |
162 | String uploadId = mDatabaseRef.push().getKey();
163 | mDatabaseRef.child(uploadId).setValue(upload);
164 |
165 | Intent i=new Intent(UploadActivity.this,UploadActivity.class);
166 | startActivity(i);
167 | finish();
168 | }
169 | })
170 | .addOnFailureListener(new OnFailureListener() {
171 | @Override
172 | public void onFailure(@NonNull Exception e) {
173 | Toast.makeText(UploadActivity.this, e.getMessage(), Toast.LENGTH_SHORT).show();
174 | }
175 | })
176 | .addOnProgressListener(new OnProgressListener() {
177 | @Override
178 | public void onProgress(UploadTask.TaskSnapshot taskSnapshot) {
179 | double progress = (100.0 * taskSnapshot.getBytesTransferred() / taskSnapshot.getTotalByteCount());
180 | mProgressBar.setProgress((int) progress);
181 | }
182 | });
183 | } else {
184 | Toast.makeText(this, "No file selected", Toast.LENGTH_SHORT).show();
185 | }
186 | }
187 |
188 |
189 |
190 |
191 |
192 | /* Medium Spinner Action*/
193 | private void initClassSpinner() {
194 | spinner = (Spinner) findViewById(R.id.spinner);
195 | // Spinner Drop down elements
196 | ArrayList languages = new ArrayList();
197 | languages.add("Play");
198 | languages.add("KG");
199 | languages.add("Nursery");
200 | languages.add("one");
201 | languages.add("Two");
202 | languages.add("Three");
203 | languages.add("Four");
204 | languages.add("Five");
205 | languages.add("Six");
206 | languages.add("Seven");
207 | languages.add("Eight");
208 | languages.add("Nine");
209 | languages.add("Ten");
210 | languages.add("Eleven");
211 | languages.add("Twelve");
212 |
213 |
214 | CustomSpinnerAdapter customSpinnerAdapter=new CustomSpinnerAdapter(UploadActivity.this,languages);
215 | spinner.setAdapter(customSpinnerAdapter);
216 | spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
217 | @Override
218 | public void onItemSelected(AdapterView> parent, View view, int position, long id) {
219 |
220 | selectedItemText= parent.getItemAtPosition(position).toString();
221 |
222 | // Toast.makeText(parent.getContext(), "Android Custom Spinner Example Output..." + item, Toast.LENGTH_LONG).show();
223 | }
224 |
225 | @Override
226 | public void onNothingSelected(AdapterView> parent) {
227 |
228 | }
229 | });
230 | }
231 |
232 |
233 | public class CustomSpinnerAdapter extends BaseAdapter implements SpinnerAdapter {
234 |
235 | private final Context activity;
236 | private ArrayList asr;
237 |
238 | public CustomSpinnerAdapter(Context context,ArrayList asr) {
239 | this.asr=asr;
240 | activity = context;
241 | }
242 |
243 |
244 |
245 | public int getCount()
246 | {
247 | return asr.size();
248 | }
249 |
250 | public Object getItem(int i)
251 | {
252 | return asr.get(i);
253 | }
254 |
255 | public long getItemId(int i)
256 | {
257 | return (long)i;
258 | }
259 |
260 |
261 |
262 | @Override
263 | public View getDropDownView(int position, View convertView, ViewGroup parent) {
264 | TextView txt = new TextView(UploadActivity.this);
265 | txt.setPadding(16, 16, 16, 16);
266 | txt.setTextSize(18);
267 | txt.setGravity(Gravity.CENTER_VERTICAL);
268 | txt.setText(asr.get(position));
269 | txt.setTextColor(Color.parseColor("#000000"));
270 | return txt;
271 | }
272 |
273 | public View getView(int i, View view, ViewGroup viewgroup) {
274 | TextView txt = new TextView(UploadActivity.this);
275 | txt.setGravity(Gravity.CENTER);
276 | txt.setPadding(16, 16, 16, 16);
277 | txt.setTextSize(16);
278 | // txt.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0);
279 | txt.setText(asr.get(i));
280 | txt.setTextColor(Color.parseColor("#000000"));
281 | return txt;
282 | }
283 |
284 | }
285 |
286 |
287 | // Back Button Work
288 | @Override
289 | public boolean onSupportNavigateUp() {
290 | finish();
291 | return true;
292 | }
293 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
19 |
20 |
25 |
26 |
32 |
33 |
34 |
39 |
40 |
45 |
46 |
51 |
52 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
77 |
78 |
87 |
88 |
94 |
95 |
100 |
101 |
106 |
107 |
115 |
116 |
117 |
126 |
127 |
133 |
134 |
140 |
141 |
146 |
147 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
167 |
168 |
177 |
178 |
184 |
185 |
191 |
192 |
197 |
198 |
206 |
207 |
208 |
217 |
218 |
224 |
225 |
231 |
232 |
237 |
238 |
246 |
247 |
248 |
249 |
250 |
251 |
257 |
258 |
264 |
265 |
271 |
272 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
--------------------------------------------------------------------------------