diff --git a/app/build.gradle b/app/build.gradle index b38ef350..6a261163 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,6 +10,7 @@ android { versionCode 1 versionName "0.1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + vectorDrawables.useSupportLibrary = true } buildTypes { release { @@ -27,5 +28,7 @@ dependencies { compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support.constraint:constraint-layout:1.0.2' compile 'org.jsoup:jsoup:1.10.2' + compile 'com.android.support:design:25.3.1' + compile 'com.android.support:support-vector-drawable:25.3.1' testCompile 'junit:junit:4.12' } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 115924dc..d402764c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -24,10 +24,11 @@ + android:label="@string/login_title" /> + android:label="@string/title_activity_dashboard" + android:theme="@style/Theme.AppCompat" /> \ No newline at end of file diff --git a/app/src/main/java/io/github/wulkanowy/activity/dashboard/DashboardActivity.java b/app/src/main/java/io/github/wulkanowy/activity/dashboard/DashboardActivity.java index 7bbbf04d..8767e0e0 100644 --- a/app/src/main/java/io/github/wulkanowy/activity/dashboard/DashboardActivity.java +++ b/app/src/main/java/io/github/wulkanowy/activity/dashboard/DashboardActivity.java @@ -1,121 +1,53 @@ package io.github.wulkanowy.activity.dashboard; -import android.app.Activity; - -import android.app.ActionBar; -import android.app.Fragment; -import android.app.FragmentManager; -import android.content.Context; -import android.os.Build; import android.os.Bundle; -import android.view.Gravity; -import android.view.LayoutInflater; -import android.view.Menu; +import android.support.annotation.NonNull; +import android.support.design.widget.BottomNavigationView; +import android.support.v7.app.AppCompatActivity; import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import android.support.v4.widget.DrawerLayout; -import android.widget.ArrayAdapter; import android.widget.TextView; import io.github.wulkanowy.R; -public class DashboardActivity extends Activity - implements NavigationDrawerFragment.NavigationDrawerCallbacks { +public class DashboardActivity extends AppCompatActivity { - /** - * Fragment managing the behaviors, interactions and presentation of the navigation drawer. - */ - private NavigationDrawerFragment mNavigationDrawerFragment; + private TextView mTextMessage; - /** - * Used to store the last screen title. For use in {@link #restoreActionBar()}. - */ - private CharSequence mTitle; + private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener + = new BottomNavigationView.OnNavigationItemSelectedListener() { + + @Override + public boolean onNavigationItemSelected(@NonNull MenuItem item) { + switch (item.getItemId()) { + case R.id.navigation_home: + mTextMessage.setText("DUPA"); + return true; + case R.id.navigation_dashboard: + mTextMessage.setText(R.string.title_dashboard); + return true; + case R.id.navigation_notifications: + mTextMessage.setText(R.string.title_attendance); + return true; + case R.id.navigation_lessonplan: + mTextMessage.setText(R.string.title_lessonplan); + return true; + case R.id.navigation_other: + mTextMessage.setText(R.string.title_other); + return true; + } + return false; + } + + }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dashboard); - mNavigationDrawerFragment = (NavigationDrawerFragment) - getFragmentManager().findFragmentById(R.id.navigation_drawer); - mTitle = getTitle(); - - // Set up the drawer. - mNavigationDrawerFragment.setUp( - R.id.navigation_drawer, - (DrawerLayout) findViewById(R.id.drawer_layout)); - } - - @Override - public void onNavigationDrawerItemSelected(int position) { - // update the main content by replacing fragments - FragmentManager fragmentManager = getFragmentManager(); - fragmentManager.beginTransaction() - .replace(R.id.container, PlaceholderFragment.newInstance(position + 1)) - .commit(); - } - - public void onSectionAttached(int number) { - switch (number) { - case 1: - mTitle = getString(R.string.title_section1); - break; - case 2: - mTitle = getString(R.string.title_section2); - break; - case 3: - mTitle = getString(R.string.title_section3); - break; - } - } - - public void restoreActionBar() { - ActionBar actionBar = getActionBar(); - actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); - actionBar.setDisplayShowTitleEnabled(true); - actionBar.setTitle(mTitle); - } - - /** - * A placeholder fragment containing a simple view. - */ - public static class PlaceholderFragment extends Fragment { - /** - * The fragment argument representing the section number for this - * fragment. - */ - private static final String ARG_SECTION_NUMBER = "section_number"; - - public PlaceholderFragment() { - } - - /** - * Returns a new instance of this fragment for the given section - * number. - */ - public static PlaceholderFragment newInstance(int sectionNumber) { - PlaceholderFragment fragment = new PlaceholderFragment(); - Bundle args = new Bundle(); - args.putInt(ARG_SECTION_NUMBER, sectionNumber); - fragment.setArguments(args); - return fragment; - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View rootView = inflater.inflate(R.layout.fragment_dashboard, container, false); - return rootView; - } - - @Override - public void onAttach(Activity activity) { - super.onAttach(activity); - ((DashboardActivity) activity).onSectionAttached( - getArguments().getInt(ARG_SECTION_NUMBER)); - } + mTextMessage = (TextView) findViewById(R.id.message); + BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation); + navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener); } } diff --git a/app/src/main/java/io/github/wulkanowy/activity/started/LoadingTask.java b/app/src/main/java/io/github/wulkanowy/activity/started/LoadingTask.java index 4331932f..635a0b49 100644 --- a/app/src/main/java/io/github/wulkanowy/activity/started/LoadingTask.java +++ b/app/src/main/java/io/github/wulkanowy/activity/started/LoadingTask.java @@ -5,6 +5,7 @@ import android.content.Context; import android.content.Intent; import android.os.AsyncTask; +import io.github.wulkanowy.activity.dashboard.DashboardActivity; import io.github.wulkanowy.activity.main.MainActivity; public class LoadingTask extends AsyncTask { @@ -27,7 +28,10 @@ public class LoadingTask extends AsyncTask { protected void onPostExecute(Void result) { - Intent intent = new Intent(activity,MainActivity.class); + /* Intent intent = new Intent(activity,MainActivity.class); + activity.startActivity(intent); */ + + Intent intent = new Intent(activity,DashboardActivity.class); activity.startActivity(intent); diff --git a/app/src/main/res/drawable/ic_dashboard_black_24dp.xml b/app/src/main/res/drawable/ic_dashboard_black_24dp.xml new file mode 100644 index 00000000..ae6a4468 --- /dev/null +++ b/app/src/main/res/drawable/ic_dashboard_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_home_black_24dp.xml b/app/src/main/res/drawable/ic_home_black_24dp.xml new file mode 100644 index 00000000..0c36320f --- /dev/null +++ b/app/src/main/res/drawable/ic_home_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_notifications_black_24dp.xml b/app/src/main/res/drawable/ic_notifications_black_24dp.xml new file mode 100644 index 00000000..02623821 --- /dev/null +++ b/app/src/main/res/drawable/ic_notifications_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/icon_attendance_24dp.xml b/app/src/main/res/drawable/icon_attendance_24dp.xml new file mode 100644 index 00000000..548b10fa --- /dev/null +++ b/app/src/main/res/drawable/icon_attendance_24dp.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/icon_lessonplan_24dp.xml b/app/src/main/res/drawable/icon_lessonplan_24dp.xml new file mode 100644 index 00000000..8cb39e96 --- /dev/null +++ b/app/src/main/res/drawable/icon_lessonplan_24dp.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/icon_marks_26dp.xml b/app/src/main/res/drawable/icon_marks_26dp.xml new file mode 100644 index 00000000..5798a713 --- /dev/null +++ b/app/src/main/res/drawable/icon_marks_26dp.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/icon_other_24dp.xml b/app/src/main/res/drawable/icon_other_24dp.xml new file mode 100644 index 00000000..babe59ab --- /dev/null +++ b/app/src/main/res/drawable/icon_other_24dp.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_dashboard.xml b/app/src/main/res/layout/activity_dashboard.xml index 0294922a..61bf7f24 100644 --- a/app/src/main/res/layout/activity_dashboard.xml +++ b/app/src/main/res/layout/activity_dashboard.xml @@ -1,26 +1,37 @@ - - + - + android:layout_height="0dp" + android:layout_weight="1"> - - + - + + + + + diff --git a/app/src/main/res/menu/navigation.xml b/app/src/main/res/menu/navigation.xml new file mode 100644 index 00000000..e2f8fdb5 --- /dev/null +++ b/app/src/main/res/menu/navigation.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 074e7a03..47c82246 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -2,8 +2,4 @@ 16dp 16dp - - - 240dp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 131ecc77..4b581c73 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -14,15 +14,9 @@ Login is failed Please wait... DashboardActivity - - Section 1 - Section 2 - Section 3 - - Open navigation drawer - Close navigation drawer - - Example action - - Settings + Dashboard + Marks + Attendance + Lesson Plan + Other diff --git a/build.gradle b/build.gradle index b78a0b86..c2eea8e2 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.1' + classpath 'com.android.tools.build:gradle:2.3.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files