Skip to content

Commit

Permalink
Working on #59
Browse files Browse the repository at this point in the history
  • Loading branch information
BedrockDev committed Jun 10, 2017
1 parent b5210a0 commit 3f40224
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 16 deletions.
78 changes: 70 additions & 8 deletions app/src/main/java/com/bedrock/padder/activity/HelpActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.widget.TextView;

import com.bedrock.padder.R;
import com.bedrock.padder.helper.AnimateHelper;
import com.bedrock.padder.helper.IntentHelper;
import com.bedrock.padder.helper.ToolbarHelper;
import com.bedrock.padder.helper.WindowHelper;

Expand All @@ -15,12 +17,22 @@ public class HelpActivity extends AppCompatActivity {

private WindowHelper window = new WindowHelper();
private ToolbarHelper toolbar = new ToolbarHelper();
private IntentHelper intent = new IntentHelper();
private AnimateHelper anim = new AnimateHelper();

private TextView detailTitle;
private TextView detailText;

private boolean isDetailVisible = false;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_help);

detailTitle = window.getTextView(R.id.activity_help_detail_title, activity);
detailText = window.getTextView(R.id.activity_help_detail_text, activity);

setUi();
}

Expand All @@ -38,10 +50,56 @@ private void setUi() {

// set taskDesc
window.setRecentColor(R.string.help_title, R.color.colorAccent, activity);

setActions();
}

private void setActions() {
window.setOnClick(R.id.activity_help_contact_email, new Runnable() {
@Override
public void run() {
intent.intentEmail(activity, R.string.feedback_email,
"Tapad Feedback - Feedback [Email]", null,
R.string.feedback_email_client_feedback, 0);
}
}, activity);
window.setOnClick(R.id.activity_help_contact_send_feedback, new Runnable() {
@Override
public void run() {
intent.intentWithExtra(activity, "activity.FeedbackActivity", "feedbackMode", "feedback", 0);
}
}, activity);

String helpItems[] = {
"about_tapad",
"about_gesture_mode",
"preset_store_download",
"preset_store_manage",
"tutorial"
};

for (final String helpItem : helpItems) {
// set onclick items
window.setOnClick(window.getId("activity_help_popular_" + helpItem), new Runnable() {
@Override
public void run() {
showDetailHelp(helpItem);
}
}, activity);
}
}

private void showDetailHelp(String helpResId) {
if (!isDetailVisible) {
isDetailVisible = true;
detailTitle.setText(window.getStringFromId("help_popular_" + helpResId, activity));
detailText.setText(window.getStringFromId("help_popular_" + helpResId + "_detail", activity));
anim.fadeIn(R.id.activity_help_detail, 0, 200, "detailIn", activity);
}
}

public boolean onOptionsItemSelected(MenuItem item) {
pressBack();
finish();
return true;
}

Expand All @@ -50,14 +108,18 @@ public void onWindowFocusChanged(boolean hasFocus) {

if (hasFocus) {
// reset taskDesc
window.setRecentColor(window.getStringFromId("help_title", activity), R.color.colorAccent, activity);
window.setRecentColor(R.string.help_title, R.color.colorAccent, activity);
}
}

void pressBack() {
KeyEvent kDown = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK);
activity.dispatchKeyEvent(kDown);
KeyEvent kUp = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BACK);
activity.dispatchKeyEvent(kUp);
@Override
public void onBackPressed() {
if (isDetailVisible) {
// visible, close detail
anim.fadeOut(R.id.activity_help_detail, 0, 200, activity);
isDetailVisible = false;
} else {
super.onBackPressed();
}
}
}
41 changes: 35 additions & 6 deletions app/src/main/res/layout/activity_help.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
android:orientation="vertical"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:translationZ="2dp">
android:elevation="2dp">

<TextView
android:id="@+id/activity_help_contact_title"
Expand Down Expand Up @@ -105,7 +105,7 @@
android:background="@color/white"
android:orientation="vertical"
android:paddingTop="8dp"
android:translationZ="2dp">
android:elevation="2dp">

<TextView
android:id="@+id/activity_help_popular_title"
Expand Down Expand Up @@ -291,23 +291,52 @@
android:clickable="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="12dp"
android:paddingBottom="14dp"
android:paddingLeft="4dp"
android:paddingTop="12dp">
android:paddingTop="14dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:fontFamily="sans-serif-medium"
android:text="@string/help_popular_browse_all"
android:textAllCaps="true"
android:textColor="@color/colorAccent"
android:textSize="12sp"
android:textStyle="bold"/>
android:textSize="14sp"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>

<LinearLayout
android:id="@+id/activity_help_detail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/actionbar"
android:background="@color/white"
android:padding="16dp"
android:visibility="gone"
android:orientation="vertical">

<TextView
android:id="@+id/activity_help_detail_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/help_popular_about_tapad"
android:textColor="@color/dark_primary"
android:layout_marginBottom="16dp"
android:textSize="24sp"/>

<TextView
android:id="@+id/activity_help_detail_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/dark_primary"
android:lineSpacingMultiplier="1.15"
android:textSize="14sp"
android:text="@string/placeholder"/>
</LinearLayout>

<include layout="@layout/fragment_actionbar"/>
</RelativeLayout>
18 changes: 16 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,25 @@

<string name="help_popular_title">Popular</string>
<string name="help_popular_about_tapad">About Tapad</string>
<string name="help_popular_about_gesture_mode">Play a gesture preset</string>
<string name="help_popular_about_gesture_mode">About gesture mode</string>
<string name="help_popular_preset_store_download">Download new presets</string>
<string name="help_popular_preset_store_manage">View &amp; delete presets</string>
<string name="help_popular_preset_store_manage">View &amp; delete installed presets</string>
<string name="help_popular_tutorial">Learn to play Tapad</string>

<string name="help_popular_about_tapad_detail">
<b><i>Tapad</i></b> is a mobile remix application. \n\n
Extended from the instrument <i>LaunchPad</i>, and made mobile friendly with touch gesture support.
It mainly features song genres like EDM, Dubstep, Progressive House, Electronic and further more.
</string>
<string name="help_popular_about_gesture_mode_detail">
<b><i>Gesture mode</i></b> is a new feature in <i>Tapad</i>. \n
In gesture mode, you can swipe in 4 directions and press a pad. Gesture presets have different sounds playing on these 5 actions.
LaunchPad and other applications have 1 input / pad. But Tapad have gesture mode to get maximum 5 input / pad.
</string>
<string name="help_popular_preset_store_download_detail">Download new presets</string>
<string name="help_popular_preset_store_manage_detail">View &amp; delete presets</string>
<string name="help_popular_tutorial_detail">Learn to play Tapad</string>

<string name="help_popular_browse_all">Browse all articles</string>

<!-- Feedback -->
Expand Down

0 comments on commit 3f40224

Please sign in to comment.