Skip to content

Instantly share code, notes, and snippets.

View mananshr's full-sized avatar
👋
Working on smart retail tech

Manan Sharma mananshr

👋
Working on smart retail tech
View GitHub Profile
public class MainActivity extends Activity {
private WebView mWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mWebView = (WebView) findViewById(R.id.webView);
package com.example.listwidgetexample2;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import android.app.Activity;
import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent;
<div class="container">
<ul id="tabs" class="nav nav-tabs" data-tabs="tabs">
<li <?php echo (empty($tab)) ? ' class = "active tab-pane"' : ''; ?>><a href="#events" data-toggle="tab">活動列表</a></li>
<?php
if($this->cmrdb_auth->logged_in()) {
$new_event = '<li ';
$new_event .= ($tab == 'create') ? ' class = "active tab-pane"' : '';
$new_event .= '><a href="#creat_event" data-toggle="tab">新增活動</a></li>';
echo $new_event;
@mananshr
mananshr / jQuery JavaScript Library
Created October 4, 2014 13:25
jQuery JavaScript Library Modified specifically for some projects
/*!
* jQuery JavaScript Library v2.1.1
* Mod 0.2.1
* http://jquery.com/
*
*http://stackoverflow.com/users/2043419/manan-merevik-sharma
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
@mananshr
mananshr / CountingFileRequestBody.java
Created October 8, 2015 13:12 — forked from eduardb/CountingFileRequestBody.java
Uploading a file with a progress displayed using OkHttp
public class CountingFileRequestBody extends RequestBody {
private static final int SEGMENT_SIZE = 2048; // okio.Segment.SIZE
private final File file;
private final ProgressListener listener;
private final String contentType;
public CountingFileRequestBody(File file, String contentType, ProgressListener listener) {
this.file = file;
@mananshr
mananshr / GetMapFromArray.java
Last active April 4, 2016 09:13
Convert ArrayList to Map. One of the attributes of array list type <V> is used as key <K>, [ K ∈ V ] of the map. The important thing here is that the keys are sorted in the map.
public HashMap<K, ArrayList<V>> getMap(ArrayList<V> vs) {
ArrayList<K> keys = new ArrayList<>();
Iterator<V> iterator = vs.iterator();
while (iterator.hasNext()) {
V v = iterator.next();
if (!keys.contains(v.getV())) {
keys.add(v.getV());
}
}
package com.merevik.countingtextview;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.animation.LinearInterpolator;
import android.widget.TextView;
@mananshr
mananshr / AnimatedGifEncoder.java
Created September 28, 2016 14:37
An animated GIF encoder for Android, without any native code required. Based on the J2ME encoder. Additionally contain dirty triangle support.
package com.gokrazee.app.util.gif;
import java.io.IOException;
import java.io.OutputStream;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Paint;