mirror of
https://github.com/playmusicexporter/playmusicexporter
synced 2024-05-17 09:16:42 +00:00
Initial commit
This commit is contained in:
commit
04dc157f6e
1
app/.gitignore
vendored
Normal file
1
app/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/build
|
92
app/app.iml
Normal file
92
app/app.iml
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" 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="compileDebugSources" />
|
||||||
|
<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/res/generated/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$/build/generated/res/generated/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" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||||
|
<orderEntry type="module" module-name="framework" exported="" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
|
|
49
app/build.gradle
Normal file
49
app/build.gradle
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 David Schulte
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 21
|
||||||
|
buildToolsVersion "21.1.2"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "de.arcus.playmusicexporter2"
|
||||||
|
minSdkVersion 8
|
||||||
|
targetSdkVersion 21
|
||||||
|
versionCode 65
|
||||||
|
versionName '2.4.0'
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled true
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
compile 'com.android.support:appcompat-v7:21.0.3'
|
||||||
|
compile 'com.android.support:support-v4:21.0.3'
|
||||||
|
compile project(':framework')
|
||||||
|
}
|
17
app/proguard-rules.pro
vendored
Normal file
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/david/android-sdks/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,35 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 David Schulte
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.arcus.playmusicexporter2;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
53
app/src/main/AndroidManifest.xml
Normal file
53
app/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2015 David Schulte
|
||||||
|
~
|
||||||
|
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
~ of this software and associated documentation files (the "Software"), to deal
|
||||||
|
~ in the Software without restriction, including without limitation the rights
|
||||||
|
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
|
~ furnished to do so, subject to the following conditions:
|
||||||
|
~
|
||||||
|
~ The above copyright notice and this permission notice shall be included in
|
||||||
|
~ all copies or substantial portions of the Software.
|
||||||
|
~
|
||||||
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
~ THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="de.arcus.playmusicexporter2" >
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@drawable/ic_launcher"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:theme="@style/AppTheme" >
|
||||||
|
<activity
|
||||||
|
android:name=".TrackListActivity"
|
||||||
|
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=".TrackDetailActivity"
|
||||||
|
android:label="@string/title_track_detail"
|
||||||
|
android:parentActivityName=".TrackListActivity" >
|
||||||
|
<meta-data
|
||||||
|
android:name="android.support.PARENT_ACTIVITY"
|
||||||
|
android:value=".TrackListActivity" />
|
||||||
|
</activity>
|
||||||
|
|
||||||
|
<meta-data android:name="crashhandler.email" android:value="mail@david-schulte.de" />
|
||||||
|
<meta-data android:name="crashhandler.supporturl" android:value="http://www.david-schulte.de/" />
|
||||||
|
</application>
|
||||||
|
</manifest>
|
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 David Schulte
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.arcus.playmusicexporter2;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
import android.support.v4.app.NavUtils;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An activity representing a single Track detail screen. This
|
||||||
|
* activity is only used on handset devices. On tablet-size devices,
|
||||||
|
* item details are presented side-by-side with a list of items
|
||||||
|
* in a {@link TrackListActivity}.
|
||||||
|
* <p/>
|
||||||
|
* This activity is mostly just a 'shell' activity containing nothing
|
||||||
|
* more than a {@link TrackDetailFragment}.
|
||||||
|
*/
|
||||||
|
public class TrackDetailActivity extends ActionBarActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_track_detail);
|
||||||
|
|
||||||
|
// Show the Up button in the action bar.
|
||||||
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
|
// savedInstanceState is non-null when there is fragment state
|
||||||
|
// saved from previous configurations of this activity
|
||||||
|
// (e.g. when rotating the screen from portrait to landscape).
|
||||||
|
// In this case, the fragment will automatically be re-added
|
||||||
|
// to its container so we don't need to manually add it.
|
||||||
|
// For more information, see the Fragments API guide at:
|
||||||
|
//
|
||||||
|
// http://developer.android.com/guide/components/fragments.html
|
||||||
|
//
|
||||||
|
if (savedInstanceState == null) {
|
||||||
|
// Create the detail fragment and add it to the activity
|
||||||
|
// using a fragment transaction.
|
||||||
|
Bundle arguments = new Bundle();
|
||||||
|
arguments.putString(TrackDetailFragment.ARG_ITEM_ID,
|
||||||
|
getIntent().getStringExtra(TrackDetailFragment.ARG_ITEM_ID));
|
||||||
|
TrackDetailFragment fragment = new TrackDetailFragment();
|
||||||
|
fragment.setArguments(arguments);
|
||||||
|
getSupportFragmentManager().beginTransaction()
|
||||||
|
.add(R.id.track_detail_container, fragment)
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
int id = item.getItemId();
|
||||||
|
if (id == android.R.id.home) {
|
||||||
|
// This ID represents the Home or Up button. In the case of this
|
||||||
|
// activity, the Up button is shown. Use NavUtils to allow users
|
||||||
|
// to navigate up one level in the application structure. For
|
||||||
|
// more details, see the Navigation pattern on Android Design:
|
||||||
|
//
|
||||||
|
// http://developer.android.com/design/patterns/navigation.html#up-vs-back
|
||||||
|
//
|
||||||
|
NavUtils.navigateUpTo(this, new Intent(this, TrackListActivity.class));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 David Schulte
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.arcus.playmusicexporter2;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
|
||||||
|
import de.arcus.playmusicexporter2.dummy.DummyContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A fragment representing a single Track detail screen.
|
||||||
|
* This fragment is either contained in a {@link TrackListActivity}
|
||||||
|
* in two-pane mode (on tablets) or a {@link TrackDetailActivity}
|
||||||
|
* on handsets.
|
||||||
|
*/
|
||||||
|
public class TrackDetailFragment extends Fragment {
|
||||||
|
/**
|
||||||
|
* The fragment argument representing the item ID that this fragment
|
||||||
|
* represents.
|
||||||
|
*/
|
||||||
|
public static final String ARG_ITEM_ID = "item_id";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The dummy content this fragment is presenting.
|
||||||
|
*/
|
||||||
|
private DummyContent.DummyItem mItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mandatory empty constructor for the fragment manager to instantiate the
|
||||||
|
* fragment (e.g. upon screen orientation changes).
|
||||||
|
*/
|
||||||
|
public TrackDetailFragment() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
if (getArguments().containsKey(ARG_ITEM_ID)) {
|
||||||
|
// Load the dummy content specified by the fragment
|
||||||
|
// arguments. In a real-world scenario, use a Loader
|
||||||
|
// to load content from a content provider.
|
||||||
|
mItem = DummyContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
View rootView = inflater.inflate(R.layout.fragment_track_detail, container, false);
|
||||||
|
|
||||||
|
// Show the dummy content as text in a TextView.
|
||||||
|
if (mItem != null) {
|
||||||
|
((TextView) rootView.findViewById(R.id.track_detail)).setText(mItem.content);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rootView;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,122 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 David Schulte
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.arcus.playmusicexporter2;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
|
||||||
|
import de.arcus.framework.logger.Logger;
|
||||||
|
import de.arcus.framework.crashhandler.CrashHandler;
|
||||||
|
import de.arcus.framework.superuser.SuperUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An activity representing a list of Tracks. This activity
|
||||||
|
* has different presentations for handset and tablet-size devices. On
|
||||||
|
* handsets, the activity presents a list of items, which when touched,
|
||||||
|
* lead to a {@link TrackDetailActivity} representing
|
||||||
|
* item details. On tablets, the activity presents the list of items and
|
||||||
|
* item details side-by-side using two vertical panes.
|
||||||
|
* <p/>
|
||||||
|
* The activity makes heavy use of fragments. The list of items is a
|
||||||
|
* {@link TrackListFragment} and the item details
|
||||||
|
* (if present) is a {@link TrackDetailFragment}.
|
||||||
|
* <p/>
|
||||||
|
* This activity also implements the required
|
||||||
|
* {@link TrackListFragment.Callbacks} interface
|
||||||
|
* to listen for item selections.
|
||||||
|
*/
|
||||||
|
public class TrackListActivity extends ActionBarActivity
|
||||||
|
implements TrackListFragment.Callbacks {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether or not the activity is in two-pane mode, i.e. running on a tablet
|
||||||
|
* device.
|
||||||
|
*/
|
||||||
|
private boolean mTwoPane;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_track_list);
|
||||||
|
|
||||||
|
// Adds the crash handler to this class
|
||||||
|
CrashHandler.addCrashHandler(this);
|
||||||
|
|
||||||
|
Logger.getInstance().logVerbose("Activity", "onCreate(" + this.getLocalClassName() + ")");
|
||||||
|
|
||||||
|
// Setup ActionBar
|
||||||
|
ActionBar actionBar = getSupportActionBar();
|
||||||
|
if (actionBar != null) {
|
||||||
|
actionBar.setTitle(R.string.app_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (findViewById(R.id.track_detail_container) != null) {
|
||||||
|
// The detail container view will be present only in the
|
||||||
|
// large-screen layouts (res/values-large and
|
||||||
|
// res/values-sw600dp). If this view is present, then the
|
||||||
|
// activity should be in two-pane mode.
|
||||||
|
mTwoPane = true;
|
||||||
|
|
||||||
|
// In two-pane mode, list items should be given the
|
||||||
|
// 'activated' state when touched.
|
||||||
|
((TrackListFragment) getSupportFragmentManager()
|
||||||
|
.findFragmentById(R.id.track_list))
|
||||||
|
.setActivateOnItemClick(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SuperUser.askForPermissions();
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: If exposing deep links into your app, handle intents here.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback method from {@link TrackListFragment.Callbacks}
|
||||||
|
* indicating that the item with the given ID was selected.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(String id) {
|
||||||
|
if (mTwoPane) {
|
||||||
|
// In two-pane mode, show the detail view in this activity by
|
||||||
|
// adding or replacing the detail fragment using a
|
||||||
|
// fragment transaction.
|
||||||
|
Bundle arguments = new Bundle();
|
||||||
|
arguments.putString(TrackDetailFragment.ARG_ITEM_ID, id);
|
||||||
|
TrackDetailFragment fragment = new TrackDetailFragment();
|
||||||
|
fragment.setArguments(arguments);
|
||||||
|
getSupportFragmentManager().beginTransaction()
|
||||||
|
.replace(R.id.track_detail_container, fragment)
|
||||||
|
.commit();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// In single-pane mode, simply start the detail activity
|
||||||
|
// for the selected item ID.
|
||||||
|
Intent detailIntent = new Intent(this, TrackDetailActivity.class);
|
||||||
|
detailIntent.putExtra(TrackDetailFragment.ARG_ITEM_ID, id);
|
||||||
|
startActivity(detailIntent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,174 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 David Schulte
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.arcus.playmusicexporter2;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.ListFragment;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ArrayAdapter;
|
||||||
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
|
||||||
|
import de.arcus.playmusicexporter2.dummy.DummyContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list fragment representing a list of Tracks. This fragment
|
||||||
|
* also supports tablet devices by allowing list items to be given an
|
||||||
|
* 'activated' state upon selection. This helps indicate which item is
|
||||||
|
* currently being viewed in a {@link TrackDetailFragment}.
|
||||||
|
* <p/>
|
||||||
|
* Activities containing this fragment MUST implement the {@link Callbacks}
|
||||||
|
* interface.
|
||||||
|
*/
|
||||||
|
public class TrackListFragment extends ListFragment {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The serialization (saved instance state) Bundle key representing the
|
||||||
|
* activated item position. Only used on tablets.
|
||||||
|
*/
|
||||||
|
private static final String STATE_ACTIVATED_POSITION = "activated_position";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The fragment's current callback object, which is notified of list item
|
||||||
|
* clicks.
|
||||||
|
*/
|
||||||
|
private Callbacks mCallbacks = sDummyCallbacks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current activated item position. Only used on tablets.
|
||||||
|
*/
|
||||||
|
private int mActivatedPosition = ListView.INVALID_POSITION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A callback interface that all activities containing this fragment must
|
||||||
|
* implement. This mechanism allows activities to be notified of item
|
||||||
|
* selections.
|
||||||
|
*/
|
||||||
|
public interface Callbacks {
|
||||||
|
/**
|
||||||
|
* Callback for when an item has been selected.
|
||||||
|
*/
|
||||||
|
public void onItemSelected(String id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A dummy implementation of the {@link Callbacks} interface that does
|
||||||
|
* nothing. Used only when this fragment is not attached to an activity.
|
||||||
|
*/
|
||||||
|
private static Callbacks sDummyCallbacks = new Callbacks() {
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(String id) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mandatory empty constructor for the fragment manager to instantiate the
|
||||||
|
* fragment (e.g. upon screen orientation changes).
|
||||||
|
*/
|
||||||
|
public TrackListFragment() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
// TODO: replace with a real list adapter.
|
||||||
|
setListAdapter(new ArrayAdapter<DummyContent.DummyItem>(
|
||||||
|
getActivity(),
|
||||||
|
android.R.layout.simple_list_item_activated_1,
|
||||||
|
android.R.id.text1,
|
||||||
|
DummyContent.ITEMS));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
// Restore the previously serialized activated item position.
|
||||||
|
if (savedInstanceState != null
|
||||||
|
&& savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
|
||||||
|
setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Activity activity) {
|
||||||
|
super.onAttach(activity);
|
||||||
|
|
||||||
|
// Activities containing this fragment must implement its callbacks.
|
||||||
|
if (!(activity instanceof Callbacks)) {
|
||||||
|
throw new IllegalStateException("Activity must implement fragment's callbacks.");
|
||||||
|
}
|
||||||
|
|
||||||
|
mCallbacks = (Callbacks) activity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
|
||||||
|
// Reset the active callbacks interface to the dummy implementation.
|
||||||
|
mCallbacks = sDummyCallbacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onListItemClick(ListView listView, View view, int position, long id) {
|
||||||
|
super.onListItemClick(listView, view, position, id);
|
||||||
|
|
||||||
|
// Notify the active callbacks interface (the activity, if the
|
||||||
|
// fragment is attached to one) that an item has been selected.
|
||||||
|
mCallbacks.onItemSelected(DummyContent.ITEMS.get(position).id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
|
super.onSaveInstanceState(outState);
|
||||||
|
if (mActivatedPosition != ListView.INVALID_POSITION) {
|
||||||
|
// Serialize and persist the activated item position.
|
||||||
|
outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Turns on activate-on-click mode. When this mode is on, list items will be
|
||||||
|
* given the 'activated' state when touched.
|
||||||
|
*/
|
||||||
|
public void setActivateOnItemClick(boolean activateOnItemClick) {
|
||||||
|
// When setting CHOICE_MODE_SINGLE, ListView will automatically
|
||||||
|
// give items the 'activated' state when touched.
|
||||||
|
getListView().setChoiceMode(activateOnItemClick
|
||||||
|
? ListView.CHOICE_MODE_SINGLE
|
||||||
|
: ListView.CHOICE_MODE_NONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setActivatedPosition(int position) {
|
||||||
|
if (position == ListView.INVALID_POSITION) {
|
||||||
|
getListView().setItemChecked(mActivatedPosition, false);
|
||||||
|
} else {
|
||||||
|
getListView().setItemChecked(position, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
mActivatedPosition = position;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,77 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 David Schulte
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.arcus.playmusicexporter2.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/ic_launcher.png
Normal file
BIN
app/src/main/res/drawable-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.2 KiB |
BIN
app/src/main/res/drawable-mdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/drawable-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
BIN
app/src/main/res/drawable-xhdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
app/src/main/res/drawable-xxhdpi/ic_launcher.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
26
app/src/main/res/layout/activity_track_detail.xml
Normal file
26
app/src/main/res/layout/activity_track_detail.xml
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2015 David Schulte
|
||||||
|
~
|
||||||
|
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
~ of this software and associated documentation files (the "Software"), to deal
|
||||||
|
~ in the Software without restriction, including without limitation the rights
|
||||||
|
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
|
~ furnished to do so, subject to the following conditions:
|
||||||
|
~
|
||||||
|
~ The above copyright notice and this permission notice shall be included in
|
||||||
|
~ all copies or substantial portions of the Software.
|
||||||
|
~
|
||||||
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
~ THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/track_detail_container"
|
||||||
|
android:layout_width="match_parent" android:layout_height="match_parent"
|
||||||
|
tools:context=".TrackDetailActivity" tools:ignore="MergeRootFrame" />
|
28
app/src/main/res/layout/activity_track_list.xml
Normal file
28
app/src/main/res/layout/activity_track_list.xml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2015 David Schulte
|
||||||
|
~
|
||||||
|
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
~ of this software and associated documentation files (the "Software"), to deal
|
||||||
|
~ in the Software without restriction, including without limitation the rights
|
||||||
|
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
|
~ furnished to do so, subject to the following conditions:
|
||||||
|
~
|
||||||
|
~ The above copyright notice and this permission notice shall be included in
|
||||||
|
~ all copies or substantial portions of the Software.
|
||||||
|
~
|
||||||
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
~ THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/track_list"
|
||||||
|
android:name="de.arcus.playmusicexporter2.TrackListFragment" android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" android:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp" tools:context=".TrackListActivity"
|
||||||
|
tools:layout="@android:layout/list_content" />
|
50
app/src/main/res/layout/activity_track_twopane.xml
Normal file
50
app/src/main/res/layout/activity_track_twopane.xml
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2015 David Schulte
|
||||||
|
~
|
||||||
|
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
~ of this software and associated documentation files (the "Software"), to deal
|
||||||
|
~ in the Software without restriction, including without limitation the rights
|
||||||
|
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
|
~ furnished to do so, subject to the following conditions:
|
||||||
|
~
|
||||||
|
~ The above copyright notice and this permission notice shall be included in
|
||||||
|
~ all copies or substantial portions of the Software.
|
||||||
|
~
|
||||||
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
~ THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<LinearLayout 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:layout_marginLeft="16dp"
|
||||||
|
android:layout_marginRight="16dp" android:baselineAligned="false"
|
||||||
|
android:divider="?android:attr/dividerHorizontal" android:orientation="horizontal"
|
||||||
|
android:showDividers="middle" tools:context=".TrackListActivity">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
This layout is a two-pane layout for the Tracks
|
||||||
|
master/detail flow.
|
||||||
|
See res/values-large/refs.xml and
|
||||||
|
res/values-sw600dp/refs.xml for an example of layout aliases
|
||||||
|
that replace the single-pane version of the layout with
|
||||||
|
this two-pane version.
|
||||||
|
|
||||||
|
For more on layout aliases, see:
|
||||||
|
http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
|
||||||
|
-->
|
||||||
|
|
||||||
|
<fragment android:id="@+id/track_list"
|
||||||
|
android:name="de.arcus.playmusicexporter2.TrackListFragment" android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent" android:layout_weight="1.5"
|
||||||
|
tools:layout="@android:layout/list_content" />
|
||||||
|
|
||||||
|
<FrameLayout android:id="@+id/track_detail_container" android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent" android:layout_weight="3" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
27
app/src/main/res/layout/fragment_track_detail.xml
Normal file
27
app/src/main/res/layout/fragment_track_detail.xml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2015 David Schulte
|
||||||
|
~
|
||||||
|
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
~ of this software and associated documentation files (the "Software"), to deal
|
||||||
|
~ in the Software without restriction, including without limitation the rights
|
||||||
|
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
|
~ furnished to do so, subject to the following conditions:
|
||||||
|
~
|
||||||
|
~ The above copyright notice and this permission notice shall be included in
|
||||||
|
~ all copies or substantial portions of the Software.
|
||||||
|
~
|
||||||
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
~ THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/track_detail"
|
||||||
|
style="?android:attr/textAppearanceLarge" android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" android:padding="16dp" android:textIsSelectable="true"
|
||||||
|
tools:context=".TrackDetailFragment" />
|
32
app/src/main/res/values-large/refs.xml
Normal file
32
app/src/main/res/values-large/refs.xml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2015 David Schulte
|
||||||
|
~
|
||||||
|
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
~ of this software and associated documentation files (the "Software"), to deal
|
||||||
|
~ in the Software without restriction, including without limitation the rights
|
||||||
|
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
|
~ furnished to do so, subject to the following conditions:
|
||||||
|
~
|
||||||
|
~ The above copyright notice and this permission notice shall be included in
|
||||||
|
~ all copies or substantial portions of the Software.
|
||||||
|
~
|
||||||
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
~ THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<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 type="layout" name="activity_track_list">@layout/activity_track_twopane</item>
|
||||||
|
</resources>
|
32
app/src/main/res/values-sw600dp/refs.xml
Normal file
32
app/src/main/res/values-sw600dp/refs.xml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2015 David Schulte
|
||||||
|
~
|
||||||
|
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
~ of this software and associated documentation files (the "Software"), to deal
|
||||||
|
~ in the Software without restriction, including without limitation the rights
|
||||||
|
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
|
~ furnished to do so, subject to the following conditions:
|
||||||
|
~
|
||||||
|
~ The above copyright notice and this permission notice shall be included in
|
||||||
|
~ all copies or substantial portions of the Software.
|
||||||
|
~
|
||||||
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
~ THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<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 type="layout" name="activity_track_list">@layout/activity_track_twopane</item>
|
||||||
|
</resources>
|
27
app/src/main/res/values/colors.xml
Normal file
27
app/src/main/res/values/colors.xml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2015 David Schulte
|
||||||
|
~
|
||||||
|
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
~ of this software and associated documentation files (the "Software"), to deal
|
||||||
|
~ in the Software without restriction, including without limitation the rights
|
||||||
|
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
|
~ furnished to do so, subject to the following conditions:
|
||||||
|
~
|
||||||
|
~ The above copyright notice and this permission notice shall be included in
|
||||||
|
~ all copies or substantial portions of the Software.
|
||||||
|
~
|
||||||
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
~ THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<color name="applicationMainColor">#ef6c00</color>
|
||||||
|
<color name="applicationMainColorDark">#e65100</color>
|
||||||
|
</resources>
|
29
app/src/main/res/values/strings.xml
Normal file
29
app/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2015 David Schulte
|
||||||
|
~
|
||||||
|
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
~ of this software and associated documentation files (the "Software"), to deal
|
||||||
|
~ in the Software without restriction, including without limitation the rights
|
||||||
|
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
|
~ furnished to do so, subject to the following conditions:
|
||||||
|
~
|
||||||
|
~ The above copyright notice and this permission notice shall be included in
|
||||||
|
~ all copies or substantial portions of the Software.
|
||||||
|
~
|
||||||
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
~ THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<string name="app_name">Play Music Exporter</string>
|
||||||
|
<string name="title_track_detail">Track Detail</string>
|
||||||
|
|
||||||
|
</resources>
|
33
app/src/main/res/values/styles.xml
Normal file
33
app/src/main/res/values/styles.xml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2015 David Schulte
|
||||||
|
~
|
||||||
|
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
~ of this software and associated documentation files (the "Software"), to deal
|
||||||
|
~ in the Software without restriction, including without limitation the rights
|
||||||
|
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
|
~ furnished to do so, subject to the following conditions:
|
||||||
|
~
|
||||||
|
~ The above copyright notice and this permission notice shall be included in
|
||||||
|
~ all copies or substantial portions of the Software.
|
||||||
|
~
|
||||||
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
~ THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<!-- Base application theme. -->
|
||||||
|
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
|
<!-- Customize your theme here. -->
|
||||||
|
<item name="colorPrimary">@color/applicationMainColor</item>
|
||||||
|
<item name="colorPrimaryDark">@color/applicationMainColorDark</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
</resources>
|
41
build.gradle
Normal file
41
build.gradle
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 David Schulte
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// 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:1.0.0'
|
||||||
|
|
||||||
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
// in the individual module build.gradle files
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
}
|
1
framework/.gitignore
vendored
Normal file
1
framework/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/build
|
48
framework/build.gradle
Normal file
48
framework/build.gradle
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 David Schulte
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
apply plugin: 'com.android.library'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 21
|
||||||
|
buildToolsVersion "21.1.2"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 8
|
||||||
|
targetSdkVersion 21
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
compile 'com.android.support:appcompat-v7:21.0.3'
|
||||||
|
}
|
92
framework/framework.iml
Normal file
92
framework/framework.iml
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="android-gradle" name="Android-Gradle">
|
||||||
|
<configuration>
|
||||||
|
<option name="GRADLE_PROJECT_PATH" value=":framework" />
|
||||||
|
</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="compileDebugSources" />
|
||||||
|
<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" />
|
||||||
|
<option name="LIBRARY_PROJECT" value="true" />
|
||||||
|
</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/res/generated/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$/build/generated/res/generated/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" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
|
|
17
framework/proguard-rules.pro
vendored
Normal file
17
framework/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/david/android-sdks/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,35 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 David Schulte
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.arcus.framework;
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
32
framework/src/main/AndroidManifest.xml
Normal file
32
framework/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2015 David Schulte
|
||||||
|
~
|
||||||
|
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
~ of this software and associated documentation files (the "Software"), to deal
|
||||||
|
~ in the Software without restriction, including without limitation the rights
|
||||||
|
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
|
~ furnished to do so, subject to the following conditions:
|
||||||
|
~
|
||||||
|
~ The above copyright notice and this permission notice shall be included in
|
||||||
|
~ all copies or substantial portions of the Software.
|
||||||
|
~
|
||||||
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
~ THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="de.arcus.framework">
|
||||||
|
|
||||||
|
<application android:allowBackup="true" >
|
||||||
|
<activity
|
||||||
|
android:name="de.arcus.framework.crashhandler.CrashActivity"
|
||||||
|
android:launchMode="singleInstance" >
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
|
@ -0,0 +1,184 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 David Schulte
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.arcus.framework.crashhandler;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.content.pm.ApplicationInfo;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.support.v4.app.ShareCompat;
|
||||||
|
import android.support.v7.app.ActionBar;
|
||||||
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import de.arcus.framework.logger.Logger;
|
||||||
|
import de.arcus.framework.R;
|
||||||
|
|
||||||
|
public class CrashActivity extends ActionBarActivity {
|
||||||
|
// Extra flags
|
||||||
|
public static final String EXTRA_FLAG_CRASH_MESSAGE = "CRASH_TITLE";
|
||||||
|
public static final String EXTRA_FLAG_CRASH_LOG = "CRASH_LOG";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* StackTrace of the exception
|
||||||
|
*/
|
||||||
|
private String mCrashMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Log of the exception
|
||||||
|
*/
|
||||||
|
private String mCrashLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the app
|
||||||
|
*/
|
||||||
|
private String mAppName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The intent to start the app (for restart the app)
|
||||||
|
*/
|
||||||
|
private Intent mLaunchIntent;
|
||||||
|
/**
|
||||||
|
* Email address to send the crash log to
|
||||||
|
* Set this in AndroidManifest.xml: <meta-data android:name="crashhandler.email" android:value="..." />
|
||||||
|
*/
|
||||||
|
private String mMetaDataEmail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL of a bugtracker or a support homepage
|
||||||
|
* Set this in AndroidManifest.xml: <meta-data android:name="crashhandler.supporturl" android:value="..." />
|
||||||
|
*/
|
||||||
|
private String mMetaDataSupportURL;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_crash);
|
||||||
|
|
||||||
|
// Reads the crash information
|
||||||
|
Bundle bundle = getIntent().getExtras();
|
||||||
|
if (bundle != null) {
|
||||||
|
if (bundle.containsKey(EXTRA_FLAG_CRASH_MESSAGE))
|
||||||
|
mCrashMessage = bundle.getString(EXTRA_FLAG_CRASH_MESSAGE);
|
||||||
|
if (bundle.containsKey(EXTRA_FLAG_CRASH_LOG))
|
||||||
|
mCrashLog = bundle.getString(EXTRA_FLAG_CRASH_LOG);
|
||||||
|
} else {
|
||||||
|
// No information; close activity
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Get the PackageManager to load information about the app
|
||||||
|
PackageManager packageManager = getPackageManager();
|
||||||
|
// Loads the ApplicationInfo with meta data
|
||||||
|
ApplicationInfo applicationInfo = packageManager.getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA);
|
||||||
|
|
||||||
|
if (applicationInfo.metaData != null) {
|
||||||
|
// Reads the crash handler settings from meta data
|
||||||
|
if (applicationInfo.metaData.containsKey("crashhandler.email"))
|
||||||
|
mMetaDataEmail = applicationInfo.metaData.getString("crashhandler.email");
|
||||||
|
if (applicationInfo.metaData.containsKey("crashhandler.supporturl"))
|
||||||
|
mMetaDataSupportURL = applicationInfo.metaData.getString("crashhandler.supporturl");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gets the app name
|
||||||
|
mAppName = packageManager.getApplicationLabel(applicationInfo).toString();
|
||||||
|
// Gets the launch intent for the restart
|
||||||
|
mLaunchIntent = packageManager.getLaunchIntentForPackage(getPackageName());
|
||||||
|
|
||||||
|
} catch (PackageManager.NameNotFoundException ex) {
|
||||||
|
// If this occurs then god must be already dead
|
||||||
|
Logger.getInstance().logError("CrashHandler", ex.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the action bar title
|
||||||
|
ActionBar actionBar = getSupportActionBar();
|
||||||
|
if (actionBar != null) {
|
||||||
|
actionBar.setTitle(getString(R.string.crashhandler_app_has_stopped_working, mAppName));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the message
|
||||||
|
TextView textViewMessage = (TextView) findViewById(R.id.text_view_crash_message);
|
||||||
|
if (textViewMessage != null) {
|
||||||
|
textViewMessage.setText(mCrashLog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
|
getMenuInflater().inflate(R.menu.menu_crash, menu);
|
||||||
|
|
||||||
|
// Hide the email button if there is no crashhandler.email in AndroidManifest.xml
|
||||||
|
menu.findItem(R.id.action_email).setVisible(!TextUtils.isEmpty(mMetaDataEmail));
|
||||||
|
|
||||||
|
// Hide the homepage if there is no crashhandler.supporturl in AndroidManifest.xml
|
||||||
|
menu.findItem(R.id.action_support).setVisible(!TextUtils.isEmpty(mMetaDataSupportURL));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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_restart) {
|
||||||
|
// Close this window
|
||||||
|
finish();
|
||||||
|
|
||||||
|
// Restart the app
|
||||||
|
startActivity(mLaunchIntent);
|
||||||
|
} else if (id == R.id.action_email) {
|
||||||
|
// Send email
|
||||||
|
ShareCompat.IntentBuilder builder = ShareCompat.IntentBuilder.from(this);
|
||||||
|
builder.setType("message/rfc822");
|
||||||
|
builder.addEmailTo(mMetaDataEmail);
|
||||||
|
builder.setSubject("Crash log for " + mAppName);
|
||||||
|
builder.setChooserTitle(R.string.crashhandler_choose_email_title);
|
||||||
|
builder.setText(mCrashLog);
|
||||||
|
builder.startChooser();
|
||||||
|
} else if (id == R.id.action_support) {
|
||||||
|
// Open Homepage
|
||||||
|
Intent intentUrl = new Intent(Intent.ACTION_VIEW, Uri.parse(mMetaDataSupportURL));
|
||||||
|
startActivity(intentUrl);
|
||||||
|
|
||||||
|
} else if (id == R.id.action_close_dialog) {
|
||||||
|
// Close this window
|
||||||
|
finish();
|
||||||
|
} else { // Other
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// One of our items was selected
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,108 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 David Schulte
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.arcus.framework.crashhandler;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
|
||||||
|
import de.arcus.framework.logger.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles crashes of activities and shows a nice dialog with
|
||||||
|
* options to send the developer an email with the crash log
|
||||||
|
*
|
||||||
|
* Use in onCreate in every activity:
|
||||||
|
* CrashHandler.addCrashHandler(this);
|
||||||
|
*
|
||||||
|
* Created by ds on 22.01.2015.
|
||||||
|
*/
|
||||||
|
public class CrashHandler implements Thread.UncaughtExceptionHandler {
|
||||||
|
/**
|
||||||
|
* Activity of the app
|
||||||
|
*/
|
||||||
|
private Activity mActivity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The default crash handler
|
||||||
|
*/
|
||||||
|
private Thread.UncaughtExceptionHandler mDefaultHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Addes a crash handler to the app context
|
||||||
|
* @param activity The activity of the app
|
||||||
|
*/
|
||||||
|
public static void addCrashHandler(Activity activity)
|
||||||
|
{
|
||||||
|
Thread.setDefaultUncaughtExceptionHandler(new CrashHandler(activity));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CrashHandler(Activity activity)
|
||||||
|
{
|
||||||
|
mActivity = activity;
|
||||||
|
mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void uncaughtException(Thread thread, Throwable ex) {
|
||||||
|
// Log crash
|
||||||
|
Logger.getInstance().logError("CrashHandler", ex.toString());
|
||||||
|
|
||||||
|
StringBuilder logBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
// Information
|
||||||
|
logBuilder.append("---------- Information -----------\n");
|
||||||
|
logBuilder.append("PackageName: " + mActivity.getPackageName() + "\n");
|
||||||
|
logBuilder.append("Crashed activity: " + mActivity.getLocalClassName() + "\n");
|
||||||
|
|
||||||
|
logBuilder.append("----------- Exception ------------\n");
|
||||||
|
logBuilder.append(ex.getMessage() + "\n");
|
||||||
|
|
||||||
|
// Log stack trace
|
||||||
|
for (StackTraceElement stackTraceElement : ex.getStackTrace())
|
||||||
|
{
|
||||||
|
logBuilder.append("\t" + stackTraceElement.toString() + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Log Caused by
|
||||||
|
if (ex.getCause() != null) {
|
||||||
|
logBuilder.append("----------- Caused by ------------\n");
|
||||||
|
logBuilder.append(ex.getCause().getMessage() + "\n");
|
||||||
|
|
||||||
|
// Log stack trace
|
||||||
|
for (StackTraceElement stackTraceElement : ex.getCause().getStackTrace())
|
||||||
|
{
|
||||||
|
logBuilder.append("\t" + stackTraceElement.toString() + "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Opens a crash window
|
||||||
|
Intent intendCrash = new Intent(mActivity, CrashActivity.class);
|
||||||
|
intendCrash.putExtra(CrashActivity.EXTRA_FLAG_CRASH_MESSAGE, ex.getMessage());
|
||||||
|
intendCrash.putExtra(CrashActivity.EXTRA_FLAG_CRASH_LOG, logBuilder.toString());
|
||||||
|
intendCrash.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
|
mActivity.startActivity(intendCrash);
|
||||||
|
|
||||||
|
// Close this app
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
}
|
229
framework/src/main/java/de/arcus/framework/logger/Logger.java
Normal file
229
framework/src/main/java/de/arcus/framework/logger/Logger.java
Normal file
|
@ -0,0 +1,229 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 David Schulte
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.arcus.framework.logger;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.Queue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper class to write into a log file and to logcat
|
||||||
|
*/
|
||||||
|
public class Logger {
|
||||||
|
/**
|
||||||
|
* Type of the log entry
|
||||||
|
*/
|
||||||
|
public enum LogEntryType { Verbose, Debug, Info, Warning, Error };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instance of the logger
|
||||||
|
*/
|
||||||
|
private static Logger instance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the active instance of the Logger
|
||||||
|
* Creates an instance if not exists
|
||||||
|
* @return Gets the logger
|
||||||
|
*/
|
||||||
|
public static Logger getInstance() {
|
||||||
|
// Create new Instance
|
||||||
|
if (instance == null)
|
||||||
|
instance = new Logger();
|
||||||
|
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of all entries
|
||||||
|
*/
|
||||||
|
private Queue<LogEntry> mEntryList = new LinkedList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Gets the entry list
|
||||||
|
*/
|
||||||
|
public Queue<LogEntry> getEntryList() {
|
||||||
|
return mEntryList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The minimum level to log messages
|
||||||
|
*/
|
||||||
|
private LogEntryType mLogLevel = LogEntryType.Debug;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Gets the log level
|
||||||
|
*/
|
||||||
|
public LogEntryType getLogLevel() {
|
||||||
|
return mLogLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the log level
|
||||||
|
* @param type The minimal log level to log messages
|
||||||
|
*/
|
||||||
|
public void setLogLevel(LogEntryType type) {
|
||||||
|
mLogLevel = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a verbose entry to the log
|
||||||
|
* @param tag Tag of the log entry (function or section)
|
||||||
|
* @param message Message of the log entry
|
||||||
|
*/
|
||||||
|
public void logVerbose(String tag, String message) {
|
||||||
|
log(LogEntryType.Verbose, tag, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a debug entry to the log
|
||||||
|
* @param tag Tag of the log entry (function or section)
|
||||||
|
* @param message Message of the log entry
|
||||||
|
*/
|
||||||
|
public void logDebug(String tag, String message) {
|
||||||
|
log(LogEntryType.Debug, tag, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a info entry to the log
|
||||||
|
* @param tag Tag of the log entry (function or section)
|
||||||
|
* @param message Message of the log entry
|
||||||
|
*/
|
||||||
|
public void logInfo(String tag, String message) {
|
||||||
|
log(LogEntryType.Info, tag, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a warning entry to the log
|
||||||
|
* @param tag Tag of the log entry (function or section)
|
||||||
|
* @param message Message of the log entry
|
||||||
|
*/
|
||||||
|
public void logWarning(String tag, String message) {
|
||||||
|
log(LogEntryType.Warning, tag, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a error entry to the log
|
||||||
|
* @param tag Tag of the log entry (function or section)
|
||||||
|
* @param message Message of the log entry
|
||||||
|
*/
|
||||||
|
public void logError(String tag, String message) {
|
||||||
|
log(LogEntryType.Error, tag, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a entry to the log
|
||||||
|
* @param type Entry type (Debug, Info, Warning, Error)
|
||||||
|
* @param tag Tag of the log entry (function or section)
|
||||||
|
* @param message Message of the log entry
|
||||||
|
*/
|
||||||
|
private void log(LogEntryType type, String tag, String message) {
|
||||||
|
// Entry type will be logged
|
||||||
|
if (type.ordinal() >= mLogLevel.ordinal())
|
||||||
|
{
|
||||||
|
LogEntry logEntry = new LogEntry(type, tag, message);
|
||||||
|
|
||||||
|
// LogCat
|
||||||
|
logEntry.writeToLogCat();
|
||||||
|
|
||||||
|
// Push entry to list
|
||||||
|
mEntryList.add(logEntry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A single log entry
|
||||||
|
*/
|
||||||
|
public class LogEntry {
|
||||||
|
/**
|
||||||
|
* Type of the log entry
|
||||||
|
*/
|
||||||
|
private LogEntryType mType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tag of the log entry
|
||||||
|
*/
|
||||||
|
private String mTag;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message of the log entry
|
||||||
|
*/
|
||||||
|
private String mMessage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Gets the Type of the log entry
|
||||||
|
*/
|
||||||
|
public LogEntryType getType() {
|
||||||
|
return mType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Gets the tag of the log entry
|
||||||
|
*/
|
||||||
|
public String getTag() {
|
||||||
|
return mTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Gets the message of the log entry
|
||||||
|
*/
|
||||||
|
public String getMessage() {
|
||||||
|
return mMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a log entry
|
||||||
|
* @param type Entry type (Debug, Info, Warning, Error)
|
||||||
|
* @param tag Tag of the log entry (function or section)
|
||||||
|
* @param message Message of the log entry
|
||||||
|
*/
|
||||||
|
public LogEntry(LogEntryType type, String tag, String message) {
|
||||||
|
mType = type;
|
||||||
|
mTag = tag;
|
||||||
|
mMessage = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes the entry to logcat
|
||||||
|
*/
|
||||||
|
public void writeToLogCat() {
|
||||||
|
switch (mType) {
|
||||||
|
case Verbose:
|
||||||
|
Log.v(mTag, mMessage);
|
||||||
|
break;
|
||||||
|
case Debug:
|
||||||
|
Log.d(mTag, mMessage);
|
||||||
|
break;
|
||||||
|
case Info:
|
||||||
|
Log.i(mTag, mMessage);
|
||||||
|
break;
|
||||||
|
case Warning:
|
||||||
|
Log.w(mTag, mMessage);
|
||||||
|
break;
|
||||||
|
case Error:
|
||||||
|
Log.e(mTag, mMessage);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,209 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 David Schulte
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.arcus.framework.settings;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper class to read and write app settings without to care about to open and close an editor
|
||||||
|
*/
|
||||||
|
public class AppSettings {
|
||||||
|
/**
|
||||||
|
* The default settings file
|
||||||
|
*/
|
||||||
|
private static final String DEFAULT_SETTINGS_FILENAME = "app_settings";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The preferences
|
||||||
|
*/
|
||||||
|
private SharedPreferences mSharedPreferences;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of AppSettings that access to the default settings file
|
||||||
|
* @param context Context of the app
|
||||||
|
*/
|
||||||
|
public AppSettings(Context context) {
|
||||||
|
this(context, DEFAULT_SETTINGS_FILENAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of AppSettings that access to a specific settings file
|
||||||
|
* @param context Context of the app
|
||||||
|
*/
|
||||||
|
public AppSettings(Context context, String settingsFilename) {
|
||||||
|
mSharedPreferences = context.getSharedPreferences(settingsFilename, Context.MODE_PRIVATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a string from the settings
|
||||||
|
* @param key Key of the setting
|
||||||
|
* @param defValue Default value which is returned if the key doesn't exists
|
||||||
|
* @return Value
|
||||||
|
*/
|
||||||
|
public String getString(String key, String defValue) {
|
||||||
|
return mSharedPreferences.getString(key, defValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a boolean from the settings
|
||||||
|
* @param key Key of the setting
|
||||||
|
* @param defValue Default value which is returned if the key doesn't exists
|
||||||
|
* @return Value
|
||||||
|
*/
|
||||||
|
public boolean getBoolean(String key, boolean defValue) {
|
||||||
|
return mSharedPreferences.getBoolean(key, defValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a float from the settings
|
||||||
|
* @param key Key of the setting
|
||||||
|
* @param defValue Default value which is returned if the key doesn't exists
|
||||||
|
* @return Value
|
||||||
|
*/
|
||||||
|
public float getFloat(String key, float defValue) {
|
||||||
|
return mSharedPreferences.getFloat(key, defValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets an int from the settings
|
||||||
|
* @param key Key of the setting
|
||||||
|
* @param defValue Default value which is returned if the key doesn't exists
|
||||||
|
* @return Value
|
||||||
|
*/
|
||||||
|
public int getInt(String key, int defValue) {
|
||||||
|
return mSharedPreferences.getInt(key, defValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets a long from the settings
|
||||||
|
* @param key Key of the setting
|
||||||
|
* @param defValue Default value which is returned if the key doesn't exists
|
||||||
|
* @return Value
|
||||||
|
*/
|
||||||
|
public long getLong(String key, long defValue) {
|
||||||
|
return mSharedPreferences.getLong(key, defValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the settings contains a specific key
|
||||||
|
* @param key Key of the setting
|
||||||
|
* @return Returns whether the settings contains a specific key
|
||||||
|
*/
|
||||||
|
public boolean contains(String key) {
|
||||||
|
return mSharedPreferences.contains(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes an setting from the settings
|
||||||
|
* @param key Key of the setting
|
||||||
|
*/
|
||||||
|
public void remove(String key) {
|
||||||
|
// Opens the editor
|
||||||
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
|
|
||||||
|
// Removes the key
|
||||||
|
editor.remove(key);
|
||||||
|
|
||||||
|
// Commits the change
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves a string to the settings
|
||||||
|
* @param key Key of the setting
|
||||||
|
* @param value Value
|
||||||
|
*/
|
||||||
|
public void setString(String key, String value) {
|
||||||
|
// Opens the editor
|
||||||
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
|
|
||||||
|
editor.putString(key, value);
|
||||||
|
|
||||||
|
// Commits the change
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves a boolean to the settings
|
||||||
|
* @param key Key of the setting
|
||||||
|
* @param value Value
|
||||||
|
*/
|
||||||
|
public void setBoolean(String key, boolean value) {
|
||||||
|
// Opens the editor
|
||||||
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
|
|
||||||
|
editor.putBoolean(key, value);
|
||||||
|
|
||||||
|
// Commits the change
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves a float to the settings
|
||||||
|
* @param key Key of the setting
|
||||||
|
* @param value Value
|
||||||
|
*/
|
||||||
|
public void setFloat(String key, float value) {
|
||||||
|
// Opens the editor
|
||||||
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
|
|
||||||
|
editor.putFloat(key, value);
|
||||||
|
|
||||||
|
// Commits the change
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves an int to the settings
|
||||||
|
* @param key Key of the setting
|
||||||
|
* @param value Value
|
||||||
|
*/
|
||||||
|
public void setInt(String key, int value) {
|
||||||
|
// Opens the editor
|
||||||
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
|
|
||||||
|
editor.putInt(key, value);
|
||||||
|
|
||||||
|
// Commits the change
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves a long to the settings
|
||||||
|
* @param key Key of the setting
|
||||||
|
* @param value Value
|
||||||
|
*/
|
||||||
|
public void setLong(String key, long value) {
|
||||||
|
// Opens the editor
|
||||||
|
SharedPreferences.Editor editor = mSharedPreferences.edit();
|
||||||
|
|
||||||
|
editor.putLong(key, value);
|
||||||
|
|
||||||
|
// Commits the change
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.arcus.framework.superuser;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The superuser managers
|
||||||
|
*
|
||||||
|
* This static class handles the superuser session.
|
||||||
|
* Start the session with {@link #askForPermissions() askForPermissions}.
|
||||||
|
* To run a command create an instance of {@link SuperUserCommand SuperUserCommand} and {@link SuperUserCommand#execute() execute} it.
|
||||||
|
*/
|
||||||
|
public class SuperUser {
|
||||||
|
/**
|
||||||
|
* The su process
|
||||||
|
*/
|
||||||
|
private static Process mProcess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the active su process
|
||||||
|
* @return Process
|
||||||
|
*/
|
||||||
|
static Process getProcess() {
|
||||||
|
return mProcess;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts the superuser session
|
||||||
|
* To start the session in your app use {@link #askForPermissions()}
|
||||||
|
*/
|
||||||
|
private static boolean sessionStart() {
|
||||||
|
// Starts the su process
|
||||||
|
try {
|
||||||
|
mProcess = Runtime.getRuntime().exec("su");
|
||||||
|
return true;
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops the superuser session
|
||||||
|
*/
|
||||||
|
public static void sessionStop() {
|
||||||
|
if (mProcess == null) return;
|
||||||
|
|
||||||
|
// End the process
|
||||||
|
mProcess.destroy();
|
||||||
|
mProcess = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets whether the su session is running
|
||||||
|
* @return Return whether the su session is running
|
||||||
|
*/
|
||||||
|
public static boolean sessionIsRunning() {
|
||||||
|
if (mProcess == null) return false;
|
||||||
|
|
||||||
|
// Hack to see if the process is running
|
||||||
|
// This is not nice, but there is no other way to check this
|
||||||
|
try {
|
||||||
|
mProcess.exitValue();
|
||||||
|
return false;
|
||||||
|
} catch(IllegalThreadStateException ex) {
|
||||||
|
// Could not get the return value => process is running
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks whether superuser permissions were granted
|
||||||
|
* @return Return whether superuser permissions were granted
|
||||||
|
*/
|
||||||
|
public static boolean hasPermissions() {
|
||||||
|
// Just check whether the session is running
|
||||||
|
return sessionIsRunning();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is like hasPermissions() but asks for the superuser permissions
|
||||||
|
* and give the user a change to grant it now.
|
||||||
|
* Use this to start you session
|
||||||
|
* @return Return whether superuser permissions were granted
|
||||||
|
*/
|
||||||
|
public static boolean askForPermissions() {
|
||||||
|
// We already have superuser permissions
|
||||||
|
if (hasPermissions()) return true;
|
||||||
|
|
||||||
|
// Starts the process
|
||||||
|
if (sessionStart()) {
|
||||||
|
// Test for superuser
|
||||||
|
SuperUserCommand superUserCommand = new SuperUserCommand("whoami");
|
||||||
|
if (superUserCommand.execute()) {
|
||||||
|
// Gets the whoami username
|
||||||
|
String[] output = superUserCommand.getStandardOutput();
|
||||||
|
if (output.length >= 1 && output[0].equals("root")) {
|
||||||
|
// We are root
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We don't have superuser permissions; abort session
|
||||||
|
sessionStop();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,197 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package de.arcus.framework.superuser;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class executes superuser commands.
|
||||||
|
*/
|
||||||
|
public class SuperUserCommand {
|
||||||
|
/**
|
||||||
|
* The default timeout for each command in milliseconds
|
||||||
|
*/
|
||||||
|
private static final long DEFAULT_COMMAND_TIMEOUT = 30 * 1000; // 30 seconds
|
||||||
|
|
||||||
|
private String[] mCommands = new String[] {};
|
||||||
|
private String[] mOutputStandard = new String[] {};
|
||||||
|
private String[] mOutputError = new String[] {};
|
||||||
|
|
||||||
|
private boolean mSuperUserFailed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The timeout for this command in milliseconds
|
||||||
|
*/
|
||||||
|
private long mTimeout;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Gets the timeout for this command in milliseconds
|
||||||
|
*/
|
||||||
|
public long getTimeout() {
|
||||||
|
return mTimeout;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the timeout for this command in milliseconds
|
||||||
|
* @param timeout Timeout
|
||||||
|
* @return Itself
|
||||||
|
*/
|
||||||
|
public SuperUserCommand setTimeout(long timeout) {
|
||||||
|
mTimeout = timeout;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Gets the executed commands
|
||||||
|
*/
|
||||||
|
public String[] getCommands() {
|
||||||
|
return mCommands;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Get the standard output
|
||||||
|
*/
|
||||||
|
public String[] getStandardOutput() {
|
||||||
|
return mOutputStandard;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Get the error output
|
||||||
|
*/
|
||||||
|
public String[] getErrorOutput() {
|
||||||
|
return mOutputError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Gets whether the command was executed without errors, even without error outputs from the command.
|
||||||
|
*/
|
||||||
|
public boolean commandWasSuccessful() {
|
||||||
|
return (!mSuperUserFailed && mOutputError.length == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Gets whether the command was granted superuser permissions, but maybe has some error outputs.
|
||||||
|
*/
|
||||||
|
public boolean superuserWasSuccessful() {
|
||||||
|
return (!mSuperUserFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a command with one command line
|
||||||
|
* @param command The command
|
||||||
|
*/
|
||||||
|
public SuperUserCommand(String command) {
|
||||||
|
this(new String[] {command});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a command with multiple command lines
|
||||||
|
* @param commands The command lines
|
||||||
|
*/
|
||||||
|
public SuperUserCommand(String[] commands) {
|
||||||
|
mCommands = commands;
|
||||||
|
|
||||||
|
// Default timeout
|
||||||
|
mTimeout = DEFAULT_COMMAND_TIMEOUT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the command and return whether the command was executed.
|
||||||
|
* It will only return false if the app wasn't granted superuser permissions, like {@link #superuserWasSuccessful()}.
|
||||||
|
* It will also return true if the command itself returns error outputs. To check this case you should use {@link #commandWasSuccessful()} instead.
|
||||||
|
* @return Gets whether the execution was successful.
|
||||||
|
*/
|
||||||
|
public boolean execute() {
|
||||||
|
String tmpLine;
|
||||||
|
List<String> tmpList = new ArrayList<>();
|
||||||
|
|
||||||
|
mSuperUserFailed = false;
|
||||||
|
|
||||||
|
// Opps, we don't have superuser permissions
|
||||||
|
// Did you run SuperUser.askForPermissions()?
|
||||||
|
if (!SuperUser.hasPermissions()) {
|
||||||
|
mSuperUserFailed = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Gets the streams
|
||||||
|
DataOutputStream dataOutputStream = new DataOutputStream(SuperUser.getProcess().getOutputStream());
|
||||||
|
BufferedReader bufferedInputReader = new BufferedReader(new InputStreamReader(SuperUser.getProcess().getInputStream()));
|
||||||
|
BufferedReader bufferedErrorReader = new BufferedReader(new InputStreamReader(SuperUser.getProcess().getErrorStream()));
|
||||||
|
|
||||||
|
// Sends the command
|
||||||
|
for (String command : mCommands)
|
||||||
|
dataOutputStream.writeBytes(command + "\n");
|
||||||
|
dataOutputStream.flush();
|
||||||
|
|
||||||
|
// TODO: This class cannot execute commands without any output (standard and error). These commands will run until the timeout will kill them!
|
||||||
|
|
||||||
|
// Start waiting
|
||||||
|
long timeStarted = System.currentTimeMillis();
|
||||||
|
|
||||||
|
// Wait for first data
|
||||||
|
while (!bufferedInputReader.ready() && !bufferedErrorReader.ready()) {
|
||||||
|
try {
|
||||||
|
// Waiting
|
||||||
|
Thread.sleep(10);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
long timeNow = System.currentTimeMillis();
|
||||||
|
|
||||||
|
// TimeOut
|
||||||
|
if (timeNow - timeStarted >= mTimeout) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reads the standard output
|
||||||
|
tmpList.clear();
|
||||||
|
while (bufferedInputReader.ready()) {
|
||||||
|
tmpLine = bufferedInputReader.readLine();
|
||||||
|
|
||||||
|
// End of data
|
||||||
|
if (tmpLine == null) break;
|
||||||
|
|
||||||
|
Log.i("SuperUser", "> " + tmpLine);
|
||||||
|
tmpList.add(tmpLine);
|
||||||
|
}
|
||||||
|
// Convert list to array
|
||||||
|
mOutputStandard = tmpList.toArray(new String[tmpList.size()]);
|
||||||
|
|
||||||
|
|
||||||
|
// Reads the error output
|
||||||
|
tmpList.clear();
|
||||||
|
while (bufferedErrorReader.ready()) {
|
||||||
|
tmpLine = bufferedErrorReader.readLine();
|
||||||
|
|
||||||
|
// End of data
|
||||||
|
if (tmpLine == null) break;
|
||||||
|
Log.e("SuperUser", "> " + tmpLine);
|
||||||
|
|
||||||
|
tmpList.add(tmpLine);
|
||||||
|
}
|
||||||
|
// Convert list to array
|
||||||
|
mOutputError = tmpList.toArray(new String[tmpList.size()]);
|
||||||
|
|
||||||
|
// Done
|
||||||
|
return true;
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
mSuperUserFailed = true;
|
||||||
|
|
||||||
|
// Command failed
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
45
framework/src/main/res/layout/activity_crash.xml
Normal file
45
framework/src/main/res/layout/activity_crash.xml
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2015 David Schulte
|
||||||
|
~
|
||||||
|
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
~ of this software and associated documentation files (the "Software"), to deal
|
||||||
|
~ in the Software without restriction, including without limitation the rights
|
||||||
|
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
|
~ furnished to do so, subject to the following conditions:
|
||||||
|
~
|
||||||
|
~ The above copyright notice and this permission notice shall be included in
|
||||||
|
~ all copies or substantial portions of the Software.
|
||||||
|
~
|
||||||
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
~ THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<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"
|
||||||
|
tools:context="de.arcus.framework.crashhandler.CrashActivity">
|
||||||
|
|
||||||
|
<ScrollView
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:id="@+id/scrollView">
|
||||||
|
|
||||||
|
<TextView android:text="@string/crashhandler_log" android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/text_view_crash_message"
|
||||||
|
android:textIsSelectable="true"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
|
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||||
|
android:typeface="monospace" />
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
35
framework/src/main/res/menu/menu_crash.xml
Normal file
35
framework/src/main/res/menu/menu_crash.xml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2015 David Schulte
|
||||||
|
~
|
||||||
|
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
~ of this software and associated documentation files (the "Software"), to deal
|
||||||
|
~ in the Software without restriction, including without limitation the rights
|
||||||
|
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
|
~ furnished to do so, subject to the following conditions:
|
||||||
|
~
|
||||||
|
~ The above copyright notice and this permission notice shall be included in
|
||||||
|
~ all copies or substantial portions of the Software.
|
||||||
|
~
|
||||||
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
~ THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools" tools:context="de.arcus.framework.crashhandler.CrashActivity">
|
||||||
|
<item android:id="@+id/action_restart" android:title="@string/crashhandler_action_restart"
|
||||||
|
android:orderInCategory="100" app:showAsAction="never" />
|
||||||
|
<item android:id="@+id/action_email" android:title="@string/crashhandler_action_email_log"
|
||||||
|
android:orderInCategory="101" app:showAsAction="never" />
|
||||||
|
<item android:id="@+id/action_support" android:title="@string/crashhandler_action_support_homepage"
|
||||||
|
android:orderInCategory="102" app:showAsAction="never" />
|
||||||
|
<item android:id="@+id/action_close_dialog" android:title="@string/crashhandler_action_close_dialog"
|
||||||
|
android:orderInCategory="103" app:showAsAction="never" />
|
||||||
|
</menu>
|
17
framework/src/main/res/values-de/strings_crashhandler.xml
Normal file
17
framework/src/main/res/values-de/strings_crashhandler.xml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2015.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<string name="crashhandler_app_has_stopped_working">%1$s funktioniert nicht mehr!</string>
|
||||||
|
|
||||||
|
<string name="crashhandler_log">Bericht</string>
|
||||||
|
|
||||||
|
<string name="crashhandler_choose_email_title">Absturzbericht senden</string>
|
||||||
|
|
||||||
|
<string name="crashhandler_action_restart">App neustarten</string>
|
||||||
|
<string name="crashhandler_action_email_log">Bereicht per E-Mail senden</string>
|
||||||
|
<string name="crashhandler_action_support_homepage">Support-Homepage öffnen</string>
|
||||||
|
<string name="crashhandler_action_close_dialog">Schließen</string>
|
||||||
|
</resources>
|
6
framework/src/main/res/values-w820dp/dimens.xml
Normal file
6
framework/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>
|
5
framework/src/main/res/values/dimens.xml
Normal file
5
framework/src/main/res/values/dimens.xml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<resources>
|
||||||
|
<!-- Default screen margins, per the Android Design guidelines. -->
|
||||||
|
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||||
|
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||||
|
</resources>
|
35
framework/src/main/res/values/strings_crashhandler.xml
Normal file
35
framework/src/main/res/values/strings_crashhandler.xml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2015 David Schulte
|
||||||
|
~
|
||||||
|
~ Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
~ of this software and associated documentation files (the "Software"), to deal
|
||||||
|
~ in the Software without restriction, including without limitation the rights
|
||||||
|
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
~ copies of the Software, and to permit persons to whom the Software is
|
||||||
|
~ furnished to do so, subject to the following conditions:
|
||||||
|
~
|
||||||
|
~ The above copyright notice and this permission notice shall be included in
|
||||||
|
~ all copies or substantial portions of the Software.
|
||||||
|
~
|
||||||
|
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
~ THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<string name="crashhandler_app_has_stopped_working">%1$s has stopped working!</string>
|
||||||
|
|
||||||
|
<string name="crashhandler_log">Log</string>
|
||||||
|
|
||||||
|
<string name="crashhandler_choose_email_title">Send crash log</string>
|
||||||
|
|
||||||
|
<string name="crashhandler_action_restart">Restart app</string>
|
||||||
|
<string name="crashhandler_action_email_log">Send log via email</string>
|
||||||
|
<string name="crashhandler_action_support_homepage">Open support homepage</string>
|
||||||
|
<string name="crashhandler_action_close_dialog">Close</string>
|
||||||
|
</resources>
|
40
gradle.properties
Normal file
40
gradle.properties
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 2015 David Schulte
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in
|
||||||
|
# all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
# THE SOFTWARE.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Project-wide Gradle settings.
|
||||||
|
|
||||||
|
# IDE (e.g. Android Studio) users:
|
||||||
|
# Gradle settings configured through the IDE *will override*
|
||||||
|
# any settings specified in this file.
|
||||||
|
|
||||||
|
# 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
|
28
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
28
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 2015 David Schulte
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in
|
||||||
|
# all copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
# THE SOFTWARE.
|
||||||
|
#
|
||||||
|
|
||||||
|
#Wed Apr 10 15:27:10 PDT 2013
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
|
23
settings.gradle
Normal file
23
settings.gradle
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015 David Schulte
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
include ':app', ':framework'
|
Loading…
Reference in a new issue