Browse Source

create PreferenceCategory for licenses

master
DF1E 9 years ago
parent
commit
1d5b904c64
  1. 11
      app/src/main/AndroidManifest.xml
  2. 72
      app/src/main/java/acr/browser/lightning/activity/LicenseActivity.java
  3. 200
      app/src/main/res/layout/license_activity.xml
  4. 44
      app/src/main/res/xml/preference_about.xml

11
app/src/main/AndroidManifest.xml

@ -119,17 +119,6 @@ @@ -119,17 +119,6 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".activity.LicenseActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
android:label="@string/licenses"
android:theme="@style/Theme.SettingsTheme" >
<intent-filter>
<action android:name="android.intent.action.LICENSE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".activity.ReadingActivity"
android:configChanges="orientation|screenSize|keyboardHidden|keyboard"

72
app/src/main/java/acr/browser/lightning/activity/LicenseActivity.java

@ -1,72 +0,0 @@ @@ -1,72 +0,0 @@
/*
* Copyright 2014 A.C.R. Development
*/
package acr.browser.lightning.activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import android.view.View;
import acr.browser.lightning.R;
/*
*NOTE: This activity must not be removed in order to comply with the Mozilla Public License v. 2.0
*under which this code is licensed. Unless you plan on providing other attribution in the app to
*the original source in another visible way, it is advised against the removal of this Activity.
*/
public class LicenseActivity extends ThemableSettingsActivity implements View.OnClickListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.license_activity);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
findViewById(R.id.browserLicense).setOnClickListener(this);
findViewById(R.id.licenseAOSP).setOnClickListener(this);
findViewById(R.id.licenseHosts).setOnClickListener(this);
findViewById(R.id.licenseOrbot).setOnClickListener(this);
findViewById(R.id.licenseSnactory).setOnClickListener(this);
findViewById(R.id.licenseJsoup).setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.browserLicense:
actionView("http://www.mozilla.org/MPL/2.0/");
break;
case R.id.licenseAOSP:
actionView("http://www.apache.org/licenses/LICENSE-2.0");
break;
case R.id.licenseHosts:
actionView("http://hosts-file.net/");
break;
case R.id.licenseOrbot:
actionView("http://www.gnu.org/licenses/lgpl.html");
break;
case R.id.licenseSnactory:
actionView("http://www.apache.org/licenses/LICENSE-2.0");
break;
case R.id.licenseJsoup:
actionView("http://jsoup.org/license");
break;
}
}
private void actionView(String url) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url), this, MainActivity.class));
finish();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
finish();
return super.onOptionsItemSelected(item);
}
}

200
app/src/main/res/layout/license_activity.xml

@ -1,200 +0,0 @@ @@ -1,200 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<include layout="@layout/toolbar_settings" />
<LinearLayout
android:id="@+id/browserLicense"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/listChoiceBackgroundIndicator"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:text="@string/app_name"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:text="@string/mpl_license"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/licenseAOSP"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/listChoiceBackgroundIndicator"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:text="@string/android_open_source_project"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:text="@string/apache"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/licenseHosts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/listChoiceBackgroundIndicator"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:text="@string/hphosts_ad_server_list"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:text="@string/freeware"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/licenseOrbot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/listChoiceBackgroundIndicator"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:text="@string/library_netcipher"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:text="@string/license_gnu"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/licenseSnactory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/listChoiceBackgroundIndicator"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:text="@string/snacktory"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:text="@string/apache"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="?attr/dividerColor" />
<LinearLayout
android:id="@+id/licenseJsoup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/listChoiceBackgroundIndicator"
android:orientation="vertical"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:text="@string/jsoup"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:text="@string/mit_license"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/light" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="?attr/dividerColor" />
</LinearLayout>

44
app/src/main/res/xml/preference_about.xml

@ -18,4 +18,48 @@ @@ -18,4 +18,48 @@
android:title="@string/version"
android:key="pref_version" />
</PreferenceCategory>
<PreferenceCategory android:title="@string/licenses">
<Preference
android:title="@string/app_name"
android:summary="@string/mpl_license">
<intent
android:action="android.intent.action.VIEW"
android:data="http://www.mozilla.org/MPL/2.0/" />
</Preference>
<Preference
android:title="@string/android_open_source_project"
android:summary="@string/apache">
<intent
android:action="android.intent.action.VIEW"
android:data="http://www.apache.org/licenses/LICENSE-2.0" />
</Preference>
<Preference
android:title="@string/hphosts_ad_server_list"
android:summary="@string/freeware">
<intent
android:action="android.intent.action.VIEW"
android:data="http://hosts-file.net/" />
</Preference>
<Preference
android:title="@string/library_netcipher"
android:summary="@string/license_gnu">
<intent
android:action="android.intent.action.VIEW"
android:data="http://www.gnu.org/licenses/lgpl.html" />
</Preference>
<Preference
android:title="@string/snacktory"
android:summary="@string/apache">
<intent
android:action="android.intent.action.VIEW"
android:data="http://www.apache.org/licenses/LICENSE-2.0" />
</Preference>
<Preference
android:title="@string/jsoup"
android:summary="@string/mit_license">
<intent
android:action="android.intent.action.VIEW"
android:data="http://jsoup.org/license" />
</Preference>
</PreferenceCategory>
</PreferenceScreen>
Loading…
Cancel
Save