diff --git a/.gitignore b/.gitignore
index 8b98844..bdd7022 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,33 @@
-.gradle/
-.idead/gradle.xml
-.idea/workspace.xml
+# Built application files
+*.apk
+*.ap_
+
+# Files for the Dalvik VM
+*.dex
+
+# Java class files
+*.class
-.DS_Store
+# Generated files
+bin/
+gen/
+
+# Gradle files
+.gradle/
+build/
+# Local configuration file (sdk path, etc)
local.properties
+
+# Proguard folder generated by Eclipse
+proguard/
+
+# Log Files
+*.log
+
+.idea/
+# Android Studio Navigation editor temp files
+.navigation/
+
+# Android Studio captures folder
+captures/
diff --git a/.idea/.name b/.idea/.name
index f6a6238..816ceab 100644
--- a/.idea/.name
+++ b/.idea/.name
@@ -1 +1 @@
-APIOK
\ No newline at end of file
+android_example
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 217af47..96cc43e 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -1,7 +1,6 @@
-
@@ -12,6 +11,7 @@
+
@@ -19,5 +19,4 @@
-
-
+
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
index 3572571..e7bedf3 100644
--- a/.idea/copyright/profiles_settings.xml
+++ b/.idea/copyright/profiles_settings.xml
@@ -1,5 +1,3 @@
-
-
-
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index e206d70..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/.idea/libraries/ComAndroidSupportAppcompatV71900_aar.xml b/.idea/libraries/ComAndroidSupportAppcompatV71900_aar.xml
deleted file mode 100644
index 8ff7913..0000000
--- a/.idea/libraries/ComAndroidSupportAppcompatV71900_aar.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/support_v4_19_0_0.xml b/.idea/libraries/support_v4_19_0_0.xml
deleted file mode 100644
index 0279a24..0000000
--- a/.idea/libraries/support_v4_19_0_0.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b153e48..1d9d626 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,10 +1,19 @@
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
index e1a6317..ff06154 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -2,9 +2,8 @@
-
-
+
+
-
-
+
\ No newline at end of file
diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml
deleted file mode 100644
index 922003b..0000000
--- a/.idea/scopes/scope_settings.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index def6a6a..94a25f7 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -1,7 +1,6 @@
-
+
-
-
+
\ No newline at end of file
diff --git a/APIOK.iml b/APIOK.iml
deleted file mode 100644
index 2140a04..0000000
--- a/APIOK.iml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/android_example.iml b/android_example.iml
new file mode 100644
index 0000000..18b2d04
--- /dev/null
+++ b/android_example.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/apiok/.gitignore b/apiok/.gitignore
deleted file mode 100644
index 796b96d..0000000
--- a/apiok/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
diff --git a/apiok/apiok.iml b/apiok/apiok.iml
deleted file mode 100644
index ef71b3d..0000000
--- a/apiok/apiok.iml
+++ /dev/null
@@ -1,76 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/apiok/build.gradle b/apiok/build.gradle
deleted file mode 100644
index fe93094..0000000
--- a/apiok/build.gradle
+++ /dev/null
@@ -1,36 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath 'com.android.tools.build:gradle:0.7.+'
- }
-}
-apply plugin: 'android'
-
-repositories {
- mavenCentral()
-}
-
-android {
- compileSdkVersion 19
- buildToolsVersion "19.0.1"
-
- defaultConfig {
- minSdkVersion 3
- targetSdkVersion 19
- versionCode 1
- versionName "1.0"
- }
- buildTypes {
- release {
- runProguard false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
- }
- }
-}
-
-dependencies {
-// compile 'com.android.support:appcompat-v7:+'
- compile files('../libs/odnoklassniki-android-sdk.jar')
-}
diff --git a/apiok/src/main/res/drawable-hdpi/ic_launcher.png b/apiok/src/main/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index 96a442e..0000000
Binary files a/apiok/src/main/res/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/apiok/src/main/res/drawable-mdpi/ic_launcher.png b/apiok/src/main/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index 359047d..0000000
Binary files a/apiok/src/main/res/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/apiok/src/main/res/drawable-xhdpi/ic_launcher.png b/apiok/src/main/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index 71c6d76..0000000
Binary files a/apiok/src/main/res/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/apiok/src/main/res/drawable-xxhdpi/ic_launcher.png b/apiok/src/main/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644
index 4df1894..0000000
Binary files a/apiok/src/main/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/apiok/src/main/res/values/styles.xml b/apiok/src/main/res/values/styles.xml
deleted file mode 100644
index 7933281..0000000
--- a/apiok/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
diff --git a/app/app.iml b/app/app.iml
new file mode 100644
index 0000000..cdbf472
--- /dev/null
+++ b/app/app.iml
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ generateDebugAndroidTestSources
+ generateDebugSources
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..3987fde
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,27 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 23
+ buildToolsVersion "23.0.1"
+
+ defaultConfig {
+ applicationId "ru.apiok"
+ minSdkVersion 9
+ targetSdkVersion 23
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile files('../libs/odnoklassniki-android-sdk.jar')
+ testCompile 'junit:junit:4.12'
+ compile 'com.android.support:appcompat-v7:23.0.1'
+}
diff --git a/apiok/proguard-rules.txt b/app/proguard-rules.pro
similarity index 68%
rename from apiok/proguard-rules.txt
rename to app/proguard-rules.pro
index 435b4ff..d59ce4b 100644
--- a/apiok/proguard-rules.txt
+++ b/app/proguard-rules.pro
@@ -1,8 +1,8 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
-# in C:/Users/valery.ozhiganov/AppData/Local/Android/android-studio/sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the ProGuard
-# include property in project.properties.
+# in /Users/afarber/Library/Android/sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
@@ -14,4 +14,4 @@
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
-#}
\ No newline at end of file
+#}
diff --git a/app/src/androidTest/java/ru/apiok/ApplicationTest.java b/app/src/androidTest/java/ru/apiok/ApplicationTest.java
new file mode 100644
index 0000000..b9f8fd6
--- /dev/null
+++ b/app/src/androidTest/java/ru/apiok/ApplicationTest.java
@@ -0,0 +1,13 @@
+package ru.apiok;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/apiok/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
similarity index 84%
rename from apiok/src/main/AndroidManifest.xml
rename to app/src/main/AndroidManifest.xml
index 8b4c72b..cab8987 100644
--- a/apiok/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,14 +1,13 @@
+
-
-
+ package="ru.apiok" >
+ android:theme="@style/AppTheme.NoActionBar"
+ android:icon="@mipmap/ic_launcher">
@@ -31,7 +30,7 @@
+ android:host="okXXXXXXXXXX" />
diff --git a/apiok/src/main/java/ru/apiok/LoginActivity.java b/app/src/main/java/ru/apiok/LoginActivity.java
old mode 100644
new mode 100755
similarity index 81%
rename from apiok/src/main/java/ru/apiok/LoginActivity.java
rename to app/src/main/java/ru/apiok/LoginActivity.java
index 505f9d7..a9fa681
--- a/apiok/src/main/java/ru/apiok/LoginActivity.java
+++ b/app/src/main/java/ru/apiok/LoginActivity.java
@@ -13,10 +13,13 @@
/*
* Created by valery.ozhiganov on 26.12.13.
+ * Updated by Alexander Farber on 08.10.2015.
*/
public class
LoginActivity extends Activity implements OkTokenRequestListener, View.OnClickListener {
- private String
+ private final static String TAG = "APIOK";
+
+ private final static String
//ID приложения
//Application ID
APP_ID = "",
@@ -39,26 +42,32 @@ public void onCreate(Bundle savedInstanceState) {
//создаем объект, привязанный к контексту приложения
//create object which will bound to the application context
mOdnoklassniki = Odnoklassniki.createInstance(getApplicationContext(), APP_ID, APP_SECRET_KEY, APP_PUBLIC_KEY);
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
- //определяем callback на операции с получением токена
- //define callback on authorization
+ //определяем callback на операции с получением токена
+ //define callback on authorization
mOdnoklassniki.setTokenRequestListener(this);
+
}
@Override
- public void onDestroy() {
- //удаляем callback
- //remove callback
- mOdnoklassniki.removeTokenRequestListener();
+ public void onPause() {
+ super.onPause();
- super.onDestroy();
+ //удаляем callback
+ //remove callback
+ mOdnoklassniki.removeTokenRequestListener();
}
//если всё хорошо, пользователь зашел в наше приложение
//if all right, user logged in our app
@Override
public void onSuccess(String token) {
- Log.v("APIOK", "Your token: " + token);
+ Log.v(TAG, "Your token: " + token);
//переходим к другой активити, где будем вызывать методы
//change activity for api interaction
startActivity(new Intent(LoginActivity.this, MainActivity.class));
@@ -69,9 +78,9 @@ public void onSuccess(String token) {
//if something goes wrong in authorization
@Override
public void onError() {
- Log.v("APIOK", "Error");
+ Log.v(TAG, "Error");
Toast.makeText(this, "Что-то пошло не так", Toast.LENGTH_LONG).show();
-// Toast.makeText(this, "Something goes wrong", Toast.LENGTH_LONG).show();
+// Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG).show();
}
//если что-то пошло не так, пользователь не зашел в наше приложение
@@ -82,9 +91,9 @@ public void onCancel() {
//press back
//нажать отменить в вебе
//press cancel
- Log.v("APIOK", "Cancel");
+ Log.v(TAG, "Cancel");
Toast.makeText(this, "Что-то пошло не так", Toast.LENGTH_LONG).show();
-// Toast.makeText(this, "Something goes wrong", Toast.LENGTH_LONG).show();
+// Toast.makeText(this, "Something went wrong", Toast.LENGTH_LONG).show();
}
//метод обработки нажатия пользователя
@@ -93,7 +102,7 @@ public void onCancel() {
public void onClick(View view) {
switch (view.getId()) {
case R.id.loginButton:
- Log.v("APIOK", "Clicked");
+ Log.v(TAG, "Clicked");
//вызываем запрос авторизации. После OAuth будет вызван callback, определенный для объекта
//request authorization
diff --git a/apiok/src/main/java/ru/apiok/MainActivity.java b/app/src/main/java/ru/apiok/MainActivity.java
old mode 100644
new mode 100755
similarity index 99%
rename from apiok/src/main/java/ru/apiok/MainActivity.java
rename to app/src/main/java/ru/apiok/MainActivity.java
index 8549d78..82241dd
--- a/apiok/src/main/java/ru/apiok/MainActivity.java
+++ b/app/src/main/java/ru/apiok/MainActivity.java
@@ -22,6 +22,7 @@
/*
* Created by valery.ozhiganov on 26.12.13.
+ * Updated by Alexander Farber on 08.10.2015.
*/
public class MainActivity extends Activity implements View.OnClickListener {
private Odnoklassniki mOdnoklassniki;
diff --git a/apiok/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml
old mode 100644
new mode 100755
similarity index 92%
rename from apiok/src/main/res/layout/activity_login.xml
rename to app/src/main/res/layout/activity_login.xml
index 8b79c7c..5b50e4f
--- a/apiok/src/main/res/layout/activity_login.xml
+++ b/app/src/main/res/layout/activity_login.xml
@@ -11,7 +11,7 @@
android:layout_height="wrap_content"
android:text="login"
android:padding="15dp"
- android:background="#F6881F"
+ android:background="?attr/colorPrimary"
android:textColor="#FFF"
android:onClick="onClick"
android:layout_centerInParent="true" />
diff --git a/apiok/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
old mode 100644
new mode 100755
similarity index 88%
rename from apiok/src/main/res/layout/activity_main.xml
rename to app/src/main/res/layout/activity_main.xml
index 3c62bc2..0e2fed3
--- a/apiok/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -4,7 +4,7 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="#F8861F">
+ android:background="?attr/colorPrimary">
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100755
index 0000000..f0ceb7a
Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100755
index 0000000..cc16d14
Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100755
index 0000000..4e8afce
Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100755
index 0000000..7388537
Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100755
index 0000000..c3e5c8e
Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/app/src/main/res/values-v21/styles.xml b/app/src/main/res/values-v21/styles.xml
new file mode 100644
index 0000000..65d0c39
--- /dev/null
+++ b/app/src/main/res/values-v21/styles.xml
@@ -0,0 +1,8 @@
+>
+
+
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
new file mode 100644
index 0000000..cdfe0f4
--- /dev/null
+++ b/app/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #F8861F
+ #303F9F
+ #FF4081
+
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..812cb7b
--- /dev/null
+++ b/app/src/main/res/values/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 16dp
+ 16dp
+ 16dp
+
diff --git a/apiok/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
similarity index 56%
rename from apiok/src/main/res/values/strings.xml
rename to app/src/main/res/values/strings.xml
index be4bacd..559cfe1 100644
--- a/apiok/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,3 +1,4 @@
APIOK
+ Settings
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..44f664f
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/src/test/java/ru/apiok/ExampleUnitTest.java b/app/src/test/java/ru/apiok/ExampleUnitTest.java
new file mode 100644
index 0000000..e4ff677
--- /dev/null
+++ b/app/src/test/java/ru/apiok/ExampleUnitTest.java
@@ -0,0 +1,15 @@
+package ru.apiok;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * To work on unit tests, switch the Test Artifact in the Build Variants view.
+ */
+public class ExampleUnitTest {
+ @Test
+ public void addition_isCorrect() throws Exception {
+ assertEquals(4, 2 + 2);
+ }
+}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index f7a7ae7..be515a8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1 +1,23 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
\ No newline at end of file
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.3.0'
+
+ // NOTE: Do not place your application dependencies here; they belong
+ // in the individual module build.gradle files
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/gradle.properties b/gradle.properties
index 5d08ba7..1d3591c 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,8 +1,8 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
-# Settings specified in this file will override any Gradle settings
-# configured through the IDE.
+# Gradle settings configured through the IDE *will override*
+# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 9b8ffdd..d7ba608 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Apr 10 15:27:10 PDT 2013
+#Thu Oct 08 20:11:36 CEST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.9-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
diff --git a/gradlew b/gradlew
old mode 100644
new mode 100755
diff --git a/settings.gradle b/settings.gradle
index 5791c47..e7b4def 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1 +1 @@
-include ':apiok'
+include ':app'