Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #604 Handles orientation change in Memory Graph Activity #605

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class MemoryGraphParent extends AppCompatActivity {

private String filePath;
public static final String MEMORY_GRAPH_FLAG = "Memory";
private static Fragment defaultProgram = MemoryGraphFragment.newInstance();

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -49,12 +50,11 @@ protected void onCreate(Bundle savedInstanceState) {
selectedFragment.setArguments(bundle);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.frame_layout, selectedFragment);
defaultProgram = selectedFragment;
transaction.commit();
return true;
});

FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
Fragment defaultProgram = MemoryGraphFragment.newInstance();
defaultProgram.setArguments(bundle);
transaction.replace(R.id.frame_layout, defaultProgram);
transaction.commit();
Expand All @@ -70,6 +70,7 @@ public boolean onSupportNavigateUp(){
public void onBackPressed() {
super.onBackPressed();
StatisticsFragment.parsedData = null;
defaultProgram = MemoryGraphFragment.newInstance();
}

public void setActionBarTitle(String title) {
Expand Down
89 changes: 47 additions & 42 deletions app/src/main/res/layout/fragment_spectrum.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,61 +15,66 @@
android:textColor="@android:color/white"
android:textSize="@dimen/text_size_small" />

<LinearLayout
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/memory_graph_background"
android:orientation="vertical">

<com.github.mikephil.charting.charts.LineChart
android:id="@+id/frequency_spectrum_chart"
android:layout_width="match_parent"
android:layout_height="@dimen/spectrum_screen_height"
android:background="@color/memory_graph_background">

</com.github.mikephil.charting.charts.LineChart>
android:background="@color/memory_graph_background">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/padding_medium"
android:orientation="horizontal">
android:layout_height="match_parent"
android:background="@color/memory_graph_background"
android:orientation="vertical">

<com.github.mikephil.charting.charts.LineChart
android:id="@+id/frequency_spectrum_chart"
android:layout_width="match_parent"
android:layout_height="@dimen/spectrum_screen_height"
android:background="@color/memory_graph_background">

<ImageView
android:layout_width="@dimen/card_margin_large"
android:layout_height="@dimen/card_margin_large"
android:src="@android:color/holo_red_dark" />
</com.github.mikephil.charting.charts.LineChart>

<TextView
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/padding_small"
android:text="@string/anger_range"
android:textSize="@dimen/text_size_small"
android:textColor="@android:color/white" />
android:layout_margin="@dimen/padding_medium"
android:orientation="horizontal">

</LinearLayout>
<ImageView
android:layout_width="@dimen/card_margin_large"
android:layout_height="@dimen/card_margin_large"
android:src="@android:color/holo_red_dark" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/padding_medium"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/padding_small"
android:text="@string/anger_range"
android:textColor="@android:color/white"
android:textSize="@dimen/text_size_small" />

<ImageView
android:layout_width="@dimen/card_margin_large"
android:layout_height="@dimen/card_margin_large"
android:src="@color/calm_green" />
</LinearLayout>

<TextView
android:layout_width="wrap_content"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/padding_small"
android:text="@string/calm_range"
android:textSize="@dimen/text_size_small"
android:textColor="@android:color/white" />
android:layout_margin="@dimen/padding_medium"
android:orientation="horizontal">

</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="@dimen/card_margin_large"
android:layout_height="@dimen/card_margin_large"
android:src="@color/calm_green" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/padding_small"
android:text="@string/calm_range"
android:textColor="@android:color/white"
android:textSize="@dimen/text_size_small" />

</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
8 changes: 7 additions & 1 deletion app/src/main/res/layout/fragment_statistics.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
android:layout_height="match_parent"
tools:context=".fragments.StatisticsFragment">

<include layout="@layout/stat_items" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

<include layout="@layout/stat_items" />

</ScrollView>

</android.support.constraint.ConstraintLayout>