-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
159 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
app/src/main/java/guru/stefma/timetracking/onboarding/Welcome.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package guru.stefma.timetracking.onboarding; | ||
|
||
import android.content.Context; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
|
||
import guru.stefma.timetracking.main.MainActivity; | ||
|
||
public class Welcome { | ||
|
||
public static final String KEY_USER_TOKEN = "KEY_USER_TOKEN"; | ||
|
||
public static final String KEY_USERNAME = "KEY_USERNAME"; | ||
|
||
private final Context mContext; | ||
|
||
private final Bundle mExtras; | ||
|
||
public Welcome(Context context, Bundle extras) { | ||
mContext = context; | ||
mExtras = extras; | ||
} | ||
|
||
public String getUsername() { | ||
return mExtras.getString(KEY_USERNAME); | ||
} | ||
|
||
public String getToken() { | ||
return mExtras.getString(KEY_USER_TOKEN); | ||
} | ||
|
||
public void onOkClicked(View view) { | ||
mContext.startActivity(MainActivity.newInstance(mContext)); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
app/src/main/java/guru/stefma/timetracking/onboarding/WelcomeActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package guru.stefma.timetracking.onboarding; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.databinding.DataBindingUtil; | ||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
import guru.stefma.restapi.objects.user.UserResult; | ||
import guru.stefma.timetracking.R; | ||
import guru.stefma.timetracking.databinding.ActivityWelcomeBinding; | ||
|
||
public class WelcomeActivity extends AppCompatActivity { | ||
|
||
public static Intent newInstance(Context context, UserResult token) { | ||
Intent intent = new Intent(context, WelcomeActivity.class); | ||
intent.putExtra(Welcome.KEY_USER_TOKEN, token.getToken()); | ||
intent.putExtra(Welcome.KEY_USERNAME, token.getUsername()); | ||
return intent; | ||
} | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
ActivityWelcomeBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_welcome); | ||
binding.setWelcome(new Welcome(this, getIntent().getExtras())); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<data> | ||
|
||
<variable | ||
name="welcome" | ||
type="guru.stefma.timetracking.onboarding.Welcome"/> | ||
</data> | ||
|
||
<RelativeLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<View | ||
android:layout_width="match_parent" | ||
android:layout_height="188dp" | ||
android:background="@color/colorPrimaryDark"/> | ||
|
||
<TextView | ||
android:id="@+id/welcome" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="@dimen/monster" | ||
android:layout_marginTop="@dimen/big" | ||
android:text="@string/welcome" | ||
android:textAppearance="@style/TextAppearance.AppCompat.Display2"/> | ||
|
||
<TextView | ||
android:id="@+id/token" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_below="@id/welcome" | ||
android:layout_marginEnd="@dimen/monster" | ||
android:layout_marginStart="@dimen/monster" | ||
android:text="@{welcome.token}" | ||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" | ||
android:textIsSelectable="true" | ||
tools:text="12891280192918289129"/> | ||
|
||
<android.support.v7.widget.CardView | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_below="@id/token" | ||
android:layout_centerHorizontal="true" | ||
android:layout_marginBottom="@dimen/monster" | ||
android:layout_marginEnd="@dimen/monster" | ||
android:layout_marginStart="@dimen/monster" | ||
android:layout_marginTop="@dimen/normal" | ||
android:elevation="@dimen/cardview_default_elevation" | ||
app:cardBackgroundColor="@color/cardview_dark_background" | ||
app:cardCornerRadius="@dimen/cardview_default_radius"> | ||
|
||
<ScrollView | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_margin="@dimen/small" | ||
android:text="@{@string/introducing(welcome.username)}" | ||
tools:text="@string/introducing"/> | ||
</ScrollView> | ||
|
||
</android.support.v7.widget.CardView> | ||
|
||
<Button | ||
style="@style/Widget.AppCompat.Button.Borderless.Colored" | ||
android:layout_width="match_parent" | ||
android:layout_height="@dimen/monster" | ||
android:layout_alignParentBottom="true" | ||
android:elevation="4dp" | ||
android:gravity="end|center_vertical" | ||
android:onClick="@{welcome.onOkClicked}" | ||
android:paddingEnd="@dimen/big" | ||
android:paddingStart="@dimen/big" | ||
android:text="@string/ok"/> | ||
|
||
</RelativeLayout> | ||
</layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters