Skip to content

Commit bde5edb

Browse files
authored
Merge pull request chenxiaolong#979 from chenxiaolong/arch-components
Initial direct Kotlin port and refactor patcher options dialog for MVVM
2 parents b391431 + a26982a commit bde5edb

File tree

231 files changed

+22289
-24630
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+22289
-24630
lines changed

Android_GUI/build.gradle.in

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
buildscript {
2+
ext.kotlin_version = '1.2.20'
3+
24
repositories {
35
jcenter()
46
google()
57
}
68
dependencies {
79
classpath 'com.android.tools.build:gradle:3.0.1'
10+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
811
}
912
}
1013

1114
apply plugin: 'com.android.application'
15+
apply plugin: 'kotlin-android'
1216

1317
repositories {
1418
jcenter()
@@ -138,6 +142,11 @@ readSigningConfig('@_DEBUG_SIGN_CONFIG_PATH@', android.signingConfigs.debug)
138142
readSigningConfig('@_CI_SIGN_CONFIG_PATH@', android.signingConfigs.ci)
139143

140144
dependencies {
145+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
146+
147+
implementation "android.arch.lifecycle:extensions:1.0.0"
148+
annotationProcessor "android.arch.lifecycle:compiler:1.0.0"
149+
141150
implementation 'com.android.support:support-v4:27.0.2'
142151
implementation 'com.android.support:appcompat-v7:27.0.2'
143152
implementation 'com.android.support:cardview-v7:27.0.2'

Android_GUI/res/layout/dialog_patcher_opts.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
android:text="@string/patcher_partconfig_title" />
4343

4444
<android.support.v7.widget.AppCompatSpinner
45-
android:id="@+id/spinner_rom_id"
45+
android:id="@+id/spinner_location"
4646
android:layout_width="match_parent"
4747
android:layout_height="wrap_content"
4848
android:layout_marginTop="@dimen/card_v7_normal_view_margin_top" />
@@ -58,7 +58,7 @@
5858
android:orientation="horizontal" />
5959

6060
<android.support.v7.widget.AppCompatEditText
61-
android:id="@+id/rom_id_named_slot_id"
61+
android:id="@+id/template_suffix"
6262
android:layout_width="match_parent"
6363
android:layout_height="wrap_content"
6464
android:hint="@string/install_location_named_slot_id_hint"
@@ -72,7 +72,7 @@
7272
android:text="@string/patcher_partconfig_desc_title" />
7373

7474
<TextView
75-
android:id="@+id/rom_id_desc"
75+
android:id="@+id/location_desc"
7676
style="@style/card_v7_message"
7777
android:layout_width="match_parent"
7878
android:layout_height="wrap_content"

Android_GUI/src/com/github/chenxiaolong/dualbootpatcher/AboutFragment.java

Lines changed: 0 additions & 73 deletions
This file was deleted.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* Copyright (C) 2014-2015 Andrew Gunnerson <[email protected]>
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation, either version 3 of the License, or
7+
* (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16+
*/
17+
18+
package com.github.chenxiaolong.dualbootpatcher
19+
20+
import android.os.Bundle
21+
import android.support.v4.app.Fragment
22+
import android.text.Html
23+
import android.text.method.LinkMovementMethod
24+
import android.view.LayoutInflater
25+
import android.view.View
26+
import android.view.ViewGroup
27+
import android.widget.TextView
28+
29+
class AboutFragment : Fragment() {
30+
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
31+
savedInstanceState: Bundle?): View? {
32+
return inflater.inflate(R.layout.fragment_about, container, false)
33+
}
34+
35+
override fun onActivityCreated(savedInstanceState: Bundle?) {
36+
super.onActivityCreated(savedInstanceState)
37+
38+
val name: TextView = activity!!.findViewById(R.id.about_name)
39+
name.setText(BuildConfig.APP_NAME_RESOURCE)
40+
41+
val version: TextView = activity!!.findViewById(R.id.about_version)
42+
version.text = String.format(getString(R.string.version), BuildConfig.VERSION_NAME)
43+
44+
val credits: TextView = activity!!.findViewById(R.id.about_credits)
45+
46+
val linkable = "<a href=\"%s\">%s</a>\n"
47+
val newline = "<br />"
48+
val separator = " | "
49+
50+
val creditsText = getString(R.string.credits)
51+
val sourceCode = String.format(linkable,
52+
getString(R.string.url_source_code),
53+
getString(R.string.link_source_code))
54+
val xdaThread = String.format(linkable,
55+
getString(R.string.url_xda_thread),
56+
getString(R.string.link_xda_thread))
57+
val licenses = String.format(linkable,
58+
getString(R.string.url_licenses),
59+
getString(R.string.link_licenses))
60+
61+
credits.text = Html.fromHtml(creditsText + newline + newline
62+
+ sourceCode + separator + xdaThread + separator + licenses)
63+
credits.movementMethod = LinkMovementMethod.getInstance()
64+
}
65+
66+
companion object {
67+
val FRAGMENT_TAG: String = AboutFragment::class.java.canonicalName
68+
69+
fun newInstance(): AboutFragment {
70+
return AboutFragment()
71+
}
72+
}
73+
}

Android_GUI/src/com/github/chenxiaolong/dualbootpatcher/AnsiStuff.java

Lines changed: 0 additions & 127 deletions
This file was deleted.

0 commit comments

Comments
 (0)