diff --git a/app/src/main/java/io/github/wulkanowy/ui/main/MainActivity.java b/app/src/main/java/io/github/wulkanowy/ui/main/MainActivity.java
index f00f57c26..3fc03fca2 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/main/MainActivity.java
+++ b/app/src/main/java/io/github/wulkanowy/ui/main/MainActivity.java
@@ -5,6 +5,7 @@ import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
+import android.support.design.widget.AppBarLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.view.View;
@@ -41,6 +42,9 @@ public class MainActivity extends BaseActivity implements MainContract.View,
@BindView(R.id.main_activity_progress_bar)
View progressBar;
+ @BindView(R.id.main_activity_appbar)
+ AppBarLayout appBar;
+
@Named("Main")
@Inject
BasePagerAdapter pagerAdapter;
@@ -56,7 +60,7 @@ public class MainActivity extends BaseActivity implements MainContract.View,
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
- setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
+ setSupportActionBar((Toolbar) findViewById(R.id.main_activity_toolbar));
injectViews();
presenter.attachView(this, getIntent().getIntExtra(EXTRA_CARD_ID_KEY, -1));
@@ -88,6 +92,7 @@ public class MainActivity extends BaseActivity implements MainContract.View,
@Override
public boolean onTabSelected(int position, boolean wasSelected) {
presenter.onTabSelected(position, wasSelected);
+ appBar.setExpanded(true, true);
return true;
}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/main/settings/AboutScreen.java b/app/src/main/java/io/github/wulkanowy/ui/main/settings/AboutScreen.java
deleted file mode 100644
index fe677de43..000000000
--- a/app/src/main/java/io/github/wulkanowy/ui/main/settings/AboutScreen.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package io.github.wulkanowy.ui.main.settings;
-
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.support.v7.preference.Preference;
-import android.widget.Toast;
-
-import com.google.android.gms.oss.licenses.OssLicensesMenuActivity;
-
-import io.github.wulkanowy.BuildConfig;
-import io.github.wulkanowy.R;
-import io.github.wulkanowy.utils.AppConstant;
-
-public class AboutScreen extends SettingsFragment {
-
- public static final String SHARED_KEY_ABOUT_VERSION = "about_version";
-
- public static final String SHARED_KEY_ABOUT_LICENSES = "about_osl";
-
- public static final String SHARED_KEY_ABOUT_REPO = "about_repo";
-
- private Preference.OnPreferenceClickListener onProgrammerListener = new Preference.OnPreferenceClickListener() {
- private int clicks = 0;
-
- @Override
- public boolean onPreferenceClick(Preference preference) {
- Toast.makeText(getActivity(), getVersionToast(clicks++), Toast.LENGTH_SHORT).show();
- return true;
- }
-
- private int getVersionToast(int click) {
- if (0 == click) {
- return R.string.about_programmer_step1;
- }
-
- if (1 == click) {
- return R.string.about_programmer_step2;
- }
-
- if (9 > click) {
- return R.string.about_programmer_step3;
- }
-
- return R.string.about_programmer;
- }
- };
-
- public AboutScreen() {
- // silence is golden
- }
-
- @Override
- public void onCreate(final Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- findPreference(SHARED_KEY_ABOUT_VERSION).setSummary(BuildConfig.VERSION_NAME);
- findPreference(SHARED_KEY_ABOUT_VERSION).setOnPreferenceClickListener(onProgrammerListener);
- findPreference(SHARED_KEY_ABOUT_REPO).setIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(AppConstant.REPO_URL)));
- findPreference(SHARED_KEY_ABOUT_LICENSES).setIntent(new Intent(getActivity(), OssLicensesMenuActivity.class)
- .putExtra("title", getString(R.string.pref_about_osl)));
- }
-
- @Override
- public void onCreatePreferences(Bundle bundle, String rootKey) {
- setPreferencesFromResource(R.xml.preferences, rootKey);
- }
-}
diff --git a/app/src/main/java/io/github/wulkanowy/ui/main/settings/SettingsFragment.java b/app/src/main/java/io/github/wulkanowy/ui/main/settings/SettingsFragment.java
index e08a49026..661706c08 100644
--- a/app/src/main/java/io/github/wulkanowy/ui/main/settings/SettingsFragment.java
+++ b/app/src/main/java/io/github/wulkanowy/ui/main/settings/SettingsFragment.java
@@ -1,18 +1,23 @@
package io.github.wulkanowy.ui.main.settings;
+import android.content.Intent;
import android.content.SharedPreferences;
+import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentTransaction;
+import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceFragmentCompat;
-import android.support.v7.preference.PreferenceScreen;
+import android.widget.Toast;
+import com.google.android.gms.oss.licenses.OssLicensesMenuActivity;
+
+import io.github.wulkanowy.BuildConfig;
import io.github.wulkanowy.R;
import io.github.wulkanowy.services.jobs.SyncJob;
+import io.github.wulkanowy.utils.AppConstant;
public class SettingsFragment extends PreferenceFragmentCompat
- implements SharedPreferences.OnSharedPreferenceChangeListener,
- PreferenceFragmentCompat.OnPreferenceStartScreenCallback{
+ implements SharedPreferences.OnSharedPreferenceChangeListener {
public static final String SHARED_KEY_START_TAB = "startup_tab";
@@ -28,6 +33,38 @@ public class SettingsFragment extends PreferenceFragmentCompat
public static final String SHARED_KEY_SERVICES_MOBILE_DISABLED = "services_disable_mobile";
+ public static final String SHARED_KEY_ABOUT_VERSION = "about_version";
+
+ public static final String SHARED_KEY_ABOUT_LICENSES = "about_osl";
+
+ public static final String SHARED_KEY_ABOUT_REPO = "about_repo";
+
+ private Preference.OnPreferenceClickListener onProgrammerListener = new Preference.OnPreferenceClickListener() {
+ private int clicks = 0;
+
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ Toast.makeText(getActivity(), getVersionToast(clicks++), Toast.LENGTH_SHORT).show();
+ return true;
+ }
+
+ private int getVersionToast(int click) {
+ if (0 == click) {
+ return R.string.about_programmer_step1;
+ }
+
+ if (1 == click) {
+ return R.string.about_programmer_step2;
+ }
+
+ if (9 > click) {
+ return R.string.about_programmer_step3;
+ }
+
+ return R.string.about_programmer;
+ }
+ };
+
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.preferences);
@@ -36,6 +73,12 @@ public class SettingsFragment extends PreferenceFragmentCompat
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+
+ findPreference(SHARED_KEY_ABOUT_VERSION).setSummary(BuildConfig.VERSION_NAME);
+ findPreference(SHARED_KEY_ABOUT_VERSION).setOnPreferenceClickListener(onProgrammerListener);
+ findPreference(SHARED_KEY_ABOUT_REPO).setIntent(new Intent(Intent.ACTION_VIEW, Uri.parse(AppConstant.REPO_URL)));
+ findPreference(SHARED_KEY_ABOUT_LICENSES).setIntent(new Intent(getActivity(), OssLicensesMenuActivity.class)
+ .putExtra("title", getString(R.string.pref_about_osl)));
}
@Override
@@ -43,21 +86,6 @@ public class SettingsFragment extends PreferenceFragmentCompat
return this;
}
- @Override
- public boolean onPreferenceStartScreen(PreferenceFragmentCompat preferenceFragmentCompat,
- PreferenceScreen preferenceScreen) {
- FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
- AboutScreen fragment = new AboutScreen();
- Bundle args = new Bundle();
- args.putString(PreferenceFragmentCompat.ARG_PREFERENCE_ROOT, preferenceScreen.getKey());
- fragment.setArguments(args);
- ft.add(R.id.main_activity_container, fragment, preferenceScreen.getKey());
- ft.addToBackStack(preferenceScreen.getKey());
- ft.commit();
-
- return true;
- }
-
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (key.equals(SHARED_KEY_SERVICES_ENABLE) || key.equals(SHARED_KEY_SERVICES_INTERVAL)
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index f9201ad46..3f8473d8c 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,37 +1,28 @@
-
-
-
-
-
-
+ android:baselineAligned="false"
+ android:weightSum="1">
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1">
+
+
+
+
+
+ android:layout_marginBottom="@dimen/bottom_navigation_height"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior" />
-
-
+
\ No newline at end of file
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index a2b1b368a..300bc0f39 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -11,13 +11,13 @@
+ android:summary="@string/required_restart"
+ android:title="@string/pref_grades_summary_line_show" />
+ android:summary="@string/required_restart"
+ android:title="@string/pref_attendance_present_show" />
+ android:title="@string/pref_services_mobile_data" />
-
-
-
-
-
-
-
-
-
-
+
+
+
+
diff --git a/build.gradle b/build.gradle
index 6af8545e5..760fb09f0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,12 +1,12 @@
buildscript {
repositories {
- jcenter()
mavenCentral()
google()
+ jcenter()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.1.2'
+ classpath 'com.android.tools.build:gradle:3.1.3'
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
@@ -70,9 +70,9 @@ ext {
allprojects {
repositories {
- jcenter()
mavenCentral()
google()
+ jcenter()
maven { url "https://jitpack.io" }
}
}