add license activity

This commit is contained in:
tibbi 2016-12-14 00:11:33 +01:00
parent e7b307401b
commit 667befcb52
6 changed files with 9 additions and 169 deletions

View File

@ -44,7 +44,7 @@ dependencies {
compile 'com.booking:rtlviewpager:1.0.1' compile 'com.booking:rtlviewpager:1.0.1'
compile 'com.simplemobiletools:fileproperties:1.0.7@aar' compile 'com.simplemobiletools:fileproperties:1.0.7@aar'
compile 'com.simplemobiletools:filepicker:1.6.1@aar' compile 'com.simplemobiletools:filepicker:1.6.1@aar'
compile 'com.simplemobiletools:commons:1.0.2@aar' compile 'com.simplemobiletools:commons:1.0.3@aar'
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2' compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
} }

View File

@ -71,7 +71,7 @@
android:parentActivityName=".activities.MainActivity"/> android:parentActivityName=".activities.MainActivity"/>
<activity <activity
android:name=".activities.LicenseActivity" android:name="com.simplemobiletools.commons.activities.LicenseActivity"
android:label="@string/third_party_licences" android:label="@string/third_party_licences"
android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity"/> android:parentActivityName="com.simplemobiletools.commons.activities.AboutActivity"/>

View File

@ -1,29 +0,0 @@
package com.simplemobiletools.gallery.activities
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import com.simplemobiletools.gallery.R
import kotlinx.android.synthetic.main.activity_license.*
class LicenseActivity : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_license)
license_kotlin_title.setOnClickListener { openUrl(R.string.kotlin_url) }
license_subsampling_title.setOnClickListener { openUrl(R.string.subsampling_url) }
license_glide_title.setOnClickListener { openUrl(R.string.glide_url) }
license_cropper_title.setOnClickListener { openUrl(R.string.cropper_url) }
license_multiselect_title.setOnClickListener { openUrl(R.string.multiselect_url) }
license_rtl_viewpager_title.setOnClickListener { openUrl(R.string.rtl_viewpager_url) }
license_filepicker_title.setOnClickListener { openUrl(R.string.filepicker_url) }
license_fileproperties_title.setOnClickListener { openUrl(R.string.fileproperties_url) }
}
private fun openUrl(id: Int) {
val url = resources.getString(id)
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(browserIntent)
}
}

View File

@ -10,9 +10,11 @@ import android.view.KeyCharacterMap
import android.view.KeyEvent import android.view.KeyEvent
import android.view.View import android.view.View
import android.view.ViewConfiguration import android.view.ViewConfiguration
import com.simplemobiletools.commons.helpers.*
import com.simplemobiletools.filepicker.extensions.getMimeType import com.simplemobiletools.filepicker.extensions.getMimeType
import com.simplemobiletools.filepicker.extensions.toast import com.simplemobiletools.filepicker.extensions.toast
import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.activities.SimpleActivity
import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE import com.simplemobiletools.gallery.helpers.REQUEST_EDIT_IMAGE
import com.simplemobiletools.gallery.helpers.REQUEST_SET_WALLPAPER import com.simplemobiletools.gallery.helpers.REQUEST_SET_WALLPAPER
import com.simplemobiletools.gallery.models.Medium import com.simplemobiletools.gallery.models.Medium
@ -107,6 +109,11 @@ fun Activity.hasNavBar(): Boolean {
} }
} }
fun SimpleActivity.launchAbout() {
startAboutActivity(R.string.app_name, LICENSE_KOTLIN or LICENSE_SUBSAMPLING or LICENSE_GLIDE or LICENSE_CROPPER or
LICENSE_MULTISELECT or LICENSE_RTL or LICENSE_FILEPICKER or LICENSE_FILEPROPERTIES)
}
fun AppCompatActivity.showSystemUI() { fun AppCompatActivity.showSystemUI() {
supportActionBar?.show() supportActionBar?.show()
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or

View File

@ -5,7 +5,6 @@ import android.content.Intent
import android.database.Cursor import android.database.Cursor
import android.net.Uri import android.net.Uri
import android.provider.MediaStore import android.provider.MediaStore
import com.simplemobiletools.commons.activities.AboutActivity
import com.simplemobiletools.filepicker.extensions.humanizePath import com.simplemobiletools.filepicker.extensions.humanizePath
import com.simplemobiletools.gallery.activities.SettingsActivity import com.simplemobiletools.gallery.activities.SettingsActivity
@ -36,7 +35,3 @@ fun Context.launchCamera() {
fun Context.launchSettings() { fun Context.launchSettings() {
startActivity(Intent(this, SettingsActivity::class.java)) startActivity(Intent(this, SettingsActivity::class.java))
} }
fun Context.launchAbout() {
startActivity(Intent(this, AboutActivity::class.java))
}

View File

@ -1,133 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/license_holder"
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:id="@+id/license_notice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/notice"/>
<TextView
android:id="@+id/license_kotlin_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_margin"
android:text="@string/kotlin_title"
android:textColor="@color/colorPrimary"/>
<TextView
android:id="@+id/license_kotlin_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/kotlin_text"/>
<TextView
android:id="@+id/license_subsampling_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_margin"
android:text="@string/subsampling_title"
android:textColor="@color/colorPrimary"/>
<TextView
android:id="@+id/license_subsampling_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/subsampling_text"/>
<TextView
android:id="@+id/license_glide_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_margin"
android:text="@string/glide_title"
android:textColor="@color/colorPrimary"/>
<TextView
android:id="@+id/license_glide_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/glide_text"/>
<TextView
android:id="@+id/license_cropper_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_margin"
android:text="@string/cropper_title"
android:textColor="@color/colorPrimary"/>
<TextView
android:id="@+id/license_cropper_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/cropper_text"/>
<TextView
android:id="@+id/license_multiselect_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_margin"
android:text="@string/multiselect_title"
android:textColor="@color/colorPrimary"/>
<TextView
android:id="@+id/license_multiselect_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/multiselect_text"/>
<TextView
android:id="@+id/license_rtl_viewpager_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_margin"
android:text="@string/rtl_viewpager_title"
android:textColor="@color/colorPrimary"/>
<TextView
android:id="@+id/license_rtl_viewpager_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/rtl_viewpager_text"/>
<TextView
android:id="@+id/license_filepicker_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_margin"
android:text="@string/filepicker_title"
android:textColor="@color/colorPrimary"/>
<TextView
android:id="@+id/license_filepicker_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/filepicker_text"/>
<TextView
android:id="@+id/license_fileproperties_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_margin"
android:text="@string/fileproperties_title"
android:textColor="@color/colorPrimary"/>
<TextView
android:id="@+id/license_fileproperties_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/fileproperties_text"/>
</LinearLayout>
</ScrollView>