Base version and config
9
.bzrignore
Normal file
@ -0,0 +1,9 @@
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
/.idea/libraries
|
||||
.DS_Store
|
||||
/build
|
||||
/app/build
|
||||
/.idea
|
||||
/.bzr
|
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
/.idea/libraries
|
||||
.DS_Store
|
||||
/build
|
19
OpenLP.iml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="java-gradle" name="Java-Gradle">
|
||||
<configuration>
|
||||
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
88
app/app.iml
Normal file
@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="OpenLP" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="android-gradle" name="Android-Gradle">
|
||||
<configuration>
|
||||
<option name="GRADLE_PROJECT_PATH" value=":app" />
|
||||
</configuration>
|
||||
</facet>
|
||||
<facet type="android" name="Android">
|
||||
<configuration>
|
||||
<option name="SELECTED_BUILD_VARIANT" value="debug" />
|
||||
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
|
||||
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugJava" />
|
||||
<option name="ASSEMBLE_TEST_TASK_NAME" value="assembleDebugTest" />
|
||||
<option name="SOURCE_GEN_TASK_NAME" value="generateDebugSources" />
|
||||
<option name="TEST_SOURCE_GEN_TASK_NAME" value="generateDebugTestSources" />
|
||||
<option name="ALLOW_USER_CONFIGURATION" value="false" />
|
||||
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
|
||||
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
|
||||
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
|
||||
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/build/intermediates/classes/debug" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/coverage-instrumented-classes" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dex-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jacoco" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaResources" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/libs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/ndk" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="support-v4-21.0.0" level="project" />
|
||||
<orderEntry type="library" exported="" name="android-async-http-1.4.6" level="project" />
|
||||
<orderEntry type="library" exported="" name="support-annotations-21.0.0" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
26
app/build.gradle
Normal file
@ -0,0 +1,26 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 21
|
||||
buildToolsVersion "20.0.0"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.openlp.android2"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 21
|
||||
versionCode 2
|
||||
versionName "2.0"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
runProguard false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:support-v4:21.0.0'
|
||||
compile 'com.loopj.android:android-async-http:1.4.6'
|
||||
}
|
17
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in /home/tim/android-sdk/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the proguardFiles
|
||||
# directive in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
@ -0,0 +1,13 @@
|
||||
package org.openlp.android2;
|
||||
|
||||
import android.app.Application;
|
||||
import android.test.ApplicationTestCase;
|
||||
|
||||
/**
|
||||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
|
||||
*/
|
||||
public class ApplicationTest extends ApplicationTestCase<Application> {
|
||||
public ApplicationTest() {
|
||||
super(Application.class);
|
||||
}
|
||||
}
|
37
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.openlp.android2" >
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme" >
|
||||
<activity
|
||||
android:name=".OpenLP"
|
||||
android:label="@string/app_name" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activities.SettingsActivity"
|
||||
android:label="@string/title_activity_settings"
|
||||
android:parentActivityName=".OpenLP" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="org.openlp.android2.OpenLP" />
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activities.ConnectionActivity"
|
||||
android:label="@string/title_activity_settings"
|
||||
android:parentActivityName=".OpenLP" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value="org.openlp.android2.OpenLP" />
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
180
app/src/main/java/org/openlp/android2/OpenLP.java
Normal file
@ -0,0 +1,180 @@
|
||||
package org.openlp.android2;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import org.openlp.android2.activities.ConnectionActivity;
|
||||
import org.openlp.android2.activities.SettingsActivity;
|
||||
import org.openlp.android2.fragments.LiveListFragment;
|
||||
import org.openlp.android2.fragments.NavigationDrawerFragment;
|
||||
import org.openlp.android2.fragments.ServicelistFragment;
|
||||
|
||||
|
||||
public class OpenLP extends Activity
|
||||
implements NavigationDrawerFragment.NavigationDrawerCallbacks {
|
||||
|
||||
/**
|
||||
* Fragment managing the behaviors, interactions and presentation of the navigation drawer.
|
||||
*/
|
||||
private NavigationDrawerFragment mNavigationDrawerFragment;
|
||||
|
||||
/**
|
||||
* Used to store the last screen title. For use in {@link #restoreActionBar()}.
|
||||
*/
|
||||
private CharSequence mTitle;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_open_lp);
|
||||
|
||||
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();
|
||||
switch (position) {
|
||||
case 0:
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.container, ServicelistFragment.newInstance())
|
||||
.commit();
|
||||
mTitle = getString(R.string.service_list);
|
||||
break;
|
||||
case 1:
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.container, LiveListFragment.newInstance())
|
||||
.commit();
|
||||
mTitle = getString(R.string.live_list);
|
||||
break;
|
||||
case 2:
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.container, PlaceholderFragment.newInstance(position + 1))
|
||||
.commit();
|
||||
mTitle = getString(R.string.stage_view);
|
||||
break;
|
||||
case 3:
|
||||
fragmentManager.beginTransaction()
|
||||
.replace(R.id.container, PlaceholderFragment.newInstance(position + 1))
|
||||
.commit();
|
||||
mTitle = getString(R.string.live_view);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onSectionAttached(int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
mTitle = getString(R.string.service_list);
|
||||
break;
|
||||
case 2:
|
||||
mTitle = getString(R.string.live_list);
|
||||
break;
|
||||
case 3:
|
||||
mTitle = getString(R.string.stage_view);
|
||||
break;
|
||||
case 4:
|
||||
mTitle = getString(R.string.live_view);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void restoreActionBar() {
|
||||
ActionBar actionBar = getActionBar();
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
actionBar.setDisplayShowTitleEnabled(true);
|
||||
actionBar.setTitle(mTitle);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
if (!mNavigationDrawerFragment.isDrawerOpen()) {
|
||||
// Only show items in the action bar relevant to this screen
|
||||
// if the drawer is not showing. Otherwise, let the drawer
|
||||
// decide what to show in the action bar.
|
||||
getMenuInflater().inflate(R.menu.open_l, menu);
|
||||
restoreActionBar();
|
||||
return true;
|
||||
}
|
||||
return super.onCreateOptionsMenu(menu);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
// Handle action bar item clicks here. The action bar will
|
||||
// automatically handle clicks on the Home/Up button, so long
|
||||
// as you specify a parent activity in AndroidManifest.xml.
|
||||
int id = item.getItemId();
|
||||
if (id == R.id.action_preferences) {
|
||||
Intent intent = new Intent(this, SettingsActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
if (id == R.id.action_connections) {
|
||||
Intent intent = new Intent(this, ConnectionActivity.class);
|
||||
startActivity(intent);
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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";
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
public PlaceholderFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View rootView = inflater.inflate(R.layout.fragment_service_list, container, false);
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
((OpenLP) activity).onSectionAttached(
|
||||
getArguments().getInt(ARG_SECTION_NUMBER));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,429 @@
|
||||
/******************************************************************************
|
||||
* OpenLP - Open Source Lyrics Projection *
|
||||
* --------------------------------------------------------------------------- *
|
||||
* Copyright (c) 2011-2014 Raoul Snyman *
|
||||
* Portions copyright (c) 2011-2014 Tim Bentley, Johan Mynhardt *
|
||||
* *
|
||||
* --------------------------------------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the Free *
|
||||
* Software Foundation; version 2 of the License. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT *
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
|
||||
* more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., 59 *
|
||||
* Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||
*******************************************************************************/
|
||||
package org.openlp.android2.activities;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.*;
|
||||
import android.text.InputType;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
import org.openlp.android2.R;
|
||||
|
||||
public class ConnectionActivity extends PreferenceActivity {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(android.R.id.content, new ConnectionFragment())
|
||||
.commit();
|
||||
}
|
||||
|
||||
public static class ConnectionFragment extends PreferenceFragment {
|
||||
private final String KEY_PREFERENCE_DISPLAY = "preferenceDisplay";
|
||||
private final String KEY_SERVER_ID = "keyServerId";
|
||||
private final String PREFERENCE_DISPLAY_SERVER = "displayServer";
|
||||
private final String LOG_TAG = ConnectionFragment.class.getName();
|
||||
|
||||
private PreferenceScreen preferenceScreen = null;
|
||||
private boolean resume = true;
|
||||
|
||||
private static String getHostConfigTitleKey(int id) {
|
||||
return HostConfig.KEY_PREFIX + id + ".title";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
addPreferencesFromResource(R.xml.empty_preferences);
|
||||
getPreferenceManager()
|
||||
.setSharedPreferencesName(getString(R.string.keySharedPreferences));
|
||||
preferenceScreen = getPreferenceScreen() == null
|
||||
? getPreferenceManager().createPreferenceScreen(getActivity())
|
||||
: getPreferenceScreen();
|
||||
preferenceScreen.removeAll();
|
||||
String preferenceDisplay = getActivity().getIntent().getStringExtra(KEY_PREFERENCE_DISPLAY);
|
||||
if (preferenceDisplay != null
|
||||
&& preferenceDisplay.equalsIgnoreCase(PREFERENCE_DISPLAY_SERVER)) {
|
||||
constructServerView(getActivity().getIntent().getIntExtra(KEY_SERVER_ID, 1));
|
||||
} else {
|
||||
resume = false;
|
||||
constructOverviewScreen();
|
||||
}
|
||||
}
|
||||
|
||||
private void constructOverviewScreen() {
|
||||
getPreferenceScreen().removeAll();
|
||||
Log.i(LOG_TAG, "constructOverviewScreen");
|
||||
Preference configPref = new Preference(getActivity());
|
||||
configPref.setTitle(getString(R.string.connection_available_configurations));
|
||||
configPref.setSummary(getString(R.string.connection_add_by_menu));
|
||||
configPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
int nextId = getNextPrefId(
|
||||
getHostConfigMap(
|
||||
getPreferenceManager()
|
||||
.getSharedPreferences().getAll()
|
||||
)
|
||||
);
|
||||
Preference newPreference = simpleClickablePreferenceFromHostConfig(
|
||||
new HostConfig(
|
||||
getString(R.string.connection_profile_server),
|
||||
nextId));
|
||||
newPreference.setTitle(getString(R.string.connection_profile_new_server));
|
||||
newPreference.setSummary(getString(R.string.connection_profile_not_saved));
|
||||
preferenceScreen.addPreference(newPreference);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
preferenceScreen.addPreference(configPref);
|
||||
List<HostConfig> hostConfigs = getHostConfigs();
|
||||
if (!hostConfigs.isEmpty()) {
|
||||
for (final HostConfig config : getHostConfigs()) {
|
||||
preferenceScreen.addPreference(
|
||||
simpleClickablePreferenceFromHostConfig(config));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void constructServerView(int hostId) {
|
||||
HostConfig hostConfig = hostConfigFromPreferencesForHostId(
|
||||
hostId,
|
||||
getHostConfigMap(
|
||||
getPreferenceManager()
|
||||
.getSharedPreferences()
|
||||
.getAll()
|
||||
)
|
||||
);
|
||||
addPreferenceCategory(preferenceScreen, hostConfig);
|
||||
}
|
||||
|
||||
private Preference simpleClickablePreferenceFromHostConfig(final HostConfig config) {
|
||||
final Preference serverConfig = new Preference(getActivity());
|
||||
serverConfig.setTitle(config.title.getSummary());
|
||||
|
||||
Boolean useSsl = getPreferenceManager()
|
||||
.getSharedPreferences()
|
||||
.getBoolean(config.useSsl.getKey(), false);
|
||||
|
||||
serverConfig.setSummary(String.format(
|
||||
"%s:%s %s",
|
||||
config.hostAddress.getText(),
|
||||
config.hostPort.getText(),
|
||||
useSsl ? "(SSL)" : "")
|
||||
);
|
||||
serverConfig.setOnPreferenceClickListener(
|
||||
new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
Intent serverConfigIntent = new Intent(
|
||||
getActivity(),
|
||||
ConnectionActivity.class
|
||||
);
|
||||
serverConfigIntent.putExtra(KEY_PREFERENCE_DISPLAY,
|
||||
PREFERENCE_DISPLAY_SERVER);
|
||||
serverConfigIntent.putExtra(KEY_SERVER_ID, config.id);
|
||||
startActivity(serverConfigIntent);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return serverConfig;
|
||||
}
|
||||
|
||||
private List<HostConfig> getHostConfigs() {
|
||||
return hostConfigsFromPreferences(
|
||||
getHostConfigMap(
|
||||
getPreferenceManager()
|
||||
.getSharedPreferences()
|
||||
.getAll()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private Map<String, ?> getHostConfigMap(Map<String, ?> preferences) {
|
||||
Map<String, Object> configMap = new TreeMap<String, Object>();
|
||||
|
||||
List<String> sortedKeys = new ArrayList<String>(preferences.keySet());
|
||||
Collections.sort(sortedKeys);
|
||||
for (String key : sortedKeys) {
|
||||
if (key.startsWith(HostConfig.KEY_PREFIX)) {
|
||||
configMap.put(key, preferences.get(key));
|
||||
}
|
||||
}
|
||||
return configMap;
|
||||
}
|
||||
|
||||
private List<HostConfig> hostConfigsFromPreferences(Map<String, ?> preferences) {
|
||||
List<Integer> hostIds = getHostIds(preferences);
|
||||
List<HostConfig> hostConfigs = new ArrayList<HostConfig>();
|
||||
for (Integer id : hostIds) {
|
||||
hostConfigs.add(hostConfigFromPreferencesForHostId(id, preferences));
|
||||
}
|
||||
return hostConfigs;
|
||||
}
|
||||
|
||||
private HostConfig hostConfigFromPreferencesForHostId(int hostId, Map<String, ?> preferences) {
|
||||
Object titleValue = preferences.get(getHostConfigTitleKey(hostId));
|
||||
String hostTitle = titleValue == null ? getString(R.string.connection_profile_server) : titleValue.toString();
|
||||
HostConfig hostConfig = new HostConfig(
|
||||
hostTitle, hostId
|
||||
);
|
||||
Object hostValueObject = preferences.get(hostConfig.hostAddress.getKey());
|
||||
String hostValue = hostValueObject == null
|
||||
? getString(R.string.hostDefaultValue) : hostValueObject.toString();
|
||||
hostConfig.hostAddress.setText(hostValue);
|
||||
hostConfig.hostAddress.setSummary(hostValue);
|
||||
|
||||
Object portValueObject = preferences.get(hostConfig.hostPort.getKey());
|
||||
String portValue = portValueObject == null
|
||||
? getString(R.string.portDefaultValue) : portValueObject.toString();
|
||||
hostConfig.hostPort.setText(portValue);
|
||||
hostConfig.hostPort.setSummary(portValue);
|
||||
|
||||
Object useridValueObject = preferences.get(hostConfig.userid.getKey());
|
||||
String useridValue = useridValueObject == null
|
||||
? getString(R.string.useridDefaultValue) : useridValueObject.toString();
|
||||
hostConfig.userid.setText(useridValue);
|
||||
hostConfig.userid.setSummary(useridValue);
|
||||
|
||||
Object passwordValueObject = preferences.get(hostConfig.password.getKey());
|
||||
String passwordValue = passwordValueObject == null
|
||||
? getString(R.string.passwordDefaultValue) : passwordValueObject.toString();
|
||||
hostConfig.password.setText(passwordValue);
|
||||
hostConfig.password.setSummary(passwordValue);
|
||||
return hostConfig;
|
||||
}
|
||||
|
||||
private int getNextPrefId(Map<String, ?> preferences) {
|
||||
int max = 0;
|
||||
for (String key : preferences.keySet()) {
|
||||
int prefValue = Integer.valueOf(key.split("\\.")[2]);
|
||||
max = prefValue > max ? prefValue : max;
|
||||
}
|
||||
return max + 1;
|
||||
}
|
||||
|
||||
private List<Integer> getHostIds(Map<String, ?> preferences) {
|
||||
Set<Integer> hashSet = new HashSet<Integer>();
|
||||
for (String key : preferences.keySet()) {
|
||||
hashSet.add(Integer.valueOf(key.split("\\.")[2]));
|
||||
}
|
||||
List<Integer> hostIds = new ArrayList<Integer>(hashSet);
|
||||
Collections.sort(hostIds);
|
||||
Log.i(LOG_TAG, "Got HostIds: " + hostIds);
|
||||
return hostIds;
|
||||
}
|
||||
|
||||
private boolean addPreferenceCategory(PreferenceScreen preferenceScreen, HostConfig hostConfig) {
|
||||
PreferenceCategory preferenceCategory = new PreferenceCategory(getActivity());
|
||||
preferenceCategory.setTitle(hostConfig.title.getSummary());
|
||||
preferenceCategory.setKey("key.preference.category");
|
||||
preferenceScreen.addPreference(preferenceCategory);
|
||||
preferenceCategory.addPreference(hostConfig.title);
|
||||
preferenceCategory.addPreference(hostConfig.hostAddress);
|
||||
preferenceCategory.addPreference(hostConfig.hostPort);
|
||||
preferenceCategory.addPreference(hostConfig.useSsl);
|
||||
preferenceCategory.addPreference(hostConfig.userid);
|
||||
preferenceCategory.addPreference(hostConfig.password);
|
||||
preferenceCategory.addPreference(hostConfig.remove);
|
||||
preferenceCategory.addPreference(hostConfig.activate);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (resume) {
|
||||
Log.i(LOG_TAG, "Resuming...");
|
||||
} else {
|
||||
constructOverviewScreen();
|
||||
Log.i(LOG_TAG, "Not resuming...");
|
||||
}
|
||||
}
|
||||
|
||||
private class HostConfig {
|
||||
static final String KEY_PREFIX = "host.config.";
|
||||
final int id;
|
||||
final EditTextPreference title;
|
||||
final EditTextPreference hostAddress;
|
||||
final EditTextPreference hostPort;
|
||||
final CheckBoxPreference useSsl;
|
||||
final EditTextPreference userid;
|
||||
final EditTextPreference password;
|
||||
final Preference remove;
|
||||
final Preference activate;
|
||||
Preference.OnPreferenceChangeListener onPreferenceChangeListener =
|
||||
new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object o) {
|
||||
preference.setSummary("" + o);
|
||||
if (preference.getKey().endsWith(".title")) {
|
||||
preferenceScreen
|
||||
.findPreference("key.preference.category")
|
||||
.setTitle("" + o);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
HostConfig(String sTitle, int id) {
|
||||
this.id = id;
|
||||
title = new EditTextPreference(getActivity());
|
||||
title.setSummary(getString(R.string.url));
|
||||
title.getEditText().setHint(getString(R.string.url));
|
||||
title.setTitle(getString(R.string.connection_profile_title));
|
||||
title.setKey(KEY_PREFIX + id + ".title");
|
||||
title.setDefaultValue(getString(R.string.url));
|
||||
title.setSummary(sTitle);
|
||||
title.setDialogTitle(getString(R.string.connection_profile_title));
|
||||
title.setOnPreferenceChangeListener(onPreferenceChangeListener);
|
||||
|
||||
hostAddress = new EditTextPreference(getActivity());
|
||||
hostAddress.setTitle(getString(R.string.urlHint));
|
||||
hostAddress.setKey(KEY_PREFIX + id + ".address");
|
||||
hostAddress.getEditText().setHint(R.string.urlHint);
|
||||
hostAddress.setSummary(getString(R.string.urlHint));
|
||||
hostAddress.setDialogTitle(getString(R.string.urlHint));
|
||||
hostAddress.getEditText().setInputType(InputType.TYPE_TEXT_VARIATION_URI);
|
||||
hostAddress.setOnPreferenceChangeListener(onPreferenceChangeListener);
|
||||
|
||||
hostPort = new EditTextPreference(getActivity());
|
||||
hostPort.setTitle(getString(R.string.port));
|
||||
hostPort.setKey(KEY_PREFIX + id + ".port");
|
||||
hostPort.setSummary(getString(R.string.port));
|
||||
hostPort.setDialogTitle(getString(R.string.port));
|
||||
hostPort.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||
hostPort.setDefaultValue(getString(R.string.portDefaultValue));
|
||||
hostPort.setOnPreferenceChangeListener(onPreferenceChangeListener);
|
||||
|
||||
useSsl = new CheckBoxPreference(getActivity());
|
||||
useSsl.setTitle(getString(R.string.connection_profile_ssl_use));
|
||||
useSsl.setSummary(getString(R.string.connection_profile_ssl_summary));
|
||||
useSsl.setKey(KEY_PREFIX + id + ".usessl");
|
||||
|
||||
userid = new EditTextPreference(getActivity());
|
||||
userid.setSummary(getString(R.string.connection_userid));
|
||||
userid.getEditText().setHint(getString(R.string.connection_userid));
|
||||
userid.setTitle(getString(R.string.connection_userid));
|
||||
userid.setKey(KEY_PREFIX + id + ".userid");
|
||||
userid.setDefaultValue(getString(R.string.useridDefaultValue));
|
||||
userid.setSummary(getString(R.string.useridDefaultValue));
|
||||
userid.setDialogTitle(getString(R.string.connection_userid));
|
||||
userid.setOnPreferenceChangeListener(onPreferenceChangeListener);
|
||||
|
||||
password = new EditTextPreference(getActivity());
|
||||
password.setSummary(getString(R.string.connection_password));
|
||||
password.getEditText().setHint(getString(R.string.connection_password));
|
||||
password.setTitle(getString(R.string.connection_password));
|
||||
password.setKey(KEY_PREFIX + id + ".password");
|
||||
password.setDefaultValue(getString(R.string.passwordDefaultValue));
|
||||
password.setSummary(getString(R.string.passwordDefaultValue));
|
||||
password.setDialogTitle(getString(R.string.connection_password));
|
||||
password.setOnPreferenceChangeListener(onPreferenceChangeListener);
|
||||
|
||||
remove = new Preference(getActivity());
|
||||
remove.setTitle(getString(R.string.connection_profile_remove));
|
||||
remove.setSummary(getString(R.string.connection_profile_remove_summary));
|
||||
remove.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
|
||||
SharedPreferences.Editor editor = prefs.edit();
|
||||
editor.remove(hostAddress.getKey());
|
||||
editor.remove(hostPort.getKey());
|
||||
editor.remove(title.getKey());
|
||||
editor.remove(useSsl.getKey());
|
||||
editor.remove(userid.getKey());
|
||||
editor.remove(password.getKey());
|
||||
editor.commit();
|
||||
getActivity().onBackPressed();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
activate = new Preference(getActivity());
|
||||
activate.setTitle(getString(R.string.connection_profile_activate));
|
||||
activate.setSummary(getString(R.string.connection_profile_summary_activate));
|
||||
activate.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||
@Override
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
SharedPreferences preferences = getPreferenceManager().getSharedPreferences();
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
String host = preferences.getString(hostAddress.getKey(),
|
||||
getString(R.string.hostDefaultValue));
|
||||
editor.putString(getString(R.string.keyHost), host);
|
||||
String port = preferences.getString(hostPort.getKey(),
|
||||
getString(R.string.portDefaultValue));
|
||||
editor.putString(getString(R.string.keyPort), port);
|
||||
Boolean bUseSsl = preferences.getBoolean(useSsl.getKey(), false);
|
||||
editor.putBoolean(getString(R.string.key_ssl_use), bUseSsl);
|
||||
String suserid = preferences.getString(userid.getKey(), getString(R.string.useridDefaultValue));
|
||||
editor.putString(getString(R.string.key_userid), suserid);
|
||||
String spassword = preferences.getString(password.getKey(),
|
||||
getString(R.string.passwordDefaultValue));
|
||||
editor.putString(getString(R.string.key_password), spassword);
|
||||
|
||||
editor.putString(
|
||||
getString(R.string.key_profile_selected_title),
|
||||
preferences.getString(
|
||||
title.getKey(),
|
||||
getString(R.string.url)));
|
||||
|
||||
editor.commit();
|
||||
Toast.makeText(getActivity(),
|
||||
String.format(
|
||||
"%s: %s\n[%s:%s] %s",
|
||||
getString(R.string.connection_profile_active_toast),
|
||||
HostConfig.this.title.getText(),
|
||||
host,
|
||||
port,
|
||||
useSsl.isChecked() ? "(SSL)" : ""
|
||||
),
|
||||
Toast.LENGTH_LONG).show();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HostConfig{" +
|
||||
"id=" + id +
|
||||
", title='" + title + '\'' +
|
||||
", hostAddress=" + hostAddress.getKey() +
|
||||
", hostPort=" + hostPort.getKey() +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,51 @@
|
||||
/******************************************************************************
|
||||
* OpenLP - Open Source Lyrics Projection *
|
||||
* --------------------------------------------------------------------------- *
|
||||
* Copyright (c) 2011-2014 Raoul Snyman *
|
||||
* Portions copyright (c) 2011-2014 Tim Bentley, Johan Mynhardt *
|
||||
* *
|
||||
* --------------------------------------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the Free *
|
||||
* Software Foundation; version 2 of the License. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT *
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *
|
||||
* more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., 59 *
|
||||
* Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
||||
*******************************************************************************/
|
||||
package org.openlp.android2.activities;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceFragment;
|
||||
import org.openlp.android2.R;
|
||||
|
||||
|
||||
public class SettingsActivity extends PreferenceActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
getFragmentManager().beginTransaction()
|
||||
.replace(android.R.id.content, new SettingsFragment())
|
||||
.commit();
|
||||
|
||||
}
|
||||
|
||||
public static class SettingsFragment extends PreferenceFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Load the preferences from an XML resource
|
||||
addPreferencesFromResource(R.xml.pref_general);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
package org.openlp.android2.fragments;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.TextView;
|
||||
import org.openlp.android2.R;
|
||||
|
||||
import org.openlp.android2.fragments.dummy.DummyContent;
|
||||
|
||||
/**
|
||||
* A fragment representing a list of Items.
|
||||
* <p />
|
||||
* Large screen devices (such as tablets) are supported by replacing the ListView
|
||||
* with a GridView.
|
||||
* <p />
|
||||
* Activities containing this fragment MUST implement the {@link Callbacks}
|
||||
* interface.
|
||||
*/
|
||||
public class LiveListFragment extends Fragment implements AbsListView.OnItemClickListener {
|
||||
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
private static final String ARG_PARAM2 = "param2";
|
||||
|
||||
// TODO: Rename and change types of parameters
|
||||
private String mParam1;
|
||||
private String mParam2;
|
||||
|
||||
private OnFragmentInteractionListener mListener;
|
||||
|
||||
/**
|
||||
* The fragment's ListView/GridView.
|
||||
*/
|
||||
private AbsListView mListView;
|
||||
|
||||
/**
|
||||
* The Adapter which will be used to populate the ListView/GridView with
|
||||
* Views.
|
||||
*/
|
||||
private ListAdapter mAdapter;
|
||||
|
||||
// TODO: Rename and change types of parameters
|
||||
public static LiveListFragment newInstance() {
|
||||
LiveListFragment fragment = new LiveListFragment();
|
||||
Bundle args = new Bundle();
|
||||
//args.putString(ARG_PARAM1, param1);
|
||||
//args.putString(ARG_PARAM2, param2);
|
||||
//fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mandatory empty constructor for the fragment manager to instantiate the
|
||||
* fragment (e.g. upon screen orientation changes).
|
||||
*/
|
||||
public LiveListFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (getArguments() != null) {
|
||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||
}
|
||||
|
||||
// TODO: Change Adapter to display your content
|
||||
mAdapter = new ArrayAdapter<DummyContent.DummyItem>(getActivity(),
|
||||
android.R.layout.simple_list_item_1, android.R.id.text1, DummyContent.ITEMS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_livelist, container, false);
|
||||
|
||||
// Set the adapter
|
||||
mListView = (AbsListView) view.findViewById(android.R.id.list);
|
||||
((AdapterView<ListAdapter>) mListView).setAdapter(mAdapter);
|
||||
|
||||
// Set OnItemClickListener so we can be notified on item clicks
|
||||
mListView.setOnItemClickListener(this);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
//try {
|
||||
// mListener = (OnFragmentInteractionListener) activity;
|
||||
//} catch (ClassCastException e) {
|
||||
// throw new ClassCastException(activity.toString()
|
||||
// + " must implement OnFragmentInteractionListener");
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
mListener = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
if (null != mListener) {
|
||||
// Notify the active callbacks interface (the activity, if the
|
||||
// fragment is attached to one) that an item has been selected.
|
||||
mListener.onFragmentInteraction(DummyContent.ITEMS.get(position).id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The default content for this Fragment has a TextView that is shown when
|
||||
* the list is empty. If you would like to change the text, call this method
|
||||
* to supply the text it should use.
|
||||
*/
|
||||
public void setEmptyText(CharSequence emptyText) {
|
||||
View emptyView = mListView.getEmptyView();
|
||||
|
||||
if (emptyText instanceof TextView) {
|
||||
((TextView) emptyView).setText(emptyText);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This interface must be implemented by activities that contain this
|
||||
* fragment to allow an interaction in this fragment to be communicated
|
||||
* to the activity and potentially other fragments contained in that
|
||||
* activity.
|
||||
* <p>
|
||||
* See the Android Training lesson <a href=
|
||||
* "http://developer.android.com/training/basics/fragments/communicating.html"
|
||||
* >Communicating with Other Fragments</a> for more information.
|
||||
*/
|
||||
public interface OnFragmentInteractionListener {
|
||||
// TODO: Update argument type and name
|
||||
public void onFragmentInteraction(String id);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,284 @@
|
||||
package org.openlp.android2.fragments;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActionBar;
|
||||
import android.app.Fragment;
|
||||
import android.support.v4.app.ActionBarDrawerToggle;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
import org.openlp.android2.R;
|
||||
|
||||
/**
|
||||
* Fragment used for managing interactions for and presentation of a navigation drawer.
|
||||
* See the <a href="https://developer.android.com/design/patterns/navigation-drawer.html#Interaction">
|
||||
* design guidelines</a> for a complete explanation of the behaviors implemented here.
|
||||
*/
|
||||
public class NavigationDrawerFragment extends Fragment {
|
||||
|
||||
/**
|
||||
* Remember the position of the selected item.
|
||||
*/
|
||||
private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position";
|
||||
|
||||
/**
|
||||
* Per the design guidelines, you should show the drawer on launch until the user manually
|
||||
* expands it. This shared preference tracks this.
|
||||
*/
|
||||
private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned";
|
||||
|
||||
/**
|
||||
* A pointer to the current callbacks instance (the Activity).
|
||||
*/
|
||||
private NavigationDrawerCallbacks mCallbacks;
|
||||
|
||||
/**
|
||||
* Helper component that ties the action bar to the navigation drawer.
|
||||
*/
|
||||
private ActionBarDrawerToggle mDrawerToggle;
|
||||
|
||||
private DrawerLayout mDrawerLayout;
|
||||
private ListView mDrawerListView;
|
||||
private View mFragmentContainerView;
|
||||
|
||||
private int mCurrentSelectedPosition = 0;
|
||||
private boolean mFromSavedInstanceState;
|
||||
private boolean mUserLearnedDrawer;
|
||||
|
||||
public NavigationDrawerFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Read in the flag indicating whether or not the user has demonstrated awareness of the
|
||||
// drawer. See PREF_USER_LEARNED_DRAWER for details.
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);
|
||||
|
||||
if (savedInstanceState != null) {
|
||||
mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
|
||||
mFromSavedInstanceState = true;
|
||||
}
|
||||
|
||||
// Select either the default item (0) or the last selected item.
|
||||
selectItem(mCurrentSelectedPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated (Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
// Indicate that this fragment would like to influence the set of actions in the action bar.
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
mDrawerListView = (ListView) inflater.inflate(
|
||||
R.layout.fragment_navigation_drawer, container, false);
|
||||
mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
selectItem(position);
|
||||
}
|
||||
});
|
||||
mDrawerListView.setAdapter(new ArrayAdapter<String>(
|
||||
getActionBar().getThemedContext(),
|
||||
android.R.layout.simple_list_item_activated_1,
|
||||
android.R.id.text1,
|
||||
new String[]{
|
||||
getString(R.string.service_list),
|
||||
getString(R.string.live_list),
|
||||
getString(R.string.stage_view),
|
||||
getString(R.string.live_view),
|
||||
}));
|
||||
mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
|
||||
return mDrawerListView;
|
||||
}
|
||||
|
||||
public boolean isDrawerOpen() {
|
||||
return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView);
|
||||
}
|
||||
|
||||
/**
|
||||
* Users of this fragment must call this method to set up the navigation drawer interactions.
|
||||
*
|
||||
* @param fragmentId The android:id of this fragment in its activity's layout.
|
||||
* @param drawerLayout The DrawerLayout containing this fragment's UI.
|
||||
*/
|
||||
public void setUp(int fragmentId, DrawerLayout drawerLayout) {
|
||||
mFragmentContainerView = getActivity().findViewById(fragmentId);
|
||||
mDrawerLayout = drawerLayout;
|
||||
|
||||
// set a custom shadow that overlays the main content when the drawer opens
|
||||
mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
|
||||
// set up the drawer's list view with items and click listener
|
||||
|
||||
ActionBar actionBar = getActionBar();
|
||||
actionBar.setDisplayHomeAsUpEnabled(true);
|
||||
actionBar.setHomeButtonEnabled(true);
|
||||
|
||||
// ActionBarDrawerToggle ties together the the proper interactions
|
||||
// between the navigation drawer and the action bar app icon.
|
||||
mDrawerToggle = new ActionBarDrawerToggle(
|
||||
getActivity(), /* host Activity */
|
||||
mDrawerLayout, /* DrawerLayout object */
|
||||
R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
|
||||
R.string.navigation_drawer_open, /* "open drawer" description for accessibility */
|
||||
R.string.navigation_drawer_close /* "close drawer" description for accessibility */
|
||||
) {
|
||||
@Override
|
||||
public void onDrawerClosed(View drawerView) {
|
||||
super.onDrawerClosed(drawerView);
|
||||
if (!isAdded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
getActivity().invalidateOptionsMenu(); // calls onPrepareOptionsMenu()
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDrawerOpened(View drawerView) {
|
||||
super.onDrawerOpened(drawerView);
|
||||
if (!isAdded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mUserLearnedDrawer) {
|
||||
// The user manually opened the drawer; store this flag to prevent auto-showing
|
||||
// the navigation drawer automatically in the future.
|
||||
mUserLearnedDrawer = true;
|
||||
SharedPreferences sp = PreferenceManager
|
||||
.getDefaultSharedPreferences(getActivity());
|
||||
sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).apply();
|
||||
}
|
||||
|
||||
getActivity().invalidateOptionsMenu(); // calls onPrepareOptionsMenu()
|
||||
}
|
||||
};
|
||||
|
||||
// If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer,
|
||||
// per the navigation drawer design guidelines.
|
||||
if (!mUserLearnedDrawer && !mFromSavedInstanceState) {
|
||||
mDrawerLayout.openDrawer(mFragmentContainerView);
|
||||
}
|
||||
|
||||
// Defer code dependent on restoration of previous instance state.
|
||||
mDrawerLayout.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mDrawerToggle.syncState();
|
||||
}
|
||||
});
|
||||
|
||||
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
||||
}
|
||||
|
||||
private void selectItem(int position) {
|
||||
mCurrentSelectedPosition = position;
|
||||
if (mDrawerListView != null) {
|
||||
mDrawerListView.setItemChecked(position, true);
|
||||
}
|
||||
if (mDrawerLayout != null) {
|
||||
mDrawerLayout.closeDrawer(mFragmentContainerView);
|
||||
}
|
||||
if (mCallbacks != null) {
|
||||
mCallbacks.onNavigationDrawerItemSelected(position);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
try {
|
||||
mCallbacks = (NavigationDrawerCallbacks) activity;
|
||||
} catch (ClassCastException e) {
|
||||
throw new ClassCastException("Activity must implement NavigationDrawerCallbacks.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
mCallbacks = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
// Forward the new configuration the drawer toggle component.
|
||||
mDrawerToggle.onConfigurationChanged(newConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
// If the drawer is open, show the global app actions in the action bar. See also
|
||||
// showGlobalContextActionBar, which controls the top-left area of the action bar.
|
||||
if (mDrawerLayout != null && isDrawerOpen()) {
|
||||
inflater.inflate(R.menu.global, menu);
|
||||
showGlobalContextActionBar();
|
||||
}
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (mDrawerToggle.onOptionsItemSelected(item)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (item.getItemId() == R.id.action_alert) {
|
||||
Toast.makeText(getActivity(), "Example action.", Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Per the navigation drawer design guidelines, updates the action bar to show the global app
|
||||
* 'context', rather than just what's in the current screen.
|
||||
*/
|
||||
private void showGlobalContextActionBar() {
|
||||
ActionBar actionBar = getActionBar();
|
||||
actionBar.setDisplayShowTitleEnabled(true);
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
actionBar.setTitle(R.string.app_name);
|
||||
}
|
||||
|
||||
private ActionBar getActionBar() {
|
||||
return getActivity().getActionBar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Callbacks interface that all activities using this fragment must implement.
|
||||
*/
|
||||
public static interface NavigationDrawerCallbacks {
|
||||
/**
|
||||
* Called when an item in the navigation drawer is selected.
|
||||
*/
|
||||
void onNavigationDrawerItemSelected(int position);
|
||||
}
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
package org.openlp.android2.fragments;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListAdapter;
|
||||
import android.widget.TextView;
|
||||
import org.openlp.android2.R;
|
||||
|
||||
import org.openlp.android2.fragments.dummy.DummyContent;
|
||||
|
||||
/**
|
||||
* A fragment representing a list of Items.
|
||||
* <p />
|
||||
* Large screen devices (such as tablets) are supported by replacing the ListView
|
||||
* with a GridView.
|
||||
* <p />
|
||||
* Activities containing this fragment MUST implement the {@link Callbacks}
|
||||
* interface.
|
||||
*/
|
||||
public class ServicelistFragment extends Fragment implements AbsListView.OnItemClickListener {
|
||||
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
private static final String ARG_PARAM2 = "param2";
|
||||
|
||||
// TODO: Rename and change types of parameters
|
||||
private String mParam1;
|
||||
private String mParam2;
|
||||
|
||||
private OnFragmentInteractionListener mListener;
|
||||
|
||||
/**
|
||||
* The fragment's ListView/GridView.
|
||||
*/
|
||||
private AbsListView mListView;
|
||||
|
||||
/**
|
||||
* The Adapter which will be used to populate the ListView/GridView with
|
||||
* Views.
|
||||
*/
|
||||
private ListAdapter mAdapter;
|
||||
|
||||
// TODO: Rename and change types of parameters
|
||||
public static ServicelistFragment newInstance() {
|
||||
ServicelistFragment fragment = new ServicelistFragment();
|
||||
Bundle args = new Bundle();
|
||||
//args.putString(ARG_PARAM1, param1);
|
||||
//args.putString(ARG_PARAM2, param2);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mandatory empty constructor for the fragment manager to instantiate the
|
||||
* fragment (e.g. upon screen orientation changes).
|
||||
*/
|
||||
public ServicelistFragment() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (getArguments() != null) {
|
||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||
}
|
||||
|
||||
// TODO: Change Adapter to display your content
|
||||
mAdapter = new ArrayAdapter<DummyContent.DummyItem>(getActivity(),
|
||||
android.R.layout.simple_list_item_1, android.R.id.text1, DummyContent.ITEMS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_servicelist, container, false);
|
||||
|
||||
// Set the adapter
|
||||
mListView = (AbsListView) view.findViewById(android.R.id.list);
|
||||
((AdapterView<ListAdapter>) mListView).setAdapter(mAdapter);
|
||||
|
||||
// Set OnItemClickListener so we can be notified on item clicks
|
||||
mListView.setOnItemClickListener(this);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
//try {
|
||||
// mListener = (OnFragmentInteractionListener) activity;
|
||||
//} catch (ClassCastException e) {
|
||||
// throw new ClassCastException(activity.toString()
|
||||
// + " must implement OnFragmentInteractionListener");
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
super.onDetach();
|
||||
mListener = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
if (null != mListener) {
|
||||
// Notify the active callbacks interface (the activity, if the
|
||||
// fragment is attached to one) that an item has been selected.
|
||||
mListener.onFragmentInteraction(DummyContent.ITEMS.get(position).id);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The default content for this Fragment has a TextView that is shown when
|
||||
* the list is empty. If you would like to change the text, call this method
|
||||
* to supply the text it should use.
|
||||
*/
|
||||
public void setEmptyText(CharSequence emptyText) {
|
||||
View emptyView = mListView.getEmptyView();
|
||||
|
||||
if (emptyText instanceof TextView) {
|
||||
((TextView) emptyView).setText(emptyText);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This interface must be implemented by activities that contain this
|
||||
* fragment to allow an interaction in this fragment to be communicated
|
||||
* to the activity and potentially other fragments contained in that
|
||||
* activity.
|
||||
* <p>
|
||||
* See the Android Training lesson <a href=
|
||||
* "http://developer.android.com/training/basics/fragments/communicating.html"
|
||||
* >Communicating with Other Fragments</a> for more information.
|
||||
*/
|
||||
public interface OnFragmentInteractionListener {
|
||||
// TODO: Update argument type and name
|
||||
public void onFragmentInteraction(String id);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package org.openlp.android2.fragments.dummy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Helper class for providing sample content for user interfaces created by
|
||||
* Android template wizards.
|
||||
* <p>
|
||||
* TODO: Replace all uses of this class before publishing your app.
|
||||
*/
|
||||
public class DummyContent {
|
||||
|
||||
/**
|
||||
* An array of sample (dummy) items.
|
||||
*/
|
||||
public static List<DummyItem> ITEMS = new ArrayList<DummyItem>();
|
||||
|
||||
/**
|
||||
* A map of sample (dummy) items, by ID.
|
||||
*/
|
||||
public static Map<String, DummyItem> ITEM_MAP = new HashMap<String, DummyItem>();
|
||||
|
||||
static {
|
||||
// Add 3 sample items.
|
||||
addItem(new DummyItem("1", "Item 1"));
|
||||
addItem(new DummyItem("2", "Item 2"));
|
||||
addItem(new DummyItem("3", "Item 3"));
|
||||
}
|
||||
|
||||
private static void addItem(DummyItem item) {
|
||||
ITEMS.add(item);
|
||||
ITEM_MAP.put(item.id, item);
|
||||
}
|
||||
|
||||
/**
|
||||
* A dummy item representing a piece of content.
|
||||
*/
|
||||
public static class DummyItem {
|
||||
public String id;
|
||||
public String content;
|
||||
|
||||
public DummyItem(String id, String content) {
|
||||
this.id = id;
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return content;
|
||||
}
|
||||
}
|
||||
}
|
BIN
app/src/main/res/drawable-hdpi/drawer_shadow.9.png
Normal file
After Width: | Height: | Size: 161 B |
BIN
app/src/main/res/drawable-hdpi/ic_alarm_off.png
Normal file
After Width: | Height: | Size: 704 B |
BIN
app/src/main/res/drawable-hdpi/ic_arrow_back.png
Normal file
After Width: | Height: | Size: 287 B |
BIN
app/src/main/res/drawable-hdpi/ic_drawer.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-hdpi/ic_edit.png
Normal file
After Width: | Height: | Size: 339 B |
BIN
app/src/main/res/drawable-hdpi/ic_image.png
Normal file
After Width: | Height: | Size: 351 B |
BIN
app/src/main/res/drawable-hdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 9.2 KiB |
BIN
app/src/main/res/drawable-hdpi/ic_local_movies.png
Normal file
After Width: | Height: | Size: 215 B |
BIN
app/src/main/res/drawable-hdpi/ic_my_library_add.png
Normal file
After Width: | Height: | Size: 287 B |
BIN
app/src/main/res/drawable-hdpi/ic_my_library_music.png
Normal file
After Width: | Height: | Size: 330 B |
BIN
app/src/main/res/drawable-hdpi/ic_refresh.png
Normal file
After Width: | Height: | Size: 531 B |
BIN
app/src/main/res/drawable-hdpi/ic_search.png
Normal file
After Width: | Height: | Size: 504 B |
BIN
app/src/main/res/drawable-hdpi/ic_settings_display.png
Normal file
After Width: | Height: | Size: 355 B |
BIN
app/src/main/res/drawable-mdpi/drawer_shadow.9.png
Normal file
After Width: | Height: | Size: 142 B |
BIN
app/src/main/res/drawable-mdpi/ic_alarm_off.png
Normal file
After Width: | Height: | Size: 561 B |
BIN
app/src/main/res/drawable-mdpi/ic_arrow_back.png
Normal file
After Width: | Height: | Size: 247 B |
BIN
app/src/main/res/drawable-mdpi/ic_drawer.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-mdpi/ic_edit.png
Normal file
After Width: | Height: | Size: 299 B |
BIN
app/src/main/res/drawable-mdpi/ic_image.png
Normal file
After Width: | Height: | Size: 298 B |
BIN
app/src/main/res/drawable-mdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
app/src/main/res/drawable-mdpi/ic_local_movies.png
Normal file
After Width: | Height: | Size: 241 B |
BIN
app/src/main/res/drawable-mdpi/ic_my_library_add.png
Normal file
After Width: | Height: | Size: 329 B |
BIN
app/src/main/res/drawable-mdpi/ic_my_library_music.png
Normal file
After Width: | Height: | Size: 344 B |
BIN
app/src/main/res/drawable-mdpi/ic_refresh.png
Normal file
After Width: | Height: | Size: 422 B |
BIN
app/src/main/res/drawable-mdpi/ic_search.png
Normal file
After Width: | Height: | Size: 403 B |
BIN
app/src/main/res/drawable-mdpi/ic_settings_display.png
Normal file
After Width: | Height: | Size: 328 B |
BIN
app/src/main/res/drawable-xhdpi/drawer_shadow.9.png
Normal file
After Width: | Height: | Size: 174 B |
BIN
app/src/main/res/drawable-xhdpi/ic_alarm_off.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_arrow_back.png
Normal file
After Width: | Height: | Size: 367 B |
BIN
app/src/main/res/drawable-xhdpi/ic_drawer.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_edit.png
Normal file
After Width: | Height: | Size: 415 B |
BIN
app/src/main/res/drawable-xhdpi/ic_image.png
Normal file
After Width: | Height: | Size: 474 B |
BIN
app/src/main/res/drawable-xhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_local_movies.png
Normal file
After Width: | Height: | Size: 259 B |
BIN
app/src/main/res/drawable-xhdpi/ic_my_library_add.png
Normal file
After Width: | Height: | Size: 351 B |
BIN
app/src/main/res/drawable-xhdpi/ic_my_library_music.png
Normal file
After Width: | Height: | Size: 434 B |
BIN
app/src/main/res/drawable-xhdpi/ic_refresh.png
Normal file
After Width: | Height: | Size: 693 B |
BIN
app/src/main/res/drawable-xhdpi/ic_search.png
Normal file
After Width: | Height: | Size: 731 B |
BIN
app/src/main/res/drawable-xhdpi/ic_settings_display.png
Normal file
After Width: | Height: | Size: 479 B |
BIN
app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png
Normal file
After Width: | Height: | Size: 208 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_alarm_off.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_arrow_back.png
Normal file
After Width: | Height: | Size: 410 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_drawer.png
Normal file
After Width: | Height: | Size: 202 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_edit.png
Normal file
After Width: | Height: | Size: 490 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_image.png
Normal file
After Width: | Height: | Size: 614 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_launcher.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_local_movies.png
Normal file
After Width: | Height: | Size: 231 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_my_library_add.png
Normal file
After Width: | Height: | Size: 432 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_my_library_music.png
Normal file
After Width: | Height: | Size: 577 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_refresh.png
Normal file
After Width: | Height: | Size: 875 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_search.png
Normal file
After Width: | Height: | Size: 871 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_settings_display.png
Normal file
After Width: | Height: | Size: 512 B |
31
app/src/main/res/layout/activity_open_lp.xml
Normal file
@ -0,0 +1,31 @@
|
||||
<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
|
||||
<android.support.v4.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".OpenLP">
|
||||
|
||||
<!-- As the main content view, the view below consumes the entire
|
||||
space available using match_parent in both dimensions. -->
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<!-- android:layout_gravity="start" tells DrawerLayout to treat
|
||||
this as a sliding drawer on the left side for left-to-right
|
||||
languages and on the right side for right-to-left languages.
|
||||
If you're not building against API 17 or higher, use
|
||||
android:layout_gravity="left" instead. -->
|
||||
<!-- The drawer is given a fixed width in dp and extends the full height of
|
||||
the container. -->
|
||||
<fragment android:id="@+id/navigation_drawer"
|
||||
android:layout_width="@dimen/navigation_drawer_width"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:name="org.openlp.android2.fragments.NavigationDrawerFragment"
|
||||
tools:layout="@layout/fragment_navigation_drawer" />
|
||||
|
||||
</android.support.v4.widget.DrawerLayout>
|
20
app/src/main/res/layout/fragment_livelist_grid.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="org.openlp.android2.fragments.LiveListFragment">
|
||||
|
||||
<GridView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:numColumns="2" />
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center" />
|
||||
|
||||
</FrameLayout>
|
19
app/src/main/res/layout/fragment_livelist_list.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="org.openlp.android2.fragments.LiveListFragment">
|
||||
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center" />
|
||||
|
||||
</FrameLayout>
|
9
app/src/main/res/layout/fragment_navigation_drawer.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:choiceMode="singleChoice"
|
||||
android:divider="@android:color/transparent"
|
||||
android:dividerHeight="0dp"
|
||||
android:background="#cccc"
|
||||
tools:context=".NavigationDrawerFragment" />
|
16
app/src/main/res/layout/fragment_service_list.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
tools:context=".OpenLP$PlaceholderFragment">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/section_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</RelativeLayout>
|
20
app/src/main/res/layout/fragment_servicelist_grid.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="org.openlp.android2.fragments.ServicelistFragment">
|
||||
|
||||
<GridView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:numColumns="2" />
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center" />
|
||||
|
||||
</FrameLayout>
|
19
app/src/main/res/layout/fragment_servicelist_list.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="org.openlp.android2.fragments.ServicelistFragment">
|
||||
|
||||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center" />
|
||||
|
||||
</FrameLayout>
|
6
app/src/main/res/menu/global.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/action_settings"
|
||||
android:title="@string/action_settings"
|
||||
android:orderInCategory="100"
|
||||
android:showAsAction="never" />
|
||||
</menu>
|
34
app/src/main/res/menu/open_l.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:id="@+id/action_back"
|
||||
android:checkable="true"
|
||||
android:visible="false"
|
||||
android:icon="@drawable/ic_arrow_back"
|
||||
android:title="@string/action_back"
|
||||
android:showAsAction="always" />
|
||||
<item android:id="@+id/action_alert"
|
||||
android:checkable="true"
|
||||
android:visible="true"
|
||||
android:icon="@drawable/ic_settings_display"
|
||||
android:title="@string/action_blank"
|
||||
android:showAsAction="always" />
|
||||
<item android:id="@+id/action_refresh"
|
||||
android:icon="@drawable/ic_refresh"
|
||||
android:title="@string/action_refresh"
|
||||
android:showAsAction="never|withText" />
|
||||
<item android:id="@+id/action_search"
|
||||
android:icon="@drawable/ic_search"
|
||||
android:title="@string/action_search"
|
||||
android:showAsAction="never|withText" />
|
||||
<item android:id="@+id/action_preferences"
|
||||
android:icon="@android:drawable/ic_menu_preferences"
|
||||
android:title="@string/action_preferences"
|
||||
android:showAsAction="never|withText" />
|
||||
<item android:id="@+id/action_connections"
|
||||
android:icon="@android:drawable/ic_menu_preferences"
|
||||
android:title="@string/action_connections"
|
||||
android:showAsAction="never|withText" />
|
||||
<item android:id="@+id/action_about"
|
||||
android:icon="@android:drawable/ic_menu_preferences"
|
||||
android:title="@string/action_about"
|
||||
android:showAsAction="never|withText" />
|
||||
</menu>
|
14
app/src/main/res/values-large/refs.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Layout alias to replace the single-pane version of the layout with a
|
||||
two-pane version on Large screens.
|
||||
|
||||
For more on layout aliases, see:
|
||||
http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
|
||||
-->
|
||||
<item name="fragment_servicelist" type="layout">@layout/fragment_servicelist_grid</item>
|
||||
<item name="fragment_livelist" type="layout">@layout/fragment_livelist_grid</item>
|
||||
|
||||
</resources>
|
14
app/src/main/res/values-sw600dp/refs.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Layout alias to replace the single-pane version of the layout with a
|
||||
two-pane version on Large screens.
|
||||
|
||||
For more on layout aliases, see:
|
||||
http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
|
||||
-->
|
||||
<item name="fragment_servicelist" type="layout">@layout/fragment_servicelist_grid</item>
|
||||
<item name="fragment_livelist" type="layout">@layout/fragment_livelist_grid</item>
|
||||
|
||||
</resources>
|
5
app/src/main/res/values-v21/styles.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="AppTheme" parent="android:Theme.Material.Light">
|
||||
</style>
|
||||
</resources>
|
6
app/src/main/res/values-w820dp/dimens.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<resources>
|
||||
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
|
||||
(such as screen margins) for screens with more than 820dp of available width. This
|
||||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
|
||||
<dimen name="activity_horizontal_margin">64dp</dimen>
|
||||
</resources>
|
22
app/src/main/res/values/backgroundTimeouts.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<resources>
|
||||
<string-array name="backgroundTimeEntries">
|
||||
<item>@string/none</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>5</item>
|
||||
<item>10</item>
|
||||
<item>15</item>
|
||||
<item>20</item>
|
||||
<item>30</item>
|
||||
</string-array>
|
||||
<string-array name="backgroundTimeValues">
|
||||
<item>0</item>
|
||||
<item>1000</item>
|
||||
<item>2000</item>
|
||||
<item>5000</item>
|
||||
<item>10000</item>
|
||||
<item>15000</item>
|
||||
<item>20000</item>
|
||||
<item>30000</item>
|
||||
</string-array>
|
||||
</resources>
|
14
app/src/main/res/values/defaultValues.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<resources>
|
||||
<!-- STRING -->
|
||||
<string name="hostDefaultValue">192.168.1.1</string>
|
||||
<string name="portDefaultValue">4316</string>
|
||||
<string name="ssl.port.default">4317</string>
|
||||
<string name="useridDefaultValue">userid</string>
|
||||
<string name="passwordDefaultValue">password</string>
|
||||
|
||||
<!-- INTEGER -->
|
||||
<integer name="socketTimeoutDefaultValue">3000</integer>
|
||||
<integer name="connectionTimeoutDefaultValue">3000</integer>
|
||||
<string name="backgroundRefreshDefaultValue">5000</string>
|
||||
<integer name="textSizeDefaultValue">14</integer>
|
||||
</resources>
|
9
app/src/main/res/values/dimens.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<resources>
|
||||
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
|
||||
<!-- Per the design guidelines, navigation drawers should be between 240dp and 320dp:
|
||||
https://developer.android.com/design/patterns/navigation-drawer.html -->
|
||||
<dimen name="navigation_drawer_width">240dp</dimen>
|
||||
</resources>
|
16
app/src/main/res/values/httpClientTimeoutValues.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<resources>
|
||||
<string-array name="socketValueEntries">
|
||||
<item>3000</item>
|
||||
<item>4000</item>
|
||||
<item>5000</item>
|
||||
<item>8000</item>
|
||||
<item>10000</item>
|
||||
</string-array>
|
||||
<string-array name="socketValues">
|
||||
<item>3000</item>
|
||||
<item>4000</item>
|
||||
<item>5000</item>
|
||||
<item>8000</item>
|
||||
<item>10000</item>
|
||||
</string-array>
|
||||
</resources>
|
15
app/src/main/res/values/keyStrings.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<resources>
|
||||
<string name="keyEnableCustomTimeout">enableCustomTimeout</string>
|
||||
<string name="keyBackgroundService">backgroundService</string>
|
||||
<string name="keyConnectionTimeout">connectionTimeout</string>
|
||||
<string name="keyDisplayBlankType">blankType</string>
|
||||
<string name="keyTextSize">textSize</string>
|
||||
<string name="keySocketTimeout">socketTimeout</string>
|
||||
<string name="keyHost">keyHost</string>
|
||||
<string name="keyPort">keyPort</string>
|
||||
<string name="key.userid">key.userid</string>
|
||||
<string name="key.password">key.password</string>
|
||||
<string name="keySharedPreferences">keySharedPreferences</string>
|
||||
<string name="key.ssl.use">ssl.use</string>
|
||||
<string name="key.profile.selected.title">key.profile.selected.title</string>
|
||||
</resources>
|
14
app/src/main/res/values/refs.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!--
|
||||
Layout alias to replace the single-pane version of the layout with a
|
||||
two-pane version on Large screens.
|
||||
|
||||
For more on layout aliases, see:
|
||||
http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
|
||||
-->
|
||||
<item name="fragment_servicelist" type="layout">@layout/fragment_servicelist_list</item>
|
||||
<item name="fragment_livelist" type="layout">@layout/fragment_livelist_list</item>
|
||||
|
||||
</resources>
|
57
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="about_text">Version</string>
|
||||
<string name="about_display_1">OpenLP is free church presentation software</string>
|
||||
<string name="about_display_2">Find out more about visit the OpenLP website.</string>
|
||||
<string name="about_display_4">Copyright</string>
|
||||
<string name="about_display_5">Portions copyright</string>
|
||||
<string name="about_display_6">License</string>
|
||||
<string name="about_display_7">This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.</string>
|
||||
<string name="about_display_8">This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="app_name">OpenLP</string>
|
||||
<string name="action_alert">Alert</string>
|
||||
<string name="action_back">Back</string>
|
||||
<string name="service_list">Service List</string>
|
||||
<string name="live_list">Live List</string>
|
||||
<string name="stage_view">Stage View</string>
|
||||
<string name="live_view">LiveView</string>
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
<string name="action_blank">Toggle Display</string>
|
||||
<string name="action_search">Search</string>
|
||||
<string name="action_refresh">Refresh</string>
|
||||
<string name="action_preferences">Preferences</string>
|
||||
<string name="action_connections">Connections</string>
|
||||
<string name="action_about">About</string>
|
||||
<string name="textSizeType">Text Size Type</string>
|
||||
<string name="textSizeSummary">Change the Service text size</string>
|
||||
<string name="connectionTimeout">Connection Timeout</string>
|
||||
<string name="connectionTimedout">Connection timed out</string>
|
||||
<string name="connectionTimeoutSummary">Select a value (milliseconds)</string>
|
||||
<string name="enableCustomTimeouts">Enable Custom Timeouts</string>
|
||||
<string name="customTimeoutsSummary">Check to modify timeout settings</string>
|
||||
<string name="socketTimeout">Socket Timeout</string>
|
||||
<string name="socketTimeoutSummary">Select a value (milliseconds)</string>
|
||||
<string name="none">None</string>
|
||||
<string name="connection.profile.active">Active Profile - Tap to manage</string>
|
||||
<string name="url">Server</string>
|
||||
<string name="urlHint">Hostname or IP</string>
|
||||
<string name="notSet">Not set</string>
|
||||
<string name="connection.available.configurations">List of available profiles</string>
|
||||
<string name="connection.add.by.menu">Tap to add a new profile</string>
|
||||
<string name="connection.profile.not.saved">Tap to edit properties</string>
|
||||
<string name="connection.profile.new.server">New Server</string>
|
||||
<string name="connection.profile.server">Server</string>
|
||||
<string name="connection.profile.title">Profile Title</string>
|
||||
<string name="port">Port</string>
|
||||
<string name="connection.profile.ssl.use">Use HTTPS</string>
|
||||
<string name="connection.profile.ssl.summary">Specify whether HTTPS should be used</string>
|
||||
<string name="connection.userid">Userid</string>
|
||||
<string name="connection.password">Password</string>
|
||||
<string name="connection.profile.remove">Remove</string>
|
||||
<string name="connection.profile.remove.summary">Remove this configuration</string>
|
||||
<string name="connection.profile.summary.activate">Tap to set active</string>
|
||||
<string name="connection.profile.activate">Save and Activate</string>
|
||||
<string name="connection.profile.active.toast">Active Profile</string>
|
||||
</resources>
|
59
app/src/main/res/values/strings_activity_settings.xml
Normal file
@ -0,0 +1,59 @@
|
||||
<resources>
|
||||
<string name="title_activity_settings">Settings</string>
|
||||
|
||||
<!-- Strings related to Settings -->
|
||||
|
||||
<!-- Example General settings -->
|
||||
<string name="pref_header_general">General</string>
|
||||
|
||||
<string name="pref_title_social_recommendations">Enable social recommendations</string>
|
||||
<string name="pref_description_social_recommendations">Recommendations for people to contact based on your message history</string>
|
||||
|
||||
<string name="pref_title_display_name">Display name</string>
|
||||
<string name="pref_default_display_name">John Smith</string>
|
||||
|
||||
<string name="pref_title_add_friends_to_messages">Add friends to messages</string>
|
||||
<string-array name="pref_example_list_titles">
|
||||
<item>Always</item>
|
||||
<item>When possible</item>
|
||||
<item>Never</item>
|
||||
</string-array>
|
||||
<string-array name="pref_example_list_values">
|
||||
<item>1</item>
|
||||
<item>0</item>
|
||||
<item>-1</item>
|
||||
</string-array>
|
||||
|
||||
<!-- Example settings for Data & Sync -->
|
||||
<string name="pref_header_data_sync">Data & sync</string>
|
||||
|
||||
<string name="pref_title_sync_frequency">Sync frequency</string>
|
||||
<string-array name="pref_sync_frequency_titles">
|
||||
<item>15 minutes</item>
|
||||
<item>30 minutes</item>
|
||||
<item>1 hour</item>
|
||||
<item>3 hours</item>
|
||||
<item>6 hours</item>
|
||||
<item>Never</item>
|
||||
</string-array>
|
||||
<string-array name="pref_sync_frequency_values">
|
||||
<item>15</item>
|
||||
<item>30</item>
|
||||
<item>60</item>
|
||||
<item>180</item>
|
||||
<item>360</item>
|
||||
<item>-1</item>
|
||||
</string-array>
|
||||
|
||||
<string name="pref_title_system_sync_settings">System sync settings</string>
|
||||
|
||||
<!-- Example settings for Notifications -->
|
||||
<string name="pref_header_notifications">Notifications</string>
|
||||
|
||||
<string name="pref_title_new_message_notifications">New message notifications</string>
|
||||
|
||||
<string name="pref_title_ringtone">Ringtone</string>
|
||||
<string name="pref_ringtone_silent">Silent</string>
|
||||
|
||||
<string name="pref_title_vibrate">Vibrate</string>
|
||||
</resources>
|
8
app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
|
||||
</resources>
|
22
app/src/main/res/values/textSize.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<resources>
|
||||
<string-array name="textSizeValueEntries">
|
||||
<item>6</item>
|
||||
<item>8</item>
|
||||
<item>10</item>
|
||||
<item>12</item>
|
||||
<item>14</item>
|
||||
<item>16</item>
|
||||
<item>18</item>
|
||||
<item>20</item>
|
||||
</string-array>
|
||||
<string-array name="textSizeValues">
|
||||
<item>6</item>
|
||||
<item>8</item>
|
||||
<item>10</item>
|
||||
<item>12</item>
|
||||
<item>14</item>
|
||||
<item>16</item>
|
||||
<item>18</item>
|
||||
<item>20</item>
|
||||
</string-array>
|
||||
</resources>
|
6
app/src/main/res/xml/empty_preferences.xml
Executable file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
>
|
||||
|
||||
</PreferenceScreen>
|
21
app/src/main/res/xml/pref_data_sync.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
|
||||
dismiss it. -->
|
||||
<!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
|
||||
<ListPreference
|
||||
android:key="sync_frequency"
|
||||
android:title="@string/pref_title_sync_frequency"
|
||||
android:entries="@array/pref_sync_frequency_titles"
|
||||
android:entryValues="@array/pref_sync_frequency_values"
|
||||
android:defaultValue="180"
|
||||
android:negativeButtonText="@null"
|
||||
android:positiveButtonText="@null" />
|
||||
|
||||
<!-- This preference simply launches an intent when selected. Use this UI sparingly, per
|
||||
design guidelines. -->
|
||||
<Preference android:title="@string/pref_title_system_sync_settings">
|
||||
<intent android:action="android.settings.SYNC_SETTINGS" />
|
||||
</Preference>
|
||||
|
||||
</PreferenceScreen>
|
32
app/src/main/res/xml/pref_general.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory>
|
||||
<ListPreference
|
||||
android:title="@string/textSizeType"
|
||||
android:key="@string/keyTextSize"
|
||||
android:summary="@string/textSizeSummary"
|
||||
android:entries="@array/textSizeValueEntries"
|
||||
android:entryValues="@array/textSizeValues"
|
||||
android:defaultValue="@integer/textSizeDefaultValue"/>
|
||||
<CheckBoxPreference
|
||||
android:title="@string/enableCustomTimeouts"
|
||||
android:key="@string/keyEnableCustomTimeout"
|
||||
android:summary="@string/customTimeoutsSummary"/>
|
||||
<ListPreference
|
||||
android:title="@string/connectionTimeout"
|
||||
android:key="@string/keyConnectionTimeout"
|
||||
android:summary="@string/connectionTimeoutSummary"
|
||||
android:dependency="@string/keyEnableCustomTimeout"
|
||||
android:entries="@array/socketValueEntries"
|
||||
android:entryValues="@array/socketValues"
|
||||
android:defaultValue="@integer/connectionTimeoutDefaultValue"/>
|
||||
<ListPreference
|
||||
android:title="@string/socketTimeout"
|
||||
android:key="@string/keySocketTimeout"
|
||||
android:summary="@string/socketTimeoutSummary"
|
||||
android:dependency="@string/keyEnableCustomTimeout"
|
||||
android:entries="@array/socketValueEntries"
|
||||
android:entryValues="@array/socketValues"
|
||||
android:defaultValue="@integer/socketTimeoutDefaultValue"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
17
app/src/main/res/xml/pref_headers.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- These settings headers are only used on tablets. -->
|
||||
|
||||
<header
|
||||
android:fragment="org.openlp.android2.activities.SettingsActivity$GeneralPreferenceFragment"
|
||||
android:title="@string/pref_header_general" />
|
||||
|
||||
<header
|
||||
android:fragment="org.openlp.android2.activities.SettingsActivity$NotificationPreferenceFragment"
|
||||
android:title="@string/pref_header_notifications" />
|
||||
|
||||
<header
|
||||
android:fragment="org.openlp.android2.activities.SettingsActivity$DataSyncPreferenceFragment"
|
||||
android:title="@string/pref_header_data_sync" />
|
||||
|
||||
</preference-headers>
|
27
app/src/main/res/xml/pref_notification.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- A 'parent' preference, which enables/disables child preferences (below)
|
||||
when checked/unchecked. -->
|
||||
<CheckBoxPreference
|
||||
android:key="notifications_new_message"
|
||||
android:title="@string/pref_title_new_message_notifications"
|
||||
android:defaultValue="true" />
|
||||
|
||||
<!-- Allows the user to choose a ringtone in the 'notification' category. -->
|
||||
<!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
|
||||
<!-- NOTE: RingtonePreference's summary should be set to its value by the activity code. -->
|
||||
<RingtonePreference
|
||||
android:dependency="notifications_new_message"
|
||||
android:key="notifications_new_message_ringtone"
|
||||
android:title="@string/pref_title_ringtone"
|
||||
android:ringtoneType="notification"
|
||||
android:defaultValue="content://settings/system/notification_sound" />
|
||||
|
||||
<!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
|
||||
<CheckBoxPreference
|
||||
android:dependency="notifications_new_message"
|
||||
android:key="notifications_new_message_vibrate"
|
||||
android:title="@string/pref_title_vibrate"
|
||||
android:defaultValue="true" />
|
||||
|
||||
</PreferenceScreen>
|
19
build.gradle
Normal file
@ -0,0 +1,19 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:0.12.2'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
}
|
18
gradle.properties
Normal file
@ -0,0 +1,18 @@
|
||||
# Project-wide Gradle settings.
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Settings specified in this file will override any Gradle settings
|
||||
# configured through the IDE.
|
||||
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
# Default value: -Xmx10248m -XX:MaxPermSize=256m
|
||||
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Wed Apr 10 15:27:10 PDT 2013
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
|