Skip to content

Commit

Permalink
making lib
Browse files Browse the repository at this point in the history
  • Loading branch information
Cutta committed Jan 15, 2016
1 parent 7ad35a2 commit 4d8055f
Show file tree
Hide file tree
Showing 23 changed files with 143 additions and 44 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ android {
repositories {
maven { url "https://jitpack.io" }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
Expand All @@ -29,4 +30,5 @@ dependencies {
compile('com.afollestad.material-dialogs:core:0.8.2.0@aar') {
transitive = true
}
compile project(':library')
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,35 @@
import android.app.ListActivity;
import android.os.Bundle;
import android.os.Handler;
import android.os.PersistableBundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Adapter;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.afollestad.materialdialogs.MaterialDialog;
import com.cunoraz.gifview.library.GifView;

import cuneyt.example.com.gifview.R;
import cuneyt.example.com.gifview.Utils.GifView;

/**
* Created by Cuneyt on 14.10.2015.
*/
public class ListViewActivity extends ListActivity {
SwipeRefreshLayout mSwipeRefreshLayout;
ListView listView;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
listView = (ListView)findViewById(android.R.id.list);
listView = (ListView) findViewById(android.R.id.list);
ArrayAdapter<String> itemsAdapter =
new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, getResources().getStringArray(R.array.city_names));
listView.setAdapter(itemsAdapter);

mSwipeRefreshLayout = (SwipeRefreshLayout)findViewById(R.id.swipe);
mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipe);
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
Expand All @@ -45,6 +42,7 @@ public void onRefresh() {
refreshContent();
Toast.makeText(ListViewActivity.this, "Swipe To Refresh", Toast.LENGTH_LONG).show();
}

private void refreshContent() {//fake
LayoutInflater layoutInflater = getLayoutInflater();
View view = layoutInflater.inflate(R.layout.dialog_loading, null);
Expand All @@ -60,7 +58,7 @@ public void run() {
mSwipeRefreshLayout.setRefreshing(false);
dialog.dismiss();
}
}, 1000);
}, 3000);//3 seconds
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
import android.widget.Toast;

import com.afollestad.materialdialogs.MaterialDialog;
import com.cunoraz.gifview.library.GifView;

import cuneyt.example.com.gifview.Fragments.GifFragment;
import cuneyt.example.com.gifview.R;
import cuneyt.example.com.gifview.Utils.GifView;

public class MainActivity extends AppCompatActivity {
Button loadingBtn1, loadingBtn2, loadingBtn3, loadingBtn4, deletingBtn;
Expand All @@ -33,14 +33,14 @@ protected void onCreate(Bundle savedInstanceState) {
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

activity = (Button)findViewById(R.id.activity);
activity = (Button) findViewById(R.id.activity);
activity.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
openActivity();
}
});
fragment = (Button)findViewById(R.id.fragment);
fragment = (Button) findViewById(R.id.fragment);
fragment.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Expand Down Expand Up @@ -101,12 +101,12 @@ public void onClick(View v) {

}

public void openActivity(){
Intent i = new Intent(MainActivity.this,ListViewActivity.class);
public void openActivity() {
Intent i = new Intent(MainActivity.this, ListViewActivity.class);
startActivity(i);
}

public void openFragment(){
public void openFragment() {
FragmentTransaction trans = getSupportFragmentManager()
.beginTransaction();
GifFragment fragment = new GifFragment().newInstance();
Expand All @@ -116,6 +116,7 @@ public void openFragment(){
trans.addToBackStack(fragment.getTAG());
trans.commitAllowingStateLoss();
}

public void showToast() {
LayoutInflater inflater = getLayoutInflater();
View layout = inflater.inflate(R.layout.custom_toast, null);
Expand All @@ -136,11 +137,11 @@ public void openLoadingDialog(int index) {
switch (index) {
case 1:
gifView1.setVisibility(View.VISIBLE);
gifView1.setPaused(true);
/* gifView1.setPaused(true);
gifView1.setMovie();
gifView1.setMovieResource();
gifView1.setMovieTime();
gifView1.getMovie()
gifView1.getMovie()*/
break;
case 2:
gifView2.setVisibility(View.VISIBLE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class GifFragment extends Fragment {
private String TAG;
LayoutInflater inflater;
private static int InstanceCount = 0;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -26,8 +27,7 @@ public void onCreate(Bundle savedInstanceState) {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

this.inflater = inflater;
View view = inflater.inflate(R.layout.fragment_layout, container, false);
return view;
return inflater.inflate(R.layout.fragment_layout, container, false);
}

public static GifFragment newInstance() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/custom_toast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:id="@+id/linearLayout">
<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/coffe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/dialog_deleting.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:id="@+id/linearLayout">
<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/dialog_loading.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@
android:layout_centerHorizontal="true"
android:gravity="center">

<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
custom:gif="@mipmap/gif1" />

<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
custom:gif="@mipmap/gif2" />

<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
custom:gif="@mipmap/gif3" />

<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
android:id="@+id/linearLayout"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true">
<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/coffe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand Down
20 changes: 10 additions & 10 deletions app/src/main/res/layout/wiewpager_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,61 +12,61 @@
android:gravity="center"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true">
<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif1"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:gif="@mipmap/gif1"/>
<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif2"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:gif="@mipmap/gif2"/>
<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif3"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:gif="@mipmap/gif3"/>
<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif4"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:gif="@mipmap/gif4"/>
<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif5"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:gif="@mipmap/gif5"/>
<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif6"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:gif="@mipmap/gif6"/>
<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif7"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:gif="@mipmap/gif7"/>
<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif8"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:gif="@mipmap/gif1"/>
<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif9"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:gif="@mipmap/gif9"/>
<cuneyt.example.com.gifview.Utils.GifView
<com.cunoraz.gifview.library.GifView
android:id="@+id/gif10"
android:visibility="gone"
android:layout_width="wrap_content"
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
<attr name="gifViewStyle" format="reference" />
</declare-styleable>


</resources>
2 changes: 0 additions & 2 deletions app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
//For GifView Declaration
<style name="Widget.GifView" parent="@android:style/Widget"></style>

</resources>
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'

classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
1 change: 1 addition & 0 deletions library/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
24 changes: 24 additions & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
17 changes: 17 additions & 0 deletions library/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\lnvo\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# 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 *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.cunoraz.gifview.library;

import android.app.Application;
import android.test.ApplicationTestCase;

/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
11 changes: 11 additions & 0 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cunoraz.gifview.library">

<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true">

</application>

</manifest>
Loading

0 comments on commit 4d8055f

Please sign in to comment.