Skip to content

Commit

Permalink
1.0.0-B1
Browse files Browse the repository at this point in the history
  • Loading branch information
YARSICT committed May 27, 2019
1 parent 1a5c127 commit 80acc39
Show file tree
Hide file tree
Showing 15 changed files with 189 additions and 202 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
29 changes: 0 additions & 29 deletions .idea/codeStyles/Project.xml

This file was deleted.

4 changes: 4 additions & 0 deletions .idea/encodings.xml

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

3 changes: 3 additions & 0 deletions .idea/gradle.xml

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

11 changes: 6 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
compileSdkVersion 28
defaultConfig {
applicationId "com.aueui.clock"
minSdkVersion 22
targetSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0"
versionName "1.0.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -20,10 +20,11 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:support-v4:28.0.0'
}
38 changes: 38 additions & 0 deletions app/src/main/java/com/aueui/clock/Adpters/AuePagerAdpter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.aueui.clock.Adpters;

import android.support.annotation.NonNull;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

public class AuePagerAdpter extends PagerAdapter {
private List<View> mlist;

public AuePagerAdpter(List<View> mlist){
this.mlist=mlist;
}

@NonNull
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
container.addView(mlist.get(position));
return mlist.get(position);
}

@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
container.removeView(mlist.get(position));
}

@Override
public int getCount() {
return mlist.size();
}

@Override
public boolean isViewFromObject(@NonNull View view, @NonNull Object o) {
return view==o;
}
}
136 changes: 24 additions & 112 deletions app/src/main/java/com/aueui/clock/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.aueui.clock;

import android.support.annotation.NonNull;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
Expand All @@ -18,128 +19,39 @@

import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
import com.aueui.clock.Adpters.AuePagerAdpter;

import java.util.ArrayList;
import java.util.List;

/**
* The {@link android.support.v4.view.PagerAdapter} that will provide
* fragments for each of the sections. We use a
* {@link FragmentPagerAdapter} derivative, which will keep every
* loaded fragment in memory. If this becomes too memory intensive, it
* may be best to switch to a
* {@link android.support.v4.app.FragmentStatePagerAdapter}.
*/
private SectionsPagerAdapter mSectionsPagerAdapter;
public class MainActivity extends AppCompatActivity {

/**
* The {@link ViewPager} that will host the section contents.
*/
private ViewPager mViewPager;
private TextView tv_alarm_clock, tv_time, tv_stopwatch, tv_timer;
private List<View> views;
private View alarm, time, stopwatch, timer;

@Override

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// Create the adapter that will return a fragment for each of the three
// primary sections of the activity.
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

// Set up the ViewPager with the sections adapter.
mViewPager = (ViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);

FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});

}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
initView();
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

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;
}
private void initView() {
mViewPager = findViewById(R.id.container);
tv_alarm_clock = findViewById(R.id.tv_alarm_clock);
tv_time = findViewById(R.id.tv_time);
tv_stopwatch = findViewById(R.id.tv_stopwatch);
tv_timer = findViewById(R.id.tv_timer);
views = new ArrayList<>();
views.add(alarm);
views.add(time);
views.add(stopwatch);
views.add(timer);
mViewPager.setAdapter(new AuePagerAdpter(views));
mViewPager.setCurrentItem(0);
}

/**
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to
* one of the sections/tabs/pages.
*/
public class SectionsPagerAdapter extends FragmentPagerAdapter {

public SectionsPagerAdapter(FragmentManager fm) {
super(fm);
}

@Override
public Fragment getItem(int position) {
// 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);
}

@Override
public int getCount() {
// Show 3 total pages.
return 3;
}
}
}
11 changes: 11 additions & 0 deletions app/src/main/res/drawable/fab_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<gradient
android:startColor="#FF577BF0"
android:endColor="#FF168AFB" />
<size
android:width="120dp"
android:height="120dp"/>
</shape>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/round_bg.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#FFFFFF"/>
<corners android:radius="20dp"/>
</shape>
</item>
</selector>
Loading

0 comments on commit 80acc39

Please sign in to comment.