add licences

This commit is contained in:
tibbi 2016-06-02 18:12:31 +02:00
parent 2129cce372
commit 4257306521
6 changed files with 91 additions and 6 deletions

View File

@ -34,10 +34,15 @@
android:label="@string/about" android:label="@string/about"
android:screenOrientation="portrait"/> android:screenOrientation="portrait"/>
<activity
android:name=".LicenseActivity"
android:label="@string/third_party_licences"
android:screenOrientation="portrait"/>
<receiver <receiver
android:name=".MyWidgetProvider" android:name=".MyWidgetProvider"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="Simple Flashlight"> android:label="@string/app_name">
<intent-filter> <intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/> <action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
</intent-filter> </intent-filter>

View File

@ -1,5 +1,6 @@
package com.simplemobiletools.flashlight; package com.simplemobiletools.flashlight;
import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
@ -11,6 +12,7 @@ import java.util.Calendar;
import butterknife.BindView; import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
import butterknife.OnClick;
public class AboutActivity extends AppCompatActivity { public class AboutActivity extends AppCompatActivity {
@BindView(R.id.about_copyright) TextView copyright; @BindView(R.id.about_copyright) TextView copyright;
@ -49,4 +51,10 @@ public class AboutActivity extends AppCompatActivity {
final String copyrightText = String.format(res.getString(R.string.copyright), year); final String copyrightText = String.format(res.getString(R.string.copyright), year);
copyright.setText(copyrightText); copyright.setText(copyrightText);
} }
@OnClick(R.id.about_license)
public void licenseClicked() {
final Intent intent = new Intent(getApplicationContext(), LicenseActivity.class);
startActivity(intent);
}
} }

View File

@ -0,0 +1,28 @@
package com.simplemobiletools.flashlight;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class LicenseActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_license);
ButterKnife.bind(this);
}
@OnClick(R.id.license_butterknife_title)
public void butterKnifeClicked() {
openUrl(getResources().getString(R.string.butterknife_url));
}
private void openUrl(String url) {
final Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browserIntent);
}
}

View File

@ -33,8 +33,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/about_email" android:layout_below="@+id/about_email"
android:layout_marginTop="@dimen/activity_margin" android:paddingBottom="@dimen/activity_margin"
android:text="@string/license"/> android:paddingTop="@dimen/activity_margin"
android:text="@string/third_party_licences_underlined"
android:textColor="@color/colorPrimary"/>
<TextView <TextView
android:id="@+id/about_version" android:id="@+id/about_version"

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
android:id="@+id/license_holder"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/license"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/activity_margin">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/notice"/>
<TextView
android:id="@+id/license_butterknife_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_margin"
android:text="@string/butterknife_title"
android:textColor="@color/colorPrimary"/>
<TextView
android:id="@+id/license_butterknife_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/butterknife_text"/>
</LinearLayout>
</ScrollView>

View File

@ -4,10 +4,17 @@
<!-- About --> <!-- About -->
<string name="about">About</string> <string name="about">About</string>
<string name="website">For more simple apps please visit:\nhttp://simplemobiletools.com</string> <string name="website">For more simple apps or source codes please visit:\nhttp://simplemobiletools.com</string>
<string name="email_label">You can send your feedback and new app suggestions at:</string> <string name="email_label">You can send your feedback or new app suggestions at:</string>
<string name="email">hello@simplemobiletools.com</string> <string name="email">hello@simplemobiletools.com</string>
<string name="license">License</string> <string name="third_party_licences_underlined"><u>Third party licences</u></string>
<string name="version">v %1$s</string> <string name="version">v %1$s</string>
<string name="copyright">Copyright © Simple Mobile Tools %1$d</string> <string name="copyright">Copyright © Simple Mobile Tools %1$d</string>
<!--License-->
<string name="notice">This app uses the following third party libraries to make my life easier. Thank you.</string>
<string name="third_party_licences">Third party licences</string>
<string name="butterknife_title">Butter Knife (view injector)</string>
<string name="butterknife_text">Copyright 2013 Jake Wharton\n\nLicensed 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\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless 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.</string>
<string name="butterknife_url">https://github.com/JakeWharton/butterknife</string>
</resources> </resources>