Skip to content

Commit

Permalink
Move WBSNotchView and WBSSeekBar to their own modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
fishjd committed Jan 30, 2018
1 parent 4f46e0f commit 91c3afa
Show file tree
Hide file tree
Showing 54 changed files with 463 additions and 259 deletions.
2 changes: 2 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@ dependencies {
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5.4'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4'

compile project(path: ':wbsnotchview')
compile project(path: ':wbsseekbar')
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
package com.wholebeansoftware.wbswidgetdemo;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

Expand Down Expand Up @@ -74,41 +68,6 @@ public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}

/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
/**
* The fragment argument representing the section number for this
* fragment.
*/
private static final String ARG_SECTION_NUMBER = "section_number";

public PlaceholderFragment() {
}

/**
* Returns a new instance of this fragment for the given section
* number.
*/
public static PlaceholderFragment newInstance(int sectionNumber) {
PlaceholderFragment fragment = new PlaceholderFragment();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
fragment.setArguments(args);
return fragment;
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
TextView textView = (TextView) rootView.findViewById(R.id.section_label);
textView.setText(
getString(R.string.section_format, getArguments().getInt(ARG_SECTION_NUMBER)));
return rootView;
}
}

/**
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
Expand All @@ -128,16 +87,15 @@ public Fragment getItem(int position) {
case 1:
return NotchViewFragment.newInstance(position + 1);
default:
// getItem is called to instantiate the fragment for the given page.
// Return a PlaceholderFragment (defined as a static inner class below).
return PlaceholderFragment.newInstance(position + 1);
throw new RuntimeException(
"Illegal Fragment Position. Position = " + position);
}
}

@Override
public int getCount() {
// Show 3 total pages.
return 3;
// Show 2 total pages.
return 2;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import android.view.ViewGroup;
import android.widget.TextView;

import com.wholebeansoftware.wbswidgetdemo.widget.ValueChangeListener;
import com.wholebeansoftware.wbswidgetdemo.widget.WBSNotchView;
import com.wholebeansoftware.wbsnotchview.ValueChangeListener;
import com.wholebeansoftware.wbsnotchview.WBSNotchView;

/**
* Created by James Haring on 2018-01-19.
Expand Down Expand Up @@ -40,6 +40,7 @@ public static NotchViewFragment newInstance(int sectionNumber) {

WBSNotchView notchView;
TextView notchViewValue1;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import android.view.ViewGroup;
import android.widget.TextView;

import com.wholebeansoftware.wbswidgetdemo.widget.BigVerticalBar;
import com.wholebeansoftware.wbswidgetdemo.widget.ValueChangeListener;
import com.wholebeansoftware.wbswidgetdemo.widget.WBSSeekBar;
import com.wholebeansoftware.wbsseekbar.ValueChangeListener;
import com.wholebeansoftware.wbsseekbar.WBSSeekBar;
import com.wholebeansoftware.wbsseekbar.BigVerticalBar;

/**
* Created by James Haring on 2018-01-19.
Expand Down

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_notchview.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
android:text = "0.0"
/>

<com.wholebeansoftware.wbswidgetdemo.widget.WBSNotchView
<com.wholebeansoftware.wbsnotchview.WBSNotchView
android:id = "@+id/notchView1"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
Expand All @@ -49,7 +49,7 @@
android:text = "Notch View Demo 5 - 30"
/>

<com.wholebeansoftware.wbswidgetdemo.widget.WBSNotchView
<com.wholebeansoftware.wbsnotchview.WBSNotchView
android:id = "@+id/notchView2"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/fragment_seekbar.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
android:text = "0.0"
/>

<com.wholebeansoftware.wbswidgetdemo.widget.WBSSeekBar
<com.wholebeansoftware.wbsseekbar.WBSSeekBar
android:id = "@+id/seekBarMaster"
android:layout_column = "0"
android:layout_row = "2"
Expand All @@ -58,7 +58,7 @@
com.wholebeansoftware.widget.WBSSeekBar:suggested_range_min = "5"
/>

<com.wholebeansoftware.wbswidgetdemo.widget.WBSSeekBar
<com.wholebeansoftware.wbsseekbar.WBSSeekBar
android:id = "@+id/seekBarSlave1"
android:layout_column = "0"
android:layout_gravity = "fill_horizontal|fill_vertical"
Expand All @@ -74,7 +74,7 @@
com.wholebeansoftware.widget.WBSSeekBar:suggested_range_min = "3"
/>

<com.wholebeansoftware.wbswidgetdemo.widget.WBSSeekBar
<com.wholebeansoftware.wbsseekbar.WBSSeekBar
android:id = "@+id/seekBarSlave2"
android:layout_column = "0"
android:layout_gravity = "fill_horizontal|fill_vertical"
Expand Down
6 changes: 0 additions & 6 deletions app/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,4 @@
<dimen name = "activity_vertical_margin">16dp</dimen>
<dimen name = "fab_margin">16dp</dimen>
<dimen name = "appbar_padding_top">8dp</dimen>

<dimen name="thumb_width">30dp</dimen>
<dimen name="thumb_height">30dp</dimen>

<dimen name="bubble_thumb_width">70dp</dimen>
<dimen name="bubble_thumb_height">70dp</dimen>
</resources>
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<resources>
<string name = "app_name">WBSWidgetDemo</string>
<string name = "action_settings">Settings</string>
<string name = "section_format">Hello World from section: %1$d</string>
</resources>
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':app'
include ':app', ':wbsnotchview', ':wbsseekbar'
1 change: 1 addition & 0 deletions wbsnotchview/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
34 changes: 34 additions & 0 deletions wbsnotchview/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 26



defaultConfig {
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
21 changes: 21 additions & 0 deletions wbsnotchview/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.wholebeansoftware.wbsnotchview;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.wholebeansoftware.wbsnotchview.test", appContext.getPackageName());
}
}
4 changes: 4 additions & 0 deletions wbsnotchview/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<manifest
package = "com.wholebeansoftware.wbsnotchview"
xmlns:android = "http://schemas.android.com/apk/res/android"
/>
Loading

0 comments on commit 91c3afa

Please sign in to comment.