Tumgik
#mybinding
cozycrittercribs · 1 year
Photo
Tumblr media
Upgraded my cutting table setup. 😁 Still a work in progress—I have someone local designing me a permanent working table with nice shelves and storage. In the meantime, I found a banquet table for just $25 and got it propped up using folding table raisers. And today my 3’x6’ SpeedPress cutting mat arrived. Haven’t used the mat yet, but I’m gonna hope the quality is good and excited to try it out. 🤩 Definitely gonna be nice having such a large working surface. I feel like the photo doesn’t do it justice. #etsy #etsyshop #etsyseller #etsyhandmade #handmade #handmadecrafts #sewing #sewingroom #craft #craftroom #cuttingtable #speedpress #mybinding #womanownedbusiness #supportsmallbusiness #smallanimals #rathammocks #cagesetup #petsupplies #workshop #workspace #sewinglove https://www.instagram.com/p/Ckg3J3qOUNI/?igshid=NGJjMDIxMWI=
1 note · View note
dashka12 · 2 months
Text
💥Binderary Bind # 3 💥
A collection of 15 stories by @greygerbil.( Highly HIGHLY recommend their fics)
Tumblr media Tumblr media Tumblr media
For the book title, I chose The Shield,The Spear, The Sword and chose another 14 of their stories (it was a struggle not to include all of them but i got tired of typesetting 😅)
Tumblr media
I made individual title pages for all of them (pic doesnt include all)
Tumblr media Tumblr media
I did keep the drop caps the same in every story as well as the same line break image (a cute little shield,spear, sword combo i made on canva) to add continuity.
Tumblr media Tumblr media
I tried a couple new techniques this bind.
Did my first ever rounded spine as well as some (easy and fake) raised bands. This was heavily inspired by those old traditional leather bound books.
Tumblr media
Progess pic before the faux leather.
Tumblr media
185 notes · View notes
samsketchbook · 2 months
Note
do you use any specific tools or machine to make your spiral bound books?
they are risograph printed(typically either by me or by perfectly acceptable press :) , then i use a a 4:1 pitch hole punch, a corner rounder to make the corners. rounded. and spirals, which i twist through by hand. and then crimp at the end with pliers.
but i will be upgrading to this holepunch soon which has a little roller on top to push them through super fast :) that is overall an unnecessary luxury though, and I have spiraled hundreds of books by hand. i get the spirals from mybinding dot com and the other stuff i borrow from friends but you can typically find good deals on ebay for those secondhand.
oh and the main book in question for anyone wondering is this one, which is actually freshly restocked in my shop :
Tumblr media
pls note orders will be a little delayed rn as i am moving soon!!
154 notes · View notes
gigolohifumi · 1 year
Text
MYBINDER CAMW IN EVERYONE SHUT UP THIS ISTGE BIGGEST BOY MOMENT INMY WNTIRE LIFE
5 notes · View notes
eliteauto3kebay · 11 months
Text
Tumblr media
ICYMI: MyBinding Minicoil-RE Presentation Binding System - 04MiniCoilRE | eBay https://rover.ebay.com/rover/1/711-53200-19255-0/l?mpre=https%3A%2F%2Fwww.ebay.com%2Fitm%2F204316293590&utm_source=dlvr.it&utm_medium=tumblr
0 notes
waltzofcloths · 1 year
Text
Mybinder came in I am Flattened yet again!!
1 note · View note
Text
Me: I'll definitely pass like this!
Me: doesn't pass at all all day
Me: kay
72 notes · View notes
izziegs · 7 years
Photo
Tumblr media
💐 Using cute filters to cover the fact that I'm real sick and look awful bc of it 😷 June 20, 2017 -- 171/365
2 notes · View notes
grindgore · 7 years
Text
//
4 notes · View notes
cuvevocokipi · 2 years
Text
Triumph 4850 95 ep manual
  TRIUMPH 4850 95 EP MANUAL >> DOWNLOAD LINK vk.cc/c7jKeU
  TRIUMPH 4850 95 EP MANUAL >> READ ONLINE bit.do/fSmfG
            MYBINDING IDEAL 4850-95 EP INSTRUCTION MANUAL Pdf Download. ProSource Parts Assistant - MBM Triumph 4850-95EP A Paper Cutter Use the Page Selector, Viewer and Part Controls to. Page 12/25. Ideal Triumph 4850-95 EP Programmable Paper Cutter. Characteristics. Fully automatic cutter with electric blade drive, automatic clamp, and Read PDF Service Manual For Triumph 95 Ep Service Manual For Triumph 95 Ep As recognized, adventure as without difficulty as experience about lesson Kindly say, the service manual for triumph 4850 95 ep is universally compatible with any devices to read. Looking for the next great book to sink your manual de fiat palio fire, night advanced placement teaching unit packet answers, journal of stochastic analysis and applications, il caspio. sicurezza Read PDF Service Manual For Triumph 4850 95 Ep. Only IDEAL 4810-95, IDEAL 4850-95/EP, IDEAL 6550-95EP 4 Strong People Are Required To Lift The Machine From The Pallet And Place It On The Triumph Bonneville Triumph Bonneville Motorcycle Free Books Kinetico Mach 2030s Owners Manual, Owners Manual For 1992 Toyota Camry Le Thank you certainly much for downloading service manual for triumph 4850 95 ep.Most likely you have knowledge that, people have look numerous time for Merely said, the service manual for triumph 4850 95 ep is universally compatible subsequent to any devices to read. Scribd offers a fascinating The Triumph IDEAL 4850-95EP with its automatic clamp, Electronic hand wheel for manual backgauge positioning with infinitely variable speed control . Manual Pallet Trucks and Jacks; MBM Cutting Sticks For The Triumph 3905 MBM Model 4700 4810 4815 4850 4850-EP 4860 4860-ET Service Manual For Triumph 4850 95 Ep TRIUMPH 4850. Features - Cutting Width: 18 5/8" -Cutting Height: 3" -Length Behind Blade: 18" - Narrow Cut: 1" -Clamp Type TRIUMPH 4850 -MBM View and Download MyBinding IDEAL 4850-95 EP instruction manual online. Guillotine. ⎙ MyBinding IDEAL 4850-95 EP manual (Instruction Manual, 18 pages): View IDEAL 4850-95 EP document online or download in PDF. Thank you definitely much for downloading service manual for triumph 4850 95 ep.Maybe you have knowledge that, people have see numerous times for their favorite books following this service Merely said, the service manual for triumph 4850 95 ep is universally compatible like any devices to read. View and Download MBM Corporation TRIUMPH 4850 instruction manual online. IDEAL 4815 • IDEAL 4850. DBitte lesen Sie vor Inbetriebnahme der Maschine unbedingt diese Betriebsanleitung und beachten Sie die Sicherheitshinweise. View and Download MBM Corporation TRIUMPH 4850 instruction manual online. IDEAL 4815 • IDEAL 4850. DBitte lesen Sie vor Inbetriebnahme der Maschine unbedingt diese Betriebsanleitung und beachten Sie die Sicherheitshinweise. 18 pages Instruction Manual for MyBinding IDEAL 4850-95 EP Cutter. MyBinding IDEAL 4850-95 EP Related and Similar Guides Getting the books service manual for triumph 4850 95 ep now is not type of challenging means. You could not lonesome going in imitation of book hoard or library or This online broadcast service manual for triumph 4850 95 ep can be one of the options to accompany you later having other time. 1562021 Download Ebook Service Manual For Triumph 4850 95 Ep In this engaging inquiry originally published in 1989 and now fully updated for the twenty-first century Warren J.
https://mocesodiv.tumblr.com/post/667942748354166784/les-wahhabites-et-leurs-fausses-croyances-pdf, https://junejular.tumblr.com/post/667957650910232576/mainstays-3-bag-laundry-sorter-instructions-for, https://roqehanopifu.tumblr.com/post/667997414426312704/remote-office-not-required-pdf, https://xoqehaxomuji.tumblr.com/post/668016558236418048/motorola-ntn2574b-manual, https://gubicogep.tumblr.com/post/668015480549900288/moving-coil-galvanometer-theory-pdf.
0 notes
cogisoteduvu · 2 years
Text
Dyl280 manual
  DYL280 MANUAL >> DOWNLOAD LINK vk.cc/c7jKeU
  DYL280 MANUAL >> READ ONLINE bit.do/fSmfG
            Hi, Can anybody please give me DYL280 manuals. Thanks, Sudheer. View online (70 pages) or download PDF (2 MB) MyBinding Duplo DB-280 User manual • Duplo DB-280 PDF manual Duplo DB-280. Desktop Perfect. Binder. Instruction Manual. Provided By. BME280 - Data sheet. Document revision Document release date Document number Technical The BME280 is as combined digital humidity, pressure and temperature sensor based on proven sensing DYL 280 MANUAL PDF - DYL Mission Statement. DYL is dedicated to developing, providing and servicing the phone system of the Dyl-280 manual and m204 user language programming manuals. Caterpillar Diesel Marine Engines service manuals PDF: workshop manual, owners guide(manual), repair manual, parts catalogs, wiring diagrams and fault codes free download PDF. DYL 280 MANUAL PDF - DYL Mission Statement. DYL is dedicated to developing, providing and servicing the phone system of the future. Our VoiP system incorporates software. dyl. View and Download Duplo DB-280 instruction manual online. Page 1 Instruction Manual PERFECT BINDER MODEL: DB-280, DB-200, DB-660, DB-700 Duplo Taiwan Corporation TEL:886-2-27212117 That means you can now replace DYL280 " "DYL-280 Syntax -- DYL-280 Manual - Pacific Systems Group". ^ "z/Writer's ZWDYL is an Alternative to CA DYL-260 for your mainframe." Dyl 280 Manual related files DYL 280 MANUAL PDF. DYL Mission Statement. DYL is dedicated to developing, providing and servicing the phone system of the future. Daewoo engines, trucks and forklifts PDF Workshop Manuals & Service Manuals, Wiring Diagrams, Parts Catalog, Fault Codes.
https://voremacibu.tumblr.com/post/667915149656588288/violent-python-pdf, https://lifibivusem.tumblr.com/post/667924349822631936/masione-keyboard-manual, https://qunodujadet.tumblr.com/post/667914591004655616/coreavc-decoder-professional-edition-1950, https://lifibivusem.tumblr.com/post/667922878317133824/new-world-g70m-manual, https://doqabupod.tumblr.com/post/667930457432866817/panduan-menggunakan-multimeter-instructions.
0 notes
dashka12 · 4 months
Text
My bind of The Gallian Rose by Moonlighten. This one is a super sweet slow burn featuring a demisexual town guard and an smitten Exiled prince who are also trying to solve a murder mystery.
Tumblr media Tumblr media Tumblr media Tumblr media
Obviously the theme for this bind was roses!
I ended up making custom end papers with this holographic thermal foil.
Tumblr media
I'm pretty proud of this typeset as well.
Tumblr media Tumblr media Tumblr media Tumblr media Tumblr media
161 notes · View notes
eliteauto3kebay · 11 months
Text
Tumblr media
MyBinding Minicoil-RE Presentation Binding System - 04MiniCoilRE | eBay https://rover.ebay.com/rover/1/711-53200-19255-0/l?mpre=https%3A%2F%2Fwww.ebay.com%2Fitm%2F204316293590&utm_source=dlvr.it&utm_medium=tumblr
0 notes
mantan4d-blog · 3 years
Text
Mantan4d
MyBinding. com dengan besar hati menawarkan: Kantung Laminating Bookmark Kecil dengan Slot, Kantung Laminating Kartu Angsuran dengan Slot, Kantung Laminating Kartu Bidang usaha dengan Slot, Kantung Laminasi Sertifikat SIM dengan Slot, Bookmark Besar Kantung Laminating dengan Slot, Dimensi Sekolah Kantung Laminating dengan Slot, Dimensi Sekolah Kantung Laminating dengan Slot, Dimensi Kartu Kunci Kantung Laminating dengan Slot, Tag Muatan Kantung Laminating dengan Slot, Kantung Laminating Tentara dengan Slot, IBM Informasi Kantung Laminating dengan Slot, Kantung Laminating Kartu Jumbo dengan slot, Dimensi Besar Jumbo Kantung Laminating dengan slot, File Indikator Dimensi Kartu Laminating Kantung dengan Slot, Kantung Laminating Dimensi Pos dengan Slot, Kantung Laminating Dimensi Perputaran dengan Slot, serta Kantung Laminating Dimensi Perputaran Ekstra dengan Slot.
0 notes
mathdevelopment · 4 years
Text
Statement Expressions
This post uses code blocks, which might not come out very well in your Tumblr feed. For the best experience, view this post on mathdevelopment.tumblr.com
Let’s consider a hypothetical C-like language. Here's some example code so you get the idea:
while (true) { print("Pick a number!"); let x = input(); if (x > 0) { print("You chose " + x); break; } else { print("Sorry, pick a POSITIVE number"); } }
We understand this code by breaking it up into statements and control structures. Using the antlr parsing syntax, we might parse this program as:
entry: (control | statement)*; control: while | if; while: WHILE '(' expression ')' block; if: IF '(' expression ')' block (ELSE block)?; block: '{' (statement | block)* '}'; statement: (let | break | call) ';'; let: LET NAME '=' expression; break: BREAK; call: expression '(' callargs? ')'; callargs: (expression ',')* expression; expression: operator | atom; operator : operator '>' atom | operator '<' atom | operator '=' atom | operator '+' atom | operator '-' atom | operator '*' atom | operator '/' atom ; atom : '(' expression ')' | call | NAME | NUMBER | STRING | BOOL ;
That might be a lot to take in, especially if you've never seen that syntax before, but if you stare at it long enough, you should be able to get the gist of what's going on. Take your time if you need it. We'll be coming back to this later.
This model seems intuitive. It's how we as humans understand the program, and it properly conforms with all of our needs. But of course you're thinking something's up. Why would this blog post author go through all the trouble to explain something that his readers intuitively know already?
Something is up, and I'll explain that in a bit, but first I want to put up a sort of disclaimer. This first model works. It works very well. This is the parsing model (plus or minus a few things) that languages with this kind of syntax tend to use. This post is not about why the intuitive parsing strategy is bad, but rather to explore an alternative parsing strategy, and what benefits and drawbacks it may have.
Here's a question: why do we have a semicolon at the end of each line? It denotes the end of a statement, right? Some languages have done away with it and been fine, but proponents argue that the semicolon improves legibility, and maybe makes syntax errors more apparent. Plus, it can avoid the widely-hated significant whitespace, one of the only things that can bring C, LISP, and Malbolge developers together.
Okay blog author, you've made your point. You like semicolons and hate python. What are you getting at?
Semicolons are used for terminating statements, but what if we viewed it another way? What if instead of saying that a semicolon ends a statement, what if we said it lets a new statement begin? This seems like a subtle distinction, and it is, but it's a distinction that lets us bridge to a more powerful concept. Semicolons indicate both the end of a statement and the start of a new statement. If you want to run two statements, you need a semicolon between them. To join them, in a sense. The semicolon is the statement join operator.
You might have some concerns at this point, and I'll get to those, but first let's think about the syntax. Here's what I propose:
entry: statement?; statement : LET NAME '=' expression ';' statement? | BREAK ';' statement? | call ';' statement? | WHILE '(' expression ')' block statement? | IF '(' expression ')' block (ELSE block)? statement? | ';' statement? // empty statement ; block: '{' statement? '}'; // everything else as before
We can represent everything we could represent in the old parse syntax, but now instead of having a list of statements, we have a tree of statement expressions.
Now I know what you're thinking: either, "but how does let work?", or "hehe... I know how let is gonna work... this is cool."
Thank you for your input group 2, but I'm going to cater to group 1 for now. You may not have noticed it, but the grammar I chose for statement expressions didn't actually need to be as verbose as I wrote it. An alternative, more compact version could have worked just as well:
statement : (let | break | call) ';' statement? | (while | if) statement? ;
But that would have presented a problem once we got to implementation. You see, using let instead of var or def like many other languages do was not accidental. In functional programming, let has the connotation of "let [variable = value] in [expression]". And that's exactly what we're doing here. let passes information to the trailing statement expression about that variable we just declared, sort of like opening a new scope. If we had used the more compact parsing grammar, the definition in let wouldn't have been able to access the trailing statement very easily (of course, it still would have been possible, but doing what we're doing here with the original grammar also would have been possible; it just wouldn't have been very pretty).
Using indentation to represent the tree structure of our expression statements, we get this for the original program:
while (true) { print("Pick a number!"); let x = input(); if (x > 0) { print("You chose " + x); break; } else { print("Sorry, pick a POSITIVE number"); } }
You might have a new concern, and understandably so. This sample program was carefully created as to avoid something common in imperative languages and much less common in functional languages:
let x = input(); if (x < 0) { let y = x*x; x = y; } print(x);
Mutation.
We're stuck, right? This is the end? Our exploration of treating statements as expressions has come to a close?
No, not quite.
Our statements are expressions, and expressions return something. So what data type does x = y return? State. It returns the state of x having been assigned to y. Every time we evaluate the next statement in the tree, we pass it the state of the previous one, and at the end we return not a value, but the newly constructed state after the statement has been evaluated. When we enter a block we create a new state whose parent state is the state passed into the block's statement, and the block returns the parent of the state returned from its last statement.
Update: Let me interject for a moment to clarify something. I'm assuming here that the state is an immutable data structure. It doesn't need to be of course, but this whole state-passing system starts to feel extremely over-engineered if it is not.
Say we input 3:
// For state, we use the format [parentState, [myBindings]] let x = input(); // returns [global, [x: 3]] if (x < 0) { let y = x*x; x = y; } // returns [global, [x: 3]] print(x); // returns [global, [x: 3]]
But if we input -3:
let x = input(); // returns [global, [x: -3]] if (x < 0) { let y = x*x; // returns [[global, [x: -3]], [y: 9]] x = y; // returns [[global, [x: 9]], [y: 9]] } // returns [global, [x: 9]] print(x); // returns [global, [x: 9]]
So why do we want this? What's the point? Part of it is a sense of idealism. There's a general feeling that immutability is good practice, and this brings immutability to... mutation, I suppose. In some cases it could be easier to develop a language with this structure. Static code analysis could catch bugs that would be harder to detect with mutable state.
But there are drawbacks too. This doesn't permit shared program state across threads, for example, though this model could be extended with some sort of "unsafe assignment" mechanism to mutate a shared state. And if a compiler developer is seeking optimal performance, this model will likely be reduced down to exactly what we had before anyways.
In the end, as mentioned near to the start of this post, this alternative model is not "better" than our more traditional sequential statement model, but it's not worse either. It's an alternative approach, a new way to tackle an old problem. But that's also kind of the point. Even problems which appear to have only one solution can often be elegantly solved with alternative approaches. The solution is not defined by the problem, the problem is defined by the solution.
0 notes
jacob-cs · 4 years
Text
android bound service 설명 youtube
original source : https://youtu.be/_xNkVNaC9AI
기본 전제)
service는 server 이며 이에 연결되는 activity는 client라고 이해하면 이해한다.
MainActivity
package com.codingwithmitch.boundserviceexample1; import android.arch.lifecycle.Observer; import android.arch.lifecycle.ViewModelProviders; import android.content.Context; import android.content.Intent; import android.os.Handler; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity {    private static final String TAG = "MainActivity";    // UI Components    private ProgressBar mProgressBar;    private TextView mTextView;    private Button mButton;    // Vars    private MyService mService;    private MainActivityViewModel mViewModel;    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_main);        mProgressBar = findViewById(R.id.progresss_bar);        mTextView = findViewById(R.id.text_view);        mButton = findViewById(R.id.toggle_updates);        mViewModel = ViewModelProviders.of(this).get(MainActivityViewModel.class);        setObservers();        mButton.setOnClickListener(new View.OnClickListener() {            @Override            public void onClick(View view) {                toggleUpdates();            }        });    }    private void toggleUpdates(){        if(mService != null){            if(mService.getProgress() == mService.getMaxValue()){                mService.resetTask();                mButton.setText("Start");            }            else{                if(mService.getIsPaused()){                    mService.unPausePretendLongRunningTask();                    mViewModel.setIsProgressBarUpdating(true);                }                else{                    mService.pausePretendLongRunningTask();                    mViewModel.setIsProgressBarUpdating(false);                }            }        }    }    private void setObservers(){        mViewModel.getBinder().observe(this, new Observer<MyService.MyBinder>() {            @Override            public void onChanged(@Nullable MyService.MyBinder myBinder) {                if(myBinder == null){                    Log.d(TAG, "onChanged: unbound from service");                }                else{                    Log.d(TAG, "onChanged: bound to service.");                    mService = myBinder.getService();                }            }        });        mViewModel.getIsProgressBarUpdating().observe(this, new Observer<Boolean>() {            @Override            public void onChanged(@Nullable final Boolean aBoolean) {                final Handler handler = new Handler();                final Runnable runnable = new Runnable() {                    @Override                    public void run() {                        if(mViewModel.getIsProgressBarUpdating.getValue()){                            if(mViewModel.getBinder().getValue() != null){ // meaning the service is bound                                if(mService.getProgress() == mService.getMaxValue()){                                    mViewModel.setIsProgressBarUpdating(false);                                }                                mProgressBar.setProgress(mService.getProgress());                                mProgressBar.setMax(mService.getMaxValue());                                String progress =                                        String.valueOf(100 * mService.getProgress() / mService.getMaxValue()) + "%";                                mTextView.setText(progress);                            }                            handler.postDelayed(this, 100);                        }                        else{                            handler.removeCallbacks(this);                        }                    }                };                // control what the button shows                if(aBoolean){                    mButton.setText("Pause");                    handler.postDelayed(runnable, 100);                }                else{                    if(mService.getProgress() == mService.getMaxValue()){                        mButton.setText("Restart");                    }                    else{                        mButton.setText("Start");                    }                }            }        });    }    @Override    protected void onResume() {        super.onResume();        startService();    }    @Override    protected void onStop() {        super.onStop();        if(mViewModel.getBinder() != null){            unbindService(mViewModel.getServiceConnection());        }    }    private void startService(){        Intent serviceIntent = new Intent(this, MyService.class);        startService(serviceIntent);        bindService();    }    private void bindService(){        Intent serviceBindIntent =  new Intent(this, MyService.class);        bindService(serviceBindIntent, mViewModel.getServiceConnection(), Context.BIND_AUTO_CREATE);    } }
위 코드에서 runnable 호출을 runnable 자체내에서 수행함으로써 looping를 한 부분이 생소했다.아래 그림 참조
Tumblr media
또한 bindService()도 처음에는 이해하기 힘들었다. 두번째 파라미터 service connection을 전달부분이 어려웠다. 아래 MainActivityViewModel 코드를 확인하면 ServiceConnection obj 생성시에는 특별한 파라미터를 필요로 하지 않는다. ServiceConnection 는 activity에 service가 연결될때 호출되는 callback obj 로 추측한다. 
Tumblr media
MainActivityViewModel
package com.codingwithmitch.boundserviceexample1; import android.arch.lifecycle.LiveData; import android.arch.lifecycle.MutableLiveData; import android.arch.lifecycle.ViewModel; import android.content.ComponentName; import android.content.ServiceConnection; import android.os.Handler; import android.os.IBinder; import android.util.Log; public class MainActivityViewModel extends ViewModel {    private static final String TAG = "MainActivityViewModel";    private MutableLiveData<Boolean> mIsProgressBarUpdating = new MutableLiveData<>();    private MutableLiveData<MyService.MyBinder> mBinder = new MutableLiveData<>();    // Keeping this in here because it doesn't require a context    private ServiceConnection serviceConnection = new ServiceConnection() {        @Override        public void onServiceConnected(ComponentName className, IBinder iBinder) {            Log.d(TAG, "ServiceConnection: connected to service.");            // We've bound to MyService, cast the IBinder and get MyBinder instance            MyService.MyBinder binder = (MyService.MyBinder) iBinder;            mBinder.postValue(binder); ��      }        @Override        public void onServiceDisconnected(ComponentName arg0) {            Log.d(TAG, "ServiceConnection: disconnected from service.");            mBinder.postValue(null);        }    };    public ServiceConnection getServiceConnection(){        return serviceConnection;    }    public LiveData<MyService.MyBinder> getBinder(){        return mBinder;    }    public LiveData<Boolean> getIsProgressBarUpdating(){        return mIsProgressBarUpdating;    }    public void setIsProgressBarUpdating(boolean isUpdating){        mIsProgressBarUpdating.postValue(isUpdating);    } }
MyService
package com.codingwithmitch.boundserviceexample1; import android.app.Service; import android.content.Intent; import android.os.Binder; import android.os.Handler; import android.os.HandlerThread; import android.os.IBinder; import android.support.annotation.Nullable; import android.util.Log; public class MyService extends Service {    private static final String TAG = "MyService";    private final IBinder mBinder = new MyBinder();    private Handler mHandler;    private int mProgress, mMaxValue;    private Boolean mIsPaused;    @Override    public void onCreate() {        super.onCreate();        mHandler = new Handler();        mProgress = 0;        mIsPaused = true;        mMaxValue = 5000;    }    @Nullable    @Override    public IBinder onBind(Intent intent) {        return mBinder;    }    public class MyBinder extends Binder{        MyService getService(){            return MyService.this;        }    }    public Boolean getIsPaused(){        return mIsPaused;    }    public int getProgress(){        return mProgress;    }    public int getMaxValue(){        return mMaxValue;    }    public void pausePretendLongRunningTask(){        mIsPaused = true;    }    public void unPausePretendLongRunningTask(){        mIsPaused = false;        startPretendLongRunningTask();    }    public void startPretendLongRunningTask(){        final Runnable runnable = new Runnable() {            @Override            public void run() {                if(mProgress >= mMaxValue || mIsPaused){                    Log.d(TAG, "run: removing callbacks");                    mHandler.removeCallbacks(this); // remove callbacks from runnable                    pausePretendLongRunningTask();                }                else{                    Log.d(TAG, "run: progress: " + mProgress);                    mProgress += 100; // increment the progress                    mHandler.postDelayed(this, 100); // continue incrementing                }            }        };        mHandler.postDelayed(runnable, 100);    }    public void resetTask(){        mProgress = 0;    }    @Override    public void onTaskRemoved(Intent rootIntent) {        super.onTaskRemoved(rootIntent);        Log.d(TAG, "onTaskRemoved: called.");        stopSelf();    }    @Override    public void onDestroy() {        super.onDestroy();        Log.d(TAG, "onDestroy: called.");    } }
0 notes