Skip to content

Commit

Permalink
updates to issues posted in GitHub today
Browse files Browse the repository at this point in the history
  • Loading branch information
bknatterud committed Apr 16, 2015
1 parent 2e24e58 commit 2dd3473
Show file tree
Hide file tree
Showing 67 changed files with 503 additions and 177 deletions.
3 changes: 2 additions & 1 deletion app/app/src/main/java/activity/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private void setupSimplePreferencesScreen() {

addPreferencesFromResource(R.xml.pref_general);

Preference button = (Preference)findPreference("reset_url");
Preference button = (Preference) findPreference("reset_url");
button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference arg0) {
Expand All @@ -69,6 +69,7 @@ public boolean onPreferenceClick(Preference arg0) {
}
});


// Add 'notifications' preferences, and a corresponding header.
// PreferenceCategory fakeHeader = new PreferenceCategory(this);
// fakeHeader.setTitle(R.string.pref_header_data);
Expand Down
83 changes: 77 additions & 6 deletions app/app/src/main/java/activity/reading/ReadingActivity.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
package activity.reading;


import android.app.Dialog;
import android.app.FragmentManager;
import android.content.res.Configuration;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import org.unfoldingword.mobile.BuildConfig;
import org.unfoldingword.mobile.R;

import java.util.ArrayList;
Expand Down Expand Up @@ -62,7 +69,7 @@ public class ReadingActivity extends ActionBarActivity implements
private ViewPager readingViewPager = null;
private ActionBar mActionBar = null;
private LinearLayout versionsButton = null;
private LinearLayout chaptersButton = null;
private RelativeLayout chaptersButton = null;
private TextView versionsTextView = null;
private TextView chapterTextView = null;

Expand Down Expand Up @@ -128,7 +135,7 @@ private void setupActionBar(){
View view = getLayoutInflater().inflate(R.layout.actionbar_custom_view, null);

mActionBar = getSupportActionBar();
chaptersButton = (LinearLayout) view.findViewById(R.id.middle_button);
chaptersButton = (RelativeLayout) view.findViewById(R.id.middle_button);
mActionBar.setCustomView(view);
mActionBar.setDisplayShowCustomEnabled(true);
mActionBar.setDisplayShowHomeEnabled(true);
Expand All @@ -137,11 +144,39 @@ private void setupActionBar(){

setupChapterButton(view);
setupVersionButton(view);
setupCheckingLevelView(view);
}

void setupCheckingLevelView(View view){

ImageView imageView = (ImageView) view.findViewById(R.id.checking_level_image_view);
if(this.mChapter != null){
int checkingLevel = Integer.parseInt(mChapter.getParent(getApplicationContext()).getParent(getApplicationContext()).status.checkingLevel);
imageView.setImageResource(getCheckingLevelImage(checkingLevel));
imageView.setVisibility(View.VISIBLE);
}
else{
imageView.setVisibility(View.GONE);
}
}

private int getCheckingLevelImage(int level){
switch (level){
case 2:{
return R.drawable.level_two;
}
case 3:{
return R.drawable.level_three;
}
default:{
return R.drawable.level_one;
}
}
}

private void setupChapterButton(View view){

chaptersButton = (LinearLayout) view.findViewById(R.id.middle_button);
chaptersButton = (RelativeLayout) view.findViewById(R.id.middle_button);
chapterTextView = (TextView) view.findViewById(R.id.middle_button_text);
if(this.mChapter != null) {
chapterTextView.setText(this.mChapter.getTitle(getApplicationContext()));
Expand Down Expand Up @@ -429,4 +464,40 @@ public void bookWasSelected(String chapterUid) {
public void chapterWasSelected() {

}

public void checkingLevelClicked(View view) {

FragmentTransaction ft = getSupportFragmentManager().beginTransaction();

CheckingLevelFragment fragment = new CheckingLevelFragment();
fragment.show(ft, CHECKING_LEVEL_FRAGMENT_ID);
}

static private final String CHECKING_LEVEL_FRAGMENT_ID = "CHECKING_LEVEL_FRAGMENT_ID";

static public class CheckingLevelFragment extends DialogFragment {

public CheckingLevelFragment() {
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.version_footer, container, false);

TextView tView = (TextView) view.findViewById(R.id.textView);
String versionName = BuildConfig.VERSION_NAME;

tView.setText(versionName);
return view;
}

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = super.onCreateDialog(savedInstanceState);
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
return dialog;
}
}
}
79 changes: 76 additions & 3 deletions app/app/src/main/java/activity/reading/StoryReadingActivity.java
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
package activity.reading;


import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;

import org.unfoldingword.mobile.BuildConfig;
import org.unfoldingword.mobile.R;

import java.util.Locale;
Expand Down Expand Up @@ -60,7 +69,7 @@ public class StoryReadingActivity extends ActionBarActivity implements
private ViewPager readingViewPager = null;
private ActionBar mActionBar = null;
private LinearLayout versionsButton = null;
private LinearLayout chaptersButton = null;
private RelativeLayout chaptersButton = null;
private TextView versionsTextView = null;
private TextView chapterTextView = null;

Expand Down Expand Up @@ -120,7 +129,7 @@ private void setupActionBar(){
View view = getLayoutInflater().inflate(R.layout.actionbar_custom_view, null);

mActionBar = getSupportActionBar();
chaptersButton = (LinearLayout) view.findViewById(R.id.middle_button);
chaptersButton = (RelativeLayout) view.findViewById(R.id.middle_button);
mActionBar.setCustomView(view);
mActionBar.setDisplayShowCustomEnabled(true);
mActionBar.setDisplayShowHomeEnabled(true);
Expand All @@ -129,11 +138,39 @@ private void setupActionBar(){

setupChapterButton(view);
setupVersionButton(view);
setupCheckingLevelView(view);
}

void setupCheckingLevelView(View view){

ImageView imageView = (ImageView) view.findViewById(R.id.checking_level_image_view);
if(this.mChapter != null){
int checkingLevel = Integer.parseInt(mChapter.getParent(getApplicationContext()).getParent(getApplicationContext()).status.checkingLevel);
imageView.setImageResource(getCheckingLevelImage(checkingLevel));
imageView.setVisibility(View.VISIBLE);
}
else{
imageView.setVisibility(View.GONE);
}
}

private int getCheckingLevelImage(int level){
switch (level){
case 2:{
return R.drawable.level_two;
}
case 3:{
return R.drawable.level_three;
}
default:{
return R.drawable.level_one;
}
}
}

private void setupChapterButton(View view){

chaptersButton = (LinearLayout) view.findViewById(R.id.middle_button);
chaptersButton = (RelativeLayout) view.findViewById(R.id.middle_button);
chapterTextView = (TextView) view.findViewById(R.id.middle_button_text);
if(this.mChapter != null) {
chapterTextView.setText(this.mChapter.title);
Expand Down Expand Up @@ -416,4 +453,40 @@ private void removeFragment(String fragmentId){
ft.commit();
reload();
}

public void checkingLevelClicked(View view) {

FragmentTransaction ft = getSupportFragmentManager().beginTransaction();

CheckingLevelFragment fragment = new CheckingLevelFragment();
fragment.show(ft, CHECKING_LEVEL_FRAGMENT_ID);
}

static private final String CHECKING_LEVEL_FRAGMENT_ID = "CHECKING_LEVEL_FRAGMENT_ID";

static public class CheckingLevelFragment extends DialogFragment {

public CheckingLevelFragment() {
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.version_footer, container, false);

TextView tView = (TextView) view.findViewById(R.id.textView);
String versionName = BuildConfig.VERSION_NAME;

tView.setText(versionName);
return view;
}

@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
Dialog dialog = super.onCreateDialog(savedInstanceState);
dialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
return dialog;
}
}
}
Loading

0 comments on commit 2dd3473

Please sign in to comment.