Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
the how-to screen is now selectable again
Browse files Browse the repository at this point in the history
  • Loading branch information
y20k committed Oct 16, 2017
1 parent 12f2756 commit 275aaa9
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 39 deletions.
71 changes: 35 additions & 36 deletions app/src/main/java/org/y20k/transistor/ListFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
Expand Down Expand Up @@ -227,41 +226,41 @@ public boolean onOptionsItemSelected(MenuItem item) {
dialog.show();
return true;

// CASE ABOUT
case R.id.menu_about:
// put title and content into arguments and start fragment transaction
String aboutTitle = mActivity.getString(R.string.header_about);
Bundle aboutArgs = new Bundle();
aboutArgs.putString(ARG_INFOSHEET_TITLE, aboutTitle);
aboutArgs.putInt(ARG_INFOSHEET_CONTENT, INFOSHEET_CONTENT_ABOUT);

InfosheetFragment aboutInfosheetFragment = new InfosheetFragment();
aboutInfosheetFragment.setArguments(aboutArgs);

((AppCompatActivity) mActivity).getSupportFragmentManager().beginTransaction()
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.replace(R.id.main_container, aboutInfosheetFragment, INFOSHEET_FRAGMENT_TAG)
.addToBackStack(null)
.commit();
return true;

// CASE HOWTO
case R.id.menu_howto:
// put title and content into arguments and start fragment transaction
String howToTitle = mActivity.getString(R.string.header_howto);
Bundle howtoArgs = new Bundle();
howtoArgs.putString(ARG_INFOSHEET_TITLE, howToTitle);
howtoArgs.putInt(ARG_INFOSHEET_CONTENT, INFOSHEET_CONTENT_ABOUT);

InfosheetFragment howtoInfosheetFragment = new InfosheetFragment();
howtoInfosheetFragment.setArguments(howtoArgs);

((AppCompatActivity) mActivity).getSupportFragmentManager().beginTransaction()
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.replace(R.id.main_container, howtoInfosheetFragment, INFOSHEET_FRAGMENT_TAG)
.addToBackStack(null)
.commit();
return true;
// // CASE ABOUT
// case R.id.menu_about:
// // put title and content into arguments and start fragment transaction
// String aboutTitle = mActivity.getString(R.string.header_about);
// Bundle aboutArgs = new Bundle();
// aboutArgs.putString(ARG_INFOSHEET_TITLE, aboutTitle);
// aboutArgs.putInt(ARG_INFOSHEET_CONTENT, INFOSHEET_CONTENT_ABOUT);
//
// InfosheetFragment aboutInfosheetFragment = new InfosheetFragment();
// aboutInfosheetFragment.setArguments(aboutArgs);
//
// ((AppCompatActivity) mActivity).getSupportFragmentManager().beginTransaction()
// .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
// .replace(R.id.main_container, aboutInfosheetFragment, INFOSHEET_FRAGMENT_TAG)
// .addToBackStack(null)
// .commit();
// return true;
//
// // CASE HOWTO
// case R.id.menu_howto:
// // put title and content into arguments and start fragment transaction
// String howToTitle = mActivity.getString(R.string.header_howto);
// Bundle howtoArgs = new Bundle();
// howtoArgs.putString(ARG_INFOSHEET_TITLE, howToTitle);
// howtoArgs.putInt(ARG_INFOSHEET_CONTENT, INFOSHEET_CONTENT_HOWTO);
//
// InfosheetFragment howtoInfosheetFragment = new InfosheetFragment();
// howtoInfosheetFragment.setArguments(howtoArgs);
//
// ((AppCompatActivity) mActivity).getSupportFragmentManager().beginTransaction()
// .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
// .replace(R.id.main_container, howtoInfosheetFragment, INFOSHEET_FRAGMENT_TAG)
// .addToBackStack(null)
// .commit();
// return true;

// CASE REFRESH LIST
case R.id.menu_refresh:
Expand Down
50 changes: 49 additions & 1 deletion app/src/main/java/org/y20k/transistor/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* MainActivity.java
* Implements the app's main activity
* The main activity sets up the main view end inflates a menu bar menu
* The main activity sets up the main view end inflates an action bar menu
*
* This file is part of
* TRANSISTOR - Radio App for Android
Expand All @@ -28,7 +28,9 @@
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;

Expand Down Expand Up @@ -150,6 +152,52 @@ protected void onNewIntent(Intent intent) {
}


@Override
public boolean onOptionsItemSelected(MenuItem item) {

switch (item.getItemId()) {
// CASE ABOUT
case R.id.menu_about:
// put title and content into arguments and start fragment transaction
String aboutTitle = getString(R.string.header_about);
Bundle aboutArgs = new Bundle();
aboutArgs.putString(ARG_INFOSHEET_TITLE, aboutTitle);
aboutArgs.putInt(ARG_INFOSHEET_CONTENT, INFOSHEET_CONTENT_ABOUT);

InfosheetFragment aboutInfosheetFragment = new InfosheetFragment();
aboutInfosheetFragment.setArguments(aboutArgs);

getSupportFragmentManager().beginTransaction()
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.replace(R.id.main_container, aboutInfosheetFragment, INFOSHEET_FRAGMENT_TAG)
.addToBackStack(null)
.commit();
return true;

// CASE HOWTO
case R.id.menu_howto:
// put title and content into arguments and start fragment transaction
String howToTitle = getString(R.string.header_howto);
Bundle howtoArgs = new Bundle();
howtoArgs.putString(ARG_INFOSHEET_TITLE, howToTitle);
howtoArgs.putInt(ARG_INFOSHEET_CONTENT, INFOSHEET_CONTENT_HOWTO);

InfosheetFragment howtoInfosheetFragment = new InfosheetFragment();
howtoInfosheetFragment.setArguments(howtoArgs);

getSupportFragmentManager().beginTransaction()
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.replace(R.id.main_container, howtoInfosheetFragment, INFOSHEET_FRAGMENT_TAG)
.addToBackStack(null)
.commit();
return true;

// CASE DEFAULT
default:
return super.onOptionsItemSelected(item);
}
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ allprojects {
url "https://maven.google.com"
project.ext {
applicationId = 'org.y20k.transistor'
versionCode = 46
versionName = '2.3.4'
versionCode = 47
versionName = '2.3.5'
minSdkVersion = 19
compileSdkVersion = 26
targetSdkVersion = 26
Expand Down

0 comments on commit 275aaa9

Please sign in to comment.