Skip to content

Commit

Permalink
Code cleaning.
Browse files Browse the repository at this point in the history
  • Loading branch information
itzikBraun committed Dec 22, 2014
1 parent 7ec86fb commit 2ef8944
Show file tree
Hide file tree
Showing 23 changed files with 2,984 additions and 763 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion TutorialViewApp.iml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/build/classes/main" />
<output-test url="file://$MODULE_DIR$/build/classes/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
Expand Down
2 changes: 2 additions & 0 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/debug" isTestSource="false" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/debug" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/r/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/aidl/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/buildConfig/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/source/rs/test/debug" isTestSource="true" generated="true" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/rs/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/build/generated/res/generated/test/debug" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
Expand Down
3 changes: 1 addition & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'

android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.braunster.tutorialviewapp"
Expand All @@ -13,7 +13,6 @@ android {
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
<activity android:name="com.braunster.tutorialview.TutorialActivity"
android:theme="@style/TutorialActivityTheme"/>

<activity android:name="com.braunster.tutorialview.TutorialActivity"
android:theme="@style/TutorialActivityTheme"/>

</application>

</manifest>
42 changes: 25 additions & 17 deletions app/src/main/java/com/braunster/tutorialviewapp/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import com.braunster.tutorialview.TutorialActivity;
Expand Down Expand Up @@ -41,9 +40,13 @@ protected void onCreate(Bundle savedInstanceState) {
getActionBar().setBackgroundDrawable(new ColorDrawable(Color.DKGRAY));

tutorialView.setActionBarRestoreColor(Color.DKGRAY);
tutorialView.setTutorialBackgroundColor(Color.CYAN);
tutorialView.changeActionBarColor(true);
tutorialView.setActionBar(getActionBar());
tutorialView.setHasActionBar(true);
tutorialView.setTutorialTextTypeFace("fonts/roboto_light.ttf");
tutorialView.setHasStatusBar(true);
//Using the tutorial view
tutorialView.setTutorialText("This is some general text that is not that long but also not so short.");
}

@Override
Expand All @@ -53,28 +56,25 @@ public boolean onCreateOptionsMenu(Menu menu) {
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

return super.onOptionsItemSelected(item);
}

private View.OnClickListener tutorialClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {

//Using the tutorial view
/*tutorialView.setViewToSurround(v, v instanceof TextView ? ((TextView) v).getText().toString() : "Fixed Title");
tutorialView.setTutorialText("This is some general text that is not that long but also not so short.");
tutorialView.setHasStatusBar(true);
tutorialView.setHasActionBar(true);*/
// This is used for the tutorial view that should be in your root view.
// This may lead to problems when used inside LinearLayout and maybe other view.
// The best thing to do is to use the TutorialActivity.

// Set the background color.
// tutorialView.setTutorialBackgroundColor(randomColor());

// Setting the view that should be surrounded.
// tutorialView.setViewToSurround(v, v instanceof TextView ? ((TextView) v).getText().toString() : "Fixed Title");

// Using the tutorial Activity
startActivity(TutorialActivity.getIntent(MainActivity.this, v, true, "This is some general text that is not that long but also not so short.", randomColor()));

// Override the default animation of the entering activity.
// This will allow the nice wrapping of the view by the tutorial activity.
overridePendingTransition(R.anim.dummy, R.anim.dummy);
}
};
Expand All @@ -83,4 +83,12 @@ private int randomColor(){
Random rnd = new Random();
return Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
}

@Override
public void onBackPressed() {
if (tutorialView.isShowing())
tutorialView.closeTutorial();
else
super.onBackPressed();
}
}
10 changes: 10 additions & 0 deletions app/src/main/res/drawable/circle_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android">

<solid android:color="@android:color/holo_blue_bright"/>

<size android:height="32dp" android:width="32dp"/>

</shape>
28 changes: 18 additions & 10 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

Expand All @@ -12,10 +14,12 @@
android:layout_width="70dp"
android:layout_height="70dp"
android:textSize="30sp"
android:background="@android:color/holo_orange_dark"

android:background="@drawable/circle_button"
android:id="@+id/view_to_surround"
android:gravity="center"
android:layout_marginLeft="100dp"
android:textColor="@android:color/white"
android:layout_marginTop="50dp"
android:text="T"/>

Expand All @@ -35,7 +39,7 @@
android:gravity="center"
android:padding="5dp"
android:layout_marginBottom="5dp"
android:text="Taaaa"/>
android:text="Test"/>

<TextView
android:layout_width="wrap_content"
Expand All @@ -44,36 +48,40 @@
android:padding="10dp"
android:background="@android:color/holo_orange_dark"
android:gravity="center"
android:text="Tsssss"/>
android:text="Center"/>

</LinearLayout>

</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30sp"
android:background="@android:color/darker_gray"
android:layout_margin="5dp"
android:background="@android:color/holo_purple"
android:padding="5dp"
android:id="@+id/view_to_surround2"
android:gravity="center"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Test2"/>
android:text="T-TL"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BTN"
android:text="T-BL"
android:background="@android:color/holo_green_dark"
android:layout_alignParentBottom="true"
android:layout_marginLeft="20dp"
android:layout_margin="5dp"
android:id="@+id/btn_test_button"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Just a button2"
android:text="T-Right"
android:background="@android:color/holo_blue_dark"
android:layout_alignParentRight="true"
android:layout_marginTop="50dp"
android:id="@+id/btn_test_button2"/>

</RelativeLayout>
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.13.2'
classpath 'com.android.tools.build:gradle:1.0.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
#Mon Dec 22 13:54:03 CET 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
6 changes: 2 additions & 4 deletions tutorial_view/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ apply plugin: 'com.android.library'

android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
buildToolsVersion "21.1.2"

defaultConfig {
applicationId "com.braunster.tutorialview"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
versionName "0.7.1"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Expand Down
Loading

0 comments on commit 2ef8944

Please sign in to comment.