Implemented Settings screen (WIP)
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 27
|
||||
compileSdkVersion 28
|
||||
buildToolsVersion '27.0.3'
|
||||
defaultConfig {
|
||||
applicationId "de.sebse.fuplanner"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 27
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
@@ -27,23 +27,24 @@ android {
|
||||
|
||||
|
||||
dependencies {
|
||||
implementation 'com.android.support:recyclerview-v7:27.1.1'
|
||||
implementation 'com.android.support:recyclerview-v7:28.0.0-beta01'
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
|
||||
exclude group: 'com.android.support', module: 'support-annotations'
|
||||
})
|
||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||
implementation 'com.android.support:design:27.1.1'
|
||||
implementation 'com.android.support:appcompat-v7:28.0.0-beta01'
|
||||
implementation 'com.android.support:preference-v7:28.0.0-beta01'
|
||||
implementation 'com.android.support:design:28.0.0-beta01'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
|
||||
implementation 'com.android.volley:volley:1.0.0'
|
||||
//noinspection GradleDependency
|
||||
implementation 'com.google.android.gms:play-services-auth:15.0.0'
|
||||
implementation 'com.android.support:support-v4:27.1.1'
|
||||
implementation 'com.android.support:support-v4:28.0.0-beta01'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||
implementation 'com.android.support:appcompat-v7:28.0.0-beta01'
|
||||
implementation 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
|
||||
implementation 'com.android.support:support-v4:27.1.1'
|
||||
implementation 'com.android.support:support-v4:28.0.0-beta01'
|
||||
implementation 'org.jetbrains:annotations-java5:15.0'
|
||||
//implementation 'com.github.quivr:android-week-view:2.0.2'//com.github.alamkanak:android-week-view:1.2.6
|
||||
implementation 'com.ms-square:expandableTextView:0.1.4'
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.Iterator;
|
||||
import de.sebse.fuplanner.fragments.CanteensFragment;
|
||||
import de.sebse.fuplanner.fragments.LoginFragment;
|
||||
import de.sebse.fuplanner.fragments.ModulesFragment;
|
||||
import de.sebse.fuplanner.fragments.PrefsFragment;
|
||||
import de.sebse.fuplanner.fragments.ScheduleFragment;
|
||||
import de.sebse.fuplanner.fragments.StartupFragment;
|
||||
import de.sebse.fuplanner.fragments.canteen.DaySwitcherFragment;
|
||||
@@ -51,6 +52,7 @@ public class MainActivity extends AppCompatActivity
|
||||
private static final int FRAGMENT_SCHEDULE = 4;
|
||||
private static final int FRAGMENT_CANTEENS = 5;
|
||||
private static final int FRAGMENT_CANTEENS_DETAILS = 6;
|
||||
private static final int FRAGMENT_PREFERENCES = 7;
|
||||
|
||||
private static final String ARG_FRAGMENT_PAGE = "fragment_page";
|
||||
private static final String ARG_FRAGMENT_STATUS = "fragment_status";
|
||||
@@ -156,7 +158,6 @@ public class MainActivity extends AppCompatActivity
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
@SuppressWarnings("StatementWithEmptyBody")
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||
// Handle navigation view item clicks here.
|
||||
@@ -172,6 +173,9 @@ public class MainActivity extends AppCompatActivity
|
||||
case R.id.nav_dining:
|
||||
changeFragment(FRAGMENT_CANTEENS);
|
||||
break;
|
||||
case R.id.nav_settings:
|
||||
changeFragment(FRAGMENT_PREFERENCES);
|
||||
break;
|
||||
case R.id.nav_share:
|
||||
Intent sendIntent = new Intent();
|
||||
sendIntent.setAction(Intent.ACTION_SEND);
|
||||
@@ -307,6 +311,9 @@ public class MainActivity extends AppCompatActivity
|
||||
case FRAGMENT_CANTEENS_DETAILS:
|
||||
fragment = DaySwitcherFragment.newInstance(Integer.parseInt(newData));
|
||||
break;
|
||||
case FRAGMENT_PREFERENCES:
|
||||
fragment = PrefsFragment.newInstance();
|
||||
break;
|
||||
default: // FRAGMENT_STARTUP
|
||||
fragment = StartupFragment.newInstance();
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package de.sebse.fuplanner.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.preference.PreferenceFragmentCompat;
|
||||
|
||||
import de.sebse.fuplanner.R;
|
||||
|
||||
public class PrefsFragment extends PreferenceFragmentCompat {
|
||||
|
||||
public static PrefsFragment newInstance() {
|
||||
PrefsFragment fragment = new PrefsFragment();
|
||||
Bundle args = new Bundle();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
// Load the preferences from an XML resource
|
||||
setPreferencesFromResource(R.xml.preferences, rootKey);
|
||||
}
|
||||
}
|
||||
@@ -47,4 +47,5 @@
|
||||
<string name="location_name">Location: %1$s</string>
|
||||
<string name="module_name">Module: %1$s</string>
|
||||
<string name="close">Close</string>
|
||||
<string name="root_preferences" translatable="false">root_preferences</string>
|
||||
</resources>
|
||||
|
||||
12
app/src/main/res/xml/preferences.xml
Normal file
12
app/src/main/res/xml/preferences.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:title="@string/root_preferences">
|
||||
<PreferenceScreen
|
||||
android:title="@string/hello_blank_fragment"
|
||||
android:summary="@string/lorem_ipsum_100">
|
||||
|
||||
<intent android:action="android.intent.action.VIEW"
|
||||
android:data="http://www.android.com" />
|
||||
|
||||
</PreferenceScreen>
|
||||
</PreferenceScreen>
|
||||
Reference in New Issue
Block a user