// Path: android/tweakr/src/main/java/com/google/tweakr/Tweakr.java
// public class Tweakr {
// 
//     private static TweakrRepo repo;
// 
//     /**
//      * Returns the current repo used for this session.
//      */
//     public static synchronized TweakrRepo getRepo() {
//         if (repo == null) {
//             throw new IllegalStateException("Must call TweakrRepo.setRepo() first.");
//         }
//         return repo;
//     }
// 
//     /**
//      * Optionally sets the repo to be used for this session.
//      *
//      * You must set this before any other calls to methods in this class (e.g.
//      * {@link #register(Object)}). Best practice is to set it in your {@link Application#onCreate()}
//      *
//      */
//     public static synchronized void setRepo(TweakrRepo repo) {
//         if (Tweakr.repo != null) {
//             throw new IllegalStateException("Repo has already been set. You may only setRepo once, before any calls to register() or addListener()");
//         }
//         Tweakr.repo = repo;
//     }
// 
//     /**
//      * {@see #register(Object, String)}
//      */
//     public static void register(Object target) {
//         register(target, null);
//     }
// 
//     /**
//      * Registers all members of target that are annotated with
//      * {@link com.google.tweakr.annotations.Tweak}.
//      *
//      * Any annotated fields with children must be non-null at the time of registration.
//      *
//      * @param target the object containing members to register.
//      * @param namePrefix An optional prefix for each Tweak. Use this if you want to differentiate
//      *                   multiple objects in the UI: instead of changing a value and changing all
//      *                   objects that share that member, you can add a unique namePrefix for each
//      *                   object (or group of objects) so that the changes only affect a subset of
//      *                   the targets.
//      */
//     public static void register(Object target, String namePrefix) {
//         TweakrRegistry.get(getRepo()).register(target, namePrefix);
//     }
// 
//     /**
//      * Registers all members of target that are annotated with
//      * {@link com.google.tweakr.annotations.Tweak}.
//      *
//      * Any annotated fields with children must be non-null at the time of registration.
//      *
//      * @param target the object containing members to register.
//      * @param clazz the type of object to gather fields from. Use this in superclasses, since Tweakr
//      *              will only gather the declared fields of the given class, not inherited fields.
//      * @param namePrefix An optional prefix for each Tweak. Use this if you want to differentiate
//      *                   multiple objects in the UI: instead of changing a value and changing all
//      *                   objects that share that member, you can add a unique namePrefix for each
//      *                   object (or group of objects) so that the changes only affect a subset of
//      *                   the targets.
//      */
//     public <T> void register(T target, Class<? extends T> clazz,  String namePrefix) {
//         TweakrRegistry.get(getRepo()).register(target, clazz, namePrefix);
//     }
// 
//     /**
//      * {@see TweakrRepo#addListener}
//      */
//     public static void addListener(TweakrRepo.OnChangeListener listener) {
//         getRepo().addListener(listener);
//     }
//     /**
//      * {@see TweakrRepo#removeListener}
//      */
//     public static void removeListener(TweakrRepo.OnChangeListener listener) {
//         getRepo().removeListener(listener);
//     }
// }


import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.TextView;
import com.google.tweakr.Tweakr;
import com.google.tweakr.annotations.Tweak;
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.tweakr.sample;

//import androidx.appcompat.app.AppCompatActivity;



public class MainActivity extends Activity {

    @Tweak(child ="setText(CharSequence)")
    public TextView introText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        introText = findViewById(R.id.text);

        // Make sure to register AFTER you have set all your View fields!
// Path: android/tweakr/src/main/java/com/google/tweakr/Tweakr.java
// public class Tweakr {
// 
//     private static TweakrRepo repo;
// 
//     /**
//      * Returns the current repo used for this session.
//      */
//     public static synchronized TweakrRepo getRepo() {
//         if (repo == null) {
//             throw new IllegalStateException("Must call TweakrRepo.setRepo() first.");
//         }
//         return repo;
//     }
// 
//     /**
//      * Optionally sets the repo to be used for this session.
//      *
//      * You must set this before any other calls to methods in this class (e.g.
//      * {@link #register(Object)}). Best practice is to set it in your {@link Application#onCreate()}
//      *
//      */
//     public static synchronized void setRepo(TweakrRepo repo) {
//         if (Tweakr.repo != null) {
//             throw new IllegalStateException("Repo has already been set. You may only setRepo once, before any calls to register() or addListener()");
//         }
//         Tweakr.repo = repo;
//     }
// 
//     /**
//      * {@see #register(Object, String)}
//      */
//     public static void register(Object target) {
//         register(target, null);
//     }
// 
//     /**
//      * Registers all members of target that are annotated with
//      * {@link com.google.tweakr.annotations.Tweak}.
//      *
//      * Any annotated fields with children must be non-null at the time of registration.
//      *
//      * @param target the object containing members to register.
//      * @param namePrefix An optional prefix for each Tweak. Use this if you want to differentiate
//      *                   multiple objects in the UI: instead of changing a value and changing all
//      *                   objects that share that member, you can add a unique namePrefix for each
//      *                   object (or group of objects) so that the changes only affect a subset of
//      *                   the targets.
//      */
//     public static void register(Object target, String namePrefix) {
//         TweakrRegistry.get(getRepo()).register(target, namePrefix);
//     }
// 
//     /**
//      * Registers all members of target that are annotated with
//      * {@link com.google.tweakr.annotations.Tweak}.
//      *
//      * Any annotated fields with children must be non-null at the time of registration.
//      *
//      * @param target the object containing members to register.
//      * @param clazz the type of object to gather fields from. Use this in superclasses, since Tweakr
//      *              will only gather the declared fields of the given class, not inherited fields.
//      * @param namePrefix An optional prefix for each Tweak. Use this if you want to differentiate
//      *                   multiple objects in the UI: instead of changing a value and changing all
//      *                   objects that share that member, you can add a unique namePrefix for each
//      *                   object (or group of objects) so that the changes only affect a subset of
//      *                   the targets.
//      */
//     public <T> void register(T target, Class<? extends T> clazz,  String namePrefix) {
//         TweakrRegistry.get(getRepo()).register(target, clazz, namePrefix);
//     }
// 
//     /**
//      * {@see TweakrRepo#addListener}
//      */
//     public static void addListener(TweakrRepo.OnChangeListener listener) {
//         getRepo().addListener(listener);
//     }
//     /**
//      * {@see TweakrRepo#removeListener}
//      */
//     public static void removeListener(TweakrRepo.OnChangeListener listener) {
//         getRepo().removeListener(listener);
//     }
// }


// Path: android-sample/app/src/main/java/com/google/tweakr/sample/MainActivity.java
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.TextView;
import com.google.tweakr.Tweakr;
import com.google.tweakr.annotations.Tweak;

// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.tweakr.sample;

//import androidx.appcompat.app.AppCompatActivity;



public class MainActivity extends Activity {

    @Tweak(child ="setText(CharSequence)")
    public TextView introText;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        introText = findViewById(R.id.text);

        // Make sure to register AFTER you have set all your View fields!
        Tweakr.register(this);