This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
@Override protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); | |
setSupportActionBar(toolbar); | |
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | |
fab.setOnClickListener(new View.OnClickListener() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : AppCompatActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_main) | |
val toolbar = findViewById(R.id.toolbar) as Toolbar? | |
setSupportActionBar(toolbar) | |
val fab = findViewById(R.id.fab) as FloatingActionButton? | |
fab?.setOnClickListener(View.OnClickListener { view -> Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG).setAction("Action", null).show() }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
/** | |
* Created by Vincent on 23-Mar-15. | |
Copy paste this code and use it by running Engima.encrypt("YOUR_PLAIN_TEXT"); | |
*/ | |
public class Engima { | |
//set your Rotor Settings here | |
static String[] firstRotor = {"E", "K", "M", "F", "L", "G", "D", "Q", "V", "Z", "N", "T", "O", "W", "Y", "H", "X", "U", "S", "P", "A", "I", "B", "R", "C", "J"}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void loadData() { | |
swipeRefreshingLayout.setRefreshing(true); | |
FireBaseDatabaseManager.getHotelReference().addValueEventListener(new ValueEventListener() { | |
@Override public void onDataChange(DataSnapshot dataSnapshot) { | |
GenericTypeIndicator<List<Hotel>> tempIndicator = new GenericTypeIndicator<List<Hotel>>() { | |
}; | |
hotelRecyclerAdapter.setItems(dataSnapshot.getValue(tempIndicator)); | |
swipeRefreshingLayout.setRefreshing(false); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FireBaseDatabaseManager { | |
public static FirebaseDatabase database; | |
public static DatabaseReference hotelReference; | |
public static FirebaseDatabase getDatabase() { | |
if (database == null) { | |
database = FirebaseDatabase.getInstance(); | |
database.setPersistenceEnabled(true); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
compile fileTree(include: ['*.jar'], dir: 'libs') | |
//Retrofit | |
compile 'com.squareup.retrofit2:retrofit:2.1.0' | |
compile 'com.squareup.retrofit2:converter-gson:2.1.0' | |
compile 'com.squareup.okhttp3:logging-interceptor:3.3.1' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Retrofit getRetrofit() { | |
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); | |
interceptor.setLevel(HttpLoggingInterceptor.Level.BASIC); | |
OkHttpClient client = new OkHttpClient.Builder() | |
.addInterceptor(interceptor) | |
.build(); | |
return new Retrofit.Builder().baseUrl(BASE_URL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { | |
boolean isShow = false; | |
int scrollRange = -1; | |
@Override public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { | |
if (scrollRange == -1) { | |
scrollRange = appBarLayout.getTotalScrollRange(); | |
} | |
if (scrollRange + verticalOffset == 0) { | |
getSupportActionBar().setTitle(series.title_english); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int max = array[0]; | |
for (int i = 1; i < array.length; i++) { | |
if (array[i] > max) max = array[i]; | |
} | |
return max; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout android:id="@+id/activity_main" | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:paddingBottom="@dimen/activity_vertical_margin" | |
android:paddingLeft="@dimen/activity_horizontal_margin" | |
android:paddingRight="@dimen/activity_horizontal_margin" | |
android:paddingTop="@dimen/activity_vertical_margin" |
OlderNewer