├── .gitignore
├── AlipayHome
├── .gitignore
├── .idea
│ ├── compiler.xml
│ ├── copyright
│ │ └── profiles_settings.xml
│ ├── encodings.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── modules.xml
│ └── runConfigurations.xml
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── kyleduo
│ │ │ └── alipayhome
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── kyleduo
│ │ │ │ └── alipayhome
│ │ │ │ ├── MainActivity.java
│ │ │ │ └── widgets
│ │ │ │ ├── APBarView.java
│ │ │ │ ├── APHeaderView.java
│ │ │ │ ├── APScrollingBehavior.java
│ │ │ │ ├── APSnapView.java
│ │ │ │ ├── CommonListDecoration.java
│ │ │ │ └── support
│ │ │ │ ├── ATHeaderBehavior.java
│ │ │ │ ├── ATHeaderScrollingViewBehavior.java
│ │ │ │ ├── ATMathUtils.java
│ │ │ │ ├── ATViewOffsetBehavior.java
│ │ │ │ └── ATViewOffsetHelper.java
│ │ └── res
│ │ │ ├── drawable-xxxhdpi
│ │ │ ├── bar1.png
│ │ │ ├── bar2.png
│ │ │ ├── grid.png
│ │ │ └── snap.png
│ │ │ ├── drawable
│ │ │ └── common_item_bg.xml
│ │ │ ├── layout
│ │ │ ├── activity_main.xml
│ │ │ └── item_content.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── ids.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── kyleduo
│ │ └── alipayhome
│ │ └── ExampleUnitTest.java
├── build.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── DiggingTranslucentStatusBar
├── .gitignore
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── kyleduo
│ │ │ └── digging
│ │ │ └── translucentstatusbar
│ │ │ └── ExampleInstrumentedTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── kyleduo
│ │ │ │ └── digging
│ │ │ │ └── translucentstatusbar
│ │ │ │ ├── BaseActivity.java
│ │ │ │ ├── Demo1Activity.java
│ │ │ │ ├── Demo2Activity.java
│ │ │ │ ├── Demo3Activity.java
│ │ │ │ ├── Demo3BActivity.java
│ │ │ │ ├── Demo3BFragment.java
│ │ │ │ ├── Demo3Fragment.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ ├── SecondActivity.java
│ │ │ │ └── widgets
│ │ │ │ ├── DummySupportToolbar.java
│ │ │ │ ├── FitCollapsingToolbarLayout.java
│ │ │ │ └── OnItemClickListener.java
│ │ └── res
│ │ │ ├── drawable-xxhdpi
│ │ │ ├── drawer_header.jpg
│ │ │ ├── ic_back.png
│ │ │ ├── ic_burger.png
│ │ │ └── temp.jpg
│ │ │ ├── layout
│ │ │ ├── act_demo1.xml
│ │ │ ├── act_demo2.xml
│ │ │ ├── act_demo3.xml
│ │ │ ├── act_main.xml
│ │ │ ├── act_second.xml
│ │ │ ├── frgm_demo3.xml
│ │ │ ├── frgm_demo3b.xml
│ │ │ └── stub_kitkat_statusbar.xml
│ │ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ │ ├── values-sw360dp
│ │ │ └── dimens.xml
│ │ │ ├── values-sw400dp
│ │ │ └── dimens.xml
│ │ │ ├── values-v19
│ │ │ └── styles.xml
│ │ │ ├── values-v21
│ │ │ └── styles.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── kyleduo
│ │ └── digging
│ │ └── translucentstatusbar
│ │ └── ExampleUnitTest.java
├── build.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── ExchangeFragment
├── .gitignore
├── .idea
│ ├── .name
│ ├── compiler.xml
│ ├── copyright
│ │ └── profiles_settings.xml
│ ├── encodings.xml
│ ├── gradle.xml
│ ├── misc.xml
│ ├── modules.xml
│ └── runConfigurations.xml
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ ├── androidTest
│ │ └── java
│ │ │ └── com
│ │ │ └── kyleduo
│ │ │ └── blogdemo
│ │ │ └── exchangefragment
│ │ │ └── ApplicationTest.java
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── kyleduo
│ │ │ │ └── blogdemo
│ │ │ │ └── exchangefragment
│ │ │ │ ├── ExchangedFragment.java
│ │ │ │ ├── Holder1Fragment.java
│ │ │ │ ├── Holder2Fragment.java
│ │ │ │ ├── Holder3Fragment.java
│ │ │ │ ├── Holder4Fragment.java
│ │ │ │ ├── HolderFragment.java
│ │ │ │ └── MainActivity.java
│ │ └── res
│ │ │ ├── drawable-xxxhdpi
│ │ │ └── icon_holder.png
│ │ │ ├── drawable
│ │ │ ├── tab_selector.xml
│ │ │ └── top_line_bg.xml
│ │ │ ├── layout
│ │ │ ├── activity_main.xml
│ │ │ ├── fragment_holder.xml
│ │ │ └── layout_tab.xml
│ │ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ │ ├── values-w820dp
│ │ │ └── dimens.xml
│ │ │ └── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── kyleduo
│ │ └── blogdemo
│ │ └── exchangefragment
│ │ └── ExampleUnitTest.java
├── build.gradle
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── LICENSE
├── PCHImportProblem
├── PCHImportProblem.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── kyle.xcuserdatad
│ │ │ └── UserInterfaceState.xcuserstate
│ └── xcuserdata
│ │ └── kyle.xcuserdatad
│ │ └── xcschemes
│ │ ├── PCHImportProblem.xcscheme
│ │ ├── TestWatchOS (Notification).xcscheme
│ │ ├── TestWatchOS.xcscheme
│ │ └── xcschememanagement.plist
├── PCHImportProblem.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── kyle.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── PCHImportProblem
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ ├── ImportFile.h
│ ├── Info.plist
│ ├── Mock.h
│ ├── Mock.m
│ ├── PrefixHeader.pch
│ ├── SubTestJsonModel.h
│ ├── SubTestJsonModel.m
│ ├── TestJsonModel.h
│ ├── TestJsonModel.m
│ ├── ViewController.h
│ ├── ViewController.m
│ └── main.m
├── Podfile
├── Podfile.lock
├── Pods
│ ├── Headers
│ │ ├── Private
│ │ │ └── JSONModel
│ │ │ │ ├── JSONAPI.h
│ │ │ │ ├── JSONHTTPClient.h
│ │ │ │ ├── JSONKeyMapper.h
│ │ │ │ ├── JSONModel+networking.h
│ │ │ │ ├── JSONModel.h
│ │ │ │ ├── JSONModelArray.h
│ │ │ │ ├── JSONModelClassProperty.h
│ │ │ │ ├── JSONModelError.h
│ │ │ │ ├── JSONModelLib.h
│ │ │ │ ├── JSONValueTransformer.h
│ │ │ │ └── NSArray+JSONModel.h
│ │ └── Public
│ │ │ └── JSONModel
│ │ │ ├── JSONAPI.h
│ │ │ ├── JSONHTTPClient.h
│ │ │ ├── JSONKeyMapper.h
│ │ │ ├── JSONModel+networking.h
│ │ │ ├── JSONModel.h
│ │ │ ├── JSONModelArray.h
│ │ │ ├── JSONModelClassProperty.h
│ │ │ ├── JSONModelError.h
│ │ │ ├── JSONModelLib.h
│ │ │ ├── JSONValueTransformer.h
│ │ │ └── NSArray+JSONModel.h
│ ├── JSONModel
│ │ ├── JSONModel
│ │ │ ├── JSONModel
│ │ │ │ ├── JSONModel.h
│ │ │ │ ├── JSONModel.m
│ │ │ │ ├── JSONModelArray.h
│ │ │ │ ├── JSONModelArray.m
│ │ │ │ ├── JSONModelClassProperty.h
│ │ │ │ ├── JSONModelClassProperty.m
│ │ │ │ ├── JSONModelError.h
│ │ │ │ └── JSONModelError.m
│ │ │ ├── JSONModelCategories
│ │ │ │ ├── NSArray+JSONModel.h
│ │ │ │ └── NSArray+JSONModel.m
│ │ │ ├── JSONModelLib.h
│ │ │ ├── JSONModelNetworking
│ │ │ │ ├── JSONAPI.h
│ │ │ │ ├── JSONAPI.m
│ │ │ │ ├── JSONHTTPClient.h
│ │ │ │ ├── JSONHTTPClient.m
│ │ │ │ ├── JSONModel+networking.h
│ │ │ │ └── JSONModel+networking.m
│ │ │ └── JSONModelTransformations
│ │ │ │ ├── JSONKeyMapper.h
│ │ │ │ ├── JSONKeyMapper.m
│ │ │ │ ├── JSONValueTransformer.h
│ │ │ │ └── JSONValueTransformer.m
│ │ ├── LICENSE_jsonmodel.txt
│ │ └── README.md
│ ├── Manifest.lock
│ ├── Pods.xcodeproj
│ │ ├── project.pbxproj
│ │ └── xcuserdata
│ │ │ └── kyle.xcuserdatad
│ │ │ └── xcschemes
│ │ │ ├── JSONModel.xcscheme
│ │ │ ├── Pods-PCHImportProblem.xcscheme
│ │ │ └── xcschememanagement.plist
│ └── Target Support Files
│ │ ├── JSONModel
│ │ ├── JSONModel-dummy.m
│ │ ├── JSONModel-prefix.pch
│ │ └── JSONModel.xcconfig
│ │ └── Pods-PCHImportProblem
│ │ ├── Pods-PCHImportProblem-acknowledgements.markdown
│ │ ├── Pods-PCHImportProblem-acknowledgements.plist
│ │ ├── Pods-PCHImportProblem-dummy.m
│ │ ├── Pods-PCHImportProblem-frameworks.sh
│ │ ├── Pods-PCHImportProblem-resources.sh
│ │ ├── Pods-PCHImportProblem.debug.xcconfig
│ │ └── Pods-PCHImportProblem.release.xcconfig
├── TestWatchOS Extension
│ ├── Assets.xcassets
│ │ └── README__ignoredByTemplate__
│ ├── ExtensionDelegate.h
│ ├── ExtensionDelegate.m
│ ├── Info.plist
│ ├── InterfaceController.h
│ ├── InterfaceController.m
│ ├── NotificationController.h
│ ├── NotificationController.m
│ ├── PrefixHeader.pch
│ └── PushNotificationPayload.apns
└── TestWatchOS
│ ├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
│ ├── Base.lproj
│ └── Interface.storyboard
│ └── Info.plist
├── README.md
└── preview
├── ExchangeFragment.gif
└── alipay.png
/.gitignore:
--------------------------------------------------------------------------------
1 | */gradle.properties
2 |
3 | # Built application files
4 | *.apk
5 | *.ap_
6 |
7 | # Files for the Dalvik VM
8 | *.dex
9 |
10 | # Java class files
11 | *.class
12 |
13 | # Generated files
14 | bin/
15 | gen/
16 |
17 | # Gradle files
18 | .gradle/
19 | build/
20 |
21 | # Local configuration file (sdk path, etc)
22 | local.properties
23 |
24 | # Proguard folder generated by Eclipse
25 | proguard/
26 |
27 | # Log Files
28 | *.log
29 |
30 | # Android Studio Navigation editor temp files
31 | .navigation/
32 |
33 | # Android Studio captures folder
34 | captures/
35 |
--------------------------------------------------------------------------------
/AlipayHome/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/AlipayHome/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/AlipayHome/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/AlipayHome/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AlipayHome/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/AlipayHome/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/AlipayHome/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/AlipayHome/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/AlipayHome/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/AlipayHome/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.3"
6 | defaultConfig {
7 | applicationId "com.kyleduo.alipayhome"
8 | minSdkVersion 14
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | ext {
23 | supportVersion = '25.3.1'
24 | }
25 |
26 | dependencies {
27 | compile fileTree(dir: 'libs', include: ['*.jar'])
28 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
29 | exclude group: 'com.android.support', module: 'support-annotations'
30 | })
31 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
32 | testCompile 'junit:junit:4.12'
33 |
34 |
35 | compile "com.android.support:recyclerview-v7:$supportVersion"
36 | compile "com.android.support:appcompat-v7:$supportVersion"
37 | compile "com.android.support:design:$supportVersion"
38 | }
39 |
--------------------------------------------------------------------------------
/AlipayHome/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/kyle/Documents/developer/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/androidTest/java/com/kyleduo/alipayhome/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.alipayhome;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.kyleduo.alipayhome", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/java/com/kyleduo/alipayhome/widgets/APBarView.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.alipayhome.widgets;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.AttrRes;
5 | import android.support.annotation.NonNull;
6 | import android.support.annotation.Nullable;
7 | import android.util.AttributeSet;
8 | import android.view.View;
9 | import android.view.ViewParent;
10 | import android.widget.FrameLayout;
11 |
12 | import com.kyleduo.alipayhome.widgets.support.ATMathUtils;
13 | import com.kyleduo.alipayhome.widgets.support.ATViewOffsetHelper;
14 |
15 | import java.lang.ref.WeakReference;
16 |
17 | /**
18 | * AndroidTech
19 | * Created by kyleduo on 2017/7/12.
20 | */
21 |
22 | public class APBarView extends FrameLayout {
23 |
24 | private View mView1;
25 | private View mView2;
26 |
27 | private APHeaderView.OnOffsetChangeListener mOnOffsetChangeListener;
28 |
29 | private ATViewOffsetHelper mOffsetHelper;
30 |
31 | public APBarView(@NonNull Context context) {
32 | super(context);
33 | }
34 |
35 | public APBarView(@NonNull Context context, @Nullable AttributeSet attrs) {
36 | super(context, attrs);
37 | }
38 |
39 | public APBarView(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) {
40 | super(context, attrs, defStyleAttr);
41 | }
42 |
43 | @Override
44 | protected void onFinishInflate() {
45 | super.onFinishInflate();
46 | mView1 = getChildAt(0);
47 | mView2 = getChildAt(1);
48 | }
49 |
50 | @Override
51 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
52 | super.onLayout(changed, left, top, right, bottom);
53 | if (mOffsetHelper != null) {
54 | mOffsetHelper.onViewLayout();
55 | }
56 | }
57 |
58 | @Override
59 | protected void onAttachedToWindow() {
60 | super.onAttachedToWindow();
61 | if (mOffsetHelper == null) {
62 | mOffsetHelper = new ATViewOffsetHelper(this);
63 | }
64 | ViewParent parent = getParent();
65 | if (parent != null && parent instanceof APHeaderView) {
66 | APHeaderView header = (APHeaderView) parent;
67 | if (mOnOffsetChangeListener == null) {
68 | mOnOffsetChangeListener = new OffsetChangeListener(this);
69 | }
70 | header.addOnOffsetChangeListener(mOnOffsetChangeListener);
71 | }
72 | }
73 |
74 | @Override
75 | protected void onDetachedFromWindow() {
76 | super.onDetachedFromWindow();
77 | ViewParent parent = getParent();
78 | if (parent != null && parent instanceof APHeaderView) {
79 | APHeaderView header = (APHeaderView) parent;
80 | if (mOnOffsetChangeListener != null) {
81 | header.removeOnOffsetChangeListener(mOnOffsetChangeListener);
82 | }
83 | }
84 | }
85 |
86 | void offset(int offset) {
87 | mOffsetHelper.setTopAndBottomOffset(-offset);
88 |
89 | float ratio = 1 - Math.abs(offset) * 1.f / (getResources().getDisplayMetrics().density * 104);
90 | ratio = ATMathUtils.constrain(ratio, 0, 1);
91 |
92 | float alpha1 = 1 - Math.min(1, ratio / 0.5f);
93 | float alpha2 = Math.max((ratio - 0.5f) / 0.5f, 0);
94 |
95 | mView1.setAlpha(alpha1);
96 | mView2.setAlpha(alpha2);
97 | }
98 |
99 | private static class OffsetChangeListener implements APHeaderView.OnOffsetChangeListener {
100 |
101 | private WeakReference mSnapViewRef;
102 |
103 | public OffsetChangeListener(APBarView barView) {
104 | mSnapViewRef = new WeakReference<>(barView);
105 | }
106 |
107 | @Override
108 | public void onOffsetChanged(APHeaderView header, int currOffset) {
109 | APBarView barView = mSnapViewRef.get();
110 | if (barView != null) {
111 | barView.offset(currOffset);
112 | }
113 | }
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/java/com/kyleduo/alipayhome/widgets/APScrollingBehavior.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.alipayhome.widgets;
2 |
3 | import android.content.Context;
4 | import android.graphics.Rect;
5 | import android.support.design.widget.CoordinatorLayout;
6 | import android.support.v4.view.ViewCompat;
7 | import android.util.AttributeSet;
8 | import android.view.View;
9 |
10 | import com.kyleduo.alipayhome.widgets.support.ATHeaderScrollingViewBehavior;
11 | import com.kyleduo.alipayhome.widgets.support.ATViewOffsetHelper;
12 |
13 | import java.util.List;
14 |
15 | /**
16 | *
17 | * Created by kyleduo on 2017/7/12.
18 | */
19 |
20 | public class APScrollingBehavior extends ATHeaderScrollingViewBehavior {
21 |
22 | ATViewOffsetHelper mOffsetHelper;
23 |
24 | public APScrollingBehavior() {
25 | }
26 |
27 | public APScrollingBehavior(Context context, AttributeSet attrs) {
28 | super(context, attrs);
29 | }
30 |
31 | @Override
32 | protected APHeaderView findFirstDependency(List views) {
33 | for (int i = 0, z = views.size(); i < z; i++) {
34 | View view = views.get(i);
35 | if (view instanceof APHeaderView) {
36 | return (APHeaderView) view;
37 | }
38 | }
39 | return null;
40 | }
41 |
42 | @Override
43 | public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) {
44 | return dependency instanceof APHeaderView;
45 | }
46 |
47 | @Override
48 | public boolean onDependentViewChanged(CoordinatorLayout parent, final View child, View dependency) {
49 | APHeaderView header = findFirstDependency(parent.getDependencies(child));
50 | if (header != null) {
51 | CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) header.getLayoutParams();
52 | CoordinatorLayout.Behavior behavior = lp.getBehavior();
53 | if (behavior instanceof APHeaderView.Behavior) {
54 | APHeaderView.Behavior headerBehavior = (APHeaderView.Behavior) behavior;
55 | int offset = headerBehavior.getTopAndBottomOffset();
56 | ViewCompat.offsetTopAndBottom(child, (dependency.getBottom() - child.getTop()));
57 | }
58 | }
59 | return super.onDependentViewChanged(parent, child, dependency);
60 | }
61 |
62 | @Override
63 | protected int getScrollRange(View v) {
64 | if (v instanceof APHeaderView) {
65 | return ((APHeaderView) v).getScrollRange();
66 | }
67 | return super.getScrollRange(v);
68 | }
69 |
70 | @Override
71 | public boolean onRequestChildRectangleOnScreen(CoordinatorLayout coordinatorLayout, View child, Rect rectangle, boolean immediate) {
72 | final APHeaderView header = findFirstDependency(coordinatorLayout.getDependencies(child));
73 | if (header != null) {
74 | // Offset the rect by the child's left/top
75 | rectangle.offset(child.getLeft(), child.getTop());
76 |
77 | final Rect parentRect = mTempRect1;
78 | parentRect.set(0, 0, coordinatorLayout.getWidth(), coordinatorLayout.getHeight());
79 |
80 | if (!parentRect.contains(rectangle)) {
81 | // If the rectangle can not be fully seen the visible bounds, collapse
82 | // the AppBarLayout
83 | header.setExpanded(false);
84 | return true;
85 | }
86 | }
87 | return false;
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/java/com/kyleduo/alipayhome/widgets/APSnapView.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.alipayhome.widgets;
2 |
3 | import android.content.Context;
4 | import android.util.AttributeSet;
5 | import android.view.View;
6 | import android.view.ViewParent;
7 | import android.widget.RelativeLayout;
8 |
9 | import com.kyleduo.alipayhome.widgets.support.ATMathUtils;
10 | import com.kyleduo.alipayhome.widgets.support.ATViewOffsetHelper;
11 |
12 | import java.lang.ref.WeakReference;
13 |
14 | /**
15 | *
16 | * Created by kyleduo on 2017/7/12.
17 | */
18 |
19 | public class APSnapView extends RelativeLayout {
20 |
21 | private APHeaderView.OnOffsetChangeListener mOnOffsetChangeListener;
22 |
23 | private View mContent;
24 | private ATViewOffsetHelper mOffsetHelper;
25 |
26 | public APSnapView(Context context) {
27 | super(context);
28 | }
29 |
30 | public APSnapView(Context context, AttributeSet attrs) {
31 | super(context, attrs);
32 | }
33 |
34 | public APSnapView(Context context, AttributeSet attrs, int defStyleAttr) {
35 | super(context, attrs, defStyleAttr);
36 | }
37 |
38 | @Override
39 | protected void onFinishInflate() {
40 | super.onFinishInflate();
41 | mContent = getChildAt(0);
42 | mOffsetHelper = new ATViewOffsetHelper(mContent);
43 | }
44 |
45 | @Override
46 | protected void onAttachedToWindow() {
47 | super.onAttachedToWindow();
48 | ViewParent parent = getParent();
49 | if (parent != null && parent instanceof APHeaderView) {
50 | APHeaderView header = (APHeaderView) parent;
51 | if (mOnOffsetChangeListener == null) {
52 | mOnOffsetChangeListener = new OffsetChangeListener(this);
53 | }
54 | header.addOnOffsetChangeListener(mOnOffsetChangeListener);
55 | }
56 | }
57 |
58 | @Override
59 | protected void onDetachedFromWindow() {
60 | super.onDetachedFromWindow();
61 | ViewParent parent = getParent();
62 | if (parent != null && parent instanceof APHeaderView) {
63 | APHeaderView header = (APHeaderView) parent;
64 | if (mOnOffsetChangeListener != null) {
65 | header.removeOnOffsetChangeListener(mOnOffsetChangeListener);
66 | }
67 | }
68 | }
69 |
70 | void offset(int offset) {
71 | final float ratio = 0.5f;
72 | float alpha = 1 - Math.abs(offset) * 1.f / (0.8f * getHeight());
73 | alpha = ATMathUtils.constrain(alpha, 0, 1);
74 | if (offset < -getHeight()) {
75 | offset = -getHeight();
76 | } else if (offset > 0) {
77 | offset = 0;
78 | }
79 | int value = (int) (-offset * ratio);
80 | mOffsetHelper.setTopAndBottomOffset(value);
81 | getChildAt(0).setAlpha(alpha);
82 | }
83 |
84 | private static class OffsetChangeListener implements APHeaderView.OnOffsetChangeListener {
85 |
86 | private WeakReference mSnapViewRef;
87 |
88 | public OffsetChangeListener(APSnapView snapView) {
89 | mSnapViewRef = new WeakReference<>(snapView);
90 | }
91 |
92 | @Override
93 | public void onOffsetChanged(APHeaderView header, int currOffset) {
94 | APSnapView snapView = mSnapViewRef.get();
95 | if (snapView != null) {
96 | snapView.offset(currOffset);
97 | }
98 | }
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/java/com/kyleduo/alipayhome/widgets/CommonListDecoration.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.alipayhome.widgets;
2 |
3 | import android.graphics.Rect;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.View;
6 |
7 | /**
8 | *
9 | * Created by kyleduo on 2017/6/30.
10 | */
11 |
12 | public class CommonListDecoration extends RecyclerView.ItemDecoration {
13 |
14 | private int mSpaceV, mSpaceH;
15 |
16 | public CommonListDecoration() {
17 | }
18 |
19 | public CommonListDecoration(int spaceV, int spaceH) {
20 | mSpaceV = spaceV;
21 | mSpaceH = spaceH;
22 | }
23 |
24 | @Override
25 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
26 | int position = parent.getChildLayoutPosition(view);
27 | RecyclerView.Adapter adapter = parent.getAdapter();
28 | int itemCount = adapter == null ? 0 : adapter.getItemCount();
29 |
30 | if (mSpaceH == 0 && mSpaceV == 0) {
31 | float density = parent.getContext().getResources().getDisplayMetrics().density;
32 | mSpaceH = (int) (density * 16);
33 | mSpaceV = (int) (density * 12);
34 | }
35 | //noinspection UnnecessaryLocalVariable
36 | int top = 0;
37 | int left = 0;
38 | int right = 0;
39 | int bottom = 0;
40 |
41 | if (position == 0) {
42 | top = mSpaceV;
43 | bottom = mSpaceV / 2;
44 | } else if (position == itemCount - 1) {
45 | top = mSpaceV / 2;
46 | bottom = mSpaceV;
47 | } else {
48 | top = mSpaceV / 2;
49 | bottom = mSpaceV / 2;
50 | }
51 |
52 | left = mSpaceH;
53 | right = mSpaceH;
54 |
55 | outRect.set(left, top, right, bottom);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/java/com/kyleduo/alipayhome/widgets/support/ATMathUtils.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.alipayhome.widgets.support;
2 |
3 | /**
4 | * AndroidTech
5 | * Created by kyleduo on 2017/7/11.
6 | */
7 |
8 | public class ATMathUtils {
9 |
10 | public static int constrain(int amount, int low, int high) {
11 | int ret = amount < low ? low : amount;
12 | ret = ret > high ? high : ret;
13 | return ret;
14 | }
15 |
16 | public static float constrain(float amount, float low, float high) {
17 | float ret = amount < low ? low : amount;
18 | ret = ret > high ? high : ret;
19 | return ret;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/java/com/kyleduo/alipayhome/widgets/support/ATViewOffsetBehavior.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.alipayhome.widgets.support;
2 |
3 | import android.content.Context;
4 | import android.support.design.widget.CoordinatorLayout;
5 | import android.util.AttributeSet;
6 | import android.view.View;
7 |
8 | /**
9 | * AndroidTech
10 | * Created by kyleduo on 2017/7/11.
11 | */
12 |
13 | public class ATViewOffsetBehavior extends CoordinatorLayout.Behavior {
14 |
15 | private ATViewOffsetHelper mViewOffsetHelper;
16 |
17 | private int mTempTopBottomOffset = 0;
18 | private int mTempLeftRightOffset = 0;
19 |
20 | public ATViewOffsetBehavior() {}
21 |
22 | public ATViewOffsetBehavior(Context context, AttributeSet attrs) {
23 | super(context, attrs);
24 | }
25 |
26 | @Override
27 | public boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection) {
28 | // First let lay the child out
29 | layoutChild(parent, child, layoutDirection);
30 |
31 | if (mViewOffsetHelper == null) {
32 | mViewOffsetHelper = new ATViewOffsetHelper(child);
33 | }
34 | mViewOffsetHelper.onViewLayout();
35 |
36 | if (mTempTopBottomOffset != 0) {
37 | mViewOffsetHelper.setTopAndBottomOffset(mTempTopBottomOffset);
38 | mTempTopBottomOffset = 0;
39 | }
40 | if (mTempLeftRightOffset != 0) {
41 | mViewOffsetHelper.setLeftAndRightOffset(mTempLeftRightOffset);
42 | mTempLeftRightOffset = 0;
43 | }
44 |
45 | return true;
46 | }
47 |
48 | protected void layoutChild(CoordinatorLayout parent, V child, int layoutDirection) {
49 | // Let the parent lay it out by default
50 | parent.onLayoutChild(child, layoutDirection);
51 | }
52 |
53 | public boolean setTopAndBottomOffset(int offset) {
54 | if (mViewOffsetHelper != null) {
55 | return mViewOffsetHelper.setTopAndBottomOffset(offset);
56 | } else {
57 | mTempTopBottomOffset = offset;
58 | }
59 | return false;
60 | }
61 |
62 | public boolean setLeftAndRightOffset(int offset) {
63 | if (mViewOffsetHelper != null) {
64 | return mViewOffsetHelper.setLeftAndRightOffset(offset);
65 | } else {
66 | mTempLeftRightOffset = offset;
67 | }
68 | return false;
69 | }
70 |
71 | public int getTopAndBottomOffset() {
72 | return mViewOffsetHelper != null ? mViewOffsetHelper.getTopAndBottomOffset() : 0;
73 | }
74 |
75 | public int getLeftAndRightOffset() {
76 | return mViewOffsetHelper != null ? mViewOffsetHelper.getLeftAndRightOffset() : 0;
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/java/com/kyleduo/alipayhome/widgets/support/ATViewOffsetHelper.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.alipayhome.widgets.support;
2 |
3 | import android.support.v4.view.ViewCompat;
4 | import android.view.View;
5 |
6 | /**
7 | * AndroidTech
8 | * Created by kyleduo on 2017/7/11.
9 | */
10 |
11 | public class ATViewOffsetHelper {
12 |
13 | private final View mView;
14 |
15 | private int mLayoutTop;
16 | private int mLayoutLeft;
17 | private int mOffsetTop;
18 | private int mOffsetLeft;
19 |
20 | public ATViewOffsetHelper(View view) {
21 | mView = view;
22 | }
23 |
24 | public void onViewLayout() {
25 | // Now grab the intended top
26 | mLayoutTop = mView.getTop();
27 | mLayoutLeft = mView.getLeft();
28 |
29 | // And offset it as needed
30 | updateOffsets();
31 | }
32 |
33 | private void updateOffsets() {
34 | ViewCompat.offsetTopAndBottom(mView, mOffsetTop - (mView.getTop() - mLayoutTop));
35 | ViewCompat.offsetLeftAndRight(mView, mOffsetLeft - (mView.getLeft() - mLayoutLeft));
36 | }
37 |
38 | /**
39 | * Set the top and bottom offset for this {@link ATViewOffsetHelper}'s view.
40 | *
41 | * @param offset the offset in px.
42 | * @return true if the offset has changed
43 | */
44 | public boolean setTopAndBottomOffset(int offset) {
45 | if (mOffsetTop != offset) {
46 | mOffsetTop = offset;
47 | updateOffsets();
48 | return true;
49 | }
50 | return false;
51 | }
52 |
53 | /**
54 | * Set the left and right offset for this {@link ATViewOffsetHelper}'s view.
55 | *
56 | * @param offset the offset in px.
57 | * @return true if the offset has changed
58 | */
59 | public boolean setLeftAndRightOffset(int offset) {
60 | if (mOffsetLeft != offset) {
61 | mOffsetLeft = offset;
62 | updateOffsets();
63 | return true;
64 | }
65 | return false;
66 | }
67 |
68 | public int getTopAndBottomOffset() {
69 | return mOffsetTop;
70 | }
71 |
72 | public int getLeftAndRightOffset() {
73 | return mOffsetLeft;
74 | }
75 |
76 | public int getLayoutTop() {
77 | return mLayoutTop;
78 | }
79 |
80 | public int getLayoutLeft() {
81 | return mLayoutLeft;
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/drawable-xxxhdpi/bar1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/drawable-xxxhdpi/bar1.png
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/drawable-xxxhdpi/bar2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/drawable-xxxhdpi/bar2.png
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/drawable-xxxhdpi/grid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/drawable-xxxhdpi/grid.png
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/drawable-xxxhdpi/snap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/drawable-xxxhdpi/snap.png
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/drawable/common_item_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
19 |
20 |
26 |
27 |
28 |
29 |
34 |
35 |
39 |
40 |
41 |
42 |
48 |
49 |
54 |
55 |
60 |
61 |
62 |
63 |
69 |
70 |
75 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/layout/item_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AlipayHome
3 |
4 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/AlipayHome/app/src/test/java/com/kyleduo/alipayhome/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.alipayhome;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/AlipayHome/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.3'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/AlipayHome/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/AlipayHome/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Jul 24 20:57:41 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/AlipayHome/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/AlipayHome/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 | /.idea/
11 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "25.0.2"
6 | defaultConfig {
7 | applicationId "com.kyleduo.digging.translucentstatusbar"
8 | minSdkVersion 14
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | ext {
23 | supportVersion = '25.3.1'
24 | butterKnifeVersion = '8.5.1'
25 | }
26 |
27 | dependencies {
28 | compile fileTree(dir: 'libs', include: ['*.jar'])
29 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
30 | exclude group: 'com.android.support', module: 'support-annotations'
31 | })
32 |
33 | compile "com.android.support:appcompat-v7:$supportVersion"
34 | compile "com.android.support:design:$supportVersion"
35 |
36 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
37 | testCompile 'junit:junit:4.12'
38 |
39 |
40 | annotationProcessor "com.jakewharton:butterknife-compiler:$butterKnifeVersion"
41 | compile "com.jakewharton:butterknife:$butterKnifeVersion"
42 | }
43 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/kyle/Documents/developer/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/androidTest/java/com/kyleduo/digging/translucentstatusbar/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.digging.translucentstatusbar;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.kyleduo.digging.translucentstatusbar", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.digging.translucentstatusbar;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.app.ActionBar;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.support.v7.widget.Toolbar;
8 |
9 | import butterknife.BindView;
10 | import butterknife.ButterKnife;
11 |
12 | /**
13 | * for DiggingTranslucentStatusBar
14 | * Created by kyleduo on 2017/5/5.
15 | */
16 |
17 | public class BaseActivity extends AppCompatActivity {
18 | private static final int INVALID_RES_ID = 0;
19 |
20 | @BindView(R.id.tool_bar)
21 | Toolbar mToolbar;
22 |
23 | @Override
24 | protected void onCreate(@Nullable Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | int resId = getLayoutResId();
27 | if (resId == INVALID_RES_ID) {
28 | return;
29 | }
30 | setContentView(resId);
31 | ButterKnife.bind(this);
32 |
33 | setSupportActionBar(mToolbar);
34 | ActionBar actionBar = getSupportActionBar();
35 | if (actionBar != null) {
36 | actionBar.setHomeButtonEnabled(true);
37 | actionBar.setDisplayHomeAsUpEnabled(true);
38 | //noinspection deprecation
39 | actionBar.setHomeAsUpIndicator(getResources().getDrawable(R.drawable.ic_back));
40 | }
41 |
42 | }
43 |
44 | protected int getLayoutResId() {
45 | return INVALID_RES_ID;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/Demo1Activity.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.digging.translucentstatusbar;
2 |
3 | import android.view.MenuItem;
4 |
5 | /**
6 | * for DiggingTranslucentStatusBar
7 | * Created by kyleduo on 2017/5/5.
8 | */
9 |
10 | public class Demo1Activity extends BaseActivity {
11 |
12 | @Override
13 | protected int getLayoutResId() {
14 | return R.layout.act_demo1;
15 | }
16 |
17 | @Override
18 | public boolean onOptionsItemSelected(MenuItem item) {
19 | if (item.getItemId() == android.R.id.home) {
20 | finish();
21 | return true;
22 | }
23 | return super.onOptionsItemSelected(item);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/Demo2Activity.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.digging.translucentstatusbar;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.design.widget.AppBarLayout;
6 | import android.view.MenuItem;
7 |
8 | import butterknife.BindView;
9 |
10 | /**
11 | * for DiggingTranslucentStatusBar
12 | * Created by kyleduo on 2017/5/5.
13 | */
14 |
15 | public class Demo2Activity extends BaseActivity {
16 |
17 | @BindView(R.id.main_appbar)
18 | AppBarLayout mAppBarLayout;
19 |
20 |
21 | @Override
22 | protected int getLayoutResId() {
23 | return R.layout.act_demo2;
24 | }
25 |
26 | @Override
27 | protected void onCreate(@Nullable Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 |
30 | mAppBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
31 | @Override
32 | public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
33 | if (verticalOffset <= -mToolbar.getHeight() && mToolbar.getTranslationY() == 0) {
34 | mToolbar.animate().translationY(dp2px(-16)).setDuration(100).start();
35 | } else if (verticalOffset > -mToolbar.getHeight() + mToolbar.getTop() && mToolbar.getTranslationY() == dp2px(-16)) {
36 | mToolbar.animate().translationY(0).setDuration(100).start();
37 | }
38 | }
39 | });
40 |
41 | }
42 |
43 | private int dp2px(float dp) {
44 | return (int) (getResources().getDisplayMetrics().density * dp + 0.5);
45 | }
46 |
47 | @Override
48 | public boolean onOptionsItemSelected(MenuItem item) {
49 | if (item.getItemId() == android.R.id.home) {
50 | finish();
51 | return true;
52 | }
53 | return super.onOptionsItemSelected(item);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/Demo3Activity.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.digging.translucentstatusbar;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.app.AppCompatActivity;
6 |
7 | /**
8 | * for DiggingTranslucentStatusBar
9 | * Created by kyleduo on 2017/5/11.
10 | */
11 |
12 | public class Demo3Activity extends AppCompatActivity {
13 |
14 | @Override
15 | protected void onCreate(@Nullable Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.act_demo3);
18 |
19 | getSupportFragmentManager().beginTransaction()
20 | .add(R.id.demo3_fragment_container, new Demo3Fragment())
21 | .commit();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/Demo3BActivity.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.digging.translucentstatusbar;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.app.AppCompatActivity;
6 |
7 | /**
8 | * for DiggingTranslucentStatusBar
9 | * Created by kyleduo on 2017/5/11.
10 | */
11 |
12 | public class Demo3BActivity extends AppCompatActivity {
13 |
14 | @Override
15 | protected void onCreate(@Nullable Bundle savedInstanceState) {
16 | super.onCreate(savedInstanceState);
17 | setContentView(R.layout.act_demo3);
18 |
19 | getSupportFragmentManager().beginTransaction()
20 | .add(R.id.demo3_fragment_container, new Demo3BFragment())
21 | .commit();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/Demo3BFragment.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.digging.translucentstatusbar;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | /**
11 | * for DiggingTranslucentStatusBar
12 | * Created by kyleduo on 2017/5/17.
13 | */
14 |
15 | public class Demo3BFragment extends Fragment {
16 | @Nullable
17 | @Override
18 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
19 | return inflater.inflate(R.layout.frgm_demo3b, container, false);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/Demo3Fragment.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.digging.translucentstatusbar;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.support.v7.app.ActionBar;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.support.v7.widget.Toolbar;
9 | import android.view.LayoutInflater;
10 | import android.view.MenuItem;
11 | import android.view.View;
12 | import android.view.ViewGroup;
13 |
14 | /**
15 | * for DiggingTranslucentStatusBar
16 | * Created by kyleduo on 2017/5/11.
17 | */
18 |
19 | public class Demo3Fragment extends Fragment {
20 |
21 | Toolbar mToolbar;
22 |
23 | @Nullable
24 | @Override
25 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
26 | View view = inflater.inflate(R.layout.frgm_demo3, container, false);
27 | mToolbar = (Toolbar) view.findViewById(R.id.tool_bar);
28 | return view;
29 | }
30 |
31 | @Override
32 | public void onActivityCreated(@Nullable Bundle savedInstanceState) {
33 | super.onActivityCreated(savedInstanceState);
34 |
35 |
36 | AppCompatActivity act = (AppCompatActivity) getActivity();
37 |
38 | act.setSupportActionBar(mToolbar);
39 | ActionBar actionBar = act.getSupportActionBar();
40 | if (actionBar != null) {
41 | actionBar.setHomeButtonEnabled(true);
42 | actionBar.setDisplayHomeAsUpEnabled(true);
43 | //noinspection deprecation
44 | actionBar.setHomeAsUpIndicator(getResources().getDrawable(R.drawable.ic_back));
45 | }
46 |
47 | setHasOptionsMenu(true);
48 | }
49 |
50 | @Override
51 | public boolean onOptionsItemSelected(MenuItem item) {
52 | if (item.getItemId() == android.R.id.home) {
53 | getActivity().finish();
54 | return true;
55 | }
56 | return super.onOptionsItemSelected(item);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/SecondActivity.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.digging.translucentstatusbar;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.app.ActionBar;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.support.v7.widget.Toolbar;
8 | import android.view.MenuItem;
9 | import android.view.View;
10 |
11 | import butterknife.BindView;
12 | import butterknife.ButterKnife;
13 |
14 | /**
15 | * for DiggingTranslucentStatusBar
16 | * Created by kyleduo on 2017/5/3.
17 | */
18 |
19 | public class SecondActivity extends AppCompatActivity {
20 |
21 | @BindView(R.id.second_root)
22 | View mRootView;
23 | @BindView(R.id.second_toolbar)
24 | Toolbar mToolbar;
25 |
26 | @Override
27 | protected void onCreate(@Nullable Bundle savedInstanceState) {
28 | super.onCreate(savedInstanceState);
29 | setContentView(R.layout.act_second);
30 | ButterKnife.bind(this);
31 |
32 | setSupportActionBar(mToolbar);
33 | ActionBar actionBar = getSupportActionBar();
34 | if (actionBar != null) {
35 | actionBar.setHomeButtonEnabled(true);
36 | actionBar.setDisplayHomeAsUpEnabled(true);
37 | //noinspection deprecation
38 | actionBar.setHomeAsUpIndicator(getResources().getDrawable(R.drawable.ic_back));
39 | }
40 | }
41 |
42 | @Override
43 | public boolean onOptionsItemSelected(MenuItem item) {
44 | if (item.getItemId() == android.R.id.home) {
45 | finish();
46 | return true;
47 | }
48 | return super.onOptionsItemSelected(item);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/widgets/DummySupportToolbar.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.digging.translucentstatusbar.widgets;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.widget.Toolbar;
6 | import android.util.AttributeSet;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | /**
11 | * Created by kyleduo on 2017/5/3.
12 | */
13 |
14 | public class DummySupportToolbar extends Toolbar {
15 |
16 | private View mDummyView;
17 |
18 | public DummySupportToolbar(Context context) {
19 | super(context);
20 | }
21 |
22 | public DummySupportToolbar(Context context, @Nullable AttributeSet attrs) {
23 | super(context, attrs);
24 | }
25 |
26 | public DummySupportToolbar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
27 | super(context, attrs, defStyleAttr);
28 | }
29 |
30 | @Override
31 | public void addView(View child, int width, int height) {
32 | if (View.class.isInstance(child)) {
33 | mDummyView = child;
34 | if (height == ViewGroup.LayoutParams.MATCH_PARENT) {
35 | height = getSuggestedMinimumHeight();
36 | }
37 | }
38 | super.addView(child, width, height);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/widgets/FitCollapsingToolbarLayout.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.digging.translucentstatusbar.widgets;
2 |
3 | import android.content.Context;
4 | import android.support.design.widget.CollapsingToolbarLayout;
5 | import android.support.v4.view.WindowInsetsCompat;
6 | import android.util.AttributeSet;
7 |
8 | import java.lang.reflect.Field;
9 |
10 | /**
11 | * Created by kyleduo on 2017/5/5.
12 | */
13 |
14 | public class FitCollapsingToolbarLayout extends CollapsingToolbarLayout {
15 |
16 | Field mLastInsetsField;
17 |
18 | public FitCollapsingToolbarLayout(Context context) {
19 | this(context, null);
20 | }
21 |
22 | public FitCollapsingToolbarLayout(Context context, AttributeSet attrs) {
23 | this(context, attrs, 0);
24 | }
25 |
26 | public FitCollapsingToolbarLayout(Context context, AttributeSet attrs, int defStyleAttr) {
27 | super(context, attrs, defStyleAttr);
28 |
29 | try {
30 | mLastInsetsField = CollapsingToolbarLayout.class.getDeclaredField("mLastInsets");
31 | mLastInsetsField.setAccessible(true);
32 | } catch (NoSuchFieldException e) {
33 | e.printStackTrace();
34 | }
35 | }
36 |
37 | @Override
38 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
39 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
40 | if (mLastInsetsField != null) {
41 | try {
42 | WindowInsetsCompat insetsCompat = (WindowInsetsCompat) mLastInsetsField.get(this);
43 | if (insetsCompat != null && insetsCompat.getSystemWindowInsetTop() > 0) {
44 | setMeasuredDimension(getMeasuredWidth(), getMeasuredHeight() + insetsCompat.getSystemWindowInsetTop());
45 | }
46 | } catch (IllegalAccessException e) {
47 | e.printStackTrace();
48 | }
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/widgets/OnItemClickListener.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.digging.translucentstatusbar.widgets;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.View;
5 |
6 | /**
7 | * Created by kyleduo on 2017/4/27.
8 | */
9 |
10 | public interface OnItemClickListener {
11 | void onItemClick(View view, RecyclerView.ViewHolder holder, int position);
12 | }
13 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/drawer_header.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/drawer_header.jpg
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/ic_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/ic_back.png
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/ic_burger.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/ic_burger.png
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/temp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/temp.jpg
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/layout/act_demo1.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
17 |
18 |
30 |
31 |
41 |
42 |
49 |
50 |
56 |
57 |
58 |
59 |
60 |
65 |
66 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/layout/act_demo2.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
17 |
18 |
30 |
31 |
38 |
39 |
45 |
46 |
47 |
54 |
55 |
56 |
57 |
62 |
63 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/layout/act_demo3.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/layout/act_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
34 |
35 |
45 |
46 |
53 |
54 |
60 |
61 |
62 |
63 |
64 |
69 |
70 |
71 |
72 |
73 |
81 |
82 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/layout/act_second.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
23 |
24 |
29 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/layout/frgm_demo3.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
22 |
23 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/layout/frgm_demo3b.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
21 |
22 |
23 |
28 |
29 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/layout/stub_kitkat_statusbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/values-sw360dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 280dp
4 | 160dp
5 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/values-sw400dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 320dp
4 | 180dp
5 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/values-v19/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
12 |
13 |
16 |
17 |
20 |
21 |
24 |
25 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
12 |
13 |
16 |
17 |
20 |
21 |
24 |
25 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 240dp
4 | 135dp
5 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | TranslucentStatusBar
3 |
4 | open
5 | close
6 |
7 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
14 |
15 |
16 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/app/src/test/java/com/kyleduo/digging/translucentstatusbar/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.digging.translucentstatusbar;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.1'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue May 02 22:16:49 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/DiggingTranslucentStatusBar/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/ExchangeFragment/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/ExchangeFragment/.idea/.name:
--------------------------------------------------------------------------------
1 | ExchangeFragment
--------------------------------------------------------------------------------
/ExchangeFragment/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ExchangeFragment/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/ExchangeFragment/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ExchangeFragment/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/ExchangeFragment/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/ExchangeFragment/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ExchangeFragment/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 23
5 | buildToolsVersion "23.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.kyleduo.blogdemo.exchangefragment"
9 | minSdkVersion 15
10 | targetSdkVersion 23
11 | versionCode 1
12 | versionName "1.0"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | testCompile 'junit:junit:4.12'
25 | compile 'com.android.support:appcompat-v7:23.3.0'
26 | }
27 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/kyle/Documents/developer/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/androidTest/java/com/kyleduo/blogdemo/exchangefragment/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.blogdemo.exchangefragment;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/java/com/kyleduo/blogdemo/exchangefragment/ExchangedFragment.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.blogdemo.exchangefragment;
2 |
3 | /**
4 | * Created by kyle on 16/4/14.
5 | */
6 | public class ExchangedFragment extends HolderFragment {
7 |
8 | @Override
9 | protected String getName() {
10 | return "holder_EXCHANGED";
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/java/com/kyleduo/blogdemo/exchangefragment/Holder1Fragment.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.blogdemo.exchangefragment;
2 |
3 | import android.os.Bundle;
4 |
5 | /**
6 | * Created by kyle on 16/4/14.
7 | */
8 | public class Holder1Fragment extends HolderFragment {
9 |
10 | @Override
11 | protected String getName() {
12 | return "holder_1";
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/java/com/kyleduo/blogdemo/exchangefragment/Holder2Fragment.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.blogdemo.exchangefragment;
2 |
3 | import android.os.Bundle;
4 |
5 | /**
6 | * Created by kyle on 16/4/14.
7 | */
8 | public class Holder2Fragment extends HolderFragment {
9 |
10 | @Override
11 | protected String getName() {
12 | return "holder_2";
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/java/com/kyleduo/blogdemo/exchangefragment/Holder3Fragment.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.blogdemo.exchangefragment;
2 |
3 | import android.os.Bundle;
4 |
5 | /**
6 | * Created by kyle on 16/4/14.
7 | */
8 | public class Holder3Fragment extends HolderFragment {
9 |
10 | @Override
11 | protected String getName() {
12 | return "holder_3";
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/java/com/kyleduo/blogdemo/exchangefragment/Holder4Fragment.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.blogdemo.exchangefragment;
2 |
3 | import android.os.Bundle;
4 |
5 | /**
6 | * Created by kyle on 16/4/14.
7 | */
8 | public class Holder4Fragment extends HolderFragment {
9 |
10 | @Override
11 | protected String getName() {
12 | return "holder_4";
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/java/com/kyleduo/blogdemo/exchangefragment/HolderFragment.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.blogdemo.exchangefragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.TextView;
10 |
11 | /**
12 | * Created by kyle on 16/4/14.
13 | */
14 | public class HolderFragment extends Fragment {
15 | private String mHolderName;
16 |
17 | @Override
18 | public void onCreate(@Nullable Bundle savedInstanceState) {
19 | super.onCreate(savedInstanceState);
20 | mHolderName = getName();
21 | }
22 |
23 | @Nullable
24 | @Override
25 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
26 | return inflater.inflate(R.layout.fragment_holder, container, false);
27 | }
28 |
29 | @Override
30 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
31 | super.onViewCreated(view, savedInstanceState);
32 |
33 | ((TextView) view.findViewById(R.id.holder_tv)).setText(String.format(getString(R.string.holder_pattern), mHolderName));
34 |
35 | view.findViewById(R.id.holder_exchange).setOnClickListener(new View.OnClickListener() {
36 | @Override
37 | public void onClick(View v) {
38 | exchange();
39 | }
40 | });
41 | }
42 |
43 | private void exchange() {
44 | if (getActivity() != null && getActivity() instanceof MainActivity) {
45 | ((MainActivity) getActivity()).exchange();
46 | }
47 | }
48 |
49 | protected String getName() {
50 | return "HOLDER_FRAGMENT";
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/java/com/kyleduo/blogdemo/exchangefragment/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.blogdemo.exchangefragment;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.app.FragmentTabHost;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.text.TextUtils;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.widget.TextView;
11 |
12 | import java.lang.reflect.Field;
13 | import java.util.List;
14 |
15 | public class MainActivity extends AppCompatActivity {
16 |
17 | private FragmentTabHost mTabHost;
18 | private Class[] mOrigin = new Class[]{
19 | Holder1Fragment.class,
20 | Holder2Fragment.class,
21 | Holder3Fragment.class,
22 | Holder4Fragment.class,
23 | };
24 |
25 | private Class[] mFragments = new Class[]{
26 | Holder1Fragment.class,
27 | Holder2Fragment.class,
28 | Holder3Fragment.class,
29 | Holder4Fragment.class,
30 | };
31 |
32 |
33 | @Override
34 | protected void onCreate(Bundle savedInstanceState) {
35 | super.onCreate(savedInstanceState);
36 | setContentView(R.layout.activity_main);
37 |
38 | mTabHost = (FragmentTabHost) findViewById(android.R.id.tabhost);
39 | mTabHost.setup(this, getSupportFragmentManager(), R.id.tab_content);
40 | mTabHost.getTabWidget().setDividerDrawable(null);
41 |
42 | createTabs();
43 | }
44 |
45 | private void createTabs() {
46 | for (int index = 0; index < 4; index++) {
47 | Class clz = mFragments[index];
48 | String tag = clz.getName();
49 | if (tag.equals(ExchangedFragment.class.getName())) {
50 | tag = tag + (index + 1);
51 | }
52 | mTabHost.addTab(mTabHost.newTabSpec(tag)
53 | .setIndicator(getIndicator(index)), clz, null);
54 | }
55 | }
56 |
57 | private View getIndicator(int index) {
58 | View tab = LayoutInflater.from(this).inflate(R.layout.layout_tab, null);
59 | boolean exchanged = mFragments[index].getName().equals(ExchangedFragment.class.getName());
60 | String tabText = exchanged ? "Exchanged " + (index + 1) : String.format(getString(R.string.holder_tab_pattern), index + 1);
61 | ((TextView) tab.findViewById(R.id.tab_text)).setText(tabText);
62 | return tab;
63 | }
64 |
65 | public void exchange() {
66 | int index = mTabHost.getCurrentTab();
67 | if (index < 0 || index > 3) {
68 | return;
69 | }
70 | Class fragment = mFragments[index];
71 | String tag = fragment.getName();
72 | if (tag.equals(ExchangedFragment.class.getName())) {
73 | mFragments[index] = mOrigin[index];
74 | tag = tag + (index + 1);
75 | } else {
76 | mFragments[index] = ExchangedFragment.class;
77 | }
78 |
79 | resetTabs(tag);
80 | }
81 |
82 | public void resetTabs(String oldFragmentTag) {
83 | if (mTabHost != null) {
84 | int currentTab = mTabHost.getCurrentTab();
85 | mTabHost.clearAllTabs();
86 |
87 | //noinspection TryWithIdenticalCatches
88 | try {
89 | Field mTabs = mTabHost.getClass().getDeclaredField("mTabs");
90 | mTabs.setAccessible(true);
91 | Object o = mTabs.get(mTabHost);
92 | if (o instanceof List) {
93 | ((List) o).clear();
94 | }
95 |
96 | Field mLastTab = mTabHost.getClass().getDeclaredField("mLastTab");
97 | mLastTab.setAccessible(true);
98 | mLastTab.set(mTabHost, null);
99 |
100 | } catch (NoSuchFieldException e) {
101 | e.printStackTrace();
102 | } catch (IllegalAccessException e) {
103 | e.printStackTrace();
104 | }
105 |
106 | if (!TextUtils.isEmpty(oldFragmentTag)) {
107 | try {
108 | Fragment f = getSupportFragmentManager().findFragmentByTag(oldFragmentTag);
109 | if (f != null) {
110 | getSupportFragmentManager().beginTransaction().remove(f).commitAllowingStateLoss();
111 | }
112 | } catch (Exception e) {
113 | e.printStackTrace();
114 | }
115 | }
116 |
117 | createTabs();
118 | mTabHost.setCurrentTab(currentTab);
119 | }
120 | }
121 | }
122 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/drawable-xxxhdpi/icon_holder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/ExchangeFragment/app/src/main/res/drawable-xxxhdpi/icon_holder.png
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/drawable/tab_selector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 | -
9 |
10 |
11 |
12 |
13 | -
14 |
15 |
16 |
17 |
18 |
19 | -
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/drawable/top_line_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
8 |
9 |
10 | -
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
23 |
24 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/layout/fragment_holder.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
21 |
22 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/layout/layout_tab.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
23 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/ExchangeFragment/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/ExchangeFragment/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/ExchangeFragment/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/ExchangeFragment/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/ExchangeFragment/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3F51B5
4 | #303F9F
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | ExchangeFragment
3 |
4 | Fragment %1$s
5 | Tab %1$d
6 |
7 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ExchangeFragment/app/src/test/java/com/kyleduo/blogdemo/exchangefragment/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.kyleduo.blogdemo.exchangefragment;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
9 | */
10 | public class ExampleUnitTest {
11 | @Test
12 | public void addition_isCorrect() throws Exception {
13 | assertEquals(4, 2 + 2);
14 | }
15 | }
--------------------------------------------------------------------------------
/ExchangeFragment/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.0.0'
9 |
10 | // NOTE: Do not place your application dependencies here; they belong
11 | // in the individual module build.gradle files
12 | }
13 | }
14 |
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | }
19 | }
20 |
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/ExchangeFragment/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/ExchangeFragment/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/ExchangeFragment/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/ExchangeFragment/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/ExchangeFragment/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem.xcodeproj/project.xcworkspace/xcuserdata/kyle.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/PCHImportProblem/PCHImportProblem.xcodeproj/project.xcworkspace/xcuserdata/kyle.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem.xcodeproj/xcuserdata/kyle.xcuserdatad/xcschemes/PCHImportProblem.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem.xcodeproj/xcuserdata/kyle.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | PCHImportProblem.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 | TestWatchOS (Notification).xcscheme
13 |
14 | orderHint
15 | 4
16 |
17 | TestWatchOS.xcscheme
18 |
19 | orderHint
20 | 3
21 |
22 |
23 | SuppressBuildableAutocreation
24 |
25 | 27346F881CC51F91001D91A4
26 |
27 | primary
28 |
29 |
30 | 273D36001CC501EF00707CD4
31 |
32 | primary
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem.xcworkspace/xcuserdata/kyle.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/PCHImportProblem/PCHImportProblem.xcworkspace/xcuserdata/kyle.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // PCHImportProblem
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 |
16 | @end
17 |
18 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // PCHImportProblem
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | @interface AppDelegate ()
12 |
13 | @end
14 |
15 | @implementation AppDelegate
16 |
17 |
18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
19 | // Override point for customization after application launch.
20 | return YES;
21 | }
22 |
23 | - (void)applicationWillResignActive:(UIApplication *)application {
24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
26 | }
27 |
28 | - (void)applicationDidEnterBackground:(UIApplication *)application {
29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
31 | }
32 |
33 | - (void)applicationWillEnterForeground:(UIApplication *)application {
34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
35 | }
36 |
37 | - (void)applicationDidBecomeActive:(UIApplication *)application {
38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
39 | }
40 |
41 | - (void)applicationWillTerminate:(UIApplication *)application {
42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
43 | }
44 |
45 | @end
46 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "83.5x83.5",
66 | "scale" : "2x"
67 | }
68 | ],
69 | "info" : {
70 | "version" : 1,
71 | "author" : "xcode"
72 | }
73 | }
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/ImportFile.h:
--------------------------------------------------------------------------------
1 | //
2 | // ImportFile.h
3 | // PCHImportProblem
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #ifndef ImportFile_h
10 | #define ImportFile_h
11 |
12 | //#import "JSONModel.h"
13 |
14 | #import "Mock.h"
15 |
16 | #endif /* ImportFile_h */
17 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/Mock.h:
--------------------------------------------------------------------------------
1 | //
2 | // Mock.h
3 | // PCHImportProblem
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "SubTestJsonModel.h"
11 |
12 | @interface Mock : NSObject
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/Mock.m:
--------------------------------------------------------------------------------
1 | //
2 | // Mock.m
3 | // PCHImportProblem
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import "Mock.h"
10 |
11 | @implementation Mock
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/PrefixHeader.pch:
--------------------------------------------------------------------------------
1 | //
2 | // PrefixHeader.pch
3 | // PCHImportProblem
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #ifndef PrefixHeader_pch
10 | #define PrefixHeader_pch
11 |
12 | // Include any system framework and library headers here that should be included in all compilation units.
13 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
14 |
15 | #import "ImportFile.h"
16 |
17 |
18 | #endif /* PrefixHeader_pch */
19 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/SubTestJsonModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // SubTestJsonModel.h
3 | // PCHImportProblem
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import "TestJsonModel.h"
10 |
11 | @interface SubTestJsonModel : TestJsonModel
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/SubTestJsonModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // SubTestJsonModel.m
3 | // PCHImportProblem
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import "SubTestJsonModel.h"
10 |
11 | @implementation SubTestJsonModel
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/TestJsonModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // TestJsonModel.h
3 | // PCHImportProblem
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import "JSONModel.h"
10 |
11 | @interface TestJsonModel : JSONModel
12 |
13 | @property (nonatomic, copy) NSString *name;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/TestJsonModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // TestJsonModel.m
3 | // PCHImportProblem
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import "TestJsonModel.h"
10 |
11 | @implementation TestJsonModel
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // PCHImportProblem
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "TestJsonModel.h"
11 |
12 | @interface ViewController : UIViewController
13 |
14 |
15 | @end
16 |
17 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // PCHImportProblem
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 |
11 | @interface ViewController ()
12 |
13 | @end
14 |
15 | @implementation ViewController
16 |
17 | - (void)viewDidLoad {
18 | [super viewDidLoad];
19 | // Do any additional setup after loading the view, typically from a nib.
20 | }
21 |
22 | - (void)didReceiveMemoryWarning {
23 | [super didReceiveMemoryWarning];
24 | // Dispose of any resources that can be recreated.
25 | }
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/PCHImportProblem/PCHImportProblem/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // PCHImportProblem
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "AppDelegate.h"
11 |
12 | int main(int argc, char * argv[]) {
13 | @autoreleasepool {
14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/PCHImportProblem/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '8.0'
3 | # Uncomment this line if you're using Swift
4 | # use_frameworks!
5 | source 'https://git.coding.net/kyleduo/PodSpecs.git'
6 |
7 | target 'PCHImportProblem' do
8 |
9 | pod 'JSONModel'
10 |
11 | end
12 |
13 |
--------------------------------------------------------------------------------
/PCHImportProblem/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - JSONModel (1.2.0)
3 |
4 | DEPENDENCIES:
5 | - JSONModel
6 |
7 | SPEC CHECKSUMS:
8 | JSONModel: 12523685c4b623553ccf844bbbf7007624317b2c
9 |
10 | COCOAPODS: 0.39.0
11 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Private/JSONModel/JSONAPI.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModelNetworking/JSONAPI.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Private/JSONModel/JSONHTTPClient.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModelNetworking/JSONHTTPClient.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Private/JSONModel/JSONKeyMapper.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModelTransformations/JSONKeyMapper.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Private/JSONModel/JSONModel+networking.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModelNetworking/JSONModel+networking.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Private/JSONModel/JSONModel.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModel/JSONModel.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Private/JSONModel/JSONModelArray.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModel/JSONModelArray.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Private/JSONModel/JSONModelClassProperty.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModel/JSONModelClassProperty.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Private/JSONModel/JSONModelError.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModel/JSONModelError.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Private/JSONModel/JSONModelLib.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModelLib.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Private/JSONModel/JSONValueTransformer.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModelTransformations/JSONValueTransformer.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Private/JSONModel/NSArray+JSONModel.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModelCategories/NSArray+JSONModel.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Public/JSONModel/JSONAPI.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModelNetworking/JSONAPI.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Public/JSONModel/JSONHTTPClient.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModelNetworking/JSONHTTPClient.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Public/JSONModel/JSONKeyMapper.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModelTransformations/JSONKeyMapper.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Public/JSONModel/JSONModel+networking.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModelNetworking/JSONModel+networking.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Public/JSONModel/JSONModel.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModel/JSONModel.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Public/JSONModel/JSONModelArray.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModel/JSONModelArray.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Public/JSONModel/JSONModelClassProperty.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModel/JSONModelClassProperty.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Public/JSONModel/JSONModelError.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModel/JSONModelError.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Public/JSONModel/JSONModelLib.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModelLib.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Public/JSONModel/JSONValueTransformer.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModelTransformations/JSONValueTransformer.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Headers/Public/JSONModel/NSArray+JSONModel.h:
--------------------------------------------------------------------------------
1 | ../../../JSONModel/JSONModel/JSONModelCategories/NSArray+JSONModel.h
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/JSONModel/JSONModel/JSONModel/JSONModelArray.h:
--------------------------------------------------------------------------------
1 | //
2 | // JSONModelArray.h
3 | //
4 | // @version 0.8.0
5 | // @author Marin Todorov (http://www.underplot.com) and contributors
6 | //
7 |
8 | // Copyright (c) 2012-2015 Marin Todorov, Underplot ltd.
9 | // This code is distributed under the terms and conditions of the MIT license.
10 | //
11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 |
17 | #import
18 |
19 | /**
20 | * **Don't make instances of JSONModelArray yourself, except you know what you are doing.**
21 | *
22 | * You get automatically JSONModelArray instances, when you declare a convert on demand property, like so:
23 | *
24 | * @property (strong, nonatomic) NSArray<JSONModel, ConvertOnDemand>* list;
25 | *
26 | * The class stores its contents as they come from JSON, and upon the first request
27 | * of each of the objects stored in the array, it'll be converted to the target model class.
28 | * Thus saving time upon the very first model creation.
29 | */
30 | @interface JSONModelArray : NSObject
31 |
32 | /**
33 | * Don't make instances of JSONModelArray yourself, except you know what you are doing.
34 | *
35 | * @param array an array of NSDictionary objects
36 | * @param cls the JSONModel sub-class you'd like the NSDictionaries to be converted to on demand
37 | */
38 | - (id)initWithArray:(NSArray *)array modelClass:(Class)cls;
39 |
40 | - (id)objectAtIndex:(NSUInteger)index;
41 | - (id)objectAtIndexedSubscript:(NSUInteger)index;
42 | - (void)forwardInvocation:(NSInvocation *)anInvocation;
43 | - (NSUInteger)count;
44 | - (id)firstObject;
45 | - (id)lastObject;
46 |
47 | /**
48 | * Looks up the array's contents and tries to find a JSONModel object
49 | * with matching index property value to the indexValue param.
50 | *
51 | * Will return nil if no matching model is found. Will return nil if there's no index property
52 | * defined on the models found in the array (will sample the first object, assuming the array
53 | * contains homogeneous collection of objects)
54 | *
55 | * @param indexValue the id value to search for
56 | * @return the found model or nil
57 | */
58 | - (id)modelWithIndexValue:(id)indexValue;
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/JSONModel/JSONModel/JSONModel/JSONModelClassProperty.h:
--------------------------------------------------------------------------------
1 | //
2 | // JSONModelClassProperty.h
3 | //
4 | // @version 1.2
5 | // @author Marin Todorov (http://www.underplot.com) and contributors
6 | //
7 |
8 | // Copyright (c) 2012-2015 Marin Todorov, Underplot ltd.
9 | // This code is distributed under the terms and conditions of the MIT license.
10 | //
11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 |
17 | #import
18 |
19 | enum kCustomizationTypes {
20 | kNotInspected = 0,
21 | kCustom,
22 | kNo
23 | };
24 |
25 | typedef enum kCustomizationTypes PropertyGetterType;
26 |
27 | /**
28 | * **You do not need to instantiate this class yourself.** This class is used internally by JSONModel
29 | * to inspect the declared properties of your model class.
30 | *
31 | * Class to contain the information, representing a class property
32 | * It features the property's name, type, whether it's a required property,
33 | * and (optionally) the class protocol
34 | */
35 | @interface JSONModelClassProperty : NSObject
36 |
37 | /** The name of the declared property (not the ivar name) */
38 | @property (copy, nonatomic) NSString* name;
39 |
40 | /** A property class type */
41 | @property (assign, nonatomic) Class type;
42 |
43 | /** Struct name if a struct */
44 | @property (strong, nonatomic) NSString* structName;
45 |
46 | /** The name of the protocol the property conforms to (or nil) */
47 | @property (copy, nonatomic) NSString* protocol;
48 |
49 | /** If YES, it can be missing in the input data, and the input would be still valid */
50 | @property (assign, nonatomic) BOOL isOptional;
51 |
52 | /** If YES - don't call any transformers on this property's value */
53 | @property (assign, nonatomic) BOOL isStandardJSONType;
54 |
55 | /** If YES - create a mutable object for the value of the property */
56 | @property (assign, nonatomic) BOOL isMutable;
57 |
58 | /** If YES - create models on demand for the array members */
59 | @property (assign, nonatomic) BOOL convertsOnDemand;
60 |
61 | /** If YES - the value of this property determines equality to other models */
62 | @property (assign, nonatomic) BOOL isIndex;
63 |
64 | /** The status of property getter introspection in a model */
65 | @property (assign, nonatomic) PropertyGetterType getterType;
66 |
67 | /** a custom getter for this property, found in the owning model */
68 | @property (assign, nonatomic) SEL customGetter;
69 |
70 | /** custom setters for this property, found in the owning model */
71 | @property (strong, nonatomic) NSMutableDictionary *customSetters;
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/JSONModel/JSONModel/JSONModel/JSONModelClassProperty.m:
--------------------------------------------------------------------------------
1 | //
2 | // JSONModelClassProperty.m
3 | //
4 | // @version 1.2
5 | // @author Marin Todorov (http://www.underplot.com) and contributors
6 | //
7 |
8 | // Copyright (c) 2012-2015 Marin Todorov, Underplot ltd.
9 | // This code is distributed under the terms and conditions of the MIT license.
10 | //
11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 |
17 | #import "JSONModelClassProperty.h"
18 |
19 | @implementation JSONModelClassProperty
20 |
21 | -(NSString*)description
22 | {
23 | //build the properties string for the current class property
24 | NSMutableArray* properties = [NSMutableArray arrayWithCapacity:8];
25 |
26 | if (self.isIndex) [properties addObject:@"Index"];
27 | if (self.isOptional) [properties addObject:@"Optional"];
28 | if (self.isMutable) [properties addObject:@"Mutable"];
29 | if (self.convertsOnDemand) [properties addObject:@"ConvertOnDemand"];
30 | if (self.isStandardJSONType) [properties addObject:@"Standard JSON type"];
31 | if (self.customGetter) [properties addObject:[NSString stringWithFormat: @"Getter = %@", NSStringFromSelector(self.customGetter)]];
32 |
33 | if (self.customSetters)
34 | {
35 | NSMutableArray *setters = [NSMutableArray array];
36 |
37 | for (id obj in self.customSetters.allValues)
38 | {
39 | if (obj != [NSNull null])
40 | [setters addObject:obj];
41 | }
42 |
43 | [properties addObject:[NSString stringWithFormat: @"Setters = [%@]", [setters componentsJoinedByString:@", "]]];
44 | }
45 |
46 | NSString* propertiesString = @"";
47 | if (properties.count>0) {
48 | propertiesString = [NSString stringWithFormat:@"(%@)", [properties componentsJoinedByString:@", "]];
49 | }
50 |
51 | //return the name, type and additional properties
52 | return [NSString stringWithFormat:@"@property %@%@ %@ %@",
53 | self.type?[NSString stringWithFormat:@"%@*",self.type]:(self.structName?self.structName:@"primitive"),
54 | self.protocol?[NSString stringWithFormat:@"<%@>", self.protocol]:@"",
55 | self.name,
56 | propertiesString
57 | ];
58 | }
59 |
60 | @end
61 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/JSONModel/JSONModel/JSONModelCategories/NSArray+JSONModel.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSArray+JSONModel.h
3 | //
4 | // @version 1.2
5 | // @author Marin Todorov (http://www.underplot.com) and contributors
6 | //
7 |
8 | // Copyright (c) 2012-2015 Marin Todorov, Underplot ltd.
9 | // This code is distributed under the terms and conditions of the MIT license.
10 | //
11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 |
17 |
18 | #import
19 | #import "JSONModel.h"
20 |
21 | /**
22 | * Exposes invisible JSONModelArray methods
23 | */
24 | @interface NSArray(JSONModel)
25 |
26 | /**
27 | * Looks up the array's contents and tries to find a JSONModel object
28 | * with matching index property value to the indexValue param.
29 | *
30 | * Will return nil if no matching model is found. Will return nil if there's no index property
31 | * defined on the models found in the array (will sample the first object, assuming the array
32 | * contains homogeneous collection of objects)
33 | *
34 | * @param indexValue the id value to search for
35 | * @return the found model or nil
36 | * @exception NSException throws exception if you call this method on an instance, which is not actually a JSONModelArray
37 | */
38 | - (id)modelWithIndexValue:(id)indexValue;
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/JSONModel/JSONModel/JSONModelCategories/NSArray+JSONModel.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSArray+JSONModel.m
3 | //
4 | // @version 1.2
5 | // @author Marin Todorov (http://www.underplot.com) and contributors
6 | //
7 |
8 | // Copyright (c) 2012-2015 Marin Todorov, Underplot ltd.
9 | // This code is distributed under the terms and conditions of the MIT license.
10 | //
11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 |
17 |
18 | #import "NSArray+JSONModel.h"
19 |
20 | @implementation NSArray(JSONModel)
21 |
22 | - (id)modelWithIndexValue:(id)indexValue
23 | {
24 | NSAssert(NO, @"call modelWithIndexValue: on a ConvertOnDemand property, which is defined like that: @property (strong, nonatomic) NSArray* list;");
25 | return nil;
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/JSONModel/JSONModel/JSONModelLib.h:
--------------------------------------------------------------------------------
1 | //
2 | // JSONModelLib.h
3 | //
4 | // @version 1.2
5 | // @author Marin Todorov (http://www.underplot.com) and contributors
6 | //
7 |
8 | // Copyright (c) 2012-2015 Marin Todorov, Underplot ltd.
9 | // This code is distributed under the terms and conditions of the MIT license.
10 | //
11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 |
17 | #import
18 |
19 | //JSONModel transformations
20 | #import "JSONValueTransformer.h"
21 | #import "JSONKeyMapper.h"
22 |
23 | //basic JSONModel classes
24 | #import "JSONModelError.h"
25 | #import "JSONModelClassProperty.h"
26 | #import "JSONModel.h"
27 |
28 | //network classes
29 | #import "JSONHTTPClient.h"
30 | #import "JSONModel+networking.h"
31 | #import "JSONAPI.h"
32 |
33 | //models array
34 | #import "NSArray+JSONModel.h"
35 | #import "JSONModelArray.h"
36 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/JSONModel/JSONModel/JSONModelNetworking/JSONAPI.h:
--------------------------------------------------------------------------------
1 | //
2 | // JSONAPI.h
3 | //
4 | // @version 1.2
5 | // @author Marin Todorov (http://www.underplot.com) and contributors
6 | //
7 |
8 | // Copyright (c) 2012-2015 Marin Todorov, Underplot ltd.
9 | // This code is distributed under the terms and conditions of the MIT license.
10 | //
11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 |
17 | #import
18 | #import "JSONHTTPClient.h"
19 |
20 | /////////////////////////////////////////////////////////////////////////////////////////////
21 |
22 | /**
23 | * @discussion Class for working with JSON APIs. It builds upon the JSONHTTPClient class
24 | * and facilitates making requests to the same web host. Also features helper
25 | * method for making calls to a JSON RPC service
26 | */
27 | @interface JSONAPI : NSObject
28 |
29 | /////////////////////////////////////////////////////////////////////////////////////////////
30 |
31 | /** @name Configuring the API */
32 | /**
33 | * Sets the API url
34 | * @param base the API url as a string
35 | */
36 | +(void)setAPIBaseURLWithString:(NSString*)base;
37 |
38 | /**
39 | * Sets the default content type for the requests/responses
40 | * @param ctype The content-type as a string. Some possible types,
41 | * depending on the service: application/json, text/json, x-application/javascript, etc.
42 | */
43 | +(void)setContentType:(NSString*)ctype;
44 |
45 | /////////////////////////////////////////////////////////////////////////////////////////////
46 |
47 | /** @name Making GET API requests */
48 | /**
49 | * Makes an asynchronous GET request to the API
50 | * @param path the URL path to add to the base API URL for this HTTP call
51 | * @param params the variables to pass to the API
52 | * @param completeBlock a JSONObjectBlock block to execute upon completion
53 | */
54 | +(void)getWithPath:(NSString*)path andParams:(NSDictionary*)params completion:(JSONObjectBlock)completeBlock;
55 |
56 | /////////////////////////////////////////////////////////////////////////////////////////////
57 |
58 | /** @name Making POST API requests */
59 | /**
60 | * Makes a POST request to the API
61 | * @param path the URL path to add to the base API URL for this HTTP call
62 | * @param params the variables to pass to the API
63 | * @param completeBlock a JSONObjectBlock block to execute upon completion
64 | */
65 | +(void)postWithPath:(NSString*)path andParams:(NSDictionary*)params completion:(JSONObjectBlock)completeBlock;
66 |
67 | /////////////////////////////////////////////////////////////////////////////////////////////
68 |
69 | /** @name JSON RPC methods */
70 | /**
71 | * Makes an asynchronous JSON RPC request to the API. Read more: http://www.jsonrpc.org
72 | * @param method the HTTP method name; GET or POST only
73 | * @param args the list of arguments to pass to the API
74 | * @param completeBlock JSONObjectBlock to execute upon completion
75 | */
76 | +(void)rpcWithMethodName:(NSString*)method andArguments:(NSArray*)args completion:(JSONObjectBlock)completeBlock;
77 |
78 | /** @name JSON RPC (2.0) request method */
79 | /**
80 | * Makes an asynchronous JSON RPC 2.0 request to the API. Read more: http://www.jsonrpc.org
81 | * @param method the HTTP method name; GET or POST only
82 | * @param params the params to pass to the API - an NSArray or an NSDictionary,
83 | * depending whether you're using named or unnamed parameters
84 | * @param completeBlock JSONObjectBlock to execute upon completion
85 | */
86 | +(void)rpc2WithMethodName:(NSString*)method andParams:(id)params completion:(JSONObjectBlock)completeBlock;
87 |
88 | /////////////////////////////////////////////////////////////////////////////////////////////
89 |
90 | @end
91 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/JSONModel/JSONModel/JSONModelNetworking/JSONModel+networking.h:
--------------------------------------------------------------------------------
1 | //
2 | // JSONModel+networking.h
3 | //
4 | // @version 1.2
5 | // @author Marin Todorov (http://www.underplot.com) and contributors
6 | //
7 |
8 | // Copyright (c) 2012-2015 Marin Todorov, Underplot ltd.
9 | // This code is distributed under the terms and conditions of the MIT license.
10 | //
11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 |
17 | #import "JSONModel.h"
18 | #import "JSONHTTPClient.h"
19 |
20 | typedef void (^JSONModelBlock)(id model, JSONModelError* err);
21 |
22 | /**
23 | * The JSONModel(networking) class category adds networking to JSONModel.
24 | * It adds initFromURLWithString: initializer, which makes a GET http request
25 | * to the URL given and initializes the model with the returned JSON.
26 | * Use #import "JSONModel+networking.h" to import networking capabilities.
27 | */
28 | @interface JSONModel(Networking)
29 |
30 | @property (assign, nonatomic) BOOL isLoading;
31 | /** @name Asynchronously create a model over the network */
32 | /**
33 | * Asynchronously create a model over the network. Create a new model instance and initialize it with the JSON fetched from the given URL
34 | * @param urlString the absolute URL address of the JSON feed as a string
35 | * @param completeBlock JSONModelBlock executed upon completion. The JSONModelBlock type is defined as: void (^JSONModelBlock)(JSONModel* model, JSONModelError* e); the first parameter is the initialized model or nil,
36 | * and second parameter holds the model initialization error, if any
37 | */
38 | -(instancetype)initFromURLWithString:(NSString *)urlString completion:(JSONModelBlock)completeBlock;
39 |
40 | /**
41 | * Asynchronously gets the contents of a URL and constructs a JSONModel object from the response.
42 | * The constructed JSONModel object passed as the first parameter to the completion block will be of the same
43 | * class as the receiver. So call this method on yourJSONModel sub-class rather than directly on JSONModel.
44 | * @param urlString The absolute URL of the JSON resource, as a string
45 | * @param completeBlock The block to be called upon completion.
46 | * JSONModelBlock type is defined as: void (^JSONModelBlock)(JSONModel* model, JSONModelError* err);
47 | * The first parameter is the initialized model (of the same JSONModel sub-class as the receiver) or nil if there was an error;
48 | * The second parameter is the initialization error, if any.
49 | */
50 | + (void)getModelFromURLWithString:(NSString*)urlString completion:(JSONModelBlock)completeBlock;
51 |
52 | /**
53 | * Asynchronously posts a JSONModel object (as JSON) to a URL and constructs a JSONModel object from the response.
54 | * The constructed JSONModel object passed as the first parameter to the completion block will be of the same
55 | * class as the receiver. So call this method on yourJSONModel sub-class rather than directly on JSONModel.
56 | * @param post A JSONModel object that will be converted to JSON and sent as the POST data to the HTTP request.
57 | * @param urlString The absolute URL of the JSON resource, as a string
58 | * @param completeBlock The block to be called upon completion.
59 | * JSONModelBlock type is defined as: void (^JSONModelBlock)(JSONModel* model, JSONModelError* err);
60 | * The first parameter is the initialized model (of the same JSONModel sub-class as the receiver) or nil if there was an error;
61 | * The second parameter is the initialization error, if any.
62 | */
63 | + (void)postModel:(JSONModel*)post toURLWithString:(NSString*)urlString completion:(JSONModelBlock)completeBlock;
64 |
65 |
66 | @end
67 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/JSONModel/JSONModel/JSONModelNetworking/JSONModel+networking.m:
--------------------------------------------------------------------------------
1 | //
2 | // JSONModel+networking.m
3 | //
4 | // @version 1.2
5 | // @author Marin Todorov (http://www.underplot.com) and contributors
6 | //
7 |
8 | // Copyright (c) 2012-2015 Marin Todorov, Underplot ltd.
9 | // This code is distributed under the terms and conditions of the MIT license.
10 | //
11 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
12 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
13 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 | //
15 |
16 |
17 | #import "JSONModel+networking.h"
18 | #import "JSONHTTPClient.h"
19 |
20 | BOOL _isLoading;
21 |
22 | @implementation JSONModel(Networking)
23 |
24 | @dynamic isLoading;
25 |
26 | -(BOOL)isLoading
27 | {
28 | return _isLoading;
29 | }
30 |
31 | -(void)setIsLoading:(BOOL)isLoading
32 | {
33 | _isLoading = isLoading;
34 | }
35 |
36 | -(instancetype)initFromURLWithString:(NSString *)urlString completion:(JSONModelBlock)completeBlock
37 | {
38 | id placeholder = [super init];
39 | __block id blockSelf = self;
40 |
41 | if (placeholder) {
42 | //initialization
43 | self.isLoading = YES;
44 |
45 | [JSONHTTPClient getJSONFromURLWithString:urlString
46 | completion:^(NSDictionary *json, JSONModelError* e) {
47 |
48 | JSONModelError* initError = nil;
49 | blockSelf = [self initWithDictionary:json error:&initError];
50 |
51 | if (completeBlock) {
52 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
53 | completeBlock(blockSelf, e?e:initError );
54 | });
55 | }
56 |
57 | self.isLoading = NO;
58 |
59 | }];
60 | }
61 | return placeholder;
62 | }
63 |
64 | + (void)getModelFromURLWithString:(NSString*)urlString completion:(JSONModelBlock)completeBlock
65 | {
66 | [JSONHTTPClient getJSONFromURLWithString:urlString
67 | completion:^(NSDictionary* jsonDict, JSONModelError* err)
68 | {
69 | JSONModel* model = nil;
70 |
71 | if(err == nil)
72 | {
73 | model = [[self alloc] initWithDictionary:jsonDict error:&err];
74 | }
75 |
76 | if(completeBlock != nil)
77 | {
78 | dispatch_async(dispatch_get_main_queue(), ^
79 | {
80 | completeBlock(model, err);
81 | });
82 | }
83 | }];
84 | }
85 |
86 | + (void)postModel:(JSONModel*)post toURLWithString:(NSString*)urlString completion:(JSONModelBlock)completeBlock
87 | {
88 | [JSONHTTPClient postJSONFromURLWithString:urlString
89 | bodyString:[post toJSONString]
90 | completion:^(NSDictionary* jsonDict, JSONModelError* err)
91 | {
92 | JSONModel* model = nil;
93 |
94 | if(err == nil)
95 | {
96 | model = [[self alloc] initWithDictionary:jsonDict error:&err];
97 | }
98 |
99 | if(completeBlock != nil)
100 | {
101 | dispatch_async(dispatch_get_main_queue(), ^
102 | {
103 | completeBlock(model, err);
104 | });
105 | }
106 | }];
107 | }
108 |
109 | @end
110 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/JSONModel/LICENSE_jsonmodel.txt:
--------------------------------------------------------------------------------
1 | JSONModel
2 |
3 | Copyright (c) 2012-2014 Marin Todorov, Underplot ltd.
4 | This code is distributed under the terms and conditions of the MIT license.
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of
7 | this software and associated documentation files (the "Software"), to deal in the
8 | Software without restriction, including without limitation the rights to use, copy,
9 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
10 | and to permit persons to whom the Software is furnished to do so, subject to the
11 | following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
17 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
18 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
20 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
21 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 |
23 | The MIT License in plain English: http://www.touch-code-magazine.com/JSONModel/MITLicense
24 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Manifest.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - JSONModel (1.2.0)
3 |
4 | DEPENDENCIES:
5 | - JSONModel
6 |
7 | SPEC CHECKSUMS:
8 | JSONModel: 12523685c4b623553ccf844bbbf7007624317b2c
9 |
10 | COCOAPODS: 0.39.0
11 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Pods.xcodeproj/xcuserdata/kyle.xcuserdatad/xcschemes/JSONModel.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
44 |
45 |
46 |
52 |
53 |
55 |
56 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Pods.xcodeproj/xcuserdata/kyle.xcuserdatad/xcschemes/Pods-PCHImportProblem.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
44 |
45 |
46 |
52 |
53 |
55 |
56 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Pods.xcodeproj/xcuserdata/kyle.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | JSONModel.xcscheme
8 |
9 | isShown
10 |
11 | orderHint
12 | 1
13 |
14 | Pods-PCHImportProblem.xcscheme
15 |
16 | isShown
17 |
18 | orderHint
19 | 2
20 |
21 |
22 | SuppressBuildableAutocreation
23 |
24 | 09FA060F1A0492FB25232F489AC4E573
25 |
26 | primary
27 |
28 |
29 | C7F8F2CF907FBC02124539A0D338A362
30 |
31 | primary
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Target Support Files/JSONModel/JSONModel-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_JSONModel : NSObject
3 | @end
4 | @implementation PodsDummy_JSONModel
5 | @end
6 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Target Support Files/JSONModel/JSONModel-prefix.pch:
--------------------------------------------------------------------------------
1 | #ifdef __OBJC__
2 | #import
3 | #endif
4 |
5 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Target Support Files/JSONModel/JSONModel.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/JSONModel" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/JSONModel"
3 | PODS_ROOT = ${SRCROOT}
4 | SKIP_INSTALL = YES
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Target Support Files/Pods-PCHImportProblem/Pods-PCHImportProblem-acknowledgements.markdown:
--------------------------------------------------------------------------------
1 | # Acknowledgements
2 | This application makes use of the following third party libraries:
3 |
4 | ## JSONModel
5 |
6 | JSONModel
7 |
8 | Copyright (c) 2012-2014 Marin Todorov, Underplot ltd.
9 | This code is distributed under the terms and conditions of the MIT license.
10 |
11 | Permission is hereby granted, free of charge, to any person obtaining a copy of
12 | this software and associated documentation files (the "Software"), to deal in the
13 | Software without restriction, including without limitation the rights to use, copy,
14 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
15 | and to permit persons to whom the Software is furnished to do so, subject to the
16 | following conditions:
17 |
18 | The above copyright notice and this permission notice shall be included in all
19 | copies or substantial portions of the Software.
20 |
21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
22 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
25 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
26 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 |
28 | The MIT License in plain English: http://www.touch-code-magazine.com/JSONModel/MITLicense
29 |
30 | Generated by CocoaPods - http://cocoapods.org
31 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Target Support Files/Pods-PCHImportProblem/Pods-PCHImportProblem-acknowledgements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | FooterText
9 | This application makes use of the following third party libraries:
10 | Title
11 | Acknowledgements
12 | Type
13 | PSGroupSpecifier
14 |
15 |
16 | FooterText
17 | JSONModel
18 |
19 | Copyright (c) 2012-2014 Marin Todorov, Underplot ltd.
20 | This code is distributed under the terms and conditions of the MIT license.
21 |
22 | Permission is hereby granted, free of charge, to any person obtaining a copy of
23 | this software and associated documentation files (the "Software"), to deal in the
24 | Software without restriction, including without limitation the rights to use, copy,
25 | modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
26 | and to permit persons to whom the Software is furnished to do so, subject to the
27 | following conditions:
28 |
29 | The above copyright notice and this permission notice shall be included in all
30 | copies or substantial portions of the Software.
31 |
32 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
33 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
34 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
35 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
36 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
37 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 |
39 | The MIT License in plain English: http://www.touch-code-magazine.com/JSONModel/MITLicense
40 |
41 | Title
42 | JSONModel
43 | Type
44 | PSGroupSpecifier
45 |
46 |
47 | FooterText
48 | Generated by CocoaPods - http://cocoapods.org
49 | Title
50 |
51 | Type
52 | PSGroupSpecifier
53 |
54 |
55 | StringsTable
56 | Acknowledgements
57 | Title
58 | Acknowledgements
59 |
60 |
61 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Target Support Files/Pods-PCHImportProblem/Pods-PCHImportProblem-dummy.m:
--------------------------------------------------------------------------------
1 | #import
2 | @interface PodsDummy_Pods_PCHImportProblem : NSObject
3 | @end
4 | @implementation PodsDummy_Pods_PCHImportProblem
5 | @end
6 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Target Support Files/Pods-PCHImportProblem/Pods-PCHImportProblem-frameworks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -e
3 |
4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
6 |
7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
8 |
9 | install_framework()
10 | {
11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
12 | local source="${BUILT_PRODUCTS_DIR}/$1"
13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
15 | elif [ -r "$1" ]; then
16 | local source="$1"
17 | fi
18 |
19 | local destination="${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
20 |
21 | if [ -L "${source}" ]; then
22 | echo "Symlinked..."
23 | source="$(readlink "${source}")"
24 | fi
25 |
26 | # use filter instead of exclude so missing patterns dont' throw errors
27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
29 |
30 | local basename
31 | basename="$(basename -s .framework "$1")"
32 | binary="${destination}/${basename}.framework/${basename}"
33 | if ! [ -r "$binary" ]; then
34 | binary="${destination}/${basename}"
35 | fi
36 |
37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device
38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
39 | strip_invalid_archs "$binary"
40 | fi
41 |
42 | # Resign the code if required by the build settings to avoid unstable apps
43 | code_sign_if_enabled "${destination}/$(basename "$1")"
44 |
45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
47 | local swift_runtime_libs
48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
49 | for lib in $swift_runtime_libs; do
50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
52 | code_sign_if_enabled "${destination}/${lib}"
53 | done
54 | fi
55 | }
56 |
57 | # Signs a framework with the provided identity
58 | code_sign_if_enabled() {
59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
60 | # Use the current code_sign_identitiy
61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
62 | echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements \"$1\""
63 | /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1"
64 | fi
65 | }
66 |
67 | # Strip invalid architectures
68 | strip_invalid_archs() {
69 | binary="$1"
70 | # Get architectures for current file
71 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
72 | stripped=""
73 | for arch in $archs; do
74 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
75 | # Strip non-valid architectures in-place
76 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1
77 | stripped="$stripped $arch"
78 | fi
79 | done
80 | if [[ "$stripped" ]]; then
81 | echo "Stripped $binary of architectures:$stripped"
82 | fi
83 | }
84 |
85 |
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Target Support Files/Pods-PCHImportProblem/Pods-PCHImportProblem.debug.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/JSONModel"
3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/JSONModel"
4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"JSONModel"
5 | PODS_ROOT = ${SRCROOT}/Pods
--------------------------------------------------------------------------------
/PCHImportProblem/Pods/Target Support Files/Pods-PCHImportProblem/Pods-PCHImportProblem.release.xcconfig:
--------------------------------------------------------------------------------
1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/JSONModel"
3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/JSONModel"
4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"JSONModel"
5 | PODS_ROOT = ${SRCROOT}/Pods
--------------------------------------------------------------------------------
/PCHImportProblem/TestWatchOS Extension/Assets.xcassets/README__ignoredByTemplate__:
--------------------------------------------------------------------------------
1 | Did you know that git does not support storing empty directories?
2 |
--------------------------------------------------------------------------------
/PCHImportProblem/TestWatchOS Extension/ExtensionDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // ExtensionDelegate.h
3 | // TestWatchOS Extension
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ExtensionDelegate : NSObject
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/PCHImportProblem/TestWatchOS Extension/ExtensionDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // ExtensionDelegate.m
3 | // TestWatchOS Extension
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import "ExtensionDelegate.h"
10 |
11 | @implementation ExtensionDelegate
12 |
13 | - (void)applicationDidFinishLaunching {
14 | // Perform any final initialization of your application.
15 | }
16 |
17 | - (void)applicationDidBecomeActive {
18 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
19 | }
20 |
21 | - (void)applicationWillResignActive {
22 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
23 | // Use this method to pause ongoing tasks, disable timers, etc.
24 | }
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/PCHImportProblem/TestWatchOS Extension/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | TestWatchOS Extension
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | XPC!
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | NSExtension
26 |
27 | NSExtensionAttributes
28 |
29 | WKAppBundleIdentifier
30 | com.kyleduo.PCHImportProblem.watchkitapp
31 |
32 | NSExtensionPointIdentifier
33 | com.apple.watchkit
34 |
35 | WKExtensionDelegateClassName
36 | ExtensionDelegate
37 |
38 |
39 |
--------------------------------------------------------------------------------
/PCHImportProblem/TestWatchOS Extension/InterfaceController.h:
--------------------------------------------------------------------------------
1 | //
2 | // InterfaceController.h
3 | // TestWatchOS Extension
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface InterfaceController : WKInterfaceController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/PCHImportProblem/TestWatchOS Extension/InterfaceController.m:
--------------------------------------------------------------------------------
1 | //
2 | // InterfaceController.m
3 | // TestWatchOS Extension
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import "InterfaceController.h"
10 |
11 |
12 | @interface InterfaceController()
13 |
14 | @end
15 |
16 |
17 | @implementation InterfaceController
18 |
19 | - (void)awakeWithContext:(id)context {
20 | [super awakeWithContext:context];
21 |
22 | // Configure interface objects here.
23 | }
24 |
25 | - (void)willActivate {
26 | // This method is called when watch view controller is about to be visible to user
27 | [super willActivate];
28 | }
29 |
30 | - (void)didDeactivate {
31 | // This method is called when watch view controller is no longer visible
32 | [super didDeactivate];
33 | }
34 |
35 | @end
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/PCHImportProblem/TestWatchOS Extension/NotificationController.h:
--------------------------------------------------------------------------------
1 | //
2 | // NotificationController.h
3 | // TestWatchOS Extension
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface NotificationController : WKUserNotificationInterfaceController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/PCHImportProblem/TestWatchOS Extension/NotificationController.m:
--------------------------------------------------------------------------------
1 | //
2 | // NotificationController.m
3 | // TestWatchOS Extension
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #import "NotificationController.h"
10 |
11 |
12 | @interface NotificationController()
13 |
14 | @end
15 |
16 |
17 | @implementation NotificationController
18 |
19 | - (instancetype)init {
20 | self = [super init];
21 | if (self){
22 | // Initialize variables here.
23 | // Configure interface objects here.
24 |
25 | }
26 | return self;
27 | }
28 |
29 | - (void)willActivate {
30 | // This method is called when watch view controller is about to be visible to user
31 | [super willActivate];
32 | }
33 |
34 | - (void)didDeactivate {
35 | // This method is called when watch view controller is no longer visible
36 | [super didDeactivate];
37 | }
38 |
39 | /*
40 | - (void)didReceiveLocalNotification:(UILocalNotification *)localNotification withCompletion:(void (^)(WKUserNotificationInterfaceType))completionHandler {
41 | // This method is called when a local notification needs to be presented.
42 | // Implement it if you use a dynamic notification interface.
43 | // Populate your dynamic notification interface as quickly as possible.
44 | //
45 | // After populating your dynamic notification interface call the completion block.
46 | completionHandler(WKUserNotificationInterfaceTypeCustom);
47 | }
48 | */
49 |
50 | /*
51 | - (void)didReceiveRemoteNotification:(NSDictionary *)remoteNotification withCompletion:(void (^)(WKUserNotificationInterfaceType))completionHandler {
52 | // This method is called when a remote notification needs to be presented.
53 | // Implement it if you use a dynamic notification interface.
54 | // Populate your dynamic notification interface as quickly as possible.
55 | //
56 | // After populating your dynamic notification interface call the completion block.
57 | completionHandler(WKUserNotificationInterfaceTypeCustom);
58 | }
59 | */
60 |
61 | @end
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/PCHImportProblem/TestWatchOS Extension/PrefixHeader.pch:
--------------------------------------------------------------------------------
1 | //
2 | // PrefixHeader.pch
3 | // PCHImportProblem
4 | //
5 | // Created by kyle on 16/4/18.
6 | // Copyright © 2016年 kyleduo. All rights reserved.
7 | //
8 |
9 | #ifndef PrefixHeader_pch
10 | #define PrefixHeader_pch
11 |
12 | // Include any system framework and library headers here that should be included in all compilation units.
13 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
14 |
15 | #import "ImportFile.h"
16 |
17 |
18 | #endif /* PrefixHeader_pch */
19 |
--------------------------------------------------------------------------------
/PCHImportProblem/TestWatchOS Extension/PushNotificationPayload.apns:
--------------------------------------------------------------------------------
1 | {
2 | "aps": {
3 | "alert": {
4 | "body": "Test message",
5 | "title": "Optional title"
6 | },
7 | "category": "myCategory"
8 | },
9 |
10 | "WatchKit Simulator Actions": [
11 | {
12 | "title": "First Button",
13 | "identifier": "firstButtonAction"
14 | }
15 | ],
16 |
17 | "customKey": "Use this file to define a testing payload for your notifications. The aps dictionary specifies the category, alert text and title. The WatchKit Simulator Actions array can provide info for one or more action buttons in addition to the standard Dismiss button. Any other top level keys are custom payload. If you have multiple such JSON files in your project, you'll be able to select them when choosing to debug the notification interface of your Watch App."
18 | }
19 |
--------------------------------------------------------------------------------
/PCHImportProblem/TestWatchOS/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "24x24",
5 | "idiom" : "watch",
6 | "scale" : "2x",
7 | "role" : "notificationCenter",
8 | "subtype" : "38mm"
9 | },
10 | {
11 | "size" : "27.5x27.5",
12 | "idiom" : "watch",
13 | "scale" : "2x",
14 | "role" : "notificationCenter",
15 | "subtype" : "42mm"
16 | },
17 | {
18 | "size" : "29x29",
19 | "idiom" : "watch",
20 | "role" : "companionSettings",
21 | "scale" : "2x"
22 | },
23 | {
24 | "size" : "29x29",
25 | "idiom" : "watch",
26 | "role" : "companionSettings",
27 | "scale" : "3x"
28 | },
29 | {
30 | "size" : "40x40",
31 | "idiom" : "watch",
32 | "scale" : "2x",
33 | "role" : "appLauncher",
34 | "subtype" : "38mm"
35 | },
36 | {
37 | "size" : "86x86",
38 | "idiom" : "watch",
39 | "scale" : "2x",
40 | "role" : "quickLook",
41 | "subtype" : "38mm"
42 | },
43 | {
44 | "size" : "98x98",
45 | "idiom" : "watch",
46 | "scale" : "2x",
47 | "role" : "quickLook",
48 | "subtype" : "42mm"
49 | }
50 | ],
51 | "info" : {
52 | "version" : 1,
53 | "author" : "xcode"
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/PCHImportProblem/TestWatchOS/Base.lproj/Interface.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/PCHImportProblem/TestWatchOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | PCHImportProblem
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1
25 | UISupportedInterfaceOrientations
26 |
27 | UIInterfaceOrientationPortrait
28 | UIInterfaceOrientationPortraitUpsideDown
29 |
30 | WKCompanionAppBundleIdentifier
31 | com.kyleduo.PCHImportProblem
32 | WKWatchKitApp
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ExamplesFromMyBlog
2 |
3 | This Repository contains source code of some demos in my blog. --> [https://kyleduo.com](https://kyleduo.com)
4 |
5 | ### [Digging] 支付宝首页交互
6 |
7 | 
8 |
9 | ### [Digging] Android Translucent Status Bar
10 |
11 | How to implement perfect translucent bar in >= 4.4 and why.
12 |
13 | 
14 |
15 |
16 |
17 |
18 |
19 | ### ExchangeFragment
20 |
21 | Exchange fragment in FragmentTabHost.
22 |
23 | [Link](https://blog.kyleduo.com/2016/04/14/exchange-fragment-in-fragmenttabhost/)
24 |
25 | Preview:
26 |
27 | 
28 |
29 |
--------------------------------------------------------------------------------
/preview/ExchangeFragment.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/preview/ExchangeFragment.gif
--------------------------------------------------------------------------------
/preview/alipay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/preview/alipay.png
--------------------------------------------------------------------------------