Permalink
Browse files

Update library and samples to ActionBarCompat. Remove sample_sherlock

  • Loading branch information...
1 parent 30dd1ac commit a51e34deac81af7d7429b451b0e31bd29c4b304b @mwong56 mwong56 committed Jul 12, 2015
Showing with 42 additions and 521 deletions.
  1. +1 −1 build.gradle
  2. +2 −2 gradle/wrapper/gradle-wrapper.properties
  3. +7 −10 library/build.gradle
  4. +2 −1 library/src/main/java/me/imid/swipebacklayout/lib/app/SwipeBackActivity.java
  5. BIN sample_sherlock/libs/android-support-v4.jar
  6. +0 −30 sample_sherlock/src/main/AndroidManifest.xml
  7. +0 −180 sample_sherlock/src/main/java/me/imid/swipebacklayout/demo/sherlock/DemoSherlockActivity.java
  8. +0 −70 sample_sherlock/src/main/java/me/imid/swipebacklayout/demo/sherlock/PreferenceUtils.java
  9. +0 −51 sample_sherlock/src/main/java/me/imid/swipebacklayout/demo/sherlock/SwipeBackSherlockActivity.java
  10. BIN sample_sherlock/src/main/res/drawable-hdpi/ic_launcher.png
  11. BIN sample_sherlock/src/main/res/drawable-mdpi/ic_launcher.png
  12. BIN sample_sherlock/src/main/res/drawable-xhdpi/ic_launcher.png
  13. BIN sample_sherlock/src/main/res/drawable-xxhdpi/ic_launcher.png
  14. +0 −72 sample_sherlock/src/main/res/layout/activity_demo.xml
  15. +0 −7 sample_sherlock/src/main/res/menu/main.xml
  16. +0 −4 sample_sherlock/src/main/res/values-sw600dp/dimens.xml
  17. +0 −5 sample_sherlock/src/main/res/values-sw720dp-land/dimens.xml
  18. +0 −6 sample_sherlock/src/main/res/values-v11/styles.xml
  19. +0 −9 sample_sherlock/src/main/res/values/color.xml
  20. +0 −6 sample_sherlock/src/main/res/values/dimens.xml
  21. +0 −16 sample_sherlock/src/main/res/values/strings.xml
  22. +0 −10 sample_sherlock/src/main/res/values/styles.xml
  23. +4 −4 samples/build.gradle
  24. BIN samples/libs/android-support-v4.jar
  25. +6 −2 samples/src/main/java/me/imid/swipebacklayout/demo/DemoActivity.java
  26. +18 −8 samples/src/main/res/layout/activity_demo.xml
  27. +0 −12 samples/src/main/res/values-v11/styles.xml
  28. +0 −13 samples/src/main/res/values-v14/styles.xml
  29. +2 −2 samples/src/main/res/values/styles.xml
View
@@ -3,7 +3,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:1.1.2'
+ classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
}
@@ -1,6 +1,6 @@
-#Wed Jul 02 17:20:01 CST 2014
+#Sat Jul 11 17:40:25 PDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
View
@@ -1,29 +1,26 @@
apply plugin: 'com.android.library'
-apply plugin: 'com.github.dcendents.android-maven'
-apply plugin: 'com.jfrog.bintray'
-
-version = "1.0.0"
repositories {
mavenCentral()
}
dependencies {
- compile 'com.android.support:support-v4:21.0.3'
+ compile 'com.android.support:appcompat-v7:22.2.0'
}
android {
- compileSdkVersion 21
- buildToolsVersion "21.1.2"
+ compileSdkVersion 22
+ buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 7
- targetSdkVersion 21
+ targetSdkVersion 22
versionCode 1
- versionName version
+ versionName "1.0.0"
}
}
+/*
def siteUrl = 'https://github.com/ikew0ng/SwipeBackLayout'
def gitUrl = 'https://github.com/ikew0ng/SwipeBackLayout.git'
group = "me.imid.swipebacklayout.lib"
@@ -91,4 +88,4 @@ bintray {
licenses = ["Apache-2.0"]
publish = true
}
-}
+}*/
@@ -3,12 +3,13 @@
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
+import android.support.v7.app.AppCompatActivity;
import android.view.View;
import me.imid.swipebacklayout.lib.SwipeBackLayout;
import me.imid.swipebacklayout.lib.Utils;
-public class SwipeBackActivity extends FragmentActivity implements SwipeBackActivityBase {
+public class SwipeBackActivity extends AppCompatActivity implements SwipeBackActivityBase {
private SwipeBackActivityHelper mHelper;
@Override
Binary file not shown.
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="me.imid.swipebacklayout.demo.sherlock"
- android:versionCode="1"
- android:versionName="1.0">
-
- <uses-sdk
- android:minSdkVersion="8"
- android:targetSdkVersion="18"/>
-
- <uses-permission android:name="android.permission.VIBRATE"/>
-
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme">
- <!-- demo for actionbar sherlock activity -->
- <activity
- android:name=".DemoSherlockActivity"
- android:label="sherlock">
- <intent-filter>
- <action android:name="android.intent.action.MAIN"/>
-
- <category android:name="android.intent.category.LAUNCHER"/>
- </intent-filter>
- </activity>
- </application>
-
-</manifest>
@@ -1,180 +0,0 @@
-
-package me.imid.swipebacklayout.demo.sherlock;
-
-import me.imid.swipebacklayout.demo.sherlock.R;
-import me.imid.swipebacklayout.lib.SwipeBackLayout;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.Resources;
-import android.graphics.drawable.ColorDrawable;
-import android.net.Uri;
-import android.os.Bundle;
-import android.os.Vibrator;
-import android.view.View;
-import android.widget.RadioGroup;
-
-import com.actionbarsherlock.view.Menu;
-import com.actionbarsherlock.view.MenuItem;
-
-/**
- * sample for using actionbar sherlock
- */
-public class DemoSherlockActivity extends SwipeBackSherlockActivity implements View.OnClickListener {
- private static final int VIBRATE_DURATION = 20;
-
- private int[] mBgColors;
-
- private static int mBgIndex = 0;
-
- private String mKeyTrackingMode;
-
- private RadioGroup mTrackingModeGroup;
-
- private SwipeBackLayout mSwipeBackLayout;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_demo);
- changeActionBarColor();
- findViews();
- mKeyTrackingMode = getString(R.string.key_tracking_mode);
- mSwipeBackLayout = getSwipeBackLayout();
-
- mTrackingModeGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(RadioGroup group, int checkedId) {
- int edgeFlag;
- switch (checkedId) {
- case R.id.mode_left:
- edgeFlag = SwipeBackLayout.EDGE_LEFT;
- break;
- case R.id.mode_right:
- edgeFlag = SwipeBackLayout.EDGE_RIGHT;
- break;
- case R.id.mode_bottom:
- edgeFlag = SwipeBackLayout.EDGE_BOTTOM;
- break;
- default:
- edgeFlag = SwipeBackLayout.EDGE_ALL;
- }
- mSwipeBackLayout.setEdgeTrackingEnabled(edgeFlag);
- saveTrackingMode(edgeFlag);
- }
- });
- mSwipeBackLayout.setSwipeListener(new SwipeBackLayout.SwipeListener() {
- @Override
- public void onScrollStateChange(int state, float scrollPercent) {
-
- }
-
- @Override
- public void onEdgeTouch(int edgeFlag) {
- vibrate(VIBRATE_DURATION);
- }
-
- @Override
- public void onScrollOverThreshold() {
- vibrate(VIBRATE_DURATION);
- }
- });
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- restoreTrackingMode();
- }
-
- private void saveTrackingMode(int flag) {
- PreferenceUtils.setPrefInt(getApplicationContext(), mKeyTrackingMode, flag);
- }
-
- private void restoreTrackingMode() {
- int flag = PreferenceUtils.getPrefInt(getApplicationContext(), mKeyTrackingMode,
- SwipeBackLayout.EDGE_LEFT);
- mSwipeBackLayout.setEdgeTrackingEnabled(flag);
- switch (flag) {
- case SwipeBackLayout.EDGE_LEFT:
- mTrackingModeGroup.check(R.id.mode_left);
- break;
- case SwipeBackLayout.EDGE_RIGHT:
- mTrackingModeGroup.check(R.id.mode_right);
- break;
- case SwipeBackLayout.EDGE_BOTTOM:
- mTrackingModeGroup.check(R.id.mode_bottom);
- break;
- case SwipeBackLayout.EDGE_ALL:
- mTrackingModeGroup.check(R.id.mode_all);
- break;
- }
- }
-
- private void changeActionBarColor() {
- getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getColors()[mBgIndex]));
- mBgIndex++;
- if (mBgIndex >= getColors().length) {
- mBgIndex = 0;
- }
- }
-
- private void findViews() {
- findViewById(R.id.btn_start).setOnClickListener(this);
- findViewById(R.id.btn_finish).setOnClickListener(this);
- mTrackingModeGroup = (RadioGroup) findViewById(R.id.tracking_mode);
- }
-
- private int[] getColors() {
- if (mBgColors == null) {
- Resources resource = getResources();
- mBgColors = new int[] {
- resource.getColor(R.color.androidColorA),
- resource.getColor(R.color.androidColorB),
- resource.getColor(R.color.androidColorC),
- resource.getColor(R.color.androidColorD),
- resource.getColor(R.color.androidColorE),
- };
- }
- return mBgColors;
- }
-
- private void vibrate(long duration) {
- Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
- long[] pattern = {
- 0, duration
- };
- vibrator.vibrate(pattern, -1);
- }
-
- @Override
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.btn_start:
- startActivity(new Intent(DemoSherlockActivity.this, DemoSherlockActivity.class));
- break;
- case R.id.btn_finish:
- scrollToFinishActivity();
- break;
- }
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- getSupportMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case R.id.action_github:
- Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.setData(Uri.parse("https://github.com/Issacw0ng/SwipeBackLayout"));
- startActivity(intent);
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
- }
-
-}
@@ -1,70 +0,0 @@
-
-package me.imid.swipebacklayout.demo.sherlock;
-
-import android.content.Context;
-import android.content.SharedPreferences;
-import android.content.SharedPreferences.Editor;
-import android.preference.PreferenceManager;
-
-public class PreferenceUtils {
- public static String getPrefString(Context context, String key, final String defaultValue) {
- final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
- return settings.getString(key, defaultValue);
- }
-
- public static void setPrefString(Context context, final String key, final String value) {
- final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
- settings.edit().putString(key, value).commit();
- }
-
- public static boolean getPrefBoolean(Context context, final String key,
- final boolean defaultValue) {
- final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
- return settings.getBoolean(key, defaultValue);
- }
-
- public static boolean hasKey(Context context, final String key) {
- return PreferenceManager.getDefaultSharedPreferences(context).contains(key);
- }
-
- public static void setPrefBoolean(Context context, final String key, final boolean value) {
- final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
- settings.edit().putBoolean(key, value).commit();
- }
-
- public static void setPrefInt(Context context, final String key, final int value) {
- final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
- settings.edit().putInt(key, value).commit();
- }
-
- public static int getPrefInt(Context context, final String key, final int defaultValue) {
- final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
- return settings.getInt(key, defaultValue);
- }
-
- public static void setPrefFloat(Context context, final String key, final float value) {
- final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
- settings.edit().putFloat(key, value).commit();
- }
-
- public static float getPrefFloat(Context context, final String key, final float defaultValue) {
- final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
- return settings.getFloat(key, defaultValue);
- }
-
- public static void setSettingLong(Context context, final String key, final long value) {
- final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
- settings.edit().putLong(key, value).commit();
- }
-
- public static long getPrefLong(Context context, final String key, final long defaultValue) {
- final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(context);
- return settings.getLong(key, defaultValue);
- }
-
- public static void clearPreference(Context context, final SharedPreferences p) {
- final Editor editor = p.edit();
- editor.clear();
- editor.commit();
- }
-}
Oops, something went wrong.

0 comments on commit a51e34d

Please sign in to comment.