Skip to content

Commit 68c356f

Browse files
committed
config kotlin extension
1 parent ed58b8f commit 68c356f

File tree

8 files changed

+78
-5
lines changed

8 files changed

+78
-5
lines changed

app/build.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ dependencies {
6161
compile fileTree(include: ['*.jar'], dir: 'libs')
6262

6363

64-
compile 'com.google.code.gson:gson:2.8.0'
6564
testCompile 'junit:junit:4.12'
6665
compile 'com.google.code.gson:gson:2.8.0'
6766
compile 'com.android.support:appcompat-v7:26.1.0'
@@ -96,4 +95,11 @@ dependencies {
9695
compile 'com.xw.repo:bubbleseekbar:3.10-lite'
9796
testCompile 'junit:junit:4.12'
9897
debugCompile 'com.facebook.stetho:stetho:1.5.0'
98+
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
9999
}
100+
101+
apply plugin: 'kotlin-android'
102+
apply plugin: 'kotlin-android-extensions'
103+
repositories {
104+
mavenCentral()
105+
}

app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
android:theme="@style/MyTheme">
4242
<activity
4343
android:name=".AppStartActivity"
44+
android:configChanges="orientation|keyboardHidden|screenSize"
4445
android:label="@string/app_name"
4546
android:theme="@style/AppTheme">
4647
<intent-filter>
@@ -317,8 +318,11 @@
317318
android:name=".master.ui.MasterPaintActivity"
318319
android:hardwareAccelerated="false">
319320
</activity>
320-
<activity android:name=".master.ui.MasterFilterActivity"
321-
>
321+
<activity android:name=".master.ui.MasterFilterActivity">
322+
</activity>
323+
<activity
324+
android:name=".activity.OrientationActivity"
325+
android:screenOrientation="landscape">
322326
</activity>
323327
</application>
324328

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package home.smart.fly.animations.activity
2+
3+
import android.os.Bundle
4+
import android.support.v7.app.AppCompatActivity
5+
import home.smart.fly.animations.R
6+
7+
class OrientationActivity : AppCompatActivity() {
8+
9+
override fun onCreate(savedInstanceState: Bundle?) {
10+
super.onCreate(savedInstanceState)
11+
setContentView(R.layout.activity_orientation)
12+
}
13+
}

app/src/main/java/home/smart/fly/animations/activity/ViewPagerNestedActivity.java

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import android.view.MenuItem;
1818
import android.view.View;
1919
import android.view.ViewGroup;
20+
import android.widget.Button;
21+
import android.widget.ImageView;
2022
import android.widget.TextView;
2123

2224
import java.util.ArrayList;
@@ -40,7 +42,7 @@ public class ViewPagerNestedActivity extends AppCompatActivity {
4042
* The {@link ViewPager} that will host the section contents.
4143
*/
4244
private ViewPager mViewPager;
43-
45+
private static boolean flag = true;
4446

4547
@Override
4648
protected void onCreate(Bundle savedInstanceState) {
@@ -58,7 +60,6 @@ protected void onCreate(Bundle savedInstanceState) {
5860
tabLayout.setupWithViewPager(mViewPager);
5961

6062

61-
6263
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
6364
fab.setOnClickListener(new View.OnClickListener() {
6465
@Override
@@ -153,6 +154,26 @@ public void run() {
153154
}
154155
});
155156

157+
158+
final ImageView mImageView = rootView.findViewById(R.id.image);
159+
// mImageView.setPivotX(Tools.getScreenWidth(getContext()));
160+
// mImageView.setPivotY(Tools.getScreenHeight(getContext()));
161+
Button mButton = rootView.findViewById(R.id.button);
162+
mButton.setOnClickListener(new View.OnClickListener() {
163+
@Override
164+
public void onClick(View v) {
165+
if (flag) {
166+
mImageView.animate().scaleX(1.0f).setDuration(400);
167+
mImageView.animate().scaleY(1.0f).setDuration(400);
168+
} else {
169+
mImageView.animate().scaleX(0.5f).setDuration(400);
170+
mImageView.animate().scaleY(0.5f).setDuration(400);
171+
}
172+
flag = !flag;
173+
174+
}
175+
});
176+
156177
return rootView;
157178
}
158179

app/src/main/java/home/smart/fly/animations/fragments/OtherFragment.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import home.smart.fly.animations.activity.LaunchOtherAppActivity;
2626
import home.smart.fly.animations.activity.LoadCircleImageActivity;
2727
import home.smart.fly.animations.activity.MailActivity;
28+
import home.smart.fly.animations.activity.OrientationActivity;
2829
import home.smart.fly.animations.activity.PdfActivity;
2930
import home.smart.fly.animations.activity.ScreenCaptureActivity;
3031
import home.smart.fly.animations.activity.ViewPagerNestedActivity;
@@ -77,6 +78,7 @@ private void InitView() {
7778
demos.add(new ItemInfo(R.string.circle_view, LoadCircleImageActivity.class));
7879
demos.add(new ItemInfo(R.string.base_recyclerview, BaseRecyclerViewActivity.class));
7980
demos.add(new ItemInfo(R.string.input_view, InputActivity.class));
81+
demos.add(new ItemInfo(R.string.app_name, OrientationActivity.class));
8082
recyclerView = V.f(rootView, R.id.recyclerView);
8183
MyAdpater myAdpater = new MyAdpater();
8284
recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<android.support.constraint.ConstraintLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:app="http://schemas.android.com/apk/res-auto"
5+
xmlns:tools="http://schemas.android.com/tools"
6+
android:layout_width="match_parent"
7+
android:layout_height="match_parent"
8+
tools:context="home.smart.fly.animations.activity.OrientationActivity">
9+
10+
</android.support.constraint.ConstraintLayout>

app/src/main/res/layout/fragment_view_pager_nested.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@
2626
android:layout_width="match_parent"
2727
android:layout_height="200dp"
2828
/>
29+
30+
<ImageView
31+
android:id="@+id/image"
32+
android:layout_width="match_parent"
33+
android:layout_height="300dp"
34+
android:layout_margin="10dp"
35+
android:scaleX="0.5"
36+
android:scaleY="0.5"
37+
android:src="@drawable/cat"/>
38+
39+
<Button
40+
android:id="@+id/button"
41+
android:layout_width="match_parent"
42+
android:layout_height="wrap_content"
43+
android:text="scale"/>
2944
</LinearLayout>
3045
</android.support.v4.widget.SwipeRefreshLayout>
3146

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4+
ext.kotlin_version = '1.2.0'
45
repositories {
56
jcenter()
67
mavenCentral()
@@ -14,6 +15,7 @@ buildscript {
1415
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
1516
// NOTE: Do not place your application dependencies here; they belong
1617
// in the individual module build.gradle files
18+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1719
}
1820

1921

0 commit comments

Comments
 (0)