#279 - Initial version
This commit is contained in:
parent
4f5ccdc3a8
commit
39b539a23b
19 changed files with 356 additions and 21 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -10,3 +10,6 @@
|
|||
[submodule "viewpagerindicator"]
|
||||
path = viewpagerindicator
|
||||
url = git://github.com/JakeWharton/Android-ViewPagerIndicator.git
|
||||
[submodule "submodules/viewpagerindicator"]
|
||||
path = submodules/viewpagerindicator
|
||||
url = git://github.com/JakeWharton/Android-ViewPagerIndicator.git
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-18
|
||||
android.library.reference.1=../submodules/facebook-android-sdk/facebook
|
||||
android.library.reference.2=../submodules/Android-Feather
|
||||
android.library.reference.3=../submodules/HoloEverywhere/library
|
||||
android.library.reference.4=../submodules/HoloEverywhere/addons/preferences
|
||||
android.library.reference.5=../submodules/HoloEverywhere/addons/slider
|
||||
android.library.reference.6=../submodules/google-play-services_lib
|
BIN
app/res/drawable-hdpi/slide_1_image.png
Normal file
BIN
app/res/drawable-hdpi/slide_1_image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.5 KiB |
BIN
app/res/drawable-hdpi/slide_2_image.png
Normal file
BIN
app/res/drawable-hdpi/slide_2_image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
BIN
app/res/drawable-hdpi/slide_3_image.png
Normal file
BIN
app/res/drawable-hdpi/slide_3_image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
24
app/res/drawable/custom_border_intro.xml
Normal file
24
app/res/drawable/custom_border_intro.xml
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#FF3b2414" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:bottom="20dp" android:top="20dp" >
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@android:color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
<!-- transparent
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:top="0dp" android:left="-20dp" android:right="-20dp"
|
||||
android:bottom="0dp">
|
||||
<shape android:shape="rectangle">
|
||||
<stroke android:width="20dp" android:color="#FF3b2414" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
-->
|
36
app/res/layout/activity_intro.xml
Normal file
36
app/res/layout/activity_intro.xml
Normal file
|
@ -0,0 +1,36 @@
|
|||
<LinearLayout 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"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingTop="10dp"
|
||||
xmlns:app="http://schemas.android.com/apk/res/com.trovebox.android.app">
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<com.viewpagerindicator.CirclePageIndicator
|
||||
android:id="@+id/indicator"
|
||||
android:padding="10dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent"
|
||||
app:radius="2dp"
|
||||
app:strokeColor="#FF000000"
|
||||
app:strokeWidth="1dp"
|
||||
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/button_skip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:onClick="skipIntro"
|
||||
android:text="@string/button_skip" />
|
||||
|
||||
</LinearLayout>
|
|
@ -5,6 +5,9 @@
|
|||
<string name="loading">Carregando…</string>
|
||||
<string name="take_photo">Tire foto</string>
|
||||
|
||||
<!-- Intro -->
|
||||
<string name="button_skip">Pular</string>
|
||||
|
||||
<!-- Menu -->
|
||||
<string name="menu_refresh">Atualizar</string>
|
||||
<string name="menu_preferences">Preferências</string>
|
||||
|
|
8
app/res/values-sw600dp/dimens.xml
Normal file
8
app/res/values-sw600dp/dimens.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<resources>
|
||||
|
||||
<!--
|
||||
Customize dimensions originally defined in res/values/dimens.xml (such as
|
||||
screen margins) for sw600dp devices (e.g. 7" tablets) here.
|
||||
-->
|
||||
|
||||
</resources>
|
9
app/res/values-sw720dp-land/dimens.xml
Normal file
9
app/res/values-sw720dp-land/dimens.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<resources>
|
||||
|
||||
<!--
|
||||
Customize dimensions originally defined in res/values/dimens.xml (such as
|
||||
screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here.
|
||||
-->
|
||||
<dimen name="activity_horizontal_margin">128dp</dimen>
|
||||
|
||||
</resources>
|
|
@ -29,4 +29,7 @@
|
|||
|
||||
<item name="slider_menu_width" type="dimen">200dip</item>
|
||||
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
<dimen name="activity_vertical_margin">16dp</dimen>
|
||||
|
||||
</resources>
|
|
@ -5,6 +5,12 @@
|
|||
<string name="loading">Loading…</string>
|
||||
<string name="take_photo">Take Photo</string>
|
||||
|
||||
<!-- Intro -->
|
||||
<string name="button_skip">Skip</string>
|
||||
<string name="slide_1_text">One spot for your company\'s photos and videos</string>
|
||||
<string name="slide_2_text">Collaborate with colleagues and clients</string>
|
||||
<string name="slide_3_text">Securely and painlessly organize and share</string>
|
||||
|
||||
<!-- Menu -->
|
||||
<string name="menu_camera">Take a photo</string>
|
||||
<string name="menu_refresh">Refresh</string>
|
||||
|
@ -311,5 +317,8 @@
|
|||
<!-- In-App Billing -->
|
||||
<string name="iabMonthlySubscriptionSuccess">Thank you for subscribing to premium!</string>
|
||||
<string name="iabNoNeedToUpgrade">You are already a premium member and don\'t need to upgrade!</string>
|
||||
<string name="title_activity_teste">TesteActivity</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
<string name="hello_world">Hello world!</string>
|
||||
|
||||
</resources>
|
78
app/src/com/trovebox/android/app/ImageFragment.java
Normal file
78
app/src/com/trovebox/android/app/ImageFragment.java
Normal file
|
@ -0,0 +1,78 @@
|
|||
package com.trovebox.android.app;
|
||||
|
||||
import com.trovebox.android.app.R;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.LinearLayout.LayoutParams;
|
||||
import android.widget.TextView;
|
||||
|
||||
public final class ImageFragment extends Fragment {
|
||||
int imageResourceId;
|
||||
int contentResourceId;
|
||||
private static final String KEY_CONTENT = "ImageFragment:imageResourceId";
|
||||
int mNum;
|
||||
public static Fragment newInstance(int i, int content) {
|
||||
ImageFragment f = new ImageFragment();
|
||||
// Supply num input as an argument.
|
||||
// Bundle args = new Bundle();
|
||||
//args.putInt(KEY_CONTENT, i);
|
||||
//f.setArguments(args);
|
||||
f.imageResourceId = i;
|
||||
f.contentResourceId = content;
|
||||
//imageResourceId = i;
|
||||
return f;
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if ((savedInstanceState != null) && savedInstanceState.containsKey(KEY_CONTENT)) {
|
||||
imageResourceId = savedInstanceState.getInt(KEY_CONTENT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
|
||||
TextView text = new TextView(getActivity());
|
||||
text.setGravity(Gravity.CENTER);
|
||||
// text.setText("teste");
|
||||
text.setText(getString(contentResourceId));
|
||||
//int scale = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
|
||||
// (float) 123.4, getResources().getDisplayMetrics());
|
||||
// int scale = (int)getResources().getDisplayMetrics().density;
|
||||
// Log.i("MyActivity", "MyClass.getView() Ñ get item number " + getResources().getDisplayMetrics().density);
|
||||
text.setTextSize(12 * getResources().getDisplayMetrics().density);
|
||||
text.setPadding(10, 10, 10, 10);
|
||||
|
||||
|
||||
ImageView image = new ImageView(getActivity());
|
||||
image.setImageResource(imageResourceId);
|
||||
|
||||
LinearLayout layout = new LinearLayout(getActivity());
|
||||
layout.setOrientation(LinearLayout.VERTICAL);
|
||||
layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,
|
||||
LayoutParams.FILL_PARENT));
|
||||
|
||||
layout.setGravity(Gravity.CENTER);
|
||||
layout.addView(image);
|
||||
layout.addView(text);
|
||||
|
||||
return layout;
|
||||
}
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putInt(KEY_CONTENT, imageResourceId);
|
||||
}
|
||||
|
||||
}
|
38
app/src/com/trovebox/android/app/ImageFragmentAdapter.java
Normal file
38
app/src/com/trovebox/android/app/ImageFragmentAdapter.java
Normal file
|
@ -0,0 +1,38 @@
|
|||
package com.trovebox.android.app;
|
||||
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v4.app.FragmentPagerAdapter;
|
||||
|
||||
public class ImageFragmentAdapter extends FragmentPagerAdapter {
|
||||
private static final int[] Images = new int[] {R.drawable.slide_1_image, R.drawable.slide_2_image, R.drawable.slide_3_image};
|
||||
private static final int[] Content = new int[] {R.string.slide_1_text, R.string.slide_2_text,R.string.slide_3_text};
|
||||
//private static final int[] Images = new int[]
|
||||
|
||||
private int mCount = Images.length;
|
||||
|
||||
public ImageFragmentAdapter(FragmentManager fm) {
|
||||
super(fm);
|
||||
|
||||
|
||||
}
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
|
||||
return ImageFragment.newInstance(Images[position], Content[position]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mCount;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
if (count > 0 && count <= 10) {
|
||||
mCount = count;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
132
app/src/com/trovebox/android/app/IntroActivity.java
Normal file
132
app/src/com/trovebox/android/app/IntroActivity.java
Normal file
|
@ -0,0 +1,132 @@
|
|||
|
||||
package com.trovebox.android.app;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import com.viewpagerindicator.CirclePageIndicator;
|
||||
import com.viewpagerindicator.PageIndicator;
|
||||
|
||||
public class IntroActivity extends FragmentActivity
|
||||
{
|
||||
|
||||
ImageFragmentAdapter mAdapter;
|
||||
ViewPager mPager;
|
||||
PageIndicator mIndicator;
|
||||
int mPosition;
|
||||
float mPositionOffset;
|
||||
int mPositionOffsetPixels;
|
||||
int mState;
|
||||
|
||||
float x1, x2;
|
||||
float y1, y2;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_intro);
|
||||
// Set the pager with an adapter
|
||||
mPager = (ViewPager) findViewById(R.id.pager);
|
||||
|
||||
mAdapter = new ImageFragmentAdapter(getSupportFragmentManager());
|
||||
mPager.setAdapter(mAdapter);
|
||||
mPager.setOnTouchListener(new View.OnTouchListener() {
|
||||
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent touchEvent) {
|
||||
int action = touchEvent.getAction();
|
||||
switch (action) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
{
|
||||
x1 = touchEvent.getX();
|
||||
y1 = touchEvent.getY();
|
||||
break;
|
||||
}
|
||||
case MotionEvent.ACTION_UP:
|
||||
{
|
||||
x2 = touchEvent.getX();
|
||||
y2 = touchEvent.getY();
|
||||
|
||||
// if left to right sweep event on screen
|
||||
if (x1 > x2 && mPosition + 1 == mAdapter.getCount())
|
||||
skipIntro(null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
mIndicator = (CirclePageIndicator) findViewById(R.id.indicator);
|
||||
mIndicator.setViewPager(mPager);
|
||||
|
||||
mIndicator.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
mPosition = position;
|
||||
mPositionOffset = positionOffset;
|
||||
mPositionOffsetPixels = positionOffsetPixels;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
mState = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int arg0) {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
Log.i("DD", "onResume()");
|
||||
//
|
||||
SharedPreferences sharedPrefs = this.getSharedPreferences(
|
||||
"skip_intro", this.MODE_PRIVATE);
|
||||
Log.i("DD", "" + (sharedPrefs.getInt("clickedSkip", 0)));
|
||||
|
||||
if(sharedPrefs.getInt("clickedSkip", 0) == 1)
|
||||
{
|
||||
startActivity(new Intent(this, AccountActivity.class));
|
||||
finish();
|
||||
}
|
||||
|
||||
// startActivity(new Intent(this, MainActivity.class));
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void skipIntro(View v)
|
||||
{
|
||||
|
||||
|
||||
SharedPreferences sharedPrefs = this.getSharedPreferences(
|
||||
"skip_intro", this.MODE_PRIVATE);
|
||||
Log.i("DD", "" + (sharedPrefs.getInt("clickedSkip", 0)));
|
||||
|
||||
if(sharedPrefs.getInt("clickedSkip", 0) == 0)
|
||||
{
|
||||
SharedPreferences.Editor editor = sharedPrefs.edit();
|
||||
editor.putInt("clickedSkip", 1);
|
||||
editor.commit();
|
||||
|
||||
}
|
||||
Log.i("DD", "" + (sharedPrefs.getInt("clickedSkip", 0)));
|
||||
startActivity(new Intent(this, AccountActivity.class));
|
||||
finish();
|
||||
|
||||
}
|
||||
}
|
|
@ -12,10 +12,12 @@ import org.holoeverywhere.app.Activity;
|
|||
import org.holoeverywhere.app.Activity.Addons;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
import com.actionbarsherlock.app.ActionBar;
|
||||
import com.actionbarsherlock.view.Menu;
|
||||
|
@ -179,7 +181,7 @@ public class MainActivity extends CommonActivity implements LoadingControl, Gall
|
|||
super.onSaveInstanceState(outState);
|
||||
instanceSaved = true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume()
|
||||
{
|
||||
|
@ -190,7 +192,14 @@ public class MainActivity extends CommonActivity implements LoadingControl, Gall
|
|||
if (!Preferences.isLoggedIn(this))
|
||||
{
|
||||
// startActivity(new Intent(this, SetupActivity.class));
|
||||
startActivity(new Intent(this, AccountActivity.class));
|
||||
// startActivity(new Intent(this, AccountActivity.class));
|
||||
SharedPreferences sharedPrefs = this.getSharedPreferences(
|
||||
"skip_intro", this.MODE_PRIVATE);
|
||||
if (sharedPrefs.getInt("clickedSkip", 0) == 0)
|
||||
startActivity(new Intent(this, IntroActivity.class));
|
||||
else
|
||||
startActivity(new Intent(this, AccountActivity.class));
|
||||
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public class SplashActivity extends Activity {
|
|||
// Go to Main screen
|
||||
Intent i = Preferences.isLoggedIn() ?
|
||||
new Intent(SplashActivity.this, MainActivity.class) :
|
||||
new Intent(SplashActivity.this, AccountActivity.class);
|
||||
new Intent(SplashActivity.this, IntroActivity.class);
|
||||
startActivity(i);
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,6 @@ public class IAccountTroveboxApiFactory {
|
|||
*/
|
||||
public static IAccountTroveboxApi getApi(Context context)
|
||||
{
|
||||
return new AccountTroveboxApi(context);
|
||||
return new FakeAccountTroveboxApi(context);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue