Last active
February 10, 2020 10:07
-
-
Save neller1/8c0493fa1683cf94d8cd1457eff69b70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.neller.vvcontroller; | |
import android.app.Service; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.graphics.BlurMaskFilter; | |
import android.graphics.Color; | |
import android.graphics.drawable.Drawable; | |
import android.provider.Settings; | |
import android.support.v4.content.ContextCompat; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.text.Layout; | |
import android.text.format.DateFormat; | |
import android.transition.Scene; | |
import android.transition.TransitionManager; | |
import android.util.TypedValue; | |
import android.view.Gravity; | |
import android.view.LayoutInflater; | |
import android.view.MotionEvent; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.Button; | |
import android.widget.DatePicker; | |
import android.widget.ImageView; | |
import android.widget.PopupWindow; | |
import android.widget.TextView; | |
import android.widget.TimePicker; | |
import java.util.Locale; | |
import jp.wasabeef.blurry.Blurry; | |
public class vvm_start_screen extends AppCompatActivity { | |
private Scene Work = null; | |
private Scene Start = null; | |
private Scene Info = null; | |
private Scene Lists = null; | |
private Scene Counters = null; | |
private Scene About = null; | |
private Scene Report = null; | |
private Scene Settings = null; | |
private Scene Service = null; | |
private Scene SystemSettings = null; | |
private Scene Themes = null; | |
private Scene DateTime = null; | |
private Scene scene1 = null; | |
private Scene scene2 = null; | |
private Scene scene3 = null; | |
private int scene_num = 1; | |
private int popup_calendar_width = 750; | |
private int popup_calendar_height = 650; | |
private int popup_changing_parts_width = 450; | |
private int popup_changing_parts_height = 250; | |
private int popup_activate_rental_mode_width = 650; | |
private int popup_activate_rental_mode_height = 250; | |
private int popup_pin_code_width = 350; | |
private int popup_pin_code_height = 600; | |
public PopupWindow popupWindowPin = null; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_vvm_start_screen); | |
hideSystemUI(); | |
Locale myLocale = new Locale("ru", "RU"); | |
Locale.setDefault(myLocale); //Для русских месяцов | |
ViewGroup root = findViewById(R.id.mma_la_root); | |
Work = Scene.getSceneForLayout(root, R.layout.vvm_work, this); | |
Start = Scene.getSceneForLayout(root, R.layout.vvm_start, this); | |
Info = Scene.getSceneForLayout(root, R.layout.vvm_info, this); | |
Counters = Scene.getSceneForLayout(root, R.layout.vvm_counters, this); | |
Lists = Scene.getSceneForLayout(root, R.layout.vvm_lists, this); | |
About = Scene.getSceneForLayout(root, R.layout.vvm_about, this); | |
Report = Scene.getSceneForLayout(root, R.layout.vvm_report, this); | |
Settings = Scene.getSceneForLayout(root, R.layout.vvm_settings, this); | |
Service = Scene.getSceneForLayout(root, R.layout.vvm_service, this); | |
SystemSettings = Scene.getSceneForLayout(root, R.layout.vvm_systemsettings, this); | |
Themes = Scene.getSceneForLayout(root, R.layout.vvm_themes, this); | |
DateTime = Scene.getSceneForLayout(root, R.layout.vvm_datetime, this); | |
Start.enter(); | |
InitStartBtn(); | |
} | |
private void hideSystemUI() { | |
// Enables rgular immersive mode. | |
// For "lean back" mode, remove SYSTEM_UI_FLAG_IMMERSIVE. | |
// Or for "sticky immersive," replace it with SYSTEM_UI_FLAG_IMMERSIVE_STICKY | |
View decorView = getWindow().getDecorView(); | |
decorView.setSystemUiVisibility( | |
View.SYSTEM_UI_FLAG_IMMERSIVE | |
// Set the content to appear under the system bars so that the | |
// content doesn't resize when the system bars hide and show. | |
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE | |
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | |
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | |
// Hide the nav bar and status bar | |
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | |
| View.SYSTEM_UI_FLAG_FULLSCREEN); | |
} | |
public void InitStartBtn() { | |
final Button StartBtn = (Button) findViewById(R.id.start_btn); | |
StartBtn.setOnTouchListener(new View.OnTouchListener() { | |
@Override | |
public boolean onTouch(View v, MotionEvent event) { | |
if (event.getAction() == MotionEvent.ACTION_DOWN) { | |
StartBtn.setBackgroundResource(R.drawable.start_hold); | |
StartBtnClick(v); | |
} else if (event.getAction() == MotionEvent.ACTION_UP) { | |
// Released | |
StartBtn.setBackgroundResource(R.drawable.start_on); | |
StartBtnClickUp(v); | |
ToWork(v); | |
} | |
return true; | |
} | |
}); | |
} | |
public void ToWork(View view) { | |
TransitionManager.go(Work); | |
} | |
public void ToStart(View view) { | |
TransitionManager.go(Start); | |
InitStartBtn(); | |
} | |
public void ToInfo(View view) { | |
TransitionManager.go(Info); | |
} | |
public void ToCounters(View view) { | |
TransitionManager.go(Counters); | |
} | |
public void ToJournal(View view) { | |
TransitionManager.go(Lists); | |
} | |
public void ToAbout(View view) { | |
TransitionManager.go(About); | |
ViewGroup root = findViewById(R.id.rootContainer); | |
scene1 = Scene.getSceneForLayout(root, R.layout.vvm_scene1, this); | |
scene2 = Scene.getSceneForLayout(root, R.layout.vvm_scene2, this); | |
scene3 = Scene.getSceneForLayout(root, R.layout.vvm_scene3, this); | |
scene1.enter(); | |
} | |
public void ToReport(View view) { | |
TransitionManager.go(Report); | |
} | |
public void ToSettings(View view) { | |
TransitionManager.go(Settings); | |
} | |
public void ToService(View view) { | |
TransitionManager.go(Service); | |
} | |
public void ToThemes(View view) { | |
TransitionManager.go(Themes); | |
} | |
public void ToDateTime(View view) { | |
TransitionManager.go(DateTime); | |
TimePicker t1 = findViewById(R.id.timePicker1); | |
t1.setIs24HourView(true); | |
} | |
public void ToSystemSettings(View view) { | |
TransitionManager.go(SystemSettings); | |
popupWindowPin.dismiss(); | |
} | |
public void ToRentalMode(View view) { | |
} | |
public void ToChangeEngine(View view) { | |
} | |
public void ToChangeBrush(View view) { | |
} | |
public void ToChangeFilter(View view) { | |
} | |
public void ToPowerLimit(View view) { | |
} | |
public void ToDiagnostics(View view) { | |
} | |
public void ToExport(View view) { | |
} | |
public void ToRent(View view) { | |
} | |
public void ToBlueTheme(View view) { | |
} | |
public void ToGreenTheme(View view) { | |
} | |
public void ToYellowTheme(View view) { | |
} | |
public void ToRedTheme(View view) { | |
} | |
public void ToPinkTheme(View view) { | |
} | |
public void StartBtnClick(View view) { | |
//Button StartBtn = (Button)findViewById(R.id.start_btn); | |
float factor = this.getResources().getDisplayMetrics().density; | |
Float size = 9.9f; | |
// View ViewSpace = (View) findViewById(R.id.view_space); | |
// TextView Text1 = (TextView) findViewById(R.id.text1); | |
// TextView Text2 = (TextView) findViewById(R.id.text2); | |
// Text1.setTextSize(Text1.getTextSize()/10*size); | |
// Text2.setTextSize(Text2.getTextSize()/10*size); | |
// | |
// Text1.setLetterSpacing(Text1.getLetterSpacing()/10*size); | |
// Text2.setLetterSpacing(Text2.getLetterSpacing()/10*size); | |
// ViewGroup.LayoutParams params = ViewSpace.getLayoutParams(); | |
// params.height = (int)(size*factor); | |
// ViewSpace.setLayoutParams(params); | |
} | |
public void StartBtnClickUp(View view) { | |
//Button StartBtn = (Button)findViewById(R.id.start_btn); | |
float factor = this.getResources().getDisplayMetrics().density; | |
Float size = 9.9f; | |
// View ViewSpace = (View) findViewById(R.id.view_space); | |
// TextView Text1 = (TextView) findViewById(R.id.text1); | |
// TextView Text2 = (TextView) findViewById(R.id.text2); | |
// | |
// Text1.setTextSize(Text1.getTextSize()/size*10); | |
// Text2.setTextSize(Text2.getTextSize()/size*10); | |
// | |
// Text1.setLetterSpacing(Text1.getLetterSpacing()/size*10); | |
// Text2.setLetterSpacing(Text2.getLetterSpacing()/size*10); | |
// ViewGroup.LayoutParams params = ViewSpace.getLayoutParams(); | |
// params.height = (int)(10*factor); | |
// ViewSpace.setLayoutParams(params); | |
} | |
public void OnDay(View view) { | |
} | |
public void PopupCalendar(View view) { | |
// inflate the layout of the popup window | |
LayoutInflater inflater = (LayoutInflater) | |
getSystemService(LAYOUT_INFLATER_SERVICE); | |
View popupView = inflater.inflate(R.layout.popup, null); | |
// create the popup window | |
int width = popup_calendar_width; | |
int height = popup_calendar_height; | |
boolean focusable = true; // lets taps outside the popup also dismiss it | |
final PopupWindow popupWindow = new PopupWindow(popupView, width, height, focusable); | |
//final PopupWindow popupWindow = new PopupWindow(popupView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,true); | |
// show the popup window | |
// which view you pass in doesn't matter, it is only used for the window tolken | |
popupWindow.showAtLocation(view, Gravity.CENTER, 0, 40); | |
// dismiss the popup window when touched | |
popupView.setOnTouchListener(new View.OnTouchListener() { | |
@Override | |
public boolean onTouch(View v, MotionEvent event) { | |
popupWindow.dismiss(); | |
return true; | |
} | |
}); | |
// Blurry.with(this).capture(view).into((ImageView) findViewById(R.id.sep)); | |
} | |
public void PopupChangingParts(View view) { | |
// inflate the layout of the popup window | |
LayoutInflater inflater = (LayoutInflater) | |
getSystemService(LAYOUT_INFLATER_SERVICE); | |
View popupView = inflater.inflate(R.layout.popup_changing_parts, null); | |
// create the popup window | |
int width = popup_changing_parts_width; | |
int height = popup_changing_parts_height; | |
boolean focusable = true; // lets taps outside the popup also dismiss it | |
final PopupWindow popupWindow = new PopupWindow(popupView, width, height, focusable); | |
//final PopupWindow popupWindow = new PopupWindow(popupView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,true); | |
// show the popup window | |
// which view you pass in doesn't matter, it is only used for the window tolken | |
popupWindow.showAtLocation(view, Gravity.CENTER, 0, 40); | |
// dismiss the popup window when touched | |
popupView.setOnTouchListener(new View.OnTouchListener() { | |
@Override | |
public boolean onTouch(View v, MotionEvent event) { | |
popupWindow.dismiss(); | |
return true; | |
} | |
}); | |
// Blurry.with(this).capture(view).into((ImageView) findViewById(R.id.sep)); | |
} | |
public void PopupActivateRentalMode(View view) { | |
// inflate the layout of the popup window | |
LayoutInflater inflater = (LayoutInflater) | |
getSystemService(LAYOUT_INFLATER_SERVICE); | |
View popupView = inflater.inflate(R.layout.popup_activate_rental_mode, null); | |
// create the popup window | |
int width = popup_activate_rental_mode_width; | |
int height = popup_activate_rental_mode_height; | |
boolean focusable = true; // lets taps outside the popup also dismiss it | |
final PopupWindow popupWindow = new PopupWindow(popupView, width, height, focusable); | |
//final PopupWindow popupWindow = new PopupWindow(popupView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,true); | |
// show the popup window | |
// which view you pass in doesn't matter, it is only used for the window tolken | |
popupWindow.showAtLocation(view, Gravity.CENTER, 0, 40); | |
// dismiss the popup window when touched | |
popupView.setOnTouchListener(new View.OnTouchListener() { | |
@Override | |
public boolean onTouch(View v, MotionEvent event) { | |
popupWindow.dismiss(); | |
return true; | |
} | |
}); | |
// Blurry.with(this).capture(view).into((ImageView) findViewById(R.id.sep)); | |
} | |
public void PopupPinCode(View view) { | |
// inflate the layout of the popup window | |
LayoutInflater inflater = (LayoutInflater) | |
getSystemService(LAYOUT_INFLATER_SERVICE); | |
View popupView = inflater.inflate(R.layout.popup_pin_code, null); | |
// create the popup window | |
int width = popup_pin_code_width; | |
int height = popup_pin_code_height; | |
boolean focusable = true; // lets taps outside the popup also dismiss it | |
popupWindowPin = new PopupWindow(popupView, width, height, focusable); | |
//final PopupWindow popupWindow = new PopupWindow(popupView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,true); | |
// show the popup window | |
// which view you pass in doesn't matter, it is only used for the window tolken | |
popupWindowPin.showAtLocation(view, Gravity.CENTER, 0, 40); | |
// dismiss the popup window when touched | |
popupView.setOnTouchListener(new View.OnTouchListener() { | |
@Override | |
public boolean onTouch(View v, MotionEvent event) { | |
popupWindowPin.dismiss(); | |
return true; | |
} | |
}); | |
// Blurry.with(this).capture(view).into((ImageView) findViewById(R.id.sep)); | |
} | |
public void Next(View view) { | |
// Intent intent = new Intent(this, vvm_about_screen2.class); | |
// startActivity(intent); | |
// overridePendingTransition(R.anim.second,R.anim.first); | |
if (scene_num == 1) { | |
TransitionManager.go(scene2); | |
scene_num = 2; | |
} else if (scene_num == 2) { | |
TransitionManager.go(scene3); | |
scene_num = 3; | |
} else if (scene_num == 3) { | |
TransitionManager.go(scene1); | |
scene_num = 1; | |
} | |
} | |
public void Prev(View view) { | |
// Intent intent = new Intent(this, vvm_about_screen3.class); | |
// startActivity(intent); | |
// overridePendingTransition(R.anim.second_back,R.anim.first_back); | |
if (scene_num == 1) { | |
TransitionManager.go(scene3); | |
scene_num = 3; | |
} else if (scene_num == 2) { | |
TransitionManager.go(scene1); | |
scene_num = 1; | |
} else if (scene_num == 3) { | |
TransitionManager.go(scene2); | |
scene_num = 2; | |
} | |
} | |
public int ChangeTheme(View view) { | |
View vvm_start_layout = getLayoutInflater().inflate(R.layout.vvm_start, null); | |
ImageView imageView = null; | |
Button button = null; | |
//blue | |
if (view == findViewById(R.id.blue_btn)) { | |
imageView = (ImageView) findViewById(R.id.sep); | |
imageView.setImageResource(R.drawable.themeb_band); | |
button = (Button) vvm_start_layout.findViewById(R.id.start_btn); | |
button.setBackgroundResource(R.drawable.themeb_start_switch); | |
} | |
//green | |
else if (view == findViewById(R.id.green_btn)) { | |
imageView = (ImageView) findViewById(R.id.sep); | |
imageView.setImageResource(R.drawable.themeg_band); | |
button = (Button) findViewById(R.id.start_btn); | |
button.setBackgroundResource(R.drawable.themeg_start_switch); | |
} | |
//pink | |
else if (view == findViewById(R.id.pink_btn)) { | |
imageView = (ImageView) findViewById(R.id.sep); | |
imageView.setImageResource(R.drawable.themep_band); | |
button = (Button) findViewById(R.id.start_btn); | |
button.setBackgroundResource(R.drawable.themep_start_switch); | |
} | |
//red | |
else if (view == findViewById(R.id.red_btn)) { | |
imageView = (ImageView) findViewById(R.id.sep); | |
imageView.setImageResource(R.drawable.themer_band); | |
button = (Button) findViewById(R.id.start_btn); | |
button.setBackgroundResource(R.drawable.themer_start_switch); | |
} | |
//yellow | |
else if (view == findViewById(R.id.yellow_btn)) { | |
imageView = (ImageView) findViewById(R.id.sep); | |
imageView.setImageResource(R.drawable.themey_band); | |
button = (Button) findViewById(R.id.start_btn); | |
button.setBackgroundResource(R.drawable.themey_start_switch); | |
} | |
//CHANGE | |
return 1; //completed | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment