Initial commit

parents
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<compositeConfiguration>
<compositeBuild compositeDefinitionSource="SCRIPT" />
</compositeConfiguration>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeSettings">
<configurations>
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
</configurations>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
/build
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.stilldre.moovify"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
buildConfigField("String", "TMDB_API_KEY", '"6a2b8629fcc338600751630494627b3e"')
buildConfigField("String", "TMDB_BASE_URL", '"https://api.themoviedb.org/3/"')
buildConfigField("String", "TMDB_IMAGE_BASE_URL_780", '"https://image.tmdb.org/t/p/w780"')
buildConfigField("String", "TMDB_IMAGE_BASE_URL_500", '"https://image.tmdb.org/t/p/w500"')
buildConfigField("String", "TMDB_MOVIE_ID", '"movie_id"')
buildConfigField("String", "TMDB_MOVIE_TITLE", '"movie_title"')
buildConfigField("String", "FAVORITE_TABLE_MOVIE", '"favorite"')
buildConfigField("String", "FAVORITE_AUTHORITY", '"com.stilldre.moovify"')
buildConfigField("String", "TIME_DAILY", '"07:00"')
buildConfigField("String", "TIME_RELEASE_TODAY", '"08:00"')
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation("com.github.bumptech.glide:glide:4.7.1") {
exclude group: "com.android.support"
}
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
implementation 'com.jakewharton:butterknife:10.2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'
implementation 'com.firebaseui:firebase-ui-database:6.1.0'
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
}
{
"project_info": {
"project_number": "467708988852",
"firebase_url": "https://moovify-c8bdd.firebaseio.com",
"project_id": "moovify-c8bdd",
"storage_bucket": "moovify-c8bdd.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:467708988852:android:83ec41df9fb28077f976e1",
"android_client_info": {
"package_name": "com.stilldre.moovify"
}
},
"oauth_client": [
{
"client_id": "467708988852-vn80dhhvorhtr34kum7skavjjs6n9fq2.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.stilldre.moovify",
"certificate_hash": "1a759895ed9a4048325542e9f0b16d46f8e7cc90"
}
},
{
"client_id": "467708988852-f6hp24gle8iqfe6hvbdpa0btheofrsst.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCTImt0mNidNKg5DIP97_sz64xxeZzJcKI"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "467708988852-f6hp24gle8iqfe6hvbdpa0btheofrsst.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
package com.stilldre.moovify;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.stilldre.moovify", appContext.getPackageName());
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.stilldre.moovify">
<uses-permission android:name="android.permission.INTERNET" />
<permission
android:name="com.stilldre.moovify.READ_DATABASE"
android:protectionLevel="normal" />
<permission
android:name="com.stilldre.moovify.WRITE_DATABASE"
android:protectionLevel="normal" />
<application
android:allowBackup="true"
android:appComponentFactory="@string/app_component_factory"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:appComponentFactory">
<activity
android:name=".activity.SplashscreenActivity"
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.ChatroomActivity" />
<activity android:name=".activity.MessageActivity" />
<activity android:name=".activity.RegisterActivity" />
<activity android:name=".activity.ReminderActivity" />
<receiver android:name=".widget.MoovifyFavoriteWidget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/moovify_favorite_widget_info" />
</receiver>
<activity
android:name=".activity.SearchActivity"
android:configChanges="orientation|screenSize" />
<activity
android:name=".activity.DetailActivity"
android:configChanges="orientation|screenSize" />
<activity
android:name=".activity.MainActivity"
android:configChanges="orientation|screenSize" >
</activity>
<activity
android:name=".activity.LoginActivity"
android:configChanges="orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name=".provider.FavoriteProvider"
android:authorities="com.stilldre.moovify"
android:exported="true"
android:readPermission="com.stilldre.moovify.READ_DATABASE"
android:writePermission="com.stilldre.moovify.WRITE_DATABASE" />
<service
android:name=".widget.MoovifyWidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS" />
<receiver
android:name=".reminder.ReminderReceiver"
android:enabled="true"
android:exported="true" />
</application>
</manifest>
\ No newline at end of file
package com.stilldre.moovify.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.stilldre.moovify.R;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class ChatroomActivity extends AppCompatActivity {
private Button btn_send_msg;
private EditText input_msg;
private TextView chat_conversation;
private String user_name ,room_name;
private DatabaseReference root;
private String temp_key;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chatroom);
btn_send_msg = (Button)findViewById(R.id.button);
input_msg = (EditText)findViewById(R.id.editText);
chat_conversation = (TextView)findViewById(R.id.textView);
user_name = getIntent().getExtras().get("user_name").toString();
room_name = getIntent().getExtras().get("room_name").toString();
setTitle("Room - "+room_name);
root = FirebaseDatabase.getInstance().getReference().child(room_name);
btn_send_msg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Map<String,Object> map = new HashMap<String, Object>();
temp_key = root.push().getKey();
root.updateChildren(map);
DatabaseReference message_root = root.child(temp_key);
Map<String,Object> map2 = new HashMap<String, Object>();
map2.put("name",user_name);
map2.put("msg",input_msg.getText().toString());
message_root.updateChildren(map2);
}
});
root.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
append_chat_conversatin(dataSnapshot);
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
append_chat_conversatin(dataSnapshot);
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
private String chat_msg, chat_user_name;
private void append_chat_conversatin(DataSnapshot dataSnapshot) {
Iterator i = dataSnapshot.getChildren().iterator();
while (i.hasNext())
{
chat_msg = (String) ((DataSnapshot)i.next()).getValue();
chat_user_name = (String) ((DataSnapshot)i.next()).getValue();
chat_conversation.append(chat_user_name + " : "+chat_msg +"\n");
}
}
}
package com.stilldre.moovify.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import androidx.appcompat.widget.Toolbar;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.stilldre.moovify.BuildConfig;
import com.stilldre.moovify.R;
import com.stilldre.moovify.helper.FavoriteHelper;
import com.stilldre.moovify.model.Movie;
import com.stilldre.moovify.repository.MovieRepository;
import com.stilldre.moovify.service.network.callback.OnGetDetailCallback;
import butterknife.BindView;
import butterknife.ButterKnife;
public class DetailActivity extends AppCompatActivity {
public static String MOVIE_ID = BuildConfig.TMDB_MOVIE_ID;
private static String IMAGE_BASE_URL = BuildConfig.TMDB_IMAGE_BASE_URL_780;
FavoriteHelper favoriteHelper;
private Movie movie;
@BindView(R.id.movieDetailsBackdrop)
ImageView ivBackdrop;
@BindView(R.id.movieDetailsTitle)
TextView tvTitle;
@BindView(R.id.movieDetailsOverview)
TextView tvOverview;
@BindView(R.id.overviewLabel)
TextView tvOverviewLabel;
@BindView(R.id.movieDetailsReleaseDate)
TextView tvReleaseDate;
@BindView(R.id.movieDetailsRating)
RatingBar rbRating;
@BindView(R.id.detailToolbar)
Toolbar toolbar;
private MovieRepository movieRepository;
private boolean isFavorite;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
movie = getIntent().getParcelableExtra("movie");
movieRepository = MovieRepository.getInstance();
favoriteHelper = new FavoriteHelper(this);
favoriteHelper.open();
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(getResources().getColor(R.color.black));
ButterKnife.bind(this);
setSupportActionBar(toolbar);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setTitle(null);
}
getMovieDetail();
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
super.onPrepareOptionsMenu(menu);
if (!favoriteHelper.getMovieById(movie.getId())) {
isFavorite = false;
menu.findItem(R.id.action_favorite).setIcon(R.drawable.ic_favorite);
} else if (favoriteHelper.getMovieById(movie.getId())) {
isFavorite = true;
menu.findItem(R.id.action_favorite).setIcon(R.drawable.ic_favorite_red);
}
MenuItem item = menu.findItem(R.id.action_favorite);
item.setOnMenuItemClickListener(view -> {
if (!isFavorite) {
addFav(movie);
favoriteAdded();
menu.findItem(R.id.action_favorite).setIcon(R.drawable.ic_favorite_red);
isFavorite = true;
} else if (isFavorite) {
removeFav(movie.getId());
isFavorite = false;
menu.findItem(R.id.action_favorite).setIcon(R.drawable.ic_favorite);
favoriteRemoved();
}
return true;
});
return super.onPrepareOptionsMenu(menu);
}
private void getMovieDetail() {
movieRepository.getDetail(movie.getId(), new OnGetDetailCallback() {
@Override
public void onSuccess(Movie movie) {
tvTitle.setText(movie.getTitle());
tvOverviewLabel.setVisibility(View.VISIBLE);
tvOverview.setText(movie.getOverview());
rbRating.setVisibility(View.VISIBLE);
rbRating.setRating(movie.getRating() / 2);
tvReleaseDate.setText(movie.getReleaseDate());
if (!isFinishing()) {
Glide.with(DetailActivity.this)
.load(IMAGE_BASE_URL + movie.getBackdropPath())
.apply(RequestOptions.placeholderOf(R.color.colorPrimary))
.into(ivBackdrop);
}
}
@Override
public void onError() {
finish();
}
});
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_toolbar_detail, menu);
return true;
}
private void favoriteAdded() {
Toast.makeText(DetailActivity.this, "Favorite Added", Toast.LENGTH_SHORT).show();
}
private void favoriteRemoved() {
Toast.makeText(DetailActivity.this, "Favorite Removed", Toast.LENGTH_SHORT).show();
}
public void addFav(Movie movie) {
favoriteHelper.insertMovie(movie);
}
public void removeFav(String id) {
favoriteHelper.deleteFavorite(id);
}
}
package com.stilldre.moovify.activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.stilldre.moovify.R;
public class LoginActivity extends AppCompatActivity {
EditText Email, Password;
Button LogInButton, RegisterButton;
FirebaseAuth mAuth;
FirebaseAuth.AuthStateListener mAuthListner;
FirebaseUser mUser;
String email, password;
ProgressDialog dialog;
public static final String userEmail="";
public static final String TAG="LOGIN";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
LogInButton = (Button) findViewById(R.id.btnLogin);
RegisterButton = (Button) findViewById(R.id.btnRegister);
Email = (EditText) findViewById(R.id.email);
Password = (EditText) findViewById(R.id.password);
dialog = new ProgressDialog(this);
mAuth = FirebaseAuth.getInstance();
mUser = FirebaseAuth.getInstance().getCurrentUser();
mAuthListner = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
if (mUser != null) {
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
else
{
Log.d(TAG,"AuthStateChanged:Logout");
}
}
};
LogInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
userSign();
}
});
RegisterButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);
startActivity(intent);
}
});
}
@Override
protected void onStart() {
super.onStart();
//removeAuthSateListner is used in onStart function just for checking purposes,it helps in logging you out.
mAuth.removeAuthStateListener(mAuthListner);
}
@Override
protected void onStop() {
super.onStop();
if (mAuthListner != null) {
mAuth.removeAuthStateListener(mAuthListner);
}
}
@Override
public void onBackPressed() {
LoginActivity.super.finish();
}
private void userSign() {
email = Email.getText().toString().trim();
password = Password.getText().toString().trim();
if (TextUtils.isEmpty(email)) {
Toast.makeText(LoginActivity.this, "Enter the correct Email", Toast.LENGTH_SHORT).show();
return;
} else if (TextUtils.isEmpty(password)) {
Toast.makeText(LoginActivity.this, "Enter the correct password", Toast.LENGTH_SHORT).show();
return;
}
dialog.setMessage("Loging in please wait...");
dialog.setIndeterminate(true);
dialog.show();
mAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()) {
dialog.dismiss();
Toast.makeText(LoginActivity.this, "Login not successfull", Toast.LENGTH_SHORT).show();
} else {
dialog.dismiss();
checkIfEmailVerified();
}
}
});
}
//This function helps in verifying whether the email is verified or not.
private void checkIfEmailVerified(){
FirebaseUser users = FirebaseAuth.getInstance().getCurrentUser();
boolean emailVerified=users.isEmailVerified();
if(!emailVerified){
Toast.makeText(this,"Verify the Email Id", Toast.LENGTH_SHORT).show();
mAuth.signOut();
finish();
}
else {
Email.getText().clear();
Password.getText().clear();
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
// Sending Email to Dashboard Activity using intent.
intent.putExtra(userEmail, email);
startActivity(intent);
}
}
}
package com.stilldre.moovify.activity;
import android.content.Intent;
import android.provider.Settings;
import com.google.android.material.tabs.TabLayout;
import androidx.core.content.ContextCompat;
import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import androidx.appcompat.widget.Toolbar;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.stilldre.moovify.R;
import com.stilldre.moovify.adapter.PagerAdapter;
import java.util.Objects;
import butterknife.BindView;
import butterknife.ButterKnife;
public class MainActivity extends AppCompatActivity {
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.tabLayout)
TabLayout tabLayout;
@BindView(R.id.viewPager)
ViewPager viewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
toolbar.setTitle(getResources().getString(R.string.app_name));
toolbar.setTitleTextColor(ContextCompat.getColor(this, R.color.white));
PagerAdapter pagerAdapter = new PagerAdapter(getSupportFragmentManager(), tabLayout.getTabCount());
viewPager.setAdapter(pagerAdapter);
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.setupWithViewPager(viewPager);
Objects.requireNonNull(tabLayout.getTabAt(0).setText(R.string.now_playing));
Objects.requireNonNull(tabLayout.getTabAt(1).setText(R.string.upcoming));
Objects.requireNonNull(tabLayout.getTabAt(2).setText(R.string.favorite));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_toolbar_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
// case R.id.action_setting:
// Intent dIntent = new Intent(Settings.ACTION_LOCALE_SETTINGS);
// startActivity(dIntent);
// break;
case R.id.action_search:
Intent sIntent = new Intent(MainActivity.this, SearchActivity.class);
startActivity(sIntent);
break;
case R.id.action_reminder:
Intent rIntent = new Intent(MainActivity.this, ReminderActivity.class);
startActivity(rIntent);
break;
case R.id.action_message:
Intent mIntent = new Intent(MainActivity.this, MessageActivity.class);
startActivity(mIntent);
break;
default:
return false;
}
return super.onOptionsItemSelected(item);
}
}
package com.stilldre.moovify.activity;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import com.firebase.ui.database.FirebaseRecyclerOptions;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.stilldre.moovify.R;
import com.stilldre.moovify.adapter.RoomAdapter;
import com.stilldre.moovify.model.Room;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
public class MessageActivity extends AppCompatActivity {
private Button add_room;
private EditText room_name;
private ListView listView;
private String name;
private DatabaseReference root = FirebaseDatabase.getInstance().getReference().getRoot();
private ArrayAdapter<String> arrayAdapter;
private ArrayList<String> list_of_rooms = new ArrayList();
private RecyclerView recyclerView;
private RoomAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_message);
add_room = (Button)findViewById(R.id.btnAdd_room);
room_name = (EditText)findViewById(R.id.etNeme_room);
listView = (ListView)findViewById(R.id.listView);
arrayAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,list_of_rooms);
listView.setAdapter(arrayAdapter);
request_user_name();
add_room.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Map<String,Object> map = new HashMap<String,Object>();
map.put(room_name.getText().toString(),"");
root.updateChildren(map);
}
});
root.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
Set<String> set = new HashSet<String>();
Iterator i = dataSnapshot.getChildren().iterator();
while ( i.hasNext())
{
set.add(((DataSnapshot)i.next()).getKey());
}
list_of_rooms.clear();
list_of_rooms.addAll(set);
arrayAdapter.notifyDataSetChanged();
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Intent I = new Intent(getApplicationContext(),ChatroomActivity.class);
I.putExtra("room_name",((TextView)view).getText().toString());
I.putExtra("user_name",name);
startActivity(I);
}
});
}
private void request_user_name() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Enter Name");
final EditText input_field = new EditText(this);
builder.setView(input_field);
builder.setPositiveButton("OK ", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
name = input_field.getText().toString();
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.cancel();
request_user_name();
}
});
builder.show();
}
}
package com.stilldre.moovify.activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.stilldre.moovify.R;
import com.stilldre.moovify.model.User;
import java.util.Date;
public class RegisterActivity extends AppCompatActivity implements View.OnClickListener{
EditText name,email,password;
Button mRegisterbtn, LoginButton;
TextView mLoginPageBack;
FirebaseAuth mAuth;
DatabaseReference mdatabase;
String Name,Email,Password;
ProgressDialog mDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
name = (EditText)findViewById(R.id.editName);
email = (EditText)findViewById(R.id.editEmail);
password = (EditText)findViewById(R.id.editPassword);
mRegisterbtn = (Button)findViewById(R.id.buttonRegister);
LoginButton = (Button)findViewById(R.id.btnLogin);
// for authentication using FirebaseAuth.
mAuth = FirebaseAuth.getInstance();
mRegisterbtn.setOnClickListener(this);
//mLoginPageBack.setOnClickListener(this);
mDialog = new ProgressDialog(this);
mdatabase = FirebaseDatabase.getInstance().getReference().child("Users");
LoginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Opening new user registration activity using intent on button click.
Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
startActivity(intent);
}
});
}
@Override
public void onClick(View v) {
if (v==mRegisterbtn){
UserRegister();
}else if (v== mLoginPageBack){
startActivity(new Intent(RegisterActivity.this, LoginActivity.class));
}
}
public void Home(View view) {
Intent intent = new Intent(RegisterActivity.this, LoginActivity.class);
startActivity(intent);
}
private void UserRegister() {
Name = name.getText().toString().trim();
Email = email.getText().toString().trim();
Password = password.getText().toString().trim();
if (TextUtils.isEmpty(Name)){
Toast.makeText(RegisterActivity.this, "Enter Name", Toast.LENGTH_SHORT).show();
return;
}else if (TextUtils.isEmpty(Email)){
Toast.makeText(RegisterActivity.this, "Enter Email", Toast.LENGTH_SHORT).show();
return;
}else if (TextUtils.isEmpty(Password)){
Toast.makeText(RegisterActivity.this, "Enter Password", Toast.LENGTH_SHORT).show();
return;
}else if (Password.length()<6){
Toast.makeText(RegisterActivity.this,"Passwor must be greater then 6 digit",Toast.LENGTH_SHORT).show();
return;
}
mDialog.setMessage("Creating User please wait...");
mDialog.setCanceledOnTouchOutside(false);
mDialog.show();
mAuth.createUserWithEmailAndPassword(Email,Password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
sendEmailVerification();
mDialog.dismiss();
OnAuth(task.getResult().getUser());
mAuth.signOut();
}else{
Toast.makeText(RegisterActivity.this,"error on creating user",Toast.LENGTH_SHORT).show();
}
}
});
}
//Email verification code using FirebaseUser object and using isSucccessful()function.
private void sendEmailVerification() {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user!=null){
user.sendEmailVerification().addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()){
Toast.makeText(RegisterActivity.this,"Check your Email for verification",Toast.LENGTH_SHORT).show();
FirebaseAuth.getInstance().signOut();
startActivity(new Intent(RegisterActivity.this, LoginActivity.class));
}
}
});
}
}
private void OnAuth(FirebaseUser user) {
createAnewUser(user.getUid());
}
private void createAnewUser(String uid) {
User user = BuildNewuser();
mdatabase.child(uid).setValue(user);
}
private User BuildNewuser(){
return new User(
getDisplayName(),
getUserEmail(),
new Date().getTime()
);
}
public String getDisplayName() {
return Name;
}
public String getUserEmail() {
return Email;
}
}
package com.stilldre.moovify.activity;
import android.content.res.Configuration;
import androidx.core.content.ContextCompat;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import androidx.appcompat.widget.Toolbar;
import android.widget.Toast;
import android.widget.ToggleButton;
import com.stilldre.moovify.BuildConfig;
import com.stilldre.moovify.R;
import com.stilldre.moovify.helper.MoovifyPreference;
import com.stilldre.moovify.reminder.ReminderReceiver;
import butterknife.BindView;
import butterknife.ButterKnife;
public class ReminderActivity extends AppCompatActivity {
public static final String TIME_DAILY = BuildConfig.TIME_DAILY;
public static final String TIME_RELEASE = BuildConfig.TIME_RELEASE_TODAY;
private ReminderReceiver reminderReceiver;
private MoovifyPreference moovifyPreference;
@BindView(R.id.tb_daily_reminder)
ToggleButton tbDailyReminder;
@BindView(R.id.tb_release_today_reminder)
ToggleButton tbReleaseTodayReminder;
@BindView(R.id.toolbar_reminder)
Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reminder);
ButterKnife.bind(this);
toolbar.setTitle(getResources().getString(R.string.set_reminder));
toolbar.setTitleTextColor(ContextCompat.getColor(this, R.color.white));
if (getSupportActionBar() != null) getSupportActionBar().setDisplayShowTitleEnabled(true);
reminderReceiver = new ReminderReceiver();
moovifyPreference = new MoovifyPreference(this);
loadPreference();
tbDailyReminder.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (isChecked) {
moovifyPreference.setDailyReminder(true, TIME_DAILY);
reminderReceiver.setRepeatingReminder(this,
ReminderReceiver.TYPE_REPEATING_DAILY_REMINDER, TIME_DAILY,
getString(R.string.moovify_is_missing_you),
ReminderReceiver.NOTIFICATION_ID_REPEATING_DAILY_REMINDER);
Toast.makeText(this, getString(R.string.enabled), Toast.LENGTH_SHORT).show();
} else {
moovifyPreference.setReleaseTodayReminder(false, TIME_DAILY);
reminderReceiver.stopReminder(this);
Toast.makeText(this, getString(R.string.disabled), Toast.LENGTH_SHORT).show();
}
});
tbDailyReminder.setChecked(moovifyPreference.getDailyReminder());
tbReleaseTodayReminder.setChecked(moovifyPreference.getReleaseTodayReminder());
tbReleaseTodayReminder.setOnCheckedChangeListener((buttonView, isChecked) -> {
if (isChecked) {
moovifyPreference.setReleaseTodayReminder(true, TIME_RELEASE);
reminderReceiver.setRepeatingReminder(this,
ReminderReceiver.TYPE_REPEATING_RELEASE_TODAY, TIME_RELEASE,
getString(R.string.today),
ReminderReceiver.NOTIFICATION_ID_REPEATING_RELEASE_TODAY);
Toast.makeText(this, getString(R.string.enabled), Toast.LENGTH_SHORT).show();
} else {
moovifyPreference.setReleaseTodayReminder(false, TIME_RELEASE);
Toast.makeText(this, getString(R.string.disabled), Toast.LENGTH_SHORT).show();
}
});
}
@Override
public void onBackPressed() {
super.onBackPressed();
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
}
private void loadPreference() {
tbDailyReminder.setChecked(moovifyPreference.getDailyReminder());
if (moovifyPreference.getDailyReminder()) {
tbDailyReminder.setChecked(true);
} else {
tbDailyReminder.setChecked(false);
}
}
}
package com.stilldre.moovify.activity;
import android.content.Intent;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.appcompat.widget.SearchView;
import android.view.Menu;
import android.widget.Toast;
import com.stilldre.moovify.R;
import com.stilldre.moovify.adapter.MovieAdapter;
import com.stilldre.moovify.model.Movie;
import com.stilldre.moovify.repository.MovieRepository;
import com.stilldre.moovify.service.click.OnMovieClickCallback;
import com.stilldre.moovify.service.network.callback.OnGetMoviesCallback;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
public class SearchActivity extends AppCompatActivity {
@BindView(R.id.activity_search)
SearchView searchView;
@BindView(R.id.recyclerView_movie_list)
RecyclerView rvMovie;
private MovieAdapter movieAdapter;
private MovieRepository movieRepository;
private String movieTitle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_search);
ButterKnife.bind(this);
searchView.onActionViewExpanded();
searchView.setIconified(false);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
movieTitle = s;
getMovies();
return true;
}
@Override
public boolean onQueryTextChange(String s) {
return false;
}
});
rvMovie.setLayoutManager(new LinearLayoutManager(SearchActivity.this));
movieRepository = MovieRepository.getInstance();
}
private void getMovies() {
movieRepository.searchMovie(movieTitle, new OnGetMoviesCallback() {
@Override
public void onSuccess(ArrayList<Movie> movies) {
movieAdapter = new MovieAdapter(movies, callback);
rvMovie.setAdapter(movieAdapter);
}
@Override
public void onError() {
showError();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return true;
}
OnMovieClickCallback callback = movie -> {
Intent intent = new Intent(SearchActivity.this, DetailActivity.class);
intent.putExtra("movie", movie);
startActivity(intent);
};
private void showError() {
Toast.makeText(SearchActivity.this, R.string.no_internet_connection, Toast.LENGTH_SHORT).show();
}
}
package com.stilldre.moovify.activity;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import com.stilldre.moovify.R;
public class SplashscreenActivity extends AppCompatActivity {
private int waktu_loading=4000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splashscreen);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
//setelah loading maka akan langsung berpindah ke home activity
Intent home=new Intent(SplashscreenActivity.this, LoginActivity.class);
startActivity(home);
finish();
}
},waktu_loading);
}
}
package com.stilldre.moovify.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.firebase.ui.database.FirebaseRecyclerOptions;
import com.stilldre.moovify.R;
import com.stilldre.moovify.model.Comment;
public class CommentAdapter extends FirebaseRecyclerAdapter<Comment, CommentAdapter.PastViewHolder> {
public CommentAdapter(@NonNull FirebaseRecyclerOptions<Comment> options) {
super(options);
}
@Override
protected void onBindViewHolder(@NonNull CommentAdapter.PastViewHolder holder, int i, @NonNull Comment comment) {
holder.name.setText((comment.getUserName()));
holder.msg.setText((comment.getMessage()));
}
@NonNull
@Override
public PastViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.comment, parent, false);
return new PastViewHolder(view);
}
class PastViewHolder extends RecyclerView.ViewHolder{
TextView name, msg;
public PastViewHolder(@NonNull View itemView) {
super(itemView);
name= itemView.findViewById(R.id.userName);
msg = itemView.findViewById(R.id.message);
}
}
}
package com.stilldre.moovify.adapter;
import android.content.Context;
import android.database.Cursor;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.stilldre.moovify.BuildConfig;
import com.stilldre.moovify.R;
import com.stilldre.moovify.model.Movie;
import butterknife.BindView;
import butterknife.ButterKnife;
public class FavoriteAdapter extends RecyclerView.Adapter<FavoriteAdapter.FavoriteViewHolder> {
private String IMAGE_BASE_URL = BuildConfig.TMDB_IMAGE_BASE_URL_500;
private Context context;
private Cursor cursor;
public FavoriteAdapter(Context context) {
this.context = context;
}
public void setFavoriteMovies(Cursor cursor) {
this.cursor = cursor;
}
@NonNull
@Override
public FavoriteAdapter.FavoriteViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.layout_movie_catalogue, viewGroup, false);
return new FavoriteViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull FavoriteAdapter.FavoriteViewHolder holder, int i) {
Movie movie = getItem(i);
holder.tvReleaseDate.setText(movie.getReleaseDate().split("-")[0]);
holder.tvTitle.setText(movie.getTitle());
holder.tvRating.setText(String.valueOf(movie.getRating()));
Glide.with(context)
.load(IMAGE_BASE_URL + movie.getPosterPath())
.apply(RequestOptions.placeholderOf(R.color.colorPrimary))
.into(holder.ivPoster);
}
@Override
public int getItemCount() {
if (cursor == null) return 0;
return cursor.getCount();
}
private Movie getItem(int position) {
if (!cursor.moveToPosition(position)) {
throw new IllegalStateException("Position Invalid");
}
return new Movie(cursor);
}
public class FavoriteViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.item_movie_title)
TextView tvTitle;
@BindView(R.id.item_movie_rating)
TextView tvRating;
@BindView(R.id.item_movie_release_date)
TextView tvReleaseDate;
@BindView(R.id.item_movie_poster)
ImageView ivPoster;
public FavoriteViewHolder(@NonNull View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
}
}
}
package com.stilldre.moovify.adapter;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.stilldre.moovify.BuildConfig;
import com.stilldre.moovify.R;
import com.stilldre.moovify.model.Movie;
import com.stilldre.moovify.service.click.OnMovieClickCallback;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
public class MovieAdapter extends RecyclerView.Adapter<MovieAdapter.MovieViewHolder> {
private String IMAGE_BASE_URL = BuildConfig.TMDB_IMAGE_BASE_URL_500;
private List<Movie> movies;
private OnMovieClickCallback callback;
public MovieAdapter(List<Movie> movies, OnMovieClickCallback callback) {
this.movies = movies;
this.callback = callback;
}
@NonNull
@Override
public MovieAdapter.MovieViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.layout_movie_catalogue, viewGroup, false);
return new MovieViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MovieAdapter.MovieViewHolder movieViewHolder, int i) {
movieViewHolder.bind(movies.get(i));
}
@Override
public int getItemCount() {
return movies.size();
}
public class MovieViewHolder extends RecyclerView.ViewHolder {
@BindView(R.id.item_movie_poster)
ImageView ivPoster;
@BindView(R.id.item_movie_rating)
TextView tvRating;
@BindView(R.id.item_movie_release_date)
TextView tvReleaseDate;
@BindView(R.id.item_movie_title)
TextView tvTitle;
Movie movie;
public MovieViewHolder(@NonNull View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
itemView.setOnClickListener(v -> callback.onClick(movie));
}
public void bind(Movie movie) {
tvReleaseDate.setText(movie.getReleaseDate().split("-")[0]);
tvTitle.setText(movie.getTitle());
tvRating.setText(String.valueOf(movie.getRating()));
Glide.with(itemView)
.load(IMAGE_BASE_URL + movie.getPosterPath())
.apply(RequestOptions.placeholderOf(R.color.colorPrimary))
.into(ivPoster);
this.movie = movie;
}
}
}
package com.stilldre.moovify.adapter;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import com.stilldre.moovify.fragment.FavoriteFragment;
import com.stilldre.moovify.fragment.NowPlayingFragment;
import com.stilldre.moovify.fragment.UpcomingFragment;
public class PagerAdapter extends FragmentPagerAdapter {
int numOfTab;
public PagerAdapter(FragmentManager fm, int numOfTab) {
super(fm);
this.numOfTab = numOfTab;
}
@Override
public Fragment getItem(int i) {
switch (i) {
case 0:
return new NowPlayingFragment();
case 1:
return new UpcomingFragment();
case 2:
return new FavoriteFragment();
default:
return null;
}
}
@Override
public int getCount() {
return numOfTab;
}
@Override
public CharSequence getPageTitle(int position) {
switch (position) {
case 0:
return "Now Playing";
case 1:
return "Upcoming";
case 2:
return "Favorite";
}
return null;
}
}
package com.stilldre.moovify.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.firebase.ui.database.FirebaseRecyclerOptions;
import com.stilldre.moovify.R;
import com.stilldre.moovify.model.Room;
public class RoomAdapter extends FirebaseRecyclerAdapter<Room, RoomAdapter.PastViewHolder> {
public RoomAdapter(@NonNull FirebaseRecyclerOptions<Room> options) {
super(options);
}
@Override
protected void onBindViewHolder(@NonNull RoomAdapter.PastViewHolder holder, int i, @NonNull Room room) {
holder.name.setText(room.getName());
}
@NonNull
@Override
public PastViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.room, parent, false);
return new PastViewHolder(view);
}
class PastViewHolder extends RecyclerView.ViewHolder{
TextView name;
public PastViewHolder(@NonNull View itemView) {
super(itemView);
name = itemView.findViewById(R.id.name);
}
}
}
package com.stilldre.moovify.database;
import android.database.Cursor;
import android.net.Uri;
import android.provider.BaseColumns;
import com.stilldre.moovify.BuildConfig;
public class DatabaseContract {
public static String TABLE_NAME = BuildConfig.FAVORITE_TABLE_MOVIE;
public static String AUTHORITY = BuildConfig.FAVORITE_AUTHORITY;
public static final Uri CONTENT_URI = new Uri.Builder().scheme("content")
.authority(AUTHORITY)
.appendPath(TABLE_NAME)
.build();
public static final class FavoriteColumns implements BaseColumns {
public static String COLUMN_ID_MOVIE = "movie_id";
public static String COLUMN_TITLE = "movie_title";
public static String COLUMN_POSTER_PATH = "poster_path";
public static String COLUMN_BACKDROP_PATH = "backdrop_path";
public static String COLUMN_OVERVIEW = "overview";
public static String COLUMN_RATING = "rating";
public static String COLUMN_RELEASE_DATE = "release_date";
}
public DatabaseContract() {
}
public static String getColumnString(Cursor cursor, String columnName) {
return cursor.getString(cursor.getColumnIndex(columnName));
}
public static int getColumnInt(Cursor cursor, String columnName) {
return cursor.getInt(cursor.getColumnIndex(columnName));
}
public static float getColumnFloat(Cursor cursor, String columnName) {
return cursor.getFloat(cursor.getColumnIndex(columnName));
}
}
package com.stilldre.moovify.fragment;
import android.content.Context;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.stilldre.moovify.R;
import com.stilldre.moovify.adapter.FavoriteAdapter;
import com.stilldre.moovify.helper.FavoriteHelper;
import butterknife.BindView;
import butterknife.ButterKnife;
import static com.stilldre.moovify.database.DatabaseContract.CONTENT_URI;
/**
* A simple {@link Fragment} subclass.
*/
public class FavoriteFragment extends Fragment {
@BindView(R.id.recyclerView_favorite)
RecyclerView rvMovie;
@BindView(R.id.fav_swipe)
SwipeRefreshLayout swipeRefreshLayout;
private FavoriteHelper favoriteHelper;
private FavoriteAdapter favoriteAdapter;
private Context context;
public FavoriteFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onResume() {
super.onResume();
loadMovies();
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
this.context = context;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_favorite, container, false);
ButterKnife.bind(this, view);
swipeRefreshLayout.setOnRefreshListener(() -> {
loadMovies();
swipeRefreshLayout.setRefreshing(false);
});
favoriteHelper = new FavoriteHelper(context);
favoriteAdapter = new FavoriteAdapter(getActivity());
rvMovie.setLayoutManager(new LinearLayoutManager(getActivity()));
return view;
}
private void loadMovies() {
swipeRefreshLayout.setRefreshing(true);
new LoadFavoriteAsync().execute();
}
private class LoadFavoriteAsync extends AsyncTask<Void, Void, Cursor> {
@Override
protected void onPreExecute() {
super.onPreExecute();
swipeRefreshLayout.setRefreshing(true);
}
@Override
protected Cursor doInBackground(Void... voids) {
return getContext().getContentResolver().query(CONTENT_URI, null, null, null, null);
}
@Override
protected void onPostExecute(Cursor cursor) {
super.onPostExecute(cursor);
swipeRefreshLayout.setRefreshing(false);
Cursor movie = cursor;
favoriteAdapter.setFavoriteMovies(cursor);
favoriteAdapter.notifyDataSetChanged();
rvMovie.setAdapter(favoriteAdapter);
int count = 0;
try {
count = ((movie.getCount() > 0) ? movie.getCount() : 0);
} catch (Exception e) {
Log.w("ERROR", e.getMessage());
}
if (count == 0) {
showToast(getString(R.string.no_fav_found));
}
}
}
private void showToast(String message) {
Toast.makeText(getContext(), message, Toast.LENGTH_SHORT).show();
}
}
package com.stilldre.moovify.fragment;
import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.stilldre.moovify.R;
import com.stilldre.moovify.activity.DetailActivity;
import com.stilldre.moovify.adapter.MovieAdapter;
import com.stilldre.moovify.model.Movie;
import com.stilldre.moovify.repository.MovieRepository;
import com.stilldre.moovify.service.network.callback.OnGetMoviesCallback;
import com.stilldre.moovify.service.click.OnMovieClickCallback;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* A simple {@link Fragment} subclass.
*/
public class NowPlayingFragment extends Fragment {
@BindView(R.id.recyclerView_now_playing)
RecyclerView rvMovie;
@BindView(R.id.now_playing_swiper)
SwipeRefreshLayout swipeRefreshLayout;
private MovieAdapter movieAdapter;
private MovieRepository movieRepository;
public NowPlayingFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onResume() {
getMovies();
super.onResume();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_now_playing, container, false);
ButterKnife.bind(this, view);
rvMovie.setLayoutManager(new LinearLayoutManager(getActivity()));
swipeRefreshLayout.setRefreshing(true);
swipeRefreshLayout.setOnRefreshListener(() -> getMovies());
movieRepository = MovieRepository.getInstance();
return view;
}
private void getMovies() {
movieRepository.getNowPlayingMovie(new OnGetMoviesCallback() {
@Override
public void onSuccess(ArrayList<Movie> movies) {
movieAdapter = new MovieAdapter(movies, callback);
rvMovie.setAdapter(movieAdapter);
swipeRefreshLayout.setRefreshing(false);
}
@Override
public void onError() {
showError();
}
});
}
private void showError(){
Toast.makeText(getActivity(),R.string.no_internet_connection,Toast.LENGTH_SHORT).show();
}
OnMovieClickCallback callback = movie -> {
Intent intent = new Intent(getActivity(), DetailActivity.class);
intent.putExtra("movie", movie);
startActivity(intent);
};
}
\ No newline at end of file
package com.stilldre.moovify.fragment;
import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
import com.stilldre.moovify.R;
import com.stilldre.moovify.activity.DetailActivity;
import com.stilldre.moovify.adapter.MovieAdapter;
import com.stilldre.moovify.model.Movie;
import com.stilldre.moovify.repository.MovieRepository;
import com.stilldre.moovify.service.network.callback.OnGetMoviesCallback;
import com.stilldre.moovify.service.click.OnMovieClickCallback;
import java.util.ArrayList;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* A simple {@link Fragment} subclass.
*/
public class UpcomingFragment extends Fragment {
@BindView(R.id.recyclerView_upcoming)
RecyclerView rvMovie;
@BindView(R.id.upcoming_swiper)
SwipeRefreshLayout swipeRefreshLayout;
private MovieAdapter movieAdapter;
private MovieRepository movieRepository;
public UpcomingFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void onResume() {
getMovies();
super.onResume();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_upcoming, container, false);
ButterKnife.bind(this, view);
rvMovie.setLayoutManager(new LinearLayoutManager(getActivity()));
swipeRefreshLayout.setRefreshing(true);
swipeRefreshLayout.setOnRefreshListener(() -> getMovies());
movieRepository = MovieRepository.getInstance();
return view;
}
private void getMovies() {
movieRepository.getUpcomingMovie(new OnGetMoviesCallback() {
@Override
public void onSuccess(ArrayList<Movie> movies) {
movieAdapter = new MovieAdapter(movies, callback);
rvMovie.setAdapter(movieAdapter);
swipeRefreshLayout.setRefreshing(false);
}
@Override
public void onError() {
showError();
}
});
}
private void showError(){
Toast.makeText(getActivity(),R.string.no_internet_connection,Toast.LENGTH_SHORT).show();
}
OnMovieClickCallback callback = movie -> {
Intent intent = new Intent(getActivity(), DetailActivity.class);
intent.putExtra("movie", movie);
startActivity(intent);
};
}
\ No newline at end of file
package com.stilldre.moovify.helper;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import com.stilldre.moovify.database.DatabaseContract;
public class DatabaseHelper extends SQLiteOpenHelper{
private static final String DATABASE_NAME = "favorite.db";
private static final int DATABASE_VERSION = 1;
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
final String SQL_CREATE_TABLE_FAVORITE = "CREATE TABLE " + DatabaseContract.TABLE_NAME + " (" +
DatabaseContract.FavoriteColumns.COLUMN_ID_MOVIE + " TEXT PRIMARY KEY," +
DatabaseContract.FavoriteColumns.COLUMN_TITLE + " TEXT NOT NULL," +
DatabaseContract.FavoriteColumns.COLUMN_POSTER_PATH + " TEXT NOT NULL," +
DatabaseContract.FavoriteColumns.COLUMN_BACKDROP_PATH + " TEXT," +
DatabaseContract.FavoriteColumns.COLUMN_OVERVIEW + " TEXT NOT NULL," +
DatabaseContract.FavoriteColumns.COLUMN_RATING + " TEXT NOT NULL," +
DatabaseContract.FavoriteColumns.COLUMN_RELEASE_DATE + " TEXT NOT NULL); ";
db.execSQL(SQL_CREATE_TABLE_FAVORITE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + DatabaseContract.TABLE_NAME);
onCreate(db);
}
}
package com.stilldre.moovify.helper;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import com.stilldre.moovify.model.Movie;
import static com.stilldre.moovify.database.DatabaseContract.FavoriteColumns.COLUMN_BACKDROP_PATH;
import static com.stilldre.moovify.database.DatabaseContract.FavoriteColumns.COLUMN_ID_MOVIE;
import static com.stilldre.moovify.database.DatabaseContract.FavoriteColumns.COLUMN_OVERVIEW;
import static com.stilldre.moovify.database.DatabaseContract.FavoriteColumns.COLUMN_POSTER_PATH;
import static com.stilldre.moovify.database.DatabaseContract.FavoriteColumns.COLUMN_RATING;
import static com.stilldre.moovify.database.DatabaseContract.FavoriteColumns.COLUMN_RELEASE_DATE;
import static com.stilldre.moovify.database.DatabaseContract.FavoriteColumns.COLUMN_TITLE;
import static com.stilldre.moovify.database.DatabaseContract.TABLE_NAME;
public class FavoriteHelper {
private static final String DATABASE_TABLE = TABLE_NAME;
protected Context context;
private DatabaseHelper databaseHelper;
private SQLiteDatabase database;
public FavoriteHelper(Context context) {
this.context = context.getApplicationContext();
databaseHelper = new DatabaseHelper(context);
}
public FavoriteHelper open() throws SQLException {
database = databaseHelper.getWritableDatabase();
return this;
}
public void close() {
databaseHelper.close();
if (database.isOpen()) {
database.close();
}
}
// public ArrayList<Movie> getAllMovies() {
// ArrayList<Movie> arrayList = new ArrayList<>();
// open();
// Cursor cursor = database.query(DATABASE_TABLE, null,
// null,
// null,
// null,
// null,
// COLUMN_ID_MOVIE + " ASC",
// null);
// cursor.moveToFirst();
// Movie movie;
// if (cursor.getCount() > 0) {
// do {
// movie = new Movie();
//
// movie.setId(cursor.getString(cursor.getColumnIndex(COLUMN_ID_MOVIE)));
// movie.setTitle(cursor.getString(cursor.getColumnIndex(DatabaseContract.FavoriteColumns.COLUMN_TITLE)));
// movie.setPosterPath(cursor.getString(cursor.getColumnIndex(DatabaseContract.FavoriteColumns.COLUMN_POSTER_PATH)));
// movie.setBackdropPath(cursor.getString(cursor.getColumnIndex(DatabaseContract.FavoriteColumns.COLUMN_BACKDROP_PATH)));
// movie.setOverview(cursor.getString(cursor.getColumnIndex(DatabaseContract.FavoriteColumns.COLUMN_OVERVIEW)));
// movie.setRating(cursor.getFloat(cursor.getColumnIndex(DatabaseContract.FavoriteColumns.COLUMN_RATING)));
// movie.setReleaseDate(cursor.getString(cursor.getColumnIndex(DatabaseContract.FavoriteColumns.COLUMN_RELEASE_DATE)));
//
// arrayList.add(movie);
// cursor.moveToNext();
// } while (!cursor.isAfterLast());
// }
// cursor.close();
// close();
// return arrayList;
// }
public long insertMovie(Movie movie) {
ContentValues args = new ContentValues();
args.put(COLUMN_ID_MOVIE, movie.getId());
args.put(COLUMN_TITLE, movie.getTitle());
args.put(COLUMN_POSTER_PATH, movie.getPosterPath());
args.put(COLUMN_BACKDROP_PATH, movie.getBackdropPath());
args.put(COLUMN_OVERVIEW, movie.getOverview());
args.put(COLUMN_RATING, String.valueOf(movie.getRating()));
args.put(COLUMN_RELEASE_DATE, movie.getReleaseDate());
return database.insertWithOnConflict(DATABASE_TABLE, null, args, SQLiteDatabase.CONFLICT_REPLACE);
}
public boolean getMovieById(String id){
Cursor cursor;
open();
String query = "SELECT * FROM favorite WHERE movie_id = '" + id + "'";
cursor = database.rawQuery(query,null);
boolean isFavorite = false;
if (cursor != null && (cursor.getCount() > 0)) {
isFavorite = true;
cursor.close();
}
return isFavorite;
}
public int deleteFavorite(String id) {
return database.delete(DATABASE_TABLE, COLUMN_ID_MOVIE + " = '" + id + "'", null);
}
public Cursor queryByIdProvider(String movieId) {
return database.query(DATABASE_TABLE,
null,
null,
null,
null,
null,
null,
null);
}
public Cursor queryProvider() {
return database.query(DATABASE_TABLE,
null,
null,
null,
null,
null,
COLUMN_ID_MOVIE + " ASC");
}
public long insertProvider(ContentValues values) {
return database.insert(DATABASE_TABLE, null, values);
}
public int updateProvider(String movieId, ContentValues values) {
return database.update(DATABASE_TABLE, values, COLUMN_ID_MOVIE + " = ?", new String[]{movieId});
}
public int deleteProvider(String movieId) {
return database.delete(DATABASE_TABLE, COLUMN_ID_MOVIE + " = ?", new String[]{movieId});
}
}
package com.stilldre.moovify.helper;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
public class MoovifyPreference {
SharedPreferences sharedPreferences;
Context context;
public static final String PREFERENCES_REMINDER_DAILY = "pref_reminder_daily";
public static final String PREFERENCES_REMINDER_DAILY_TIME = "pref_reminder_daily_time";
public static final String PREFERENCES_REMINDER_RELEASE = "pref_reminder_release";
public MoovifyPreference(Context context) {
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
this.context = context;
}
public void setDailyReminder(Boolean input, String time) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(PREFERENCES_REMINDER_DAILY, input);
editor.putString(PREFERENCES_REMINDER_DAILY_TIME, time);
editor.apply();
}
public Boolean getDailyReminder() {
return sharedPreferences.getBoolean(PREFERENCES_REMINDER_DAILY, true);
}
public void setReleaseTodayReminder(Boolean input, String time) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(PREFERENCES_REMINDER_RELEASE, input);
editor.putString(PREFERENCES_REMINDER_DAILY_TIME, time);
editor.apply();
}
public Boolean getReleaseTodayReminder() {
return sharedPreferences.getBoolean(PREFERENCES_REMINDER_RELEASE, true);
}
}
\ No newline at end of file
package com.stilldre.moovify.model;
public class Comment {
private String userName, message;
public Comment(){
}
public Comment(String userName, String message){
this.userName = userName;
this.message = message;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
package com.stilldre.moovify.model;
import android.database.Cursor;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import static com.stilldre.moovify.database.DatabaseContract.FavoriteColumns.COLUMN_BACKDROP_PATH;
import static com.stilldre.moovify.database.DatabaseContract.FavoriteColumns.COLUMN_ID_MOVIE;
import static com.stilldre.moovify.database.DatabaseContract.FavoriteColumns.COLUMN_OVERVIEW;
import static com.stilldre.moovify.database.DatabaseContract.FavoriteColumns.COLUMN_POSTER_PATH;
import static com.stilldre.moovify.database.DatabaseContract.FavoriteColumns.COLUMN_RATING;
import static com.stilldre.moovify.database.DatabaseContract.FavoriteColumns.COLUMN_RELEASE_DATE;
import static com.stilldre.moovify.database.DatabaseContract.FavoriteColumns.COLUMN_TITLE;
import static com.stilldre.moovify.database.DatabaseContract.getColumnFloat;
import static com.stilldre.moovify.database.DatabaseContract.getColumnString;
public class Movie implements Parcelable {
@SerializedName("id")
@Expose
private String movieId;
@SerializedName("title")
@Expose
private String title;
@SerializedName("poster_path")
@Expose
private String posterPath;
@SerializedName("backdrop_path")
@Expose
private String backdropPath;
@SerializedName("overview")
@Expose
private String overview;
@SerializedName("release_date")
@Expose
private String releaseDate;
@SerializedName("vote_average")
@Expose
private float rating;
public Movie(String id, String title, String posterPath, String backdropPath, String overview, String releaseDate, float rating) {
this.movieId = id;
this.title = title;
this.posterPath = posterPath;
this.backdropPath = backdropPath;
this.overview = overview;
this.releaseDate = releaseDate;
this.rating = rating;
}
public Movie() {
}
protected Movie(Parcel in) {
movieId = in.readString();
title = in.readString();
posterPath = in.readString();
backdropPath = in.readString();
overview = in.readString();
releaseDate = in.readString();
rating = in.readFloat();
}
public Movie(Cursor cursor) {
this.movieId = getColumnString(cursor, COLUMN_ID_MOVIE);
this.title = getColumnString(cursor, COLUMN_TITLE);
this.posterPath = getColumnString(cursor, COLUMN_POSTER_PATH);
this.backdropPath = getColumnString(cursor, COLUMN_BACKDROP_PATH);
this.overview = getColumnString(cursor, COLUMN_OVERVIEW);
this.releaseDate = getColumnString(cursor, COLUMN_RELEASE_DATE);
this.rating = getColumnFloat(cursor, COLUMN_RATING);
}
public static final Creator<Movie> CREATOR = new Creator<Movie>() {
@Override
public Movie createFromParcel(Parcel in) {
return new Movie(in);
}
@Override
public Movie[] newArray(int size) {
return new Movie[size];
}
};
public String getId() {
return movieId;
}
public void setId(String movieId) {
this.movieId = movieId;
}
public String getTitle() {
return title;
}
public String getPosterPath() {
return posterPath;
}
public String getBackdropPath() {
return backdropPath;
}
public String getOverview() {
return overview;
}
public String getReleaseDate() {
return releaseDate;
}
public float getRating() {
return rating;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(movieId);
dest.writeString(title);
dest.writeString(posterPath);
dest.writeString(backdropPath);
dest.writeString(overview);
dest.writeString(releaseDate);
dest.writeFloat(rating);
}
@Override
public String toString() {
return "FavoriteHelper{" +
"id=" + movieId +
", title='" + title + '\'' +
", posterPath='" + posterPath + '\'' +
", backdropPath='" + backdropPath + '\'' +
", overview='" + overview + '\'' +
", releaseDate='" + releaseDate + '\'' +
", rating=" + rating +
'}';
}
}
package com.stilldre.moovify.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
public class MovieResponse {
@SerializedName("results")
@Expose
private ArrayList<Movie> movies;
public MovieResponse(ArrayList<Movie> movies) {
this.movies = movies;
}
public ArrayList<Movie> getMovies() {
return movies;
}
}
package com.stilldre.moovify.model;
public class Room {
private String name;
public Room(){
}
public Room(String name){
this.name = name;
}
public String getName(){
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.stilldre.moovify.model;
public class User {
String Displayname;
String Email;
long createdAt;
public User (){};
public User(String displayname,String email,long createdAt){
this.Displayname=displayname;
this.Email=email;
this.createdAt=createdAt;
}
public String getDisplayname() {
return Displayname;
}
public String getEmail() {
return Email;
}
public long getCreatedAt() {
return createdAt;
}
}
\ No newline at end of file
package com.stilldre.moovify.provider;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.net.Uri;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.stilldre.moovify.helper.FavoriteHelper;
import static com.stilldre.moovify.database.DatabaseContract.AUTHORITY;
import static com.stilldre.moovify.database.DatabaseContract.CONTENT_URI;
import static com.stilldre.moovify.database.DatabaseContract.TABLE_NAME;
public class FavoriteProvider extends ContentProvider {
private static final int MOVIE = 1;
private static final int MOVIE_ID = 2;
private static final UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
private FavoriteHelper favoriteHelper;
static {
uriMatcher.addURI(AUTHORITY, TABLE_NAME, MOVIE);
uriMatcher.addURI(AUTHORITY, TABLE_NAME + "/#", MOVIE_ID);
}
@Override
public boolean onCreate() {
favoriteHelper = new FavoriteHelper(getContext());
favoriteHelper.open();
return true;
}
@Nullable
@Override
public Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection, @Nullable String[] selectionArgs, @Nullable String sortOrder) {
Cursor cursor;
switch (uriMatcher.match(uri)) {
case MOVIE:
cursor = favoriteHelper.queryProvider();
break;
case MOVIE_ID:
cursor = favoriteHelper.queryByIdProvider(uri.getLastPathSegment());
break;
default:
cursor = null;
break;
}
if (cursor != null) {
cursor.setNotificationUri(getContext().getContentResolver(), uri);
}
return cursor;
}
@Nullable
@Override
public String getType(@NonNull Uri uri) {
return null;
}
@Nullable
@Override
public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) {
long added;
switch (uriMatcher.match(uri)) {
case MOVIE:
added = favoriteHelper.insertProvider(values);
break;
default:
added = 0;
break;
}
if (added > 0) {
getContext().getContentResolver().notifyChange(uri, null);
}
return Uri.parse(CONTENT_URI + "/" + added);
}
@Override
public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) {
int deleted;
switch (uriMatcher.match(uri)) {
case MOVIE_ID:
deleted = favoriteHelper.deleteProvider(uri.getLastPathSegment());
break;
default:
deleted = 0;
break;
}
if (deleted > 0) {
getContext().getContentResolver().notifyChange(uri, null);
}
return deleted;
}
@Override
public int update(@NonNull Uri uri, @Nullable ContentValues values, @Nullable String selection, @Nullable String[] selectionArgs) {
int updated;
switch (uriMatcher.match(uri)) {
case MOVIE_ID:
updated = favoriteHelper.updateProvider(uri.getLastPathSegment(), values);
break;
default:
updated = 0;
break;
}
if (updated > 0) {
getContext().getContentResolver().notifyChange(uri, null);
}
return updated;
}
}
package com.stilldre.moovify.reminder;
import android.app.AlarmManager;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.TaskStackBuilder;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import androidx.core.app.NotificationCompat;
import android.text.TextUtils;
import android.util.Log;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Locale;
import com.stilldre.moovify.BuildConfig;
import com.stilldre.moovify.R;
import com.stilldre.moovify.activity.MainActivity;
import com.stilldre.moovify.helper.MoovifyPreference;
import com.stilldre.moovify.model.Movie;
import com.stilldre.moovify.repository.MovieRepository;
import com.stilldre.moovify.service.network.callback.OnGetMoviesCallback;
import static android.content.Intent.ACTION_BOOT_COMPLETED;
public class ReminderReceiver extends BroadcastReceiver {
public final int REQUEST_CODE_DAILY = 28;
public static String CHANNEL_ID = "01";
public static CharSequence CHANNEL_NAME = "DAILY";
public static final String EXTRA_TYPE = "type";
public static final String EXTRA_MESSAGE = "message";
public static final String TYPE_REPEATING_DAILY_REMINDER = "DailyReminder";
public static final String TYPE_REPEATING_RELEASE_TODAY = "ReleaseToday";
public static final int NOTIFICATION_ID_REPEATING_DAILY_REMINDER = 100;
public static final int NOTIFICATION_ID_REPEATING_RELEASE_TODAY = 101;
public MovieRepository movieRepository;
private Context context;
public ReminderReceiver() {
}
@Override
public void onReceive(Context context, Intent intent) {
movieRepository = MovieRepository.getInstance();
this.context = context;
Calendar calendar = Calendar.getInstance();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
String today = dateFormat.format(calendar.getTime());
if (intent.getStringExtra(EXTRA_TYPE) != null && intent.getStringExtra(EXTRA_MESSAGE) != null) {
if (intent.getStringExtra(EXTRA_TYPE).equals(TYPE_REPEATING_DAILY_REMINDER)) {
showReminderNotification(context, context.getString(R.string.daily_reminder), context.getString(R.string.daily_reminder_msg), CHANNEL_ID);
} else {
movieRepository.getNowPlayingMovie(new OnGetMoviesCallback() {
@Override
public void onSuccess(ArrayList<Movie> movies) {
for (Movie m : movies) {
if (TextUtils.equals(m.getReleaseDate(), today)) {
showReminderNotification(context, context.getString(R.string.released_today) + m.getTitle(), m.getOverview(), m.getId());
}
}
}
@Override
public void onError() {
}
});
}
} else {
MoovifyPreference moovifyPreference = new MoovifyPreference(context);
String intentAction = intent.getAction();
if (intentAction != null && intentAction.equals(ACTION_BOOT_COMPLETED)) {
if (moovifyPreference.getDailyReminder()) {
setRepeatingReminder(context, ReminderReceiver.TYPE_REPEATING_DAILY_REMINDER
, BuildConfig.TIME_DAILY, context.getString(R.string.daily_reminder_msg), ReminderReceiver.NOTIFICATION_ID_REPEATING_DAILY_REMINDER);
}
if (moovifyPreference.getReleaseTodayReminder()) {
setRepeatingReminder(context, ReminderReceiver.TYPE_REPEATING_RELEASE_TODAY
, BuildConfig.TIME_RELEASE_TODAY, context.getString(R.string.today), ReminderReceiver.NOTIFICATION_ID_REPEATING_RELEASE_TODAY);
}
}
}
}
private void showReminderNotification(Context context, String title, String msg, String notifId) {
Log.e(title, msg + " " + notifId);
Intent intent = new Intent(context, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
Uri sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
PendingIntent pendingIntent = TaskStackBuilder.create(context)
.addNextIntent(intent)
.getPendingIntent(REQUEST_CODE_DAILY, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, notifId)
.setContentIntent(pendingIntent)
.setSmallIcon(R.mipmap.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher))
.setContentTitle(title)
.setContentText(msg)
.setVibrate(new long[]{1000, 1000, 1000, 1000, 1000})
.setSound(sound)
.setAutoCancel(true);
if (notificationManager != null) {
notificationManager.notify(Integer.parseInt(notifId), builder.build());
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(notifId, CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT);
channel.enableVibration(true);
channel.setVibrationPattern(new long[]{1000, 1000, 1000, 1000, 1000});
builder.setChannelId(notifId);
if (notificationManager != null) {
notificationManager.createNotificationChannel(channel);
}
}
}
public void setRepeatingReminder(Context context, String type, String time, String msg, int requestCode) {
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(context, ReminderReceiver.class);
intent.putExtra(EXTRA_MESSAGE, msg);
intent.putExtra(EXTRA_TYPE, type);
String timeArray[] = time.split(":");
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(timeArray[0]));
calendar.set(Calendar.MINUTE, Integer.parseInt(timeArray[1]));
calendar.set(Calendar.SECOND, 0);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, requestCode, intent, 0);
alarmManager.setInexactRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),
AlarmManager.INTERVAL_DAY, pendingIntent);
Log.e("TYPE: ", String.valueOf(requestCode));
}
public void stopReminder(Context context) {
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(context, ReminderReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(context, REQUEST_CODE_DAILY, intent, 0);
if (alarmManager != null) {
alarmManager.cancel(pendingIntent);
}
}
}
\ No newline at end of file
package com.stilldre.moovify.repository;
import com.stilldre.moovify.BuildConfig;
import com.stilldre.moovify.model.Movie;
import com.stilldre.moovify.model.MovieResponse;
import com.stilldre.moovify.service.network.callback.OnGetDetailCallback;
import com.stilldre.moovify.service.network.callback.OnGetMoviesCallback;
import com.stilldre.moovify.service.network.api.TMDb;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class MovieRepository {
String API_KEY = BuildConfig.TMDB_API_KEY;
static String BASE_URL = BuildConfig.TMDB_BASE_URL;
private static MovieRepository movieRepository;
private TMDb api;
public MovieRepository(TMDb api) {
this.api = api;
}
public static MovieRepository getInstance() {
if (movieRepository == null) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
movieRepository = new MovieRepository(retrofit.create(TMDb.class));
}
return movieRepository;
}
public void getNowPlayingMovie(final OnGetMoviesCallback callback) {
api.getNowPlayingMovies(API_KEY)
.enqueue(new Callback<MovieResponse>() {
@Override
public void onResponse(Call<MovieResponse> call, Response<MovieResponse> response) {
if (response.isSuccessful()) {
MovieResponse movieResponse = response.body();
if (movieResponse != null && movieResponse.getMovies() != null) {
callback.onSuccess(movieResponse.getMovies());
} else {
callback.onError();
}
} else {
callback.onError();
}
}
@Override
public void onFailure(Call<MovieResponse> call, Throwable t) {
callback.onError();
}
});
}
public void getUpcomingMovie(final OnGetMoviesCallback callback) {
api.getUpcomingMovies(API_KEY)
.enqueue(new Callback<MovieResponse>() {
@Override
public void onResponse(Call<MovieResponse> call, Response<MovieResponse> response) {
if (response.isSuccessful()) {
MovieResponse movieResponse = response.body();
if (movieResponse != null && movieResponse.getMovies() != null) {
callback.onSuccess(movieResponse.getMovies());
} else {
callback.onError();
}
} else {
callback.onError();
}
}
@Override
public void onFailure(Call<MovieResponse> call, Throwable t) {
callback.onError();
}
});
}
public void getDetail(String movieId, final OnGetDetailCallback callback) {
api.getDetail(movieId, API_KEY)
.enqueue(new Callback<Movie>() {
@Override
public void onResponse(Call<Movie> call, Response<Movie> response) {
if (response.isSuccessful()) {
Movie movie = response.body();
if (movie != null) {
callback.onSuccess(movie);
} else {
callback.onError();
}
} else {
callback.onError();
}
}
@Override
public void onFailure(Call<Movie> call, Throwable t) {
callback.onError();
}
}
);
}
public void searchMovie(String movieTitle, final OnGetMoviesCallback callback) {
api.searchMovies(API_KEY, movieTitle)
.enqueue(new Callback<MovieResponse>() {
@Override
public void onResponse(Call<MovieResponse> call, Response<MovieResponse> response) {
if (response.isSuccessful()) {
MovieResponse movieResponse = response.body();
if (movieResponse != null && movieResponse.getMovies() != null) {
callback.onSuccess(movieResponse.getMovies());
} else {
callback.onError();
}
} else {
callback.onError();
}
}
@Override
public void onFailure(Call<MovieResponse> call, Throwable t) {
callback.onError();
}
});
}
}
package com.stilldre.moovify.service.click;
import com.stilldre.moovify.model.Movie;
public interface OnMovieClickCallback {
void onClick (Movie movie);
}
package com.stilldre.moovify.service.network.api;
import com.stilldre.moovify.model.Movie;
import com.stilldre.moovify.model.MovieResponse;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Path;
import retrofit2.http.Query;
public interface TMDb {
@GET("search/movie")
Call<MovieResponse> searchMovies(
@Query("api_key") String apiKey,
@Query("query") String movieTitle
);
@GET("movie/now_playing")
Call<MovieResponse> getNowPlayingMovies(
@Query("api_key") String apiKey
);
@GET("movie/upcoming")
Call<MovieResponse> getUpcomingMovies(
@Query("api_key") String apiKey
);
@GET("movie/{movie_id}")
Call<Movie> getDetail(
@Path("movie_id") String id,
@Query("api_key") String apiKEy
);
}
package com.stilldre.moovify.service.network.callback;
import com.stilldre.moovify.model.Movie;
public interface OnGetDetailCallback {
void onSuccess(Movie movie);
void onError();
}
package com.stilldre.moovify.service.network.callback;
import com.stilldre.moovify.model.Movie;
import java.util.ArrayList;
public interface OnGetMoviesCallback {
void onSuccess(ArrayList<Movie> movies);
void onError();
}
package com.stilldre.moovify.widget;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.widget.RemoteViews;
import android.widget.Toast;
import com.stilldre.moovify.R;
/**
* Implementation of App Widget functionality.
*/
public class MoovifyFavoriteWidget extends AppWidgetProvider {
public static final String TOAST_ACTION = "com.stilldre.moovify.TOAST_ACTION";
public static final String EXTRA_ITEM = "com.stilldre.moovify.EXTRA_ITEM";
public static final String UPDATE_WIDGET = "com.stilldre.moovify.UPDATE_WIDGET";
static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
int appWidgetId) {
Intent intent = new Intent(context, MoovifyWidgetService.class);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
// Construct the RemoteViews object
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.moovify_favorite_widget);
views.setRemoteAdapter(R.id.stack_view, intent);
views.setEmptyView(R.id.stack_view, R.id.empty_view);
Intent toastIntent = new Intent(context, MoovifyFavoriteWidget.class);
toastIntent.setAction(MoovifyFavoriteWidget.TOAST_ACTION);
toastIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
PendingIntent toastPendingIntent = PendingIntent.getBroadcast(context, 0, toastIntent, PendingIntent.FLAG_UPDATE_CURRENT);
views.setPendingIntentTemplate(R.id.stack_view, toastPendingIntent);
// Instruct the widget manager to update the widget
appWidgetManager.updateAppWidget(appWidgetId, views);
}
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
// There may be multiple widgets active, so update all of them
for (int appWidgetId : appWidgetIds) {
updateAppWidget(context, appWidgetManager, appWidgetId);
}
}
@Override
public void onEnabled(Context context) {
// Enter relevant functionality for when the first widget is created
}
@Override
public void onDisabled(Context context) {
// Enter relevant functionality for when the last widget is disabled
}
@Override
public void onReceive(Context context, Intent intent) {
AppWidgetManager mgr = AppWidgetManager.getInstance(context);
if (intent.getAction().equals(TOAST_ACTION)) {
int appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
String viewTitle = intent.getStringExtra(EXTRA_ITEM);
Toast.makeText(context, viewTitle, Toast.LENGTH_SHORT).show();
}
if (intent.getAction().equals(UPDATE_WIDGET)) {
AppWidgetManager gm = AppWidgetManager.getInstance(context);
int[] ids = gm.getAppWidgetIds(new ComponentName(context, MoovifyFavoriteWidget.class));
gm.notifyAppWidgetViewDataChanged(ids, R.id.stack_view);
}
super.onReceive(context, intent);
}
}
package com.stilldre.moovify.widget;
import android.appwidget.AppWidgetManager;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.os.Binder;
import android.os.Bundle;
import android.widget.AdapterView;
import android.widget.RemoteViews;
import android.widget.RemoteViewsService;
import com.bumptech.glide.Glide;
import com.stilldre.moovify.BuildConfig;
import com.stilldre.moovify.R;
import com.stilldre.moovify.model.Movie;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.ExecutionException;
import static com.stilldre.moovify.database.DatabaseContract.CONTENT_URI;
public class MoovifyRemoteViewsFactory implements RemoteViewsService.RemoteViewsFactory {
public static String MOVIE_POSTER = BuildConfig.TMDB_IMAGE_BASE_URL_500;
private final Context context;
private int appWidgetId;
private Cursor cursor;
public MoovifyRemoteViewsFactory(Context context, Intent intent) {
this.context = context;
this.appWidgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
}
@Override
public void onCreate() {
}
@Override
public void onDataSetChanged() {
if (cursor != null) {
cursor.close();
}
final long identityToken = Binder.clearCallingIdentity();
cursor = context.getContentResolver().query(CONTENT_URI,
null,
null,
null,
null);
Binder.restoreCallingIdentity(identityToken);
}
@Override
public void onDestroy() {
if (cursor != null) cursor.close();
}
@Override
public int getCount() {
if (cursor == null) return 0;
else return cursor.getCount();
}
@Override
public RemoteViews getViewAt(int position) {
if (position == AdapterView.INVALID_POSITION || cursor == null || !cursor.moveToPosition(position)) {
return null;
}
Movie movie = getItem(position);
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.moovify_favorite_item);
Bitmap bitmap = null;
String posterPath = MOVIE_POSTER + movie.getPosterPath();
String movieTitle = movie.getTitle();
String date = dateFormat(movie.getReleaseDate());
try {
bitmap = Glide.with(context)
.asBitmap()
.load(posterPath)
.submit()
.get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
remoteViews.setImageViewBitmap(R.id.imageView, bitmap);
Bundle bundle = new Bundle();
bundle.putString(MoovifyFavoriteWidget.EXTRA_ITEM, movieTitle + "\n" + date);
Intent fillIntent = new Intent();
fillIntent.putExtras(bundle);
remoteViews.setOnClickFillInIntent(R.id.imageView, fillIntent);
return remoteViews;
}
@Override
public RemoteViews getLoadingView() {
return null;
}
@Override
public int getViewTypeCount() {
return 1;
}
@Override
public long getItemId(int position) {
if (cursor.moveToPosition(position)) {
return cursor.getLong(0);
} else return position;
}
private Movie getItem(int position) {
if (!cursor.moveToPosition(position)) {
throw new IllegalStateException("Position Invalid");
}
return new Movie(cursor);
}
@Override
public boolean hasStableIds() {
return true;
}
private String dateFormat(String oldDate) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date myDate = null;
try {
myDate = dateFormat.parse(oldDate);
} catch (ParseException e) {
e.printStackTrace();
}
SimpleDateFormat newFormat = new SimpleDateFormat("EEEE, MMM dd, yyyy");
String finalDate = newFormat.format(myDate);
return finalDate;
}
}
package com.stilldre.moovify.widget;
import android.content.Intent;
import android.widget.RemoteViewsService;
public class MoovifyWidgetService extends RemoteViewsService {
@Override
public RemoteViewsFactory onGetViewFactory(Intent intent) {
return new MoovifyRemoteViewsFactory(this.getApplicationContext(), intent);
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#42A0DF"/>
<corners android:radius="50dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#97E6E4"
android:centerColor="#B5E8E5"
android:endColor="#8BDDD9"
android:angle="90"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<layer-list>
<item>
<shape>
<stroke
android:width="2dp"
android:color="@color/blue"
/>
<padding
android:bottom="15dp"
android:left="30dp"
android:right="15dp"
android:top="15dp" />
<corners android:radius="50dp"/>
</shape>
</item>
</layer-list>
</item>
</selector>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="34dp"
android:height="34dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/blue"
android:pathData="M13,7h-2v4L7,11v2h4v4h2v-4h4v-2h-4L13,7zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FFF"
android:pathData="M20,2L4,2c-1.1,0 -1.99,0.9 -1.99,2L2,22l4,-4h14c1.1,0 2,-0.9 2,-2L22,4c0,-1.1 -0.9,-2 -2,-2zM18,14L6,14v-2h12v2zM18,11L6,11L6,9h12v2zM18,8L6,8L6,6h12v2z"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="34dp"
android:height="34dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@color/blue"
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/>
</vector>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
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"
android:orientation="vertical"
android:weightSum="1"
android:background="#F3F3F3"
tools:context=".activity.ChatroomActivity">
<ScrollView
android:layout_width="378dp"
android:layout_height="157dp"
android:id="@+id/scrollView"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_weight="1.04"
android:background="#F3F3F3">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/blue"
app:cardCornerRadius="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_margin="10dp"
android:id="@+id/textView" />
</androidx.cardview.widget.CardView>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:orientation="horizontal"
android:weightSum="1">
<EditText
android:layout_width="59dp"
android:layout_height="wrap_content"
android:id="@+id/editText"
android:background="@drawable/spinner_login"
android:layout_alignTop="@+id/button"
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/button"
android:layout_weight="1.02" />
<Button
android:layout_width="52dp"
android:layout_height="wrap_content"
android:id="@+id/button"
style="?android:attr/borderlessButtonStyle"
android:drawableLeft="@drawable/ic_send_black_24dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.DetailActivity">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="@dimen/detail_app_bar_height"
android:elevation="@dimen/detail_app_bar_elevation"
android:fitsSystemWindows="true"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed">
<ImageView
android:id="@+id/movieDetailsBackdrop"
android:contentDescription="@string/backdrop_path"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/detailToolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="parallax" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/movieDetailsTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/detail_textview_margin"
android:layout_marginLeft="@dimen/detail_textview_margin"
android:layout_marginTop="@dimen/detail_textview_margin"
android:layout_marginEnd="@dimen/detail_textview_margin"
android:layout_marginRight="@dimen/detail_textview_margin"
android:textSize="@dimen/detail_textview_size"
android:textStyle="bold"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/movieDetailsOverview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/detail_textview_margin"
android:layout_marginLeft="@dimen/detail_textview_margin"
android:layout_marginTop="@dimen/detail_textview_margin"
android:layout_marginEnd="@dimen/detail_textview_margin"
android:layout_marginRight="@dimen/detail_textview_margin"
android:alpha="0.7"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/overviewLabel" />
<RatingBar
android:id="@+id/movieDetailsRating"
style="@style/Widget.AppCompat.RatingBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/detail_textview_margin"
android:layout_marginLeft="@dimen/detail_textview_margin"
android:layout_marginTop="@dimen/detail_textview_margin_half"
android:layout_marginEnd="@dimen/detail_textview_margin"
android:layout_marginRight="@dimen/detail_textview_margin"
android:numStars="5"
android:visibility="gone"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/movieDetailsTitle" />
<TextView
android:id="@+id/overviewLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/detail_textview_margin"
android:layout_marginLeft="@dimen/detail_textview_margin"
android:layout_marginTop="@dimen/detail_textview_margin_double"
android:layout_marginEnd="@dimen/detail_textview_margin"
android:layout_marginRight="@dimen/detail_textview_margin"
android:text="@string/overview"
android:textSize="@dimen/detail_textview_size"
android:visibility="gone"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/movieDetailsReleaseDate" />
<TextView
android:id="@+id/movieDetailsReleaseDate"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/detail_textview_margin"
android:layout_marginLeft="@dimen/detail_textview_margin"
android:layout_marginTop="@dimen/detail_textview_margin_half"
android:layout_marginEnd="@dimen/detail_textview_margin"
android:layout_marginRight="@dimen/detail_textview_margin"
android:alpha="0.7"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/movieDetailsRating" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_login"
android:background="@drawable/gradient"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".activity.LoginActivity">
<ImageView
android:id="@+id/imageView"
android:layout_width="140dp"
android:layout_height="140dp"
app:srcCompat="@mipmap/ic_launcher"
android:layout_marginStart="120dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Moovify"
android:textStyle="bold"
android:textSize="25dp"
android:textAlignment="center"
android:layout_marginTop="150dp"
android:layout_marginStart="145dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</TextView>
<EditText
android:id="@+id/email"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="200dp"
android:layout_marginEnd="24dp"
android:autofillHints="@string/prompt_email"
android:hint="Email"
android:inputType="textEmailAddress"
android:selectAllOnFocus="true"
android:background="@drawable/spinner_login"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="24dp"
android:autofillHints="@string/prompt_password"
android:hint="Kata Sandi"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:selectAllOnFocus="true"
android:background="@drawable/spinner_login"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/email" />
<Button
android:id="@+id/btnLogin"
android:background="@drawable/btn_rounded"
android:layout_width="330dp"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginStart="48dp"
android:layout_marginEnd="48dp"
android:layout_marginBottom="64dp"
android:text="MASUK"
android:textColor="#fff"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/password"
app:layout_constraintVertical_bias="0.2"/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Pengguna Baru? Silahkan Daftar"
android:textColor="@color/blue"
android:textSize="15dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btnLogin"
app:layout_constraintVertical_bias="0.092">
</TextView>
<Button
android:id="@+id/btnRegister"
android:background="@drawable/btn_rounded"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginStart="48dp"
android:layout_marginEnd="48dp"
android:layout_marginBottom="64dp"
android:text="DAFTAR"
android:textColor="#fff"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text"
app:layout_constraintVertical_bias="0.2" />
<!-- <com.google.android.gms.common.SignInButton-->
<!-- android:id="@+id/sign_in_button"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_centerHorizontal="true"-->
<!-- android:layout_centerVertical="true" />-->
<ProgressBar
android:id="@+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="32dp"
android:layout_marginTop="64dp"
android:layout_marginEnd="32dp"
android:layout_marginBottom="64dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/password"
app:layout_constraintStart_toStartOf="@+id/password"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.3" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".activity.MainActivity">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:tabSelectedTextColor="@android:color/white"
app:tabTextColor="@android:color/darker_gray">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/now_playing" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/upcoming" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/favorite" />
</com.google.android.material.tabs.TabLayout>
<androidx.viewpager.widget.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
tools:context=".activity.MessageActivity">
<ListView
android:id="@+id/listView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_above="@+id/etNeme_room">
</ListView>
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:orientation="horizontal">-->
<!-- <androidx.recyclerview.widget.RecyclerView-->
<!-- android:id="@+id/recyclerView_room"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="650dp"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- tools:listitem="@layout/room">-->
<!-- </androidx.recyclerview.widget.RecyclerView>-->
<!-- </LinearLayout>-->
<EditText
android:layout_width="226dp"
android:layout_height="wrap_content"
android:id="@+id/etNeme_room"
android:background="@drawable/spinner_login"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_toStartOf="@+id/btnAdd_room" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Room"
android:textColor="@color/blue"
android:textSize="15dp"
android:id="@+id/btnAdd_room"
android:layout_gravity="right"
style="?android:attr/borderlessButtonStyle"
android:drawableLeft="@drawable/ic_add_circle_outline_black_24dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_register"
android:background="@drawable/gradient"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".activity.RegisterActivity">
<ImageView
android:id="@+id/imageView"
android:layout_width="140dp"
android:layout_height="140dp"
app:srcCompat="@mipmap/ic_launcher"
android:layout_marginStart="120dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Moovify"
android:textStyle="bold"
android:textSize="25dp"
android:textAlignment="center"
android:layout_marginTop="150dp"
android:layout_marginStart="145dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
</TextView>
<EditText
android:id="@+id/editName"
android:background="@drawable/spinner_login"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="200dp"
android:layout_marginEnd="24dp"
android:autofillHints="@string/prompt_email"
android:hint="Nama Pengguna"
android:inputType="textEmailAddress"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/editEmail"
android:background="@drawable/spinner_login"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:autofillHints="@string/prompt_email"
android:hint="Email"
android:inputType="textEmailAddress"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editName" />
<EditText
android:id="@+id/editPassword"
android:background="@drawable/spinner_login"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="24dp"
android:autofillHints="@string/prompt_password"
android:hint="Kata Sandi"
android:imeActionLabel="@string/action_sign_in_short"
android:imeOptions="actionDone"
android:inputType="textPassword"
android:selectAllOnFocus="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editEmail" />
<Button
android:id="@+id/buttonRegister"
android:background="@drawable/btn_rounded"
android:layout_width="330dp"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginStart="48dp"
android:layout_marginEnd="48dp"
android:layout_marginBottom="64dp"
android:text="DAFTAR"
android:textColor="#fff"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/editPassword"
app:layout_constraintVertical_bias="0.2"/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sudah punya akun? Silahkan Masuk"
android:textColor="@color/blue"
android:textSize="15dp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/buttonRegister"
app:layout_constraintVertical_bias="0.092">
</TextView>
<Button
android:id="@+id/btnLogin"
android:background="@drawable/btn_rounded"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginStart="48dp"
android:layout_marginEnd="48dp"
android:layout_marginBottom="64dp"
android:text="MASUK"
android:textColor="#fff"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text"
app:layout_constraintVertical_bias="0.2"
android:onClick="Home"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".activity.ReminderActivity">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_reminder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/search_margin">
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/search_margin"
android:elevation="@dimen/elevation"
android:padding="@dimen/search_margin"
app:cardCornerRadius="@dimen/search_margin_half">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorAccent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="@dimen/search_margin"
android:layout_weight="4"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/daily_reminder"
android:textColor="@color/white"
android:textSize="@dimen/widget_font_size_big"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_will_remind_you_to_come_back_every_day"
android:textColor="@color/white"
android:textSize="@dimen/font_size_normal" />
</LinearLayout>
<ToggleButton
android:id="@+id/tb_daily_reminder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/search_margin"
android:layout_weight="2"
android:background="@color/colorPrimary"
android:textColor="@color/white"
android:textOff="@string/disabled"
android:textOn="@string/enabled"
android:textSize="@dimen/font_size_normal" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/search_margin"
android:elevation="@dimen/elevation"
android:padding="@dimen/search_margin"
app:cardCornerRadius="@dimen/card_corner">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorAccent"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="@dimen/search_margin"
android:layout_weight="4"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/release_today_reminder"
android:textColor="@color/white"
android:textSize="@dimen/font_size_normal"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/you_will_get_notification_about_today_s_released_movie_s"
android:textColor="@color/white"
android:textSize="@dimen/font_size_normal" />
</LinearLayout>
<ToggleButton
android:id="@+id/tb_release_today_reminder"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/search_margin"
android:layout_weight="2"
android:background="@color/colorPrimary"
android:textColor="@color/white"
android:textOff="@string/disabled"
android:textOn="@string/enabled"
android:textSize="@dimen/font_size_normal" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".activity.SearchActivity">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
<androidx.appcompat.widget.SearchView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/search_margin_half"
android:layout_marginEnd="@dimen/search_margin"
android:layout_marginBottom="@dimen/search_margin_half"
android:background="@color/colorPrimaryDark"
android:elevation="@dimen/search_elevation"
android:gravity="end"
app:iconifiedByDefault="false"
app:queryHint="@string/search_movie" />
</androidx.appcompat.widget.Toolbar>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_movie_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/layout_movie_catalogue" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient"
tools:context=".activity.SplashscreenActivity">
<ImageView
android:id="@+id/imageView"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginTop="220dp"
android:layout_marginLeft="130dp"
app:srcCompat="@mipmap/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Moovify"
android:textStyle="bold"
android:textSize="30dp"
android:textAlignment="center"
android:layout_marginTop="360dp"
android:layout_marginStart="150dp">
</TextView>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="320dp"
android:layout_height="wrap_content"
android:layout_marginStart="48dp"
android:layout_marginTop="30dp"
app:cardCornerRadius="10dp">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:id="@+id/userName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="KOMENTAR"
android:textSize="16dp"
android:textAllCaps="true"
android:textColor="@color/black"/>
<TextView
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
android:id="@+id/message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="KOMENTAR"
android:textSize="20dp"
android:textColor="@color/black"
android:textStyle="bold"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fav_swipe"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragment.FavoriteFragment"
tools:ignore="MergeRootFrame">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_favorite"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/layout_movie_catalogue" />
</LinearLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/now_playing_swiper"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".fragment.NowPlayingFragment">
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@android:color/white"
xmlns:android="http://schemas.android.com/apk/res/android">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_now_playing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/layout_movie_catalogue"/>
</LinearLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/upcoming_swiper"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".fragment.UpcomingFragment">
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@android:color/white"
xmlns:android="http://schemas.android.com/apk/res/android">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_upcoming"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/layout_movie_catalogue"/>
</LinearLayout>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="@dimen/catalogue_cardview_height"
android:layout_marginStart="@dimen/catalogue_cardview_margin"
android:layout_marginTop="@dimen/catalogue_cardview_margin"
android:layout_marginEnd="@dimen/catalogue_cardview_margin">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/item_movie_poster"
android:layout_width="@dimen/catalogue_imageview_width"
android:layout_height="@dimen/catalogue_imageview_height"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@mipmap/ic_launcher" />
<TextView
android:id="@+id/item_movie_release_date"
android:layout_width="@dimen/textview_width"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/detail_textview_margin_half"
android:layout_marginTop="@dimen/detail_textview_margin_half"
android:layout_marginEnd="@dimen/detail_textview_margin_half"
android:layout_marginRight="@dimen/detail_textview_margin_half"
android:alpha="0.7"
android:text="@string/_2018"
app:layout_constraintEnd_toStartOf="@+id/item_movie_rating"
app:layout_constraintStart_toEndOf="@+id/item_movie_poster"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/item_movie_title"
android:layout_width="@dimen/textview_width"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/detail_textview_margin_half"
android:layout_marginTop="@dimen/detail_textview_margin_half"
android:layout_marginEnd="@dimen/detail_textview_margin_half"
android:layout_marginRight="@dimen/detail_textview_margin_half"
android:text="@string/movie_title"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/item_movie_poster"
app:layout_constraintTop_toBottomOf="@+id/item_movie_release_date" />
<TextView
android:id="@+id/item_movie_rating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/detail_textview_margin_half"
android:layout_marginEnd="@dimen/detail_textview_margin_half"
android:layout_marginRight="@dimen/detail_textview_margin_half"
android:text="8.7"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/imageView"
android:layout_width="100dp"
android:layout_height="150dp"
android:adjustViewBounds="true"
android:scaleType="fitXY" />
</LinearLayout>
\ No newline at end of file
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="10">
<StackView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/stack_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="9"
android:loopViews="true" />
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/banner_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="@color/white"
android:paddingBottom="5dp"
android:text="@string/favorite_movies"
android:textAlignment="center"
android:textColor="#ffffff"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/empty_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@color/white"
android:text="@string/no_data_available"
android:textAlignment="center"
android:textColor="#ffffff"
android:textSize="20sp"
android:textStyle="bold"
android:visibility="gone" />
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="320dp"
android:layout_height="70dp"
android:layout_marginStart="48dp"
android:layout_marginTop="30dp"
app:cardCornerRadius="10dp">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="NAMA TOPIK"
android:textSize="22dp"
android:textAllCaps="true"
android:textColor="@color/black"
android:textStyle="bold"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_favorite"
android:icon="@drawable/ic_favorite"
android:title="@string/favorite"
app:showAsAction="ifRoom" />
</menu>
\ No newline at end of file
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_search"
android:icon="@drawable/ic_search"
android:title="@string/search_movie"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_reminder"
android:icon="@drawable/ic_reminder"
android:title="@string/set_reminder"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_message"
android:icon="@drawable/ic_message_black_24dp"
android:title="Send Comment"
app:showAsAction="ifRoom" />
</menu>
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment