Skip to content
This repository was archived by the owner on Aug 8, 2021. It is now read-only.

Commit

Permalink
Tasker plugin support end Portuguese translation
Browse files Browse the repository at this point in the history
  • Loading branch information
FernandoWahl committed Mar 21, 2015
1 parent 4878b27 commit e8534e4
Show file tree
Hide file tree
Showing 61 changed files with 1,866 additions and 3 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,5 @@ Disclaimer: This app includes no warranty for your device, in my testing I've ne
- Tests

##Future:

- Tasker plugin support
- Pull in more data from the band
- Maybe integrate with Google Fit?
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ dependencies {
compile('com.android.support:palette-v7:21.0.+')
compile('com.google.code.gson:gson:2.3.1')
compile('com.melnykov:floatingactionbutton:1.1.0')
compile project(":localeapi")
androidTestCompile('junit:junit:4.12')
}

Expand Down
12 changes: 11 additions & 1 deletion local.properties
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
sdk.dir=/usr/local/android-sdk
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Thu Mar 19 15:04:33 BRT 2015
sdk.dir=C\:\\Users\\Fernando Wahl\\AppData\\Local\\Android\\sdk
18 changes: 18 additions & 0 deletions localeapi/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 17
buildToolsVersion "21.1.2"

defaultConfig {
minSdkVersion 3
targetSdkVersion 17
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
3 changes: 3 additions & 0 deletions localeapi/lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<lint>
</lint>
13 changes: 13 additions & 0 deletions localeapi/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.twofortyfouram.locale.api" >

<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="17" />

<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* Copyright 2013 two forty four a.m. LLC <http://www.twofortyfouram.com>
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* <http://www.apache.org/licenses/LICENSE-2.0>
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations under the License.
*/

package com.twofortyfouram.locale;

import android.content.Context;
import android.content.Intent;
import android.util.Log;

import com.twofortyfouram.locale.api.R;

/**
* Utility class to generate a breadcrumb title string for {@code Activity} instances in Locale.
* <p>
* This class cannot be instantiated.
*/
public final class BreadCrumber
{
/**
* Static helper method to generate bread crumbs. Bread crumb strings will be properly formatted for the
* current language, including right-to-left languages, as long as the proper
* {@link com.twofortyfouram.locale.platform.R.string#twofortyfouram_locale_breadcrumb_format} string
* resources have been created.
*
* @param context {@code Context} for loading platform resources. Cannot be null.
* @param intent {@code Intent} to extract the bread crumb from.
* @param currentCrumb The last element of the bread crumb path.
* @return {@code String} presentation of the bread crumb. If the intent parameter is null, then this
* method returns currentCrumb. If currentCrumb is null, then this method returns the empty string
* "". If intent contains a private Serializable instances as an extra, then this method returns
* the empty string "".
* @throws IllegalArgumentException if {@code context} is null.
*/
public static CharSequence generateBreadcrumb(final Context context, final Intent intent,
final String currentCrumb)
{
if (null == context)
{
throw new IllegalArgumentException("context cannot be null"); //$NON-NLS-1$
}

try
{
if (null == currentCrumb)
{
Log.w(Constants.LOG_TAG, "currentCrumb cannot be null"); //$NON-NLS-1$
return ""; //$NON-NLS-1$
}
if (null == intent)
{
Log.w(Constants.LOG_TAG, "intent cannot be null"); //$NON-NLS-1$
return currentCrumb;
}

/*
* Note: this is vulnerable to a private serializable attack, but the try-catch will solve that.
*/
final String breadcrumbString = intent.getStringExtra(com.twofortyfouram.locale.Intent.EXTRA_STRING_BREADCRUMB);
if (null != breadcrumbString)
{
return context.getString(R.string.twofortyfouram_locale_breadcrumb_format, breadcrumbString, context.getString(R.string.twofortyfouram_locale_breadcrumb_separator), currentCrumb);
}
return currentCrumb;
}
catch (final Exception e)
{
Log.e(Constants.LOG_TAG, "Encountered error generating breadcrumb", e); //$NON-NLS-1$
return ""; //$NON-NLS-1$
}
}

/**
* Private constructor prevents instantiation.
*
* @throws UnsupportedOperationException because this class cannot be instantiated.
*/
private BreadCrumber()
{
throw new UnsupportedOperationException("This class is non-instantiable"); //$NON-NLS-1$
}
}
48 changes: 48 additions & 0 deletions localeapi/src/main/java/com/twofortyfouram/locale/Constants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright 2013 two forty four a.m. LLC <http://www.twofortyfouram.com>
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* <http://www.apache.org/licenses/LICENSE-2.0>
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is
* distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations under the License.
*/

package com.twofortyfouram.locale;

/**
* Utility class containing constants for the Locale Developer Platform.
*/
/*
* This class is NOT part of the public API.
*/
/* package */final class Constants
{
/**
* Log tag for logcat messages generated by the Locale Developer Platform
*/
/*
* This is NOT a public API. Third party apps should NOT use this log tag for their own log messages.
*/
/* package */static final String LOG_TAG = "LocaleApiLibrary"; //$NON-NLS-1$

/**
* String package name for Locale.
*/
/*
* This is NOT a public API. Third parties should NOT rely on this being the only package name for Locale.
*/
/* package */static final String LOCALE_PACKAGE = "com.twofortyfouram.locale"; //$NON-NLS-1$

/**
* Private constructor prevents instantiation
*
* @throws UnsupportedOperationException because this class cannot be instantiated.
*/
private Constants()
{
throw new UnsupportedOperationException("This class is non-instantiable"); //$NON-NLS-1$
}
}
Loading

0 comments on commit e8534e4

Please sign in to comment.